Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrAuthenticationFailed = errors.New("could not retrieve an OAuth token from the API")
var ErrRequestFailed = errors.New("the API returned a response with a status outside of the 2xx range")
Functions ¶
func NewAPIClient ¶
func NewAPIClient(config apiConfig, options ...APIClientOption) *apiClient
NewAPIClient creates and returns a new APIClient
func NewAPIConfig ¶
func NewAPIConfig(serverURL, token string, opts ...APIConfigOption) (*apiConfig, error)
NewAPIConfig returns a new apiConfig that can be used for initializing a DTAPIClient with the NewAPIClient function
Types ¶
type APIClientOption ¶
type APIClientOption func(client *apiClient)
func WithHTTPClient ¶
func WithHTTPClient(httpClient http.Client) APIClientOption
WithHTTPClient injects the given HTTP client into an APIClient
func WithLogger ¶
func WithLogger(logger logr.Logger) APIClientOption
WithLogger injects the given logger into an APIClient
type APIConfigOption ¶
type APIConfigOption func(config *apiConfig)
func WithAuthURL ¶
func WithAuthURL(authURL string) APIConfigOption
func WithScopes ¶
func WithScopes(scopes []OAuthScope) APIConfigOption
WithScopes passes the given scopes to the client config
type DTAPIClient ¶
type OAuthResponse ¶
type OAuthResponse struct {
AccessToken string `json:"access_token"`
}
type OAuthScope ¶
type OAuthScope string
OAuthScope represents a scope provided for the registered OAuth client interacting with the DT API
const ( OAuthScopeStorageMetricsRead OAuthScope = "storage:metrics:read" OAuthScopeEnvironmentRoleViewer OAuthScope = "environment:roles:viewer" )
These constants define the scopes that we currently need for the DQL metric functionality. This list might extend as new features will be added. For now, we keep this at the minimum set of scopes required, as these are currently likely to change