Documentation
¶
Index ¶
- Constants
- Variables
- func CacheExpires(r *http.Response) time.Time
- type APIClient
- type APIKey
- type APIResponse
- type Application
- type ApplicationResources
- type AppsAPI
- type AppsAPIService
- func (a *AppsAPIService) CreateApp(ctx _context.Context, language string, application Application) (InlineResponse2002, *_nethttp.Response, error)
- func (a *AppsAPIService) DeleteAppByUser(ctx _context.Context, app string) (InlineResponse2002, *_nethttp.Response, error)
- func (a *AppsAPIService) FetchAppByUser(ctx _context.Context, app string) (InlineResponse2003, *_nethttp.Response, error)
- func (a *AppsAPIService) FetchAppsByUser(ctx _context.Context) (InlineResponse2003, *_nethttp.Response, error)
- func (a *AppsAPIService) FetchLogsByUser(ctx _context.Context, app string, localVarOptionals *FetchLogsByUserOpts) (InlineResponse2005, *_nethttp.Response, error)
- func (a *AppsAPIService) FetchMetricsByUser(ctx _context.Context, app string, localVarOptionals *FetchMetricsByUserOpts) (InlineResponse2006, *_nethttp.Response, error)
- func (a *AppsAPIService) RebuildAppByUser(ctx _context.Context, app string) (InlineResponse2002, *_nethttp.Response, error)
- func (a *AppsAPIService) UpdateAppByUser(ctx _context.Context, app string, application Application) (InlineResponse2002, *_nethttp.Response, error)
- type AuthAPI
- type AuthAPIService
- type BasicAuth
- type Client
- type Configuration
- type Context
- type CreateDBOpts
- type CreatedApplication
- type CreatedDatabase
- type Database
- type DbsAPI
- type DbsAPIService
- func (a *DbsAPIService) CreateDb(ctx _context.Context, databaseType string, localVarOptionals *CreateDBOpts) (InlineResponse2002, *_nethttp.Response, error)
- func (a *DbsAPIService) DeleteDbByUser(ctx _context.Context, db string) (InlineResponse2002, *_nethttp.Response, error)
- func (a *DbsAPIService) FetchDbByUser(ctx _context.Context, db string) (InlineResponse2007, *_nethttp.Response, error)
- func (a *DbsAPIService) FetchDbsByUser(ctx _context.Context) (InlineResponse2007, *_nethttp.Response, error)
- type Email
- type FetchLogsByUserOpts
- type FetchMetricsByUserOpts
- type GenericOpenAPIError
- type Git
- type InlineResponse2001
- type InlineResponse2002
- type InlineResponse2003
- type InlineResponse2004
- type InlineResponse2005
- type InlineResponse2006
- type InlineResponse2007
- type InlineResponse400
- type InlineResponse401
- type InlineResponse500
- type Instances
- type InstancesAPI
- type InstancesAPIService
- type LoginResponse
- type Metrics
- type ServerConfiguration
- type ServerVariable
Constants ¶
const LOGINPATH = "/gctllogin"
Variables ¶
var ( // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request. ContextOAuth2 = contextKey("token") // ContextBasicAuth takes BasicAuth as authentication for the request. ContextBasicAuth = contextKey("basic") // ContextAccessToken takes a string oauth2 access token as authentication for the request. ContextAccessToken = contextKey("accesstoken") // ContextAPIKey takes an APIKey as authentication for the request ContextAPIKey = contextKey("apikey") )
Functions ¶
Types ¶
type APIClient ¶
type APIClient struct { AppsAPI *AppsAPIService AuthAPI *AuthAPIService DbsAPI *DbsAPIService InstancesAPI *InstancesAPIService // contains filtered or unexported fields }
APIClient manages communication with the Gasper Master API API v1.0 In most cases there should be only one, shared, APIClient.
func NewAPIClient ¶
func NewAPIClient(cfg *Configuration) *APIClient
NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.
func (*APIClient) ChangeBasePath ¶
ChangeBasePath changes base path to allow switching to mocks
func (*APIClient) GetConfig ¶
func (c *APIClient) GetConfig() *Configuration
GetConfig allow modification of underlying config for alternate implementations and testing Caution: modifying the configuration while live can cause data races and potentially unwanted behavior
type APIKey ¶
APIKey provides API key based authentication to a request passed via context using ContextAPIKey
type APIResponse ¶
type APIResponse struct { *http.Response `json:"-"` Message string `json:"message,omitempty"` // Operation is the name of the OpenAPI operation. Operation string `json:"operation,omitempty"` // RequestURL is the request URL. This value is always available, even if the // embedded *http.Response is nil. RequestURL string `json:"url,omitempty"` // Method is the HTTP method used for the request. This value is always // available, even if the embedded *http.Response is nil. Method string `json:"method,omitempty"` // Payload holds the contents of the response body (which may be nil or empty). // This is provided here as the raw response.Body() reader will have already // been drained. Payload []byte `json:"-"` }
APIResponse stores the API response returned by the server.
func NewAPIResponse ¶
func NewAPIResponse(r *http.Response) *APIResponse
NewAPIResponse returns a new APIResonse object.
func NewAPIResponseWithError ¶
func NewAPIResponseWithError(errorMessage string) *APIResponse
NewAPIResponseWithError returns a new APIResponse object with the provided error message.
type Application ¶
type Application struct { // Name of the application Name string `json:"name"` // Password required for SSH access to the application's docker container Password string `json:"password"` Git Git `json:"git"` Context Context `json:"context"` // Environment variables required by the application Env map[string]string `json:"env,omitempty"` Resources ApplicationResources `json:"resources,omitempty"` }
Application struct for Application
type ApplicationResources ¶
type ApplicationResources struct { // Number of virtual CPUs CPU float32 `json:"cpu,omitempty"` // Memory in GigaBytes (GB) Memory float32 `json:"memory,omitempty"` }
ApplicationResources Resources required by the application
type AppsAPI ¶
type AppsAPI interface { CreateApp(ctx _context.Context, language string, application Application) (InlineResponse2002, *_nethttp.Response, error) DeleteAppByUser(ctx _context.Context, app string) (InlineResponse2002, *_nethttp.Response, error) FetchAppByUser(ctx _context.Context, app string) (InlineResponse2003, *_nethttp.Response, error) FetchAppsByUser(ctx _context.Context) (InlineResponse2003, *_nethttp.Response, error) }
AppsAPI is interface for functions of type AppsAPIService
type AppsAPIService ¶
type AppsAPIService service
AppsAPIService AppsAPI service
func (*AppsAPIService) CreateApp ¶
func (a *AppsAPIService) CreateApp(ctx _context.Context, language string, application Application) (InlineResponse2002, *_nethttp.Response, error)
CreateApp Create an application
- @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param language The programming language in which the application is written
- @param application
@return InlineResponse2002
func (*AppsAPIService) DeleteAppByUser ¶
func (a *AppsAPIService) DeleteAppByUser(ctx _context.Context, app string) (InlineResponse2002, *_nethttp.Response, error)
DeleteAppByUser Delete an application owned by a user
- @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param app The name of the application
@return InlineResponse2002
func (*AppsAPIService) FetchAppByUser ¶
func (a *AppsAPIService) FetchAppByUser(ctx _context.Context, app string) (InlineResponse2003, *_nethttp.Response, error)
FetchAppByUser Fetch a single application owned by a user
- @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param app The name of the application
@return InlineResponse2003
func (*AppsAPIService) FetchAppsByUser ¶
func (a *AppsAPIService) FetchAppsByUser(ctx _context.Context) (InlineResponse2003, *_nethttp.Response, error)
FetchAppsByUser Fetch all applications owned by a user
- @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return InlineResponse2003
func (*AppsAPIService) FetchLogsByUser ¶
func (a *AppsAPIService) FetchLogsByUser(ctx _context.Context, app string, localVarOptionals *FetchLogsByUserOpts) (InlineResponse2005, *_nethttp.Response, error)
FetchLogsByUser Fetch logs of an application
- @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param app The name of the application
- @param optional nil or *FetchLogsByUserOpts - Optional Parameters:
- @param "Tail" (optional.Int32) - Fetch the last **n** logs (Fetches all logs if not specified)
@return InlineResponse2005
func (*AppsAPIService) FetchMetricsByUser ¶
func (a *AppsAPIService) FetchMetricsByUser(ctx _context.Context, app string, localVarOptionals *FetchMetricsByUserOpts) (InlineResponse2006, *_nethttp.Response, error)
FetchMetricsByUser Fetch metrics of an application
- @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param app The name of the application
- @param optional nil or *FetchMetricsByUserOpts - Optional Parameters:
- @param "Seconds" (optional.Int32) - Fetch metrics in the last **n** seconds
- @param "Minutes" (optional.Int32) - Fetch metrics in the last **n** minutes
- @param "Hours" (optional.Int32) - Fetch metrics in the last **n** hours
- @param "Days" (optional.Int32) - Fetch metrics in the last **n** days
- @param "Weeks" (optional.Int32) - Fetch metrics in the last **n** weeks
- @param "Months" (optional.Int32) - Fetch metrics in the last **n** months
- @param "Years" (optional.Int32) - Fetch metrics in the last **n** years
- @param "Decades" (optional.Int32) - Fetch metrics in the last **n** decades
@return InlineResponse2006
func (*AppsAPIService) RebuildAppByUser ¶
func (a *AppsAPIService) RebuildAppByUser(ctx _context.Context, app string) (InlineResponse2002, *_nethttp.Response, error)
RebuildAppByUser Rebuild an application
- @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param app The name of the application
@return InlineResponse2002
func (*AppsAPIService) UpdateAppByUser ¶
func (a *AppsAPIService) UpdateAppByUser(ctx _context.Context, app string, application Application) (InlineResponse2002, *_nethttp.Response, error)
UpdateAppByUser Update an application owned by a user
- @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param app The name of the application
- @param application
@return InlineResponse2002
type AuthAPI ¶
type AuthAPI interface {
Refresh(ctx _context.Context, authorization string) (LoginResponse, *_nethttp.Response, error)
}
AuthAPI is interface for functions of type AuthAPIService
type AuthAPIService ¶
type AuthAPIService service
AuthAPIService AuthAPI service
func (*AuthAPIService) Login ¶
func (a *AuthAPIService) Login(ctx _context.Context, email Email) (InlineResponse2004, *_nethttp.Response, error)
Login Login in gctl
- @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param email
@return InlineResponse2004
func (*AuthAPIService) Refresh ¶
func (a *AuthAPIService) Refresh(ctx _context.Context, authorization string) (LoginResponse, *_nethttp.Response, error)
Refresh Refresh JWT token using existing token
- @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param authorization Bearer Token Authentication
@return LoginResponse
type BasicAuth ¶
type BasicAuth struct { UserName string `json:"userName,omitempty"` Password string `json:"password,omitempty"` }
BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
type Client ¶
type Client interface { NewAPIClient(cfg *Configuration) *APIClient CallAPI(request *http.Request) (*http.Response, error) ChangeBasePath(path string) GetConfig() *Configuration // contains filtered or unexported methods }
Client is interface for functions of type APIClient
type Configuration ¶
type Configuration struct { BasePath string `json:"basePath,omitempty"` Host string `json:"host,omitempty"` Scheme string `json:"scheme,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` Debug bool `json:"debug,omitempty"` Servers []ServerConfiguration `json:"server,omitempty"` HTTPClient *http.Client }
Configuration stores the configuration of the API client
func NewConfiguration ¶
func NewConfiguration() *Configuration
NewConfiguration returns a new Configuration object
func (*Configuration) AddDefaultHeader ¶
func (c *Configuration) AddDefaultHeader(key string, value string)
AddDefaultHeader adds a new HTTP header to the default header in the request
type Context ¶
type Context struct { // Entrypoint for an application Index string `json:"index"` // Port on which the application runs Port int64 `json:"port,omitempty"` // Is a Run Commands file present in the application's git repository's root directory? RcFile bool `json:"rc_file,omitempty"` // Commands for installing application dependencies Build []string `json:"build,omitempty"` // Commands for running the application Run []string `json:"run,omitempty"` }
Context struct for Context
type CreateDBOpts ¶
CreateDBOpts Optional parameters for the method 'CreateDB'
type CreatedApplication ¶
type CreatedApplication struct { // ID of the application's docker container ContainerId string `json:"container_id,omitempty"` // Port assigned by the node to the application's docker container ContainerPort int64 `json:"container_port,omitempty"` // Docker image used in building the application's container DockerImage string `json:"docker_image,omitempty"` // The domain name of the application (DNS entry is managed by GenDNS 💡) AppUrl string `json:"app_url,omitempty"` // IPv4 address of the node HostIp string `json:"host_ip,omitempty"` // The DNS NameServers used by the application's docker container NameServers []string `json:"name_servers,omitempty"` // The kind of instance this application belongs to InstanceType string `json:"instance_type,omitempty"` // The programming language in which the application is written Language string `json:"language,omitempty"` // Owner of the application Owner string `json:"owner,omitempty"` // Command to SSH into the application's docker container SshCmd string `json:"ssh_cmd,omitempty"` // Application's identifier assigned by MongoDB Id string `json:"_id,omitempty"` }
CreatedApplication struct for CreatedApplication
type CreatedDatabase ¶
type CreatedDatabase struct { // Username of the database User string `json:"user,omitempty"` // Owner of the database Owner string `json:"owner,omitempty"` // The domain name of the database (DNS entry is managed by GenDNS 💡) DbUrl string `json:"db_url,omitempty"` // IPv4 address of the node where the database is deployed HostIp string `json:"host_ip,omitempty"` // Port on which the database server is running Port string `json:"port,omitempty"` // The kind of instance the database belongs to InstanceType string `json:"instance_type,omitempty"` // The type of database Language string `json:"language,omitempty"` }
CreatedDatabase struct for CreatedDatabase
type Database ¶
type Database struct { // Name of the database Name string `json:"name"` // Password of the database Password string `json:"password"` }
Database struct for Database
type DbsAPI ¶
type DbsAPI interface { CreateDB(ctx _context.Context, databaseType string, localVarOptionals *CreateDBOpts) (InlineResponse2002, *_nethttp.Response, error) DeleteDbByUser(ctx _context.Context, db string) (InlineResponse2002, *_nethttp.Response, error) FetchDbByUser(ctx _context.Context, db string) (InlineResponse2007, *_nethttp.Response, error) FetchDbsByUser(ctx _context.Context) (InlineResponse2007, *_nethttp.Response, error) }
DbsAPI is interface for functions of type DbsAPIService
type DbsAPIService ¶
type DbsAPIService service
DbsAPIService DbsAPI service
func (*DbsAPIService) CreateDb ¶
func (a *DbsAPIService) CreateDb(ctx _context.Context, databaseType string, localVarOptionals *CreateDBOpts) (InlineResponse2002, *_nethttp.Response, error)
CreateDB Create a database
- @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param databaseType The type of database
- @param optional nil or *CreateDBOpts - Optional Parameters:
- @param "Database" (optional.Interface of Database) -
@return InlineResponse2002
func (*DbsAPIService) DeleteDbByUser ¶
func (a *DbsAPIService) DeleteDbByUser(ctx _context.Context, db string) (InlineResponse2002, *_nethttp.Response, error)
DeleteDbByUser Delete a single database owned by a user
- @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param db Name of the database
@return InlineResponse2002
func (*DbsAPIService) FetchDbByUser ¶
func (a *DbsAPIService) FetchDbByUser(ctx _context.Context, db string) (InlineResponse2007, *_nethttp.Response, error)
FetchDbByUser Fetch a single database owned by a user
- @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param db Name of the database
@return InlineResponse2007
func (*DbsAPIService) FetchDbsByUser ¶
func (a *DbsAPIService) FetchDbsByUser(ctx _context.Context) (InlineResponse2007, *_nethttp.Response, error)
FetchDbsByUser Fetch all databases owned by a user
- @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return InlineResponse2007
type Email ¶
type Email struct { // Email id of the user Email string `json:"email"` }
Email struct for Email
type FetchLogsByUserOpts ¶
FetchLogsByUserOpts Optional parameters for the method 'FetchLogsByUser'
type FetchMetricsByUserOpts ¶
type FetchMetricsByUserOpts struct { Seconds optional.Int32 Minutes optional.Int32 Hours optional.Int32 Days optional.Int32 Weeks optional.Int32 Months optional.Int32 Years optional.Int32 Decades optional.Int32 }
FetchMetricsByUserOpts Optional parameters for the method 'FetchMetricsByUser'
type GenericOpenAPIError ¶
type GenericOpenAPIError struct {
// contains filtered or unexported fields
}
GenericOpenAPIError Provides access to the body, error and model on returned errors.
func (GenericOpenAPIError) Body ¶
func (e GenericOpenAPIError) Body() []byte
Body returns the raw bytes of the response
func (GenericOpenAPIError) Error ¶
func (e GenericOpenAPIError) Error() string
Error returns non-empty string if there was an error.
func (GenericOpenAPIError) Model ¶
func (e GenericOpenAPIError) Model() interface{}
Model returns the unpacked model of the error
type Git ¶
type Git struct { // Git Repository URL of the application RepoUrl string `json:"repo_url"` // Access token for cloning the application's git repository AccessToken string `json:"access_token,omitempty"` // Specific branch to clone Branch string `json:"branch,omitempty"` }
Git struct for Git
type InlineResponse2001 ¶
type InlineResponse2001 struct { Success bool `json:"success,omitempty"` Data []Instances `json:"data,omitempty"` }
InlineResponse2001 struct for InlineResponse2001
type InlineResponse2002 ¶
type InlineResponse2002 struct {
Success bool `json:"success,omitempty"`
}
InlineResponse2002 struct for InlineResponse2002
type InlineResponse2003 ¶
type InlineResponse2003 struct { Success bool `json:"success,omitempty"` Data []CreatedApplication `json:"data,omitempty"` }
InlineResponse2003 struct for InlineResponse2003
type InlineResponse2004 ¶
type InlineResponse2004 struct { Success bool `json:"success,omitempty"` Expire time.Time `json:"expire,omitempty"` }
InlineResponse2004 struct for InlineResponse2004
type InlineResponse2005 ¶
type InlineResponse2005 struct { Success bool `json:"success,omitempty"` Data []string `json:"data,omitempty"` }
InlineResponse2005 struct for InlineResponse2005
type InlineResponse2006 ¶
type InlineResponse2006 struct { Success bool `json:"success,omitempty"` Data []Metrics `json:"data,omitempty"` }
InlineResponse2006 struct for InlineResponse2006
type InlineResponse2007 ¶
type InlineResponse2007 struct { Success bool `json:"success,omitempty"` Data []CreatedDatabase `json:"data,omitempty"` }
InlineResponse2007 struct for InlineResponse2007
type InlineResponse400 ¶
type InlineResponse400 struct { Success bool `json:"success,omitempty"` Error string `json:"error,omitempty"` }
InlineResponse400 struct for InlineResponse400
type InlineResponse401 ¶
type InlineResponse401 struct { Success bool `json:"success,omitempty"` Error string `json:"error,omitempty"` }
InlineResponse401 struct for InlineResponse401
type InlineResponse500 ¶
type InlineResponse500 struct { Success bool `json:"success,omitempty"` Error string `json:"error,omitempty"` }
InlineResponse500 struct for InlineResponse500
type Instances ¶
type Instances struct { // Document's identifier assigned by MongoDB Id string `json:"_id,omitempty"` // Name of the application or database Name string `json:"name,omitempty"` // The kind of instance this application belongs to InstanceType string `json:"instance_type,omitempty"` // The programming language in which the application is written Language string `json:"language,omitempty"` }
Instances struct for Instances
type InstancesAPI ¶
type InstancesAPI interface {
FetchIntancesByUser(ctx _context.Context) (InlineResponse2001, *_nethttp.Response, error)
}
InstancesAPI is interface for functions of type InstancesAPIService
type InstancesAPIService ¶
type InstancesAPIService service
InstancesAPIService InstancesAPI service
func (*InstancesAPIService) FetchIntancesByUser ¶
func (a *InstancesAPIService) FetchIntancesByUser(ctx _context.Context) (InlineResponse2001, *_nethttp.Response, error)
FetchIntancesByUser Fetch all instances owned by a user
- @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return InlineResponse2001
type LoginResponse ¶
type LoginResponse struct { Code int32 `json:"code,omitempty"` Expire time.Time `json:"expire,omitempty"` // The token required for authentication via bearer scheme Token string `json:"token,omitempty"` }
LoginResponse struct for LoginResponse
type Metrics ¶
type Metrics struct { // Document's identifier assigned by MongoDB Id string `json:"_id,omitempty"` // Name of the application Name string `json:"name,omitempty"` // IPv4 address of the node where the application is deployed HostIp string `json:"host_ip,omitempty"` // Is the application up and running? Alive bool `json:"alive,omitempty"` // The number of available CPUs in the node OnlineCpus int32 `json:"online_cpus,omitempty"` // Fraction of total CPUs utilized by the application CpuUsage float64 `json:"cpu_usage,omitempty"` // Fraction of memory utilized by the application MemoryUsage float64 `json:"memory_usage,omitempty"` // Highest fraction of memory utilized by the application in its lifetime MaxMemoryUsage float64 `json:"max_memory_usage,omitempty"` // Memory (in GigaBytes) alloted to the application MemoryLimit float32 `json:"memory_limit,omitempty"` // Unix timestamp of the metrics document Timestamp int64 `json:"timestamp,omitempty"` }
Metrics struct for Metrics
type ServerConfiguration ¶
type ServerConfiguration struct { URL string `json:"url,omitempty"` Description string `json:"description"` Variables map[string]ServerVariable }
ServerConfiguration stores the information about a server
type ServerVariable ¶
ServerVariable stores the information about a server variable
Source Files
¶
- api_apps.go
- api_auth.go
- api_dbs.go
- api_instances.go
- client.go
- configuration.go
- fetchError.go
- model_application.go
- model_application_resources.go
- model_context.go
- model_created_application.go
- model_created_database.go
- model_database.go
- model_email.go
- model_git.go
- model_inline_response_200.go
- model_inline_response_400.go
- model_instances.go
- model_login_response.go
- model_metrics.go
- response.go