Versions in this module Expand all Collapse all v2 v2.2.1 Sep 25, 2024 Changes in this version + const DefaultMaxBackoffRetries + const DefaultUserAgent + const RFC3339Milli + const RFC3339MilliNoZ + const RFC3339NoZ + const RFC3339ZNoT + const RFC3339ZNoTNoZ + func BuildHeaders(opts any) (map[string]string, error) + func BuildQueryString(opts any) (*url.URL, error) + func BuildRequestBody(opts any, parent string) (map[string]any, error) + func ExtractNextURL(links []Link) (string, error) + func IDSliceToQueryString(name string, ids []int) string + func IntToPointer(i int) *int + func IntWithinRange(val, min, max int) bool + func MaybeInt(original int) *int + func MaybeString(original string) *string + func NormalizePathURL(basePath, rawPath string) (string, error) + func NormalizeURL(url string) string + func ParseResponse(resp *http.Response, err error) (io.ReadCloser, http.Header, error) + func RemainingKeys(s any, m map[string]any) (extras map[string]any) + func ResponseCodeIs(err error, status int) bool + func WaitFor(ctx context.Context, predicate func(context.Context) (bool, error)) error + type AuthOptions struct + AllowReauth bool + ApplicationCredentialID string + ApplicationCredentialName string + ApplicationCredentialSecret string + DomainID string + DomainName string + IdentityEndpoint string + Passcode string + Password string + Scope *AuthScope + TenantID string + TenantName string + TokenID string + UserID string + Username string + func (opts *AuthOptions) ToTokenV3CreateMap(scope map[string]any) (map[string]any, error) + func (opts *AuthOptions) ToTokenV3HeadersMap(map[string]any) (map[string]string, error) + func (opts *AuthOptions) ToTokenV3ScopeMap() (map[string]any, error) + func (opts AuthOptions) CanReauth() bool + func (opts AuthOptions) ToTokenV2CreateMap() (map[string]any, error) + type AuthResult interface + ExtractTokenID func() (string, error) + type AuthScope struct + DomainID string + DomainName string + ProjectID string + ProjectName string + System bool + TrustID string + type Availability string + const AvailabilityAdmin + const AvailabilityInternal + const AvailabilityPublic + type BaseError struct + DefaultErrString string + Info string + func (e BaseError) Error() string + type EnabledState *bool + var Disabled EnabledState = &iFalse + var Enabled EnabledState = &iTrue + type EndpointLocator func(EndpointOpts) (string, error) + type EndpointOpts struct + Availability Availability + Name string + Region string + Type string + func (eo *EndpointOpts) ApplyDefaults(t string) + type ErrAPIKeyProvided struct + func (e ErrAPIKeyProvided) Error() string + type ErrAppCredMissingSecret struct + func (e ErrAppCredMissingSecret) Error() string + type ErrDomainIDOrDomainName struct + func (e ErrDomainIDOrDomainName) Error() string + type ErrDomainIDWithToken struct + func (e ErrDomainIDWithToken) Error() string + type ErrDomainIDWithUserID struct + func (e ErrDomainIDWithUserID) Error() string + type ErrDomainNameWithToken struct + func (e ErrDomainNameWithToken) Error() string + type ErrDomainNameWithUserID struct + func (e ErrDomainNameWithUserID) Error() string + type ErrEndpointNotFound struct + func (e ErrEndpointNotFound) Error() string + type ErrErrorAfterReauthentication struct + ErrOriginal error + func (e ErrErrorAfterReauthentication) Error() string + type ErrInvalidInput struct + Value any + func (e ErrInvalidInput) Error() string + type ErrMissingAnyoneOfEnvironmentVariables struct + EnvironmentVariables []string + func (e ErrMissingAnyoneOfEnvironmentVariables) Error() string + type ErrMissingEnvironmentVariable struct + EnvironmentVariable string + func (e ErrMissingEnvironmentVariable) Error() string + type ErrMissingInput struct + Argument string + func (e ErrMissingInput) Error() string + type ErrMissingPassword struct + func (e ErrMissingPassword) Error() string + type ErrMultipleResourcesFound struct + Count int + Name string + ResourceType string + func (e ErrMultipleResourcesFound) Error() string + type ErrResourceNotFound struct + Name string + ResourceType string + func (e ErrResourceNotFound) Error() string + type ErrResult struct + func (r ErrResult) ExtractErr() error + type ErrScopeDomainIDOrDomainName struct + func (e ErrScopeDomainIDOrDomainName) Error() string + type ErrScopeEmpty struct + func (e ErrScopeEmpty) Error() string + type ErrScopeProjectIDAlone struct + func (e ErrScopeProjectIDAlone) Error() string + type ErrScopeProjectIDOrProjectName struct + func (e ErrScopeProjectIDOrProjectName) Error() string + type ErrServiceNotFound struct + func (e ErrServiceNotFound) Error() string + type ErrTenantIDProvided struct + func (e ErrTenantIDProvided) Error() string + type ErrTenantNameProvided struct + func (e ErrTenantNameProvided) Error() string + type ErrTimeOut struct + func (e ErrTimeOut) Error() string + type ErrUnableToReauthenticate struct + ErrOriginal error + ErrReauth error + func (e ErrUnableToReauthenticate) Error() string + type ErrUnexpectedResponseCode struct + Actual int + Body []byte + Expected []int + Method string + ResponseHeader http.Header + URL string + func (e ErrUnexpectedResponseCode) Error() string + func (e ErrUnexpectedResponseCode) GetStatusCode() int + type ErrUnexpectedType struct + Actual string + Expected string + func (e ErrUnexpectedType) Error() string + type ErrUserIDWithToken struct + func (e ErrUserIDWithToken) Error() string + type ErrUsernameOrUserID struct + func (e ErrUsernameOrUserID) Error() string + type ErrUsernameWithToken struct + func (e ErrUsernameWithToken) Error() string + type HeaderResult struct + func (r HeaderResult) ExtractInto(to any) error + type IPVersion int + const IPv4 + const IPv6 + type JSONRFC1123 time.Time + func (jt *JSONRFC1123) UnmarshalJSON(data []byte) error + type JSONRFC3339Milli time.Time + func (jt *JSONRFC3339Milli) UnmarshalJSON(data []byte) error + type JSONRFC3339MilliNoZ time.Time + func (jt *JSONRFC3339MilliNoZ) UnmarshalJSON(data []byte) error + type JSONRFC3339NoZ time.Time + func (jt *JSONRFC3339NoZ) UnmarshalJSON(data []byte) error + type JSONRFC3339ZNoT time.Time + func (jt *JSONRFC3339ZNoT) UnmarshalJSON(data []byte) error + type JSONRFC3339ZNoTNoZ time.Time + func (jt *JSONRFC3339ZNoTNoZ) UnmarshalJSON(data []byte) error + type JSONUnix time.Time + func (jt *JSONUnix) UnmarshalJSON(data []byte) error + type Link struct + Href string + Rel string + type ProviderClient struct + EndpointLocator EndpointLocator + HTTPClient http.Client + IdentityBase string + IdentityEndpoint string + MaxBackoffRetries uint + ReauthFunc func(context.Context) error + RetryBackoffFunc RetryBackoffFunc + RetryFunc RetryFunc + Throwaway bool + TokenID string + UserAgent UserAgent + func (client *ProviderClient) AuthenticatedHeaders() (m map[string]string) + func (client *ProviderClient) CopyTokenFrom(other *ProviderClient) + func (client *ProviderClient) GetAuthResult() AuthResult + func (client *ProviderClient) IsThrowaway() bool + func (client *ProviderClient) Reauthenticate(ctx context.Context, previousToken string) error + func (client *ProviderClient) Request(ctx context.Context, method, url string, options *RequestOpts) (*http.Response, error) + func (client *ProviderClient) SetThrowaway(v bool) + func (client *ProviderClient) SetToken(t string) + func (client *ProviderClient) SetTokenAndAuthResult(r AuthResult) error + func (client *ProviderClient) Token() string + func (client *ProviderClient) UseTokenLock() + type RequestOpts struct + JSONBody any + JSONResponse any + KeepResponseBody bool + MoreHeaders map[string]string + OkCodes []int + OmitHeaders []string + RawBody io.Reader + type Result struct + Body any + Err error + Header http.Header + StatusCode int + func (r Result) ExtractInto(to any) error + func (r Result) ExtractIntoSlicePtr(to any, label string) error + func (r Result) ExtractIntoStructPtr(to any, label string) error + func (r Result) PrettyPrintJSON() string + type RetryBackoffFunc func(context.Context, *ErrUnexpectedResponseCode, error, uint) error + type RetryFunc func(context context.Context, method, url string, options *RequestOpts, err error, ...) error + type ServiceClient struct + Endpoint string + Microversion string + MoreHeaders map[string]string + ResourceBase string + Type string + func (client *ServiceClient) Delete(ctx context.Context, url string, opts *RequestOpts) (*http.Response, error) + func (client *ServiceClient) Get(ctx context.Context, url string, JSONResponse any, opts *RequestOpts) (*http.Response, error) + func (client *ServiceClient) Head(ctx context.Context, url string, opts *RequestOpts) (*http.Response, error) + func (client *ServiceClient) Patch(ctx context.Context, url string, JSONBody any, JSONResponse any, ...) (*http.Response, error) + func (client *ServiceClient) Post(ctx context.Context, url string, JSONBody any, JSONResponse any, ...) (*http.Response, error) + func (client *ServiceClient) Put(ctx context.Context, url string, JSONBody any, JSONResponse any, ...) (*http.Response, error) + func (client *ServiceClient) Request(ctx context.Context, method, url string, options *RequestOpts) (*http.Response, error) + func (client *ServiceClient) ResourceBaseURL() string + func (client *ServiceClient) ServiceURL(parts ...string) string + type UserAgent struct + func (ua *UserAgent) Join() string + func (ua *UserAgent) Prepend(s ...string)