Documentation ¶
Overview ¶
The api client for prism'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, ...) (interface{}, error)
- func (a *ApiClient) Contains(source []string, match string) bool
- func (a *ApiClient) DownloadFile(response *http.Response) (*string, 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) SetMaxRedirects(maxRedirects int)
- 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 ¶
Convert interface{} parameters to string, using a delimiter if format is provided.
func ReportError ¶
Prevent trying to import "fmt"
Types ¶
type 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"` MaxRedirects int `json:"maxRedirects,omitempty"` ReadTimeout time.Duration `json:"readTimeout,omitempty"` ConnectTimeout time.Duration `json:"connectTimeout,omitempty"` RetryInterval time.Duration `json:"retryInterval,omitempty"` DownloadDirectory string `json:"downloadDirectory,omitempty"` DownloadChunkSize int `json:"downloadChunkSize,omitempty"` RootCACertificateFile string ClientCertificateFile string ClientKeyFile string LoggerFile string `json:"loggerFile,omitempty"` // contains filtered or unexported fields }
API client to handle the client-server communication, and is invariant across implementations.
Scheme (optional) : URI scheme for connecting to the cluster (HTTP or HTTPS using SSL/TLS) (default : https) Host (required) : Host IPV4, IPV6 or FQDN for all http request made by this client (default : localhost) Port (optional) : Port for the host to connect to make all http request (default : 9440) Username (required) : Username to connect to a cluster Password (required) : Password to connect to a cluster Debug (optional) : flag to enable debug logging (default : empty) VerifySSL (optional) : Verify SSL certificate of cluster (default: true) MaxRetryAttempts (optional) : Maximum number of retry attempts to be made at a time (default: 5) MaxRedirects (optional) : Maximum number of redirect attempts to be made at a time (default: 10) ReadTimeout (optional) : Read timeout for all operations (default: 30 sec) ConnectTimeout (optional) : Connection timeout for all operations (default: 30 sec) RetryInterval (optional) : Interval between successive retry attempts (default: 3 sec) DownloadDirectory (optional) : Directory location on local for files to download (default: Current Directory) DownloadChunkSize (optional) : Chunk size in bytes for files to download (default: 8*1024 bytes) RootCACertificateFile (string) : PEM encoded Root CA certificate file path ClientCertificateFile (string) : PEM encoded client certificate file path ClientKeyFile (string) : PEM encoded client key file path LoggerFile (optional) : Log file to write activity logs
func NewApiClient ¶
func NewApiClient() *ApiClient
Returns a newly generated ApiClient instance populated with default values
func (*ApiClient) 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) (interface{}, error)
Makes the HTTP request with given options and returns response body as byte array.
func (*ApiClient) DownloadFile ¶
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 ¶
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) SetMaxRedirects ¶
Helper method to set maximum redirection attempts. After the initial instantiation of ApiClient, maximum redirection attempts must be modified only via this method
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"` }
Provides basic http authentication to a request passed via context using ContextBasicAuth
type GenericOpenAPIError ¶
Provides access to the body (error), status and model on returned errors.
func (GenericOpenAPIError) DeserializedModel ¶
func (e GenericOpenAPIError) DeserializedModel() interface{}
Returns deserialized response body if compatible with GenericOpenAPIError.Model
func (GenericOpenAPIError) Error ¶
func (e GenericOpenAPIError) Error() string
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.
Scheme: URI Scheme for connecting to the proxy ("http", "https" or "socks5") Host: Host of the proxy to which the client will connect to Port: Port of the proxy to which the client will connect to Username: Username to connect to the proxy Password: Password to connect to the proxy