api

package
v0.0.0-...-cd05bba Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

Types

type APIClient

type APIClient struct {
	SSHKeysApi *SSHKeysApiService

	ServersApi *ServersApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the ArvanCloud ECC Service API v1.0 In most cases there should be only one, shared, APIClient.

func NewAPIClient

func NewAPIClient(cfg *ecc.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

func (c *APIClient) ChangeBasePath(path string)

Change base path to allow switching to mocks

type APIResponse

type APIResponse struct {
	*http.Response `json:"-"`
	Message        string `json:"message,omitempty"`
	// Operation is the name of the 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:"-"`
}

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

type GenericError

type GenericError struct {
	// contains filtered or unexported fields
}

GenericError Provides access to the body, error and model on returned errors.

func (GenericError) Body

func (e GenericError) Body() []byte

Body returns the raw bytes of the response

func (GenericError) Error

func (e GenericError) Error() string

Error returns non-empty string if there was an error.

func (GenericError) Model

func (e GenericError) Model() interface{}

Model returns the unpacked model of the error

type SSHKeysApiService

type SSHKeysApiService service

func (*SSHKeysApiService) All

func (a *SSHKeysApiService) All(ctx context.Context, region string) (interface{}, *http.Response, error)

SSHKeysApiService Return all SSH keys.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param region Region code

@return interface{}

func (*SSHKeysApiService) Create

func (a *SSHKeysApiService) Create(ctx context.Context, region string, body interface{}) (interface{}, *http.Response, error)

SSHKeysApiService Create new SSH key.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param region Region code
  • @param body interface{}

@return interface{}

func (*SSHKeysApiService) Delete

func (a *SSHKeysApiService) Delete(ctx context.Context, region string, name string) (interface{}, *http.Response, error)

SSHKeysApiService Delete a SSH key.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param region Region code
  • @param id The ID of the SSH key
  • @param forceDelete Force delete

@return interface{}

func (*SSHKeysApiService) Get

func (a *SSHKeysApiService) Get(ctx context.Context, region string, name string) (interface{}, *http.Response, error)

SSHKeysApiService Shows details of a SSH key.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param region Region code
  • @param name The name of the SSH key

@return interface{}

type ServersApiService

type ServersApiService service

func (*ServersApiService) All

func (a *ServersApiService) All(ctx context.Context, region string) (interface{}, *http.Response, error)

ServersApiService Return all Servers.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param region Region code

@return interface{}

func (*ServersApiService) Create

func (a *ServersApiService) Create(ctx context.Context, region string, body interface{}) (interface{}, *http.Response, error)

ServersApiService Create new Server.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param region Region code
  • @param body interface{}

@return interface{}

func (*ServersApiService) Delete

func (a *ServersApiService) Delete(ctx context.Context, region string, id string, forceDelete bool) (interface{}, *http.Response, error)

ServersApiService Delete a Server.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param region Region code
  • @param id The ID of the server
  • @param forceDelete Force delete

@return interface{}

func (*ServersApiService) Get

func (a *ServersApiService) Get(ctx context.Context, region string, id string) (interface{}, *http.Response, error)

ServersApiService Shows details of a Server.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param region Region code
  • @param id The ID of the server

@return interface{}

func (*ServersApiService) GetOptions

func (a *ServersApiService) GetOptions(ctx context.Context, region string) (interface{}, *http.Response, error)

ServersApiService Return a region options.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param region Region code

@return interface{}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL