Documentation
¶
Overview ¶
The api client for storage's golang SDK
Index ¶
- func ParameterToJson(obj interface{}) (string, error)
- func ParameterToString(obj interface{}, collectionFormat string) string
- func ReportError(format string, b ...interface{}) error
- type APIKey
- type ApiClient
- func (a *ApiClient) AddDefaultHeader(headerName string, headerValue string)
- func (a *ApiClient) CallApi(uri *string, httpMethod string, body interface{}, queryParams url.Values, ...) ([]byte, error)
- func (a *ApiClient) GetAuthentication(authName string) interface{}
- func (a *ApiClient) GetAuthentications() map[string]interface{}
- func (a *ApiClient) GetEtag(object interface{}) string
- func (a *ApiClient) SetAccessToken(accessToken string) error
- func (a *ApiClient) SetApiKey(key string) error
- func (a *ApiClient) SetApiKeyPrefix(apiKeyPrefix string) error
- func (a *ApiClient) SetMaxRetryAttempts(maxRetryAttempts int)
- func (a *ApiClient) SetPassword(password string)
- func (a *ApiClient) SetRetryIntervalInMilliSeconds(ms int)
- func (a *ApiClient) SetUserName(username string)
- func (a *ApiClient) SetVerifySSL(verifySSL bool)
- type BasicAuth
- type GenericOpenAPIError
- type LeveledLogrus
- type OAuth
- type Proxy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParameterToJson ¶
helper for converting interface{} parameters to json strings
func ParameterToString ¶
parameterToString convert interface{} parameters to string, using a delimiter if format is provided.
func ReportError ¶
Prevent trying to import "fmt"
Types ¶
type APIKey ¶
APIKey provides API key based authentication to a request passed via context using ContextAPIKey
type ApiClient ¶
type ApiClient struct { Scheme string `json:"scheme,omitempty"` Host string `json:"host,omitempty"` Port int `json:"port,omitempty"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` Debug bool `json:"debug,omitempty"` VerifySSL bool Proxy *Proxy MaxRetryAttempts int `json:"maxRetryAttempts,omitempty"` ReadTimeout time.Duration `json:"readTimeout,omitempty"` ConnectTimeout time.Duration `json:"connectTimeout,omitempty"` RetryInterval time.Duration `json:"retryInterval,omitempty"` LoggerFile string `json:"loggerFile,omitempty"` // contains filtered or unexported fields }
*
Generic API client for Swagger client library builds. Swagger generic API client. This client handles the client- server communication, and is invariant across implementations. Specifics of the methods and models for each application are generated from the Swagger templates. Parameters :- Scheme (string) : URI scheme for connecting to the cluster (HTTP or HTTPS using SSL/TLS) (default : https) Host (string) : Host IPV4, IPV6 or FQDN for all http request made by this client (default : localhost) Port (string) : Port for the host to connect to make all http request (default : 9440) Username (string) : Username to connect to a cluster Password (string) : Password to connect to a cluster Debug (bool) : flag to enable debug logging (default : empty) VerifySSL (bool) : Verify SSL certificate of cluster (default: true) MaxRetryAttempts (int) : Maximum number of retry attempts to be made at a time (default: 5) ReadTimeout (time.Duration) : Read timeout for all operations in milliseconds ConnectTimeout (time.Duration) : Connection timeout for all operations in milliseconds RetryInterval (time.Duration) : Interval between successive retry attempts (default: 3 sec) LoggerFile (string) : Log file to write activity logs
func NewApiClient ¶
func NewApiClient() *ApiClient
*
Returns a newly generated ApiClient instance populated with default values
func (*ApiClient) AddDefaultHeader ¶
AddDefaultHeader Adds a default header to current api client instance for all the HTTP calls.
func (*ApiClient) CallApi ¶
func (a *ApiClient) CallApi(uri *string, httpMethod string, body interface{}, queryParams url.Values, headerParams map[string]string, formParams url.Values, accepts []string, contentType []string, authNames []string) ([]byte, error)
Makes the HTTP request with given options and returns response body as byte array.
func (*ApiClient) GetAuthentication ¶
Get authentication for the given auth name (eg : basic, oauth, bearer, apiKey)
func (*ApiClient) GetAuthentications ¶
Get all authentications (key: authentication name, value: authentication)
func (*ApiClient) GetEtag ¶
GetEtag Get ETag from an object if exists, otherwise returns empty string. The ETag is usually provided in the response of the GET API calls, which can further be used in other HTTP operations.
func (*ApiClient) SetAccessToken ¶
Helper method to set access token for the first OAuth2 authentication.
func (*ApiClient) SetApiKey ¶
Helper method to set API key value for the first API key authentication
func (*ApiClient) SetApiKeyPrefix ¶
Helper method to set API key prefix for the first API key authentication
func (*ApiClient) SetMaxRetryAttempts ¶
*
Helper method to set maximum retry attempts. After the initial instantiation of ApiClient, maximum retry attempts must be modified only via this method
func (*ApiClient) SetPassword ¶
Helper method to set password for the first HTTP basic authentication
func (*ApiClient) SetRetryIntervalInMilliSeconds ¶
*
Helper method to set retry back off period. After the initial instantiation of ApiClient, back off period must be modified only via this method
func (*ApiClient) SetUserName ¶
Helper method to set username for the first HTTP basic authentication.
func (*ApiClient) SetVerifySSL ¶
*
Helper method to enable/disable SSL verification. By default, SSL verification is enabled. Please note that disabling SSL verification is not recommended and should only be done for test purposes.
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 GenericOpenAPIError ¶
GenericOpenAPIError Provides access to the body (error), status and model on returned errors.
func (GenericOpenAPIError) DeserializedModel ¶
func (e GenericOpenAPIError) DeserializedModel() interface{}
Error returns deserialized response body if compatible with GenericOpenAPIError.Model
func (GenericOpenAPIError) Error ¶
func (e GenericOpenAPIError) Error() string
Error returns non-empty string if there was an error.
type LeveledLogrus ¶
func (*LeveledLogrus) Debug ¶
func (l *LeveledLogrus) Debug(msg string, keysAndValues ...interface{})
func (*LeveledLogrus) Error ¶
func (l *LeveledLogrus) Error(msg string, keysAndValues ...interface{})
func (*LeveledLogrus) Info ¶
func (l *LeveledLogrus) Info(msg string, keysAndValues ...interface{})
func (*LeveledLogrus) Warn ¶
func (l *LeveledLogrus) Warn(msg string, keysAndValues ...interface{})
type Proxy ¶
type Proxy struct { Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` Scheme string `json:"scheme,omitempty"` Host string `json:"host,omitempty"` Port int `json:"port,omitempty"` }
*
Configuration for the Proxy Server that requests are to be routed through. Parameters :- Scheme (string) : URI Scheme for connecting to the proxy ("http", "https" or "socks5") Host (string) : Host of the proxy to which the client will connect to Port (string) : Port of the proxy to which the client will connect to Username (string) : Username to connect to the proxy Password (string) : Password to connect to the proxy