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 ChainMiddleware(rt http.RoundTripper, middlewares ...Middleware) http.RoundTripper
- func ConfigureRegion(cfg *Configuration) error
- func WithCaptureHTTPResponse(parent context.Context, resp **http.Response) context.Contextdeprecated
- type APIKey
- type BasicAuth
- type Configuration
- type ConfigurationOption
- func WithBackgroundTokenRefresh(ctx context.Context) 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 WithJar(jar http.CookieJar) ConfigurationOption
- func WithMaxRetries(_ int) ConfigurationOptiondeprecated
- func WithMiddleware(m Middleware) ConfigurationOption
- func WithPrivateKey(privateKey string) ConfigurationOption
- func WithPrivateKeyPath(privateKeyPath string) ConfigurationOption
- func WithRegion(region string) ConfigurationOption
- func WithRetryTimeout(_ time.Duration) ConfigurationOptiondeprecated
- 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(_ time.Duration) ConfigurationOptiondeprecated
- func WithoutAuthentication() ConfigurationOption
- type Middleware
- 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") // ContextHTTPRequest holds the raw HTTP request. ContextHTTPRequest = contextKey("httpRequest") )
Functions ¶
func ChainMiddleware ¶ added in v0.12.0
func ChainMiddleware(rt http.RoundTripper, middlewares ...Middleware) http.RoundTripper
ChainMiddleware chains multiple middlewares to create a single http.RoundTripper The middlewares are applied in reverse order, so the last middleware provided in the arguments is the first to be executed If the root http.RoundTripper is nil, http.DefaultTransport is used
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"` Region string `json:"region,omitempty"` CustomAuth http.RoundTripper Servers ServerConfigurations OperationServers map[string]ServerConfigurations HTTPClient *http.Client Middleware []Middleware // If != nil, a goroutine will be launched that will refresh the service account's access token when it's close to being expired. // The goroutine is killed whenever this context is canceled. // // Only has effect for key flow BackgroundTokenRefreshContext context.Context // Deprecated: retry options were removed to reduce complexity of the client. If this functionality is needed, you can provide your own custom HTTP client. This field has no effect, and will be removed in a later update RetryOptions *clients.RetryConfig //nolint:staticcheck //will be removed in a later update // 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 WithBackgroundTokenRefresh ¶ added in v0.10.0
func WithBackgroundTokenRefresh(ctx context.Context) ConfigurationOption
WithBackgroundTokenRefresh returns a ConfigurationOption that enables access token refreshing in backgound.
If enabled, a goroutine will be launched that will refresh the service account's access token when it's close to being expired. The goroutine is killed whenever the given context is canceled.
Only has effect for key flow
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 WithJar ¶
func WithJar(jar http.CookieJar) ConfigurationOption
WithJar returns a ConfigurationOption that specifies the HTTP client cookie jar
func WithMaxRetries
deprecated
func WithMaxRetries(_ int) ConfigurationOption
Deprecated: retry options were removed to reduce complexity of the client. If this functionality is needed, you can provide your own custom HTTP client. This option has no effect, and will be removed in a later update
func WithMiddleware ¶ added in v0.12.0
func WithMiddleware(m Middleware) ConfigurationOption
WithMiddleware returns a ConfigurationOption that adds a Middleware to the client. The Middleware is prepended to the list of Middlewares so that the last added Middleware is the first to be executed. Warning: Providing this option may overide the authentication performed by the SDK if the middlewares provided break the chain. If changes are made to the authentication header and the chain is preserved, they will be overwritten. If you wish to overwrite authentication, use WithCustomAuth.
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
deprecated
func WithRetryTimeout(_ time.Duration) ConfigurationOption
Deprecated: retry options were removed to reduce complexity of the client. If this functionality is needed, you can provide your own custom HTTP client. This option has no effect, and will be removed in a later update
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
deprecated
func WithWaitBetweenCalls(_ time.Duration) ConfigurationOption
Deprecated: retry options were removed to reduce complexity of the client. If this functionality is needed, you can provide your own custom HTTP client. This option has no effect, and will be removed in a later update
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 Middleware ¶ added in v0.12.0
type Middleware func(http.RoundTripper) http.RoundTripper
Middleware is a function that wraps an http.RoundTripper to provide additional functionality such as logging, authentication, etc.
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