package
1.0.0
Repository: https://github.com/sdslabs/gctl.git
Documentation: pkg.go.dev

# README

Go API client for openapi

Handles authentication, creation/management of applications, databases, users and also provides a superuser API.

Only a superuser can avail the superuser API. A superuser can grant/revoke superuser privileges to other users. A default superuser is created every time a Gasper instance is launched whose credentials are defined in the admin section of config.toml, the main configuration file. A sample configuration file is available here.

Note:- Normally the applications and databases can only be managed by their owners but the superuser can bypass that check.

PS:- If you want to programmatically generate a client for this API, you can find the corresponding OpenAPI specifications here. We recommend using OpenAPI-Generator for generating clients.

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 1.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://chat.sdslabs.co

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
go get github.com/antihax/optional

Put the package under your project folder and add the following in import:

import "./openapi"

Documentation for API Endpoints

All URIs are relative to http://localhost:3000

ClassMethodHTTP requestDescription
AppsAPICreateAppPost /apps/{language}Create an application
AppsAPIDeleteAppByUserDelete /apps/{app}Delete an application owned by a user
AppsAPIFetchAppByUserGet /apps/{app}Fetch a single application owned by a user
AppsAPIFetchAppsByUserGet /appsFetch all applications owned by a user
AppsAPIFetchLogsByUserGet /apps/{app}/logsFetch logs of an application
AppsAPIFetchMetricsByUserGet /apps/{app}/metricsFetch metrics of an application
AppsAPIRebuildAppByUserPatch /apps/{app}/rebuildRebuild an application
AppsAPIUpdateAppByUserPut /apps/{app}Update an application owned by a user
AuthAPIRefreshGet /auth/refreshRefresh JWT token using existing token
DbsAPICreateDBPost /dbs/{databaseType}Create a database
DbsAPIDeleteDbByUserDelete /dbs/{db}Delete a single database owned by a user
DbsAPIFetchDbByUserGet /dbs/{db}Fetch a single database owned by a user
DbsAPIFetchDbsByUserGet /dbsFetch all databases owned by a user
InstancesAPIFetchIntancesByUserGet /instancesFetch all instances owned by a user

Documentation For Models

Documentation For Authorization

bearerAuth

  • Type: HTTP basic authentication

Example

auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
    UserName: "username",
    Password: "password",
})
r, err := client.Service.Operation(auth, args)

Author

[email protected]

# Packages

Package testmocks is a generated GoMock package.

# Functions

CacheExpires helper function to determine remaining time before repeating a request.
NewAPIClient creates a new API client.
NewAPIResponse returns a new APIResonse object.
NewAPIResponseWithError returns a new APIResponse object with the provided error message.
NewConfiguration returns a new Configuration object.

# Constants

No description provided by the author

# Variables

ContextAccessToken takes a string oauth2 access token as authentication for the request.
ContextAPIKey takes an APIKey as authentication for the request.
ContextBasicAuth takes BasicAuth as authentication for the request.
ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.

# Structs

APIClient manages communication with the Gasper Master API API v1.0 In most cases there should be only one, shared, APIClient.
APIKey provides API key based authentication to a request passed via context using ContextAPIKey.
APIResponse stores the API response returned by the server.
Application struct for Application.
ApplicationResources Resources required by the application.
BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth.
Configuration stores the configuration of the API client.
Context struct for Context.
CreatedApplication struct for CreatedApplication.
CreateDBOpts Optional parameters for the method 'CreateDB'.
CreatedDatabase struct for CreatedDatabase.
Database struct for Database.
Email struct for Email.
FetchLogsByUserOpts Optional parameters for the method 'FetchLogsByUser'.
FetchMetricsByUserOpts Optional parameters for the method 'FetchMetricsByUser'.
GenericOpenAPIError Provides access to the body, error and model on returned errors.
Git struct for Git.
InlineResponse2001 struct for InlineResponse2001.
InlineResponse2002 struct for InlineResponse2002.
InlineResponse2003 struct for InlineResponse2003.
InlineResponse2004 struct for InlineResponse2004.
InlineResponse2005 struct for InlineResponse2005.
InlineResponse2006 struct for InlineResponse2006.
InlineResponse2007 struct for InlineResponse2007.
InlineResponse400 struct for InlineResponse400.
InlineResponse401 struct for InlineResponse401.
InlineResponse500 struct for InlineResponse500.
Instances struct for Instances.
LoginResponse struct for LoginResponse.
Metrics struct for Metrics.
ServerConfiguration stores the information about a server.
ServerVariable stores the information about a server variable.

# Interfaces

AppsAPI is interface for functions of type AppsAPIService.
AuthAPI is interface for functions of type AuthAPIService.
Client is interface for functions of type APIClient.
DbsAPI is interface for functions of type DbsAPIService.
InstancesAPI is interface for functions of type InstancesAPIService.

# Type aliases

AppsAPIService AppsAPI service.
AuthAPIService AuthAPI service.
DbsAPIService DbsAPI service.
InstancesAPIService InstancesAPI service.