Versions in this module Expand all Collapse all v0 v0.6.28 Jan 17, 2024 Changes in this version + const DefaultUserAgent + const RFC3339Date + const RFC3339Milli + const RFC3339MilliNoZ + const RFC3339NoZ + const RFC3339Z + const RFC3339ZColon + const RFC3339ZNoT + const RFC3339ZNoTNoZ + const RFC3339ZZ + var Trans ut.Translator + var Validate *validator.Validate + func BuildHeaders(opts interface{}) (map[string]string, error) + func BuildQueryString(opts interface{}) (*url.URL, error) + func BuildRequestBody(opts interface{}, parent string) (map[string]interface{}, error) + func BuildSliceRequestBody(opts interface{}) ([]map[string]interface{}, error) + func ContainsString(s []string, e string) bool + func ExtractNextURL(links []Link) (string, error) + func FailOnErrorF(err error, msg string, args ...interface{}) + 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 NativeMapToStruct(nativeMap interface{}, obj interface{}) error + func NormalizePathURL(basePath, rawPath string) (string, error) + func NormalizeURL(url string) string + func StripLastSlashURL(url string) string + func TranslateValidationError(err error) error + func ValidateStruct(s interface{}) error + func WaitFor(timeout int, predicate func() (bool, error)) error + type APITokenAPISettings struct + APIToken string + APIURL string + Debug bool + Name string + Project int + Region int + Type string + Version string + func (gs APITokenAPISettings) ToAPITokenOptions() APITokenOptions + func (gs APITokenAPISettings) ToEndpointOptions() EndpointOpts + func (gs APITokenAPISettings) Validate() error + type APITokenClientSettings interface + ToAPITokenOptions func() APITokenOptions + ToEndpointOptions func() EndpointOpts + Validate func() error + type APITokenOptions struct + APIToken string + APIURL string + type AuthClientSettings interface + ToAuthOptions func() AuthOptions + ToEndpointOptions func() EndpointOpts + Validate func() error + type AuthOptions struct + APIURL string + AllowReauth bool + AuthURL string + ClientID string + Password string + Username string + func (ao AuthOptions) ToMap() map[string]interface{} + type AuthOptionsBuilder interface + ToMap func() map[string]interface{} + type AuthResult interface + ExtractAccessToken func() (string, error) + ExtractRefreshToken func() (string, error) + ExtractTokensPair func() (string, string, error) + type BaseError struct + DefaultErrString string + Info string + func (e BaseError) Error() string + type CIDR struct + func ParseCIDRString(s string) (*CIDR, error) + func ParseCIDRStringOrNil(s string) (*CIDR, error) + func (c *CIDR) UnmarshalJSON(data []byte) error + func (c CIDR) MarshalJSON() ([]byte, error) + func (c CIDR) String() string + type Currency struct + func ParseCurrency(s string) (*Currency, error) + func (c *Currency) UnmarshalJSON(data []byte) error + func (c Currency) MarshalJSON() ([]byte, error) + func (c Currency) String() string + type EnabledState *bool + var Disabled EnabledState = &iFalse + var Enabled EnabledState = &iTrue + type EndpointLocator func(EndpointOpts) (string, error) + func DefaultEndpointLocator(endpoint string) EndpointLocator + type EndpointOpts struct + Name string + Project int + Region int + Type string + Version string + func (eo *EndpointOpts) ApplyDefaults(t string) + type EnumValidator interface + IsValid func() error + StringList func() []string + type Err400er interface + Error400 func(ErrUnexpectedResponseCode) error + type Err401er interface + Error401 func(ErrUnexpectedResponseCode) error + type Err403er interface + Error403 func(ErrUnexpectedResponseCode) error + type Err404er interface + Error404 func(ErrUnexpectedResponseCode) error + type Err405er interface + Error405 func(ErrUnexpectedResponseCode) error + type Err408er interface + Error408 func(ErrUnexpectedResponseCode) error + type Err409er interface + Error409 func(ErrUnexpectedResponseCode) error + type Err429er interface + Error429 func(ErrUnexpectedResponseCode) error + type Err500er interface + Error500 func(ErrUnexpectedResponseCode) error + type Err502er interface + Error502 func(ErrUnexpectedResponseCode) error + type Err503er interface + Error503 func(ErrUnexpectedResponseCode) error + type Err504er interface + Error504 func(ErrUnexpectedResponseCode) error + type ErrAPIKeyProvided struct + func (e ErrAPIKeyProvided) Error() string + type ErrAppCredMissingSecret struct + func (e ErrAppCredMissingSecret) Error() string + type ErrDefault400 struct + func (e ErrDefault400) Error() string + type ErrDefault401 struct + func (e ErrDefault401) Error() string + type ErrDefault403 struct + func (e ErrDefault403) Error() string + type ErrDefault404 struct + func (e ErrDefault404) Error() string + type ErrDefault405 struct + func (e ErrDefault405) Error() string + type ErrDefault408 struct + func (e ErrDefault408) Error() string + type ErrDefault409 struct + func (e ErrDefault409) Error() string + type ErrDefault429 struct + func (e ErrDefault429) Error() string + type ErrDefault500 struct + func (e ErrDefault500) Error() string + type ErrDefault502 struct + type ErrDefault503 struct + func (e ErrDefault503) Error() string + type ErrDefault504 struct + 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 interface{} + 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 + func (e ErrUnableToReauthenticate) Error() string + type ErrUnexpectedResponseCode struct + Actual int + Body []byte + Expected []int + Method string + URL string + func (e *ErrUnexpectedResponseCode) ReadGcoreError() + 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 GcoreErrorType struct + ExceptionClass string + Message string + Traceback string + type HeaderResult struct + func (r HeaderResult) ExtractInto(to interface{}) error + type IPVersion int + const IPv4 + const IPv6 + type ItemID struct + ID string + type ItemIDName struct + ID string + Name string + type ItemName struct + Name string + type JSONRFC1123 time.Time + func (jt *JSONRFC1123) UnmarshalJSON(data []byte) error + type JSONRFC3339Date struct + func (jt *JSONRFC3339Date) MarshalJSON() ([]byte, error) + func (jt *JSONRFC3339Date) UnmarshalJSON(data []byte) error + type JSONRFC3339Milli time.Time + func (jt *JSONRFC3339Milli) UnmarshalJSON(data []byte) error + type JSONRFC3339MilliNoZ struct + func (jt *JSONRFC3339MilliNoZ) UnmarshalJSON(data []byte) error + type JSONRFC3339NoZ struct + func (jt *JSONRFC3339NoZ) MarshalJSON() ([]byte, error) + func (jt *JSONRFC3339NoZ) String() string + func (jt *JSONRFC3339NoZ) UnmarshalJSON(data []byte) error + type JSONRFC3339Z struct + func (jt *JSONRFC3339Z) MarshalJSON() ([]byte, error) + func (jt *JSONRFC3339Z) UnmarshalJSON(data []byte) error + type JSONRFC3339ZColon struct + func (jt *JSONRFC3339ZColon) MarshalJSON() ([]byte, error) + func (jt *JSONRFC3339ZColon) 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 JSONRFC3339ZZ struct + func (jt *JSONRFC3339ZZ) MarshalJSON() ([]byte, error) + func (jt *JSONRFC3339ZZ) UnmarshalJSON(data []byte) error + type JSONUnix time.Time + func (jt *JSONUnix) UnmarshalJSON(data []byte) error + type Link struct + Href string + Rel string + type MAC struct + func ParseMacString(s string) (*MAC, error) + func (m *MAC) UnmarshalJSON(data []byte) error + func (m MAC) MarshalJSON() ([]byte, error) + func (m MAC) String() string + type PasswordAPISettings struct + APIURL string + AllowReauth bool + AuthURL string + Debug bool + Name string + Password string + Project int + Region int + Type string + Username string + Version string + func (gs PasswordAPISettings) ToAuthOptions() AuthOptions + func (gs PasswordAPISettings) ToEndpointOptions() EndpointOpts + func (gs PasswordAPISettings) Validate() error + type ProviderClient struct + APIBase string + APIToken string + AccessTokenID string + Context context.Context + EndpointLocator EndpointLocator + HTTPClient http.Client + IdentityBase string + IdentityEndpoint string + ReauthFunc func() error + RefreshTokenID string + Throwaway bool + UserAgent UserAgent + func NewProviderClient() *ProviderClient + func (client *ProviderClient) AccessToken() string + func (client *ProviderClient) AuthenticatedHeaders() (m map[string]string) + func (client *ProviderClient) CopyTokensFrom(other *ProviderClient) + func (client *ProviderClient) GetAuthResult() AuthResult + func (client *ProviderClient) IsDebug() bool + func (client *ProviderClient) IsThrowaway() bool + func (client *ProviderClient) Reauthenticate(previousToken string) error + func (client *ProviderClient) RefreshToken() string + func (client *ProviderClient) Request(method, url string, options *RequestOpts) (*http.Response, error) + func (client *ProviderClient) SetAPIToken(opt APITokenOptions) error + func (client *ProviderClient) SetDebug(debug bool) + func (client *ProviderClient) SetThrowaway(v bool) + func (client *ProviderClient) SetTokensAndAuthResult(r AuthResult) error + func (client *ProviderClient) UseTokenLock() + func (client ProviderClient) ToTokenOptions() TokenOptions + type RequestOpts struct + ErrorContext error + JSONBody interface{} + JSONResponse interface{} + MoreHeaders map[string]string + OkCodes []int + RawBody io.Reader + type Result struct + Body interface{} + Err error + Header http.Header + func (r Result) ExtractInto(to interface{}) error + func (r Result) ExtractIntoMapPtr(to interface{}, label string) error + func (r Result) ExtractIntoSlicePtr(to interface{}, label string) error + func (r Result) ExtractIntoStructPtr(to interface{}, label string) error + func (r Result) PrettyPrintJSON() string + type ServiceClient struct + Endpoint string + MoreHeaders map[string]string + RegionID int + ResourceBase string + Type string + func (client *ServiceClient) BaseServiceURL(parts ...string) string + func (client *ServiceClient) Delete(url string, opts *RequestOpts) (*http.Response, error) + func (client *ServiceClient) DeleteWithResponse(url string, jsonResponse interface{}, opts *RequestOpts) (*http.Response, error) + func (client *ServiceClient) Get(url string, jsonResponse interface{}, opts *RequestOpts) (*http.Response, error) + func (client *ServiceClient) Head(url string, opts *RequestOpts) (*http.Response, error) + func (client *ServiceClient) Patch(url string, jsonBody interface{}, jsonResponse interface{}, opts *RequestOpts) (*http.Response, error) + func (client *ServiceClient) Post(url string, jsonBody interface{}, jsonResponse interface{}, opts *RequestOpts) (*http.Response, error) + func (client *ServiceClient) Put(url string, jsonBody interface{}, jsonResponse interface{}, opts *RequestOpts) (*http.Response, error) + func (client *ServiceClient) Request(method, url string, options *RequestOpts) (*http.Response, error) + func (client *ServiceClient) ResourceBaseURL() string + func (client *ServiceClient) ServiceURL(parts ...string) string + type StatusCodeError interface + Error func() string + GetStatusCode func() int + type TokenAPISettings struct + APIURL string + AccessToken string + AllowReauth bool + Debug bool + Name string + Project int + RefreshToken string + Region int + Type string + Version string + func (gs TokenAPISettings) ToEndpointOptions() EndpointOpts + func (gs TokenAPISettings) ToTokenOptions() TokenOptions + func (gs TokenAPISettings) Validate() error + type TokenClientSettings interface + ToEndpointOptions func() EndpointOpts + ToTokenOptions func() TokenOptions + Validate func() error + type TokenOptions struct + APIURL string + AccessToken string + AllowReauth bool + RefreshToken string + func (to TokenOptions) ExtractAccessToken() (string, error) + func (to TokenOptions) ExtractRefreshToken() (string, error) + func (to TokenOptions) ExtractTokensPair() (string, string, error) + func (to TokenOptions) ToMap() map[string]interface{} + type TokenOptionsBuilder interface + ToMap func() map[string]interface{} + type URL struct + func MustParseURL(s string) *URL + func ParseURL(s string) (*URL, error) + func ParseURLNonMandatory(s string) (*URL, error) + func (u *URL) UnmarshalJSON(data []byte) error + func (u URL) MarshalJSON() ([]byte, error) + func (u URL) String() string + type UserAgent struct + func (ua *UserAgent) Join() string + func (ua *UserAgent) Prepend(s ...string)