Documentation
¶
Overview ¶
Part of this code is taken from the client.go file generated by the OpenApi generator for each API client
Index ¶
- Variables
- func ConfigureRegion(cfg *Configuration) error
- func WithCaptureHTTPResponse(parent context.Context, resp **http.Response) context.Contextdeprecated
- type APIKey
- type BasicAuth
- type Configuration
- type ConfigurationOption
- func WithCheckRedirect(checkRedirect func(req *http.Request, via []*http.Request) error) ConfigurationOption
- func WithCustomAuth(rt http.RoundTripper) ConfigurationOption
- func WithCustomConfiguration(cfg *Configuration) ConfigurationOption
- func WithEndpoint(endpoint string) ConfigurationOption
- func WithHTTPClient(client *http.Client) ConfigurationOption
- func WithJWKSEndpoint(_ string) ConfigurationOptiondeprecated
- func WithJar(jar http.CookieJar) ConfigurationOption
- func WithMaxRetries(maxRetries int) ConfigurationOption
- func WithPrivateKey(privateKey string) ConfigurationOption
- func WithPrivateKeyPath(privateKeyPath string) ConfigurationOption
- func WithRegion(region string) ConfigurationOption
- func WithRetryTimeout(retryTimeout time.Duration) ConfigurationOption
- func WithServiceAccountEmail(serviceAccountEmail string) ConfigurationOption
- func WithServiceAccountKey(serviceAccountKey string) ConfigurationOption
- func WithServiceAccountKeyPath(serviceAccountKeyPath string) ConfigurationOption
- func WithTimeout(timeout time.Duration) ConfigurationOption
- func WithToken(token string) ConfigurationOption
- func WithTokenEndpoint(url string) ConfigurationOption
- func WithUserAgent(userAgent string) ConfigurationOption
- func WithWaitBetweenCalls(wait time.Duration) ConfigurationOption
- func WithoutAuthentication() ConfigurationOption
- type ServerConfiguration
- type ServerConfigurations
- type ServerVariable
Constants ¶
This section is empty.
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") // ContextAPIKeys takes a string apikey as authentication for the request ContextAPIKeys = contextKey("apiKeys") // ContextHttpSignatureAuth takes HttpSignatureAuth as authentication for the request. ContextHttpSignatureAuth = contextKey("httpsignature") // ContextServerIndex uses a server configuration from the index. ContextServerIndex = contextKey("serverIndex") // ContextOperationServerIndices uses a server configuration from the index mapping. ContextOperationServerIndices = contextKey("serverOperationIndices") // ContextServerVariables overrides a server configuration variables. ContextServerVariables = contextKey("serverVariables") // ContextOperationServerVariables overrides a server configuration variables using operation specific values. ContextOperationServerVariables = contextKey("serverOperationVariables") // ContextHTTPResponse holds the raw HTTP response after the request has completed. ContextHTTPResponse = contextKey("httpResponse") )
Functions ¶
func ConfigureRegion ¶
func ConfigureRegion(cfg *Configuration) error
ConfigureRegion configures the API server urls with the user specified region. Does nothing if a custom endpoint is provided. Throws an error if no region is given or if the region is not valid
func WithCaptureHTTPResponse
deprecated
WithCaptureHTTPResponse adds the raw HTTP response retrieval annotation to the parent context. The resp parameter will contain the raw HTTP response after the request has completed.
Deprecated: Use runtime.WithCaptureHTTPResponse instead
Types ¶
type APIKey ¶
APIKey provides API key based authentication to a request passed via context using ContextAPIKey
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 Configuration ¶
type Configuration struct {
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"`
NoAuth bool `json:"noAuth,omitempty"`
ServiceAccountEmail string `json:"serviceAccountEmail,omitempty"`
Token string `json:"token,omitempty"`
ServiceAccountKey string `json:"serviceAccountKey,omitempty"`
PrivateKey string `json:"privateKey,omitempty"`
ServiceAccountKeyPath string `json:"serviceAccountKeyPath,omitempty"`
PrivateKeyPath string `json:"privateKeyPath,omitempty"`
CredentialsFilePath string `json:"credentialsFilePath,omitempty"`
TokenCustomUrl string `json:"tokenCustomUrl,omitempty"`
// Deprecated: validation using JWKS was removed, for being redundant with token validation done in the APIs. This option has no effect, and will be removed in a later update
JWKSCustomUrl string `json:"jwksCustomUrl,omitempty"`
Region string `json:"region,omitempty"`
CustomAuth http.RoundTripper
Servers ServerConfigurations
OperationServers map[string]ServerConfigurations
HTTPClient *http.Client
RetryOptions *clients.RetryConfig
// contains filtered or unexported fields
}
Configuration stores the configuration of the API client
func (*Configuration) AddDefaultHeader ¶
func (c *Configuration) AddDefaultHeader(key, value string)
AddDefaultHeader adds a new HTTP header to the default header in the request
func (*Configuration) ServerURLWithContext ¶
ServerURLWithContext returns a new server URL given an endpoint
type ConfigurationOption ¶
type ConfigurationOption func(*Configuration) error
ConfigurationOption is an option for an API client. The options are executed sequentially, so if you use withHTTPClient with a custom client that has a timeout of 1 minute and then you use withTimeout with a timeout of 2 minutes, the HTTP client timeout will be last one to be set. In the same way, if you use withHTTPClient as the last option, it will override all of the previous configurations to the HTTPClient
func WithCheckRedirect ¶
func WithCheckRedirect(checkRedirect func(req *http.Request, via []*http.Request) error) ConfigurationOption
WithCheckRedirect returns a ConfigurationOption that specifies the HTTP client checkRedirect function
func WithCustomAuth ¶
func WithCustomAuth(rt http.RoundTripper) ConfigurationOption
WithCustomAuth returns a ConfigurationOption that provides a custom http.Roundtripper for making authenticated requests
func WithCustomConfiguration ¶
func WithCustomConfiguration(cfg *Configuration) ConfigurationOption
WithCustomConfiguration returns a ConfigurationOption that sets a custom Configuration
func WithEndpoint ¶
func WithEndpoint(endpoint string) ConfigurationOption
WithEndpoint returns a ConfigurationOption that overrides the default endpoint to be used for the client This option takes precedence over withRegion
func WithHTTPClient ¶
func WithHTTPClient(client *http.Client) ConfigurationOption
WithHTTPClient returns a ConfigurationOption that specifies the HTTP client to use as basis for the communication. Warning: providing this option overrides authentication, if you just want to customize the http client parameters except Transport, you can use the WithCheckRedirect, WithJar and WithTimeout
func WithJWKSEndpoint
deprecated
func WithJWKSEndpoint(_ string) ConfigurationOption
Deprecated: validation using JWKS was removed, for being redundant with token validation done in the APIs. This option has no effect, and will be removed in a later update
func WithJar ¶
func WithJar(jar http.CookieJar) ConfigurationOption
WithJar returns a ConfigurationOption that specifies the HTTP client cookie jar
func WithMaxRetries ¶
func WithMaxRetries(maxRetries int) ConfigurationOption
WithMaxRetries returns a ConfigurationOption that specifies the maximum number of retries in case of an error when making a request
func WithPrivateKey ¶
func WithPrivateKey(privateKey string) ConfigurationOption
WithPrivateKey returns a ConfigurationOption that sets the private key This option takes precedence over WithPrivateKeyPath
func WithPrivateKeyPath ¶
func WithPrivateKeyPath(privateKeyPath string) ConfigurationOption
WithPrivateKeyPath returns a ConfigurationOption that sets the private key path
func WithRegion ¶
func WithRegion(region string) ConfigurationOption
WithRegion returns a ConfigurationOption that specifies the region to be used
func WithRetryTimeout ¶
func WithRetryTimeout(retryTimeout time.Duration) ConfigurationOption
WithRetryTimeout returns a ConfigurationOption that specifies the maximum time for retries
func WithServiceAccountEmail ¶
func WithServiceAccountEmail(serviceAccountEmail string) ConfigurationOption
WithServiceAccountEmail returns a ConfigurationOption that sets the service account email
func WithServiceAccountKey ¶
func WithServiceAccountKey(serviceAccountKey string) ConfigurationOption
WithServiceAccountKey returns a ConfigurationOption that sets the service account key This option takes precedence over WithServiceAccountKeyPath
func WithServiceAccountKeyPath ¶
func WithServiceAccountKeyPath(serviceAccountKeyPath string) ConfigurationOption
WithServiceAccountKeyPath returns a ConfigurationOption that sets the service account key path
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ConfigurationOption
WithTimeout returns a ConfigurationOption that specifies the HTTP client timeout
func WithToken ¶
func WithToken(token string) ConfigurationOption
WithToken returns a ConfigurationOption that sets a token to be used for authentication in API calls
func WithTokenEndpoint ¶
func WithTokenEndpoint(url string) ConfigurationOption
WithTokenEndpoint returns a ConfigurationOption that overrides the default url to be used to get a token when using the key flow
func WithUserAgent ¶
func WithUserAgent(userAgent string) ConfigurationOption
WithUserAgent returns a ConfigurationOption that defines the User-Agent
func WithWaitBetweenCalls ¶
func WithWaitBetweenCalls(wait time.Duration) ConfigurationOption
WithWaitBetweenCalls returns a ConfigurationOption that specifies the time to wait between calls to an API
func WithoutAuthentication ¶
func WithoutAuthentication() ConfigurationOption
WithRetryTimeout returns a ConfigurationOption that specifies the maximum time for ret WithoutAuthentication returns a ConfigurationOption that disables authentication. This option takes precedence over the WithToken option
type ServerConfiguration ¶
type ServerConfiguration struct {
URL string
Description string
Variables map[string]ServerVariable
}
ServerConfiguration stores the information about a server
type ServerConfigurations ¶
type ServerConfigurations []ServerConfiguration
ServerConfigurations stores multiple ServerConfiguration items
type ServerVariable ¶
ServerVariable stores the information about a server variable