Documentation ¶
Overview ¶
Package aws provides core functionality for making requests to CYBR services.
Index ¶
- Constants
- func Bool(v bool) *bool
- func BoolMap(vs map[string]bool) map[string]*bool
- func BoolSlice(vs []bool) []*bool
- func Byte(v byte) *byte
- func ByteMap(vs map[string]byte) map[string]*byte
- func ByteSlice(vs []byte) []*byte
- func Duration(v time.Duration) *time.Duration
- func DurationMap(vs map[string]time.Duration) map[string]*time.Duration
- func DurationSlice(vs []time.Duration) []*time.Duration
- func Float32(v float32) *float32
- func Float32Map(vs map[string]float32) map[string]*float32
- func Float32Slice(vs []float32) []*float32
- func Float64(v float64) *float64
- func Float64Map(vs map[string]float64) map[string]*float64
- func Float64Slice(vs []float64) []*float64
- func GetDisableHTTPS(options ...interface{}) (value bool, found bool)
- func Int(v int) *int
- func Int16(v int16) *int16
- func Int16Map(vs map[string]int16) map[string]*int16
- func Int16Slice(vs []int16) []*int16
- func Int32(v int32) *int32
- func Int32Map(vs map[string]int32) map[string]*int32
- func Int32Slice(vs []int32) []*int32
- func Int64(v int64) *int64
- func Int64Map(vs map[string]int64) map[string]*int64
- func Int64Slice(vs []int64) []*int64
- func Int8(v int8) *int8
- func Int8Map(vs map[string]int8) map[string]*int8
- func Int8Slice(vs []int8) []*int8
- func IntMap(vs map[string]int) map[string]*int
- func IntSlice(vs []int) []*int
- func IsCredentialsProvider(provider, target CredentialsProvider) bool
- func String(v string) *string
- func StringMap(vs map[string]string) map[string]*string
- func StringSlice(vs []string) []*string
- func Time(v time.Time) *time.Time
- func TimeMap(vs map[string]time.Time) map[string]*time.Time
- func TimeSlice(vs []time.Time) []*time.Time
- func ToBool(p *bool) (v bool)
- func ToBoolMap(vs map[string]*bool) map[string]bool
- func ToBoolSlice(vs []*bool) []bool
- func ToByte(p *byte) (v byte)
- func ToByteMap(vs map[string]*byte) map[string]byte
- func ToByteSlice(vs []*byte) []byte
- func ToDuration(p *time.Duration) (v time.Duration)
- func ToDurationMap(vs map[string]*time.Duration) map[string]time.Duration
- func ToDurationSlice(vs []*time.Duration) []time.Duration
- func ToFloat32(p *float32) (v float32)
- func ToFloat32Map(vs map[string]*float32) map[string]float32
- func ToFloat32Slice(vs []*float32) []float32
- func ToFloat64(p *float64) (v float64)
- func ToFloat64Map(vs map[string]*float64) map[string]float64
- func ToFloat64Slice(vs []*float64) []float64
- func ToInt(p *int) (v int)
- func ToInt16(p *int16) (v int16)
- func ToInt16Map(vs map[string]*int16) map[string]int16
- func ToInt16Slice(vs []*int16) []int16
- func ToInt32(p *int32) (v int32)
- func ToInt32Map(vs map[string]*int32) map[string]int32
- func ToInt32Slice(vs []*int32) []int32
- func ToInt64(p *int64) (v int64)
- func ToInt64Map(vs map[string]*int64) map[string]int64
- func ToInt64Slice(vs []*int64) []int64
- func ToInt8(p *int8) (v int8)
- func ToInt8Map(vs map[string]*int8) map[string]int8
- func ToInt8Slice(vs []*int8) []int8
- func ToIntMap(vs map[string]*int) map[string]int
- func ToIntSlice(vs []*int) []int
- func ToString(p *string) (v string)
- func ToStringMap(vs map[string]*string) map[string]string
- func ToStringSlice(vs []*string) []string
- func ToTime(p *time.Time) (v time.Time)
- func ToTimeMap(vs map[string]*time.Time) map[string]time.Time
- func ToTimeSlice(vs []*time.Time) []time.Time
- func ToUint(p *uint) (v uint)
- func ToUint16(p *uint16) (v uint16)
- func ToUint16Map(vs map[string]*uint16) map[string]uint16
- func ToUint16Slice(vs []*uint16) []uint16
- func ToUint32(p *uint32) (v uint32)
- func ToUint32Map(vs map[string]*uint32) map[string]uint32
- func ToUint32Slice(vs []*uint32) []uint32
- func ToUint64(p *uint64) (v uint64)
- func ToUint64Map(vs map[string]*uint64) map[string]uint64
- func ToUint64Slice(vs []*uint64) []uint64
- func ToUint8(p *uint8) (v uint8)
- func ToUint8Map(vs map[string]*uint8) map[string]uint8
- func ToUint8Slice(vs []*uint8) []uint8
- func ToUintMap(vs map[string]*uint) map[string]uint
- func ToUintSlice(vs []*uint) []uint
- func Uint(v uint) *uint
- func Uint16(v uint16) *uint16
- func Uint16Map(vs map[string]uint16) map[string]*uint16
- func Uint16Slice(vs []uint16) []*uint16
- func Uint32(v uint32) *uint32
- func Uint32Map(vs map[string]uint32) map[string]*uint32
- func Uint32Slice(vs []uint32) []*uint32
- func Uint64(v uint64) *uint64
- func Uint64Map(vs map[string]uint64) map[string]*uint64
- func Uint64Slice(vs []uint64) []*uint64
- func Uint8(v uint8) *uint8
- func Uint8Map(vs map[string]uint8) map[string]*uint8
- func Uint8Slice(vs []uint8) []*uint8
- func UintMap(vs map[string]uint) map[string]*uint
- func UintSlice(vs []uint) []*uint
- type AdjustExpiresByCredentialsCacheStrategy
- type AnonymousCredentials
- type Config
- type Credentials
- type CredentialsCache
- type CredentialsCacheOptions
- type CredentialsProvider
- type CredentialsProviderFunc
- type DefaultsMode
- type Endpoint
- type EndpointDiscoveryEnableState
- type EndpointNotFoundError
- type EndpointResolverWithOptions
- type EndpointResolverWithOptionsFunc
- type EndpointSource
- type HTTPClient
- type HandleFailRefreshCredentialsCacheStrategy
- type InvalidParamError
- type InvalidParamsError
- type NopRetryer
- func (NopRetryer) GetAttemptToken(context.Context) (func(error) error, error)
- func (NopRetryer) GetInitialToken() func(error) error
- func (NopRetryer) GetRetryToken(context.Context, error) (func(error) error, error)
- func (NopRetryer) IsErrorRetryable(error) bool
- func (NopRetryer) MaxAttempts() int
- func (NopRetryer) RetryDelay(int, error) (time.Duration, error)
- type ParamRequiredError
- type RequestCanceledError
- type RetryMode
- type Retryer
- type RetryerV2
Constants ¶
const SDKName = "cybr-sdk-go"
SDKName is the name of this AWS SDK
const SDKVersion = goModuleVersion
SDKVersion is the version of this SDK
Variables ¶
This section is empty.
Functions ¶
func DurationMap ¶
DurationMap returns a map of time.Duration pointers from the values passed in.
func DurationSlice ¶
DurationSlice returns a slice of time.Duration pointers from the values passed in.
func Float32Map ¶
Float32Map returns a map of float32 pointers from the values passed in.
func Float32Slice ¶
Float32Slice returns a slice of float32 pointers from the values passed in.
func Float64Map ¶
Float64Map returns a map of float64 pointers from the values passed in.
func Float64Slice ¶
Float64Slice returns a slice of float64 pointers from the values passed in.
func GetDisableHTTPS ¶
GetDisableHTTPS takes a service's EndpointResolverOptions and returns the DisableHTTPS value. Returns boolean false if the provided options does not have a method to retrieve the DisableHTTPS.
func Int16Slice ¶
Int16Slice returns a slice of int16 pointers from the values passed in.
func Int32Slice ¶
Int32Slice returns a slice of int32 pointers from the values passed in.
func Int64Slice ¶
Int64Slice returns a slice of int64 pointers from the values passed in.
func IsCredentialsProvider ¶
func IsCredentialsProvider(provider, target CredentialsProvider) bool
IsCredentialsProvider returns whether the target CredentialProvider is the same type as provider when comparing the implementation type.
If provider has a method IsCredentialsProvider(CredentialsProvider) bool it will be responsible for validating whether target matches the credential provider type.
When comparing the CredentialProvider implementations provider and target for equality, the following rules are used:
If provider is of type T and target is of type V, true if type *T is the same as type *V, otherwise false If provider is of type *T and target is of type V, true if type *T is the same as type *V, otherwise false If provider is of type T and target is of type *V, true if type *T is the same as type *V, otherwise false If provider is of type *T and target is of type *V,true if type *T is the same as type *V, otherwise false
func StringSlice ¶
StringSlice returns a slice of string pointers from the values passed in.
func ToBool ¶
ToBool returns bool value dereferenced if the passed in pointer was not nil. Returns a bool zero value if the pointer was nil.
func ToBoolMap ¶
ToBoolMap returns a map of bool values, that are dereferenced if the passed in pointer was not nil. The bool zero value is used if the pointer was nil.
func ToBoolSlice ¶
ToBoolSlice returns a slice of bool values, that are dereferenced if the passed in pointer was not nil. Returns a bool zero value if the pointer was nil.
func ToByte ¶
ToByte returns byte value dereferenced if the passed in pointer was not nil. Returns a byte zero value if the pointer was nil.
func ToByteMap ¶
ToByteMap returns a map of byte values, that are dereferenced if the passed in pointer was not nil. The byte zero value is used if the pointer was nil.
func ToByteSlice ¶
ToByteSlice returns a slice of byte values, that are dereferenced if the passed in pointer was not nil. Returns a byte zero value if the pointer was nil.
func ToDuration ¶
ToDuration returns time.Duration value dereferenced if the passed in pointer was not nil. Returns a time.Duration zero value if the pointer was nil.
func ToDurationMap ¶
ToDurationMap returns a map of time.Duration values, that are dereferenced if the passed in pointer was not nil. The time.Duration zero value is used if the pointer was nil.
func ToDurationSlice ¶
ToDurationSlice returns a slice of time.Duration values, that are dereferenced if the passed in pointer was not nil. Returns a time.Duration zero value if the pointer was nil.
func ToFloat32 ¶
ToFloat32 returns float32 value dereferenced if the passed in pointer was not nil. Returns a float32 zero value if the pointer was nil.
func ToFloat32Map ¶
ToFloat32Map returns a map of float32 values, that are dereferenced if the passed in pointer was not nil. The float32 zero value is used if the pointer was nil.
func ToFloat32Slice ¶
ToFloat32Slice returns a slice of float32 values, that are dereferenced if the passed in pointer was not nil. Returns a float32 zero value if the pointer was nil.
func ToFloat64 ¶
ToFloat64 returns float64 value dereferenced if the passed in pointer was not nil. Returns a float64 zero value if the pointer was nil.
func ToFloat64Map ¶
ToFloat64Map returns a map of float64 values, that are dereferenced if the passed in pointer was not nil. The float64 zero value is used if the pointer was nil.
func ToFloat64Slice ¶
ToFloat64Slice returns a slice of float64 values, that are dereferenced if the passed in pointer was not nil. Returns a float64 zero value if the pointer was nil.
func ToInt ¶
ToInt returns int value dereferenced if the passed in pointer was not nil. Returns a int zero value if the pointer was nil.
func ToInt16 ¶
ToInt16 returns int16 value dereferenced if the passed in pointer was not nil. Returns a int16 zero value if the pointer was nil.
func ToInt16Map ¶
ToInt16Map returns a map of int16 values, that are dereferenced if the passed in pointer was not nil. The int16 zero value is used if the pointer was nil.
func ToInt16Slice ¶
ToInt16Slice returns a slice of int16 values, that are dereferenced if the passed in pointer was not nil. Returns a int16 zero value if the pointer was nil.
func ToInt32 ¶
ToInt32 returns int32 value dereferenced if the passed in pointer was not nil. Returns a int32 zero value if the pointer was nil.
func ToInt32Map ¶
ToInt32Map returns a map of int32 values, that are dereferenced if the passed in pointer was not nil. The int32 zero value is used if the pointer was nil.
func ToInt32Slice ¶
ToInt32Slice returns a slice of int32 values, that are dereferenced if the passed in pointer was not nil. Returns a int32 zero value if the pointer was nil.
func ToInt64 ¶
ToInt64 returns int64 value dereferenced if the passed in pointer was not nil. Returns a int64 zero value if the pointer was nil.
func ToInt64Map ¶
ToInt64Map returns a map of int64 values, that are dereferenced if the passed in pointer was not nil. The int64 zero value is used if the pointer was nil.
func ToInt64Slice ¶
ToInt64Slice returns a slice of int64 values, that are dereferenced if the passed in pointer was not nil. Returns a int64 zero value if the pointer was nil.
func ToInt8 ¶
ToInt8 returns int8 value dereferenced if the passed in pointer was not nil. Returns a int8 zero value if the pointer was nil.
func ToInt8Map ¶
ToInt8Map returns a map of int8 values, that are dereferenced if the passed in pointer was not nil. The int8 zero value is used if the pointer was nil.
func ToInt8Slice ¶
ToInt8Slice returns a slice of int8 values, that are dereferenced if the passed in pointer was not nil. Returns a int8 zero value if the pointer was nil.
func ToIntMap ¶
ToIntMap returns a map of int values, that are dereferenced if the passed in pointer was not nil. The int zero value is used if the pointer was nil.
func ToIntSlice ¶
ToIntSlice returns a slice of int values, that are dereferenced if the passed in pointer was not nil. Returns a int zero value if the pointer was nil.
func ToString ¶
ToString returns string value dereferenced if the passed in pointer was not nil. Returns a string zero value if the pointer was nil.
func ToStringMap ¶
ToStringMap returns a map of string values, that are dereferenced if the passed in pointer was not nil. The string zero value is used if the pointer was nil.
func ToStringSlice ¶
ToStringSlice returns a slice of string values, that are dereferenced if the passed in pointer was not nil. Returns a string zero value if the pointer was nil.
func ToTime ¶
ToTime returns time.Time value dereferenced if the passed in pointer was not nil. Returns a time.Time zero value if the pointer was nil.
func ToTimeMap ¶
ToTimeMap returns a map of time.Time values, that are dereferenced if the passed in pointer was not nil. The time.Time zero value is used if the pointer was nil.
func ToTimeSlice ¶
ToTimeSlice returns a slice of time.Time values, that are dereferenced if the passed in pointer was not nil. Returns a time.Time zero value if the pointer was nil.
func ToUint ¶
ToUint returns uint value dereferenced if the passed in pointer was not nil. Returns a uint zero value if the pointer was nil.
func ToUint16 ¶
ToUint16 returns uint16 value dereferenced if the passed in pointer was not nil. Returns a uint16 zero value if the pointer was nil.
func ToUint16Map ¶
ToUint16Map returns a map of uint16 values, that are dereferenced if the passed in pointer was not nil. The uint16 zero value is used if the pointer was nil.
func ToUint16Slice ¶
ToUint16Slice returns a slice of uint16 values, that are dereferenced if the passed in pointer was not nil. Returns a uint16 zero value if the pointer was nil.
func ToUint32 ¶
ToUint32 returns uint32 value dereferenced if the passed in pointer was not nil. Returns a uint32 zero value if the pointer was nil.
func ToUint32Map ¶
ToUint32Map returns a map of uint32 values, that are dereferenced if the passed in pointer was not nil. The uint32 zero value is used if the pointer was nil.
func ToUint32Slice ¶
ToUint32Slice returns a slice of uint32 values, that are dereferenced if the passed in pointer was not nil. Returns a uint32 zero value if the pointer was nil.
func ToUint64 ¶
ToUint64 returns uint64 value dereferenced if the passed in pointer was not nil. Returns a uint64 zero value if the pointer was nil.
func ToUint64Map ¶
ToUint64Map returns a map of uint64 values, that are dereferenced if the passed in pointer was not nil. The uint64 zero value is used if the pointer was nil.
func ToUint64Slice ¶
ToUint64Slice returns a slice of uint64 values, that are dereferenced if the passed in pointer was not nil. Returns a uint64 zero value if the pointer was nil.
func ToUint8 ¶
ToUint8 returns uint8 value dereferenced if the passed in pointer was not nil. Returns a uint8 zero value if the pointer was nil.
func ToUint8Map ¶
ToUint8Map returns a map of uint8 values, that are dereferenced if the passed in pointer was not nil. The uint8 zero value is used if the pointer was nil.
func ToUint8Slice ¶
ToUint8Slice returns a slice of uint8 values, that are dereferenced if the passed in pointer was not nil. Returns a uint8 zero value if the pointer was nil.
func ToUintMap ¶
ToUintMap returns a map of uint values, that are dereferenced if the passed in pointer was not nil. The uint zero value is used if the pointer was nil.
func ToUintSlice ¶
ToUintSlice returns a slice of uint values, that are dereferenced if the passed in pointer was not nil. Returns a uint zero value if the pointer was nil.
func Uint16Slice ¶
Uint16Slice returns a slice of uint16 pointers from the values passed in.
func Uint32Slice ¶
Uint32Slice returns a slice of uint32 pointers from the values passed in.
func Uint64Slice ¶
Uint64Slice returns a slice of uint64 pointers from the values passed in.
func Uint8Slice ¶
Uint8Slice returns a slice of uint8 pointers from the values passed in.
Types ¶
type AdjustExpiresByCredentialsCacheStrategy ¶
type AdjustExpiresByCredentialsCacheStrategy interface { // Given a Credentials as input, applying any mutations and // returning the potentially updated Credentials, or error. AdjustExpiresBy(Credentials, time.Duration) (Credentials, error) }
AdjustExpiresByCredentialsCacheStrategy is an interface for CredentialCache to allow CredentialsProvider to intercept adjustments to Credentials expiry based on expectations and use cases of CredentialsProvider.
Credential caches may use default implementation if nil.
type AnonymousCredentials ¶
type AnonymousCredentials struct{}
AnonymousCredentials provides a sentinel CredentialsProvider that should be used to instruct the SDK's signing middleware to not sign the request.
Using `nil` credentials when configuring an API client will achieve the same result. The AnonymousCredentials type allows you to configure the SDK's external config loading to not attempt to source credentials from the shared config or environment.
func (AnonymousCredentials) Retrieve ¶
func (AnonymousCredentials) Retrieve(context.Context) (Credentials, error)
Retrieve implements the CredentialsProvider interface, but will always return error, and cannot be used to sign a request. The AnonymousCredentials type is used as a sentinel type instructing the AWS request signing middleware to not sign a request.
type Config ¶
type Config struct { // The tenant name to use for the service client. This parameter is required // and must configured globally or on a per-client basis unless otherwise noted. TenantName string // The tenant ID to use for the service client. This parameter is optional // and may be configured globally or on a per-client basis. If not provided, // the tenant ID will be resolved using the tenant name. TenantID string // The credentials object to use when signing requests. // Use the LoadDefaultConfig to load configuration from all the SDK's supported // sources, and resolve credentials using the SDK's default credential chain. Credentials CredentialsProvider // The Bearer Authentication token provider to use for authenticating API // operation calls with a Bearer Authentication token. The API clients and // operation must support Bearer Authentication scheme in order for the // token provider to be used. API clients created with NewFromConfig will // automatically be configured with this option, if the API client support // Bearer Authentication. // // The SDK's config.LoadDefaultConfig can automatically populate this // option for external configuration options such as SSO session. BearerAuthTokenProvider smithybearer.TokenProvider // The HTTP Client the SDK's API clients will use to invoke HTTP requests. // The SDK defaults to a BuildableClient allowing API clients to create // copies of the HTTP Client for service specific customizations. // // Use a (*http.Client) for custom behavior. Using a custom http.Client // will prevent the SDK from modifying the HTTP client. HTTPClient HTTPClient // RetryMaxAttempts specifies the maximum number attempts an API client // will call an operation that fails with a retryable error. // // API Clients will only use this value to construct a retryer if the // Config.Retryer member is not nil. This value will be ignored if // Retryer is not nil. RetryMaxAttempts int // RetryMode specifies the retry model the API client will be created with. // // API Clients will only use this value to construct a retryer if the // Config.Retryer member is not nil. This value will be ignored if // Retryer is not nil. RetryMode RetryMode // Retryer is a function that provides a Retryer implementation. A Retryer // guides how HTTP requests should be retried in case of recoverable // failures. When nil the API client will use a default retryer. // // In general, the provider function should return a new instance of a // Retryer if you are attempting to provide a consistent Retryer // configuration across all clients. This will ensure that each client will // be provided a new instance of the Retryer implementation, and will avoid // issues such as sharing the same retry token bucket across services. // // If not nil, RetryMaxAttempts, and RetryMode will be ignored by API // clients. Retryer func() Retryer // ConfigSources are the sources that were used to construct the Config. // Allows for additional configuration to be loaded by clients. ConfigSources []interface{} // APIOptions provides the set of middleware mutations modify how the API // client requests will be handled. This is useful for adding additional // tracing data to a request, or changing behavior of the SDK's client. APIOptions []func(*middleware.Stack) error // The logger writer interface to write logging messages to. Defaults to // standard error. Logger logging.Logger // AppId is an optional application specific identifier that can be set. // When set it will be appended to the User-Agent header of every request // in the form of App/{AppId}. This variable is sourced from environment // variable AWS_SDK_UA_APP_ID or the shared config profile attribute sdk_ua_app_id. // TODO: EDIT ABOVE AppID string // BaseEndpoint is an intermediary transfer location to a service specific // BaseEndpoint on a service's Options. BaseEndpoint *string }
A Config provides service configuration for service clients.
type Credentials ¶
type Credentials struct { // The Authorization Token. BearerToken string // Source of the credentials. Source string // States if the credentials can expire or not. CanExpire bool // The time when the credentials expire. Should be ignored when CanExpire is // false. Expires time.Time }
func (Credentials) Expired ¶
func (v Credentials) Expired() bool
Expired returns if the credentials have expired.
func (Credentials) HasKeys ¶
func (v Credentials) HasKeys() bool
HasKeys returns if the credentials keys are set.
type CredentialsCache ¶
type CredentialsCache struct {
// contains filtered or unexported fields
}
CredentialsCache provides caching and concurrency safe credentials retrieval via the provider's retrieve method.
CredentialsCache will look for optional interfaces on the Provider to adjust how the credential cache handles credentials caching.
HandleFailRefreshCredentialsCacheStrategy - Allows provider to handle credential refresh failures. This could return an updated Credentials value, or attempt another means of retrieving credentials.
AdjustExpiresByCredentialsCacheStrategy - Allows provider to adjust how credentials Expires is modified. This could modify how the Credentials Expires is adjusted based on the CredentialsCache ExpiryWindow option. Such as providing a floor not to reduce the Expires below.
func NewCredentialsCache ¶
func NewCredentialsCache(provider CredentialsProvider, optFns ...func(options *CredentialsCacheOptions)) *CredentialsCache
NewCredentialsCache returns a CredentialsCache that wraps provider. Provider is expected to not be nil. A variadic list of one or more functions can be provided to modify the CredentialsCache configuration. This allows for configuration of credential expiry window and jitter.
func (*CredentialsCache) Invalidate ¶
func (p *CredentialsCache) Invalidate()
Invalidate will invalidate the cached credentials. The next call to Retrieve will cause the provider's Retrieve method to be called.
func (*CredentialsCache) IsCredentialsProvider ¶
func (p *CredentialsCache) IsCredentialsProvider(target CredentialsProvider) bool
IsCredentialsProvider returns whether credential provider wrapped by CredentialsCache matches the target provider type.
func (*CredentialsCache) Retrieve ¶
func (p *CredentialsCache) Retrieve(ctx context.Context) (Credentials, error)
Retrieve returns the credentials. If the credentials have already been retrieved, and not expired the cached credentials will be returned. If the credentials have not been retrieved yet, or expired the provider's Retrieve method will be called.
Returns and error if the provider's retrieve method returns an error.
type CredentialsCacheOptions ¶
type CredentialsCacheOptions struct { // ExpiryWindow will allow the credentials to trigger refreshing prior to // the credentials actually expiring. This is beneficial so race conditions // with expiring credentials do not cause request to fail unexpectedly // due to ExpiredTokenException exceptions. // // An ExpiryWindow of 10s would cause calls to IsExpired() to return true // 10 seconds before the credentials are actually expired. This can cause an // increased number of requests to refresh the credentials to occur. // // If ExpiryWindow is 0 or less it will be ignored. ExpiryWindow time.Duration // ExpiryWindowJitterFrac provides a mechanism for randomizing the // expiration of credentials within the configured ExpiryWindow by a random // percentage. Valid values are between 0.0 and 1.0. // // As an example if ExpiryWindow is 60 seconds and ExpiryWindowJitterFrac // is 0.5 then credentials will be set to expire between 30 to 60 seconds // prior to their actual expiration time. // // If ExpiryWindow is 0 or less then ExpiryWindowJitterFrac is ignored. // If ExpiryWindowJitterFrac is 0 then no randomization will be applied to the window. // If ExpiryWindowJitterFrac < 0 the value will be treated as 0. // If ExpiryWindowJitterFrac > 1 the value will be treated as 1. ExpiryWindowJitterFrac float64 }
type CredentialsProvider ¶
type CredentialsProvider interface { // Retrieve returns nil if it successfully retrieved the value. // Error is returned if the value were not obtainable, or empty. Retrieve(ctx context.Context) (Credentials, error) }
A CredentialsProvider is the interface for any component which will provide credentials Credentials. A CredentialsProvider is required to manage its own Expired state, and what to be expired means.
A credentials provider implementation can be wrapped with a CredentialCache to cache the credential value retrieved. Without the cache the SDK will attempt to retrieve the credentials for every request.
type CredentialsProviderFunc ¶
type CredentialsProviderFunc func(context.Context) (Credentials, error)
CredentialsProviderFunc provides a helper wrapping a function value to satisfy the CredentialsProvider interface.
func (CredentialsProviderFunc) Retrieve ¶
func (fn CredentialsProviderFunc) Retrieve(ctx context.Context) (Credentials, error)
Retrieve delegates to the function value the CredentialsProviderFunc wraps.
type DefaultsMode ¶
type DefaultsMode string
DefaultsMode is the SDK defaults mode setting.
const ( // DefaultsModeAuto is an experimental mode that builds on the standard mode. // The SDK will attempt to discover the execution environment to determine the // appropriate settings automatically. // // Note that the auto detection is heuristics-based and does not guarantee 100% // accuracy. STANDARD mode will be used if the execution environment cannot // be determined. The auto detection might query EC2 Instance Metadata service // (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html), // which might introduce latency. Therefore we recommend choosing an explicit // defaults_mode instead if startup latency is critical to your application DefaultsModeAuto DefaultsMode = "auto" // DefaultsModeLegacy provides default settings that vary per SDK and were used // prior to establishment of defaults_mode DefaultsModeLegacy DefaultsMode = "legacy" // DefaultsModeMobile builds on the standard mode and includes optimization // tailored for mobile applications // // Note that the default values vended from this mode might change as best practices // may evolve. As a result, it is encouraged to perform tests when upgrading // the SDK DefaultsModeMobile DefaultsMode = "mobile" // DefaultsModeStandard provides the latest recommended default values that // should be safe to run in most scenarios // // Note that the default values vended from this mode might change as best practices // may evolve. As a result, it is encouraged to perform tests when upgrading // the SDK DefaultsModeStandard DefaultsMode = "standard" )
The DefaultsMode constants.
func (*DefaultsMode) SetFromString ¶
func (d *DefaultsMode) SetFromString(v string) (ok bool)
SetFromString sets the DefaultsMode value to one of the pre-defined constants that matches the provided string when compared using EqualFold. If the value does not match a known constant it will be set to as-is and the function will return false. As a special case, if the provided value is a zero-length string, the mode will be set to LegacyDefaultsMode.
type Endpoint ¶
type Endpoint struct { // The base URL endpoint the SDK API clients will use to make API calls to. // The SDK will suffix URI path and query elements to this endpoint. URL string // Specifies if the endpoint's hostname can be modified by the SDK's API // client. // // If the hostname is mutable the SDK API clients may modify any part of // the hostname based on the requirements of the API, (e.g. adding, or // removing content in the hostname). // // Care should be taken when providing a custom endpoint for an API. If the // endpoint hostname is mutable, and the client cannot modify the endpoint // correctly, the operation call will most likely fail, or have undefined // behavior. // // If hostname is immutable, the SDK API clients will not modify the // hostname of the URL. This may cause the API client not to function // correctly if the API requires the operation specific hostname values // to be used by the client. // // This flag does not modify the API client's behavior if this endpoint // will be used instead of Endpoint Discovery, or if the endpoint will be // used to perform Endpoint Discovery. That behavior is configured via the // API Client's Options. HostnameImmutable bool // The AWS partition the endpoint belongs to. PartitionID string // The service name that should be used for signing the requests to the // endpoint. SigningName string // The signing method that should be used for signing the requests to the // endpoint. SigningMethod string // The source of the Endpoint. By default, this will be EndpointSourceServiceMetadata. // When providing a custom endpoint, you should set the source as EndpointSourceCustom. // If source is not provided when providing a custom endpoint, the SDK may not // perform required host mutations correctly. Source should be used along with // HostnameImmutable property as per the usage requirement. Source EndpointSource }
Endpoint represents the endpoint a service client should make API operation calls to.
The SDK will automatically resolve these endpoints per API client using an internal endpoint resolvers. If you'd like to provide custom endpoint resolving behavior you can implement the EndpointResolver interface.
type EndpointDiscoveryEnableState ¶
type EndpointDiscoveryEnableState uint
EndpointDiscoveryEnableState indicates if endpoint discovery is enabled, disabled, auto or unset state.
Default behavior (Auto or Unset) indicates operations that require endpoint discovery will use Endpoint Discovery by default. Operations that optionally use Endpoint Discovery will not use Endpoint Discovery unless EndpointDiscovery is explicitly enabled.
const ( // EndpointDiscoveryUnset represents EndpointDiscoveryEnableState is unset. // Users do not need to use this value explicitly. The behavior for unset // is the same as for EndpointDiscoveryAuto. EndpointDiscoveryUnset EndpointDiscoveryEnableState = iota // EndpointDiscoveryAuto represents an AUTO state that allows endpoint // discovery only when required by the api. This is the default // configuration resolved by the client if endpoint discovery is neither // enabled or disabled. EndpointDiscoveryAuto // default state // EndpointDiscoveryDisabled indicates client MUST not perform endpoint // discovery even when required. EndpointDiscoveryDisabled // EndpointDiscoveryEnabled indicates client MUST always perform endpoint // discovery if supported for the operation. EndpointDiscoveryEnabled )
Enumeration values for EndpointDiscoveryEnableState
type EndpointNotFoundError ¶
type EndpointNotFoundError struct {
Err error
}
EndpointNotFoundError is a sentinel error to indicate that the EndpointResolver implementation was unable to resolve an endpoint for the given service and region. Resolvers should use this to indicate that an API client should fallback and attempt to use it's internal default resolver to resolve the endpoint.
func (*EndpointNotFoundError) Error ¶
func (e *EndpointNotFoundError) Error() string
Error is the error message.
func (*EndpointNotFoundError) Unwrap ¶
func (e *EndpointNotFoundError) Unwrap() error
Unwrap returns the underlying error.
type EndpointResolverWithOptions ¶
type EndpointResolverWithOptions interface {
ResolveEndpoint(service string, options ...interface{}) (Endpoint, error)
}
EndpointResolverWithOptions is an endpoint resolver that can be used to provide or override an endpoint for the given service, region, and the service client's EndpointOptions. API clients will attempt to use the EndpointResolverWithOptions first to resolve an endpoint if available. If the EndpointResolverWithOptions returns an EndpointNotFoundError error, API clients will fallback to attempting to resolve the endpoint using its internal default endpoint resolver.
type EndpointResolverWithOptionsFunc ¶
EndpointResolverWithOptionsFunc wraps a function to satisfy the EndpointResolverWithOptions interface.
func (EndpointResolverWithOptionsFunc) ResolveEndpoint ¶
func (e EndpointResolverWithOptionsFunc) ResolveEndpoint(service string, options ...interface{}) (Endpoint, error)
ResolveEndpoint calls the wrapped function and returns the results.
type HTTPClient ¶
HTTPClient provides the interface to provide custom HTTPClients. Generally *http.Client is sufficient for most use cases. The HTTPClient should not follow 301 or 302 redirects.
type HandleFailRefreshCredentialsCacheStrategy ¶
type HandleFailRefreshCredentialsCacheStrategy interface { // Given the previously cached Credentials, if any, and refresh error, may // returns new or modified set of Credentials, or error. // // Credential caches may use default implementation if nil. HandleFailToRefresh(context.Context, Credentials, error) (Credentials, error) }
HandleFailRefreshCredentialsCacheStrategy is an interface for CredentialsCache to allow CredentialsProvider how failed to refresh credentials is handled.
type InvalidParamError ¶
type InvalidParamError interface { error // Field name the error occurred on. Field() string // SetContext updates the context of the error. SetContext(string) // AddNestedContext updates the error's context to include a nested level. AddNestedContext(string) }
An InvalidParamError represents an invalid parameter error type.
type InvalidParamsError ¶
type InvalidParamsError struct { // Context is the base context of the invalid parameter group. Context string // contains filtered or unexported fields }
An InvalidParamsError provides wrapping of invalid parameter errors found when validating API operation input parameters.
func (*InvalidParamsError) Add ¶
func (e *InvalidParamsError) Add(err InvalidParamError)
Add adds a new invalid parameter error to the collection of invalid parameters. The context of the invalid parameter will be updated to reflect this collection.
func (*InvalidParamsError) AddNested ¶
func (e *InvalidParamsError) AddNested(nestedCtx string, nested InvalidParamsError)
AddNested adds the invalid parameter errors from another InvalidParamsError value into this collection. The nested errors will have their nested context updated and base context to reflect the merging.
Use for nested validations errors.
func (InvalidParamsError) Error ¶
func (e InvalidParamsError) Error() string
Error returns the string formatted form of the invalid parameters.
func (InvalidParamsError) Errs ¶
func (e InvalidParamsError) Errs() []error
Errs returns a slice of the invalid parameters
func (*InvalidParamsError) Len ¶
func (e *InvalidParamsError) Len() int
Len returns the number of invalid parameter errors
type NopRetryer ¶
type NopRetryer struct{}
NopRetryer provides a RequestRetryDecider implementation that will flag all attempt errors as not retryable, with a max attempts of 1.
func (NopRetryer) GetAttemptToken ¶
GetAttemptToken returns a stub function that does nothing.
func (NopRetryer) GetInitialToken ¶
func (NopRetryer) GetInitialToken() func(error) error
GetInitialToken returns a stub function that does nothing.
func (NopRetryer) GetRetryToken ¶
GetRetryToken returns a stub function that does nothing.
func (NopRetryer) IsErrorRetryable ¶
func (NopRetryer) IsErrorRetryable(error) bool
IsErrorRetryable returns false for all error values.
func (NopRetryer) MaxAttempts ¶
func (NopRetryer) MaxAttempts() int
MaxAttempts always returns 1 for the original attempt.
func (NopRetryer) RetryDelay ¶
RetryDelay is not valid for the NopRetryer. Will always return error.
type ParamRequiredError ¶
type ParamRequiredError struct {
// contains filtered or unexported fields
}
An ParamRequiredError represents an required parameter error.
func NewErrParamRequired ¶
func NewErrParamRequired(field string) *ParamRequiredError
NewErrParamRequired creates a new required parameter error.
func (*ParamRequiredError) AddNestedContext ¶
func (e *ParamRequiredError) AddNestedContext(ctx string)
AddNestedContext prepends a context to the field's path.
func (ParamRequiredError) Error ¶
func (e ParamRequiredError) Error() string
Error returns the string version of the invalid parameter error.
func (ParamRequiredError) Field ¶
func (e ParamRequiredError) Field() string
Field Returns the field and context the error occurred.
func (*ParamRequiredError) SetContext ¶
func (e *ParamRequiredError) SetContext(ctx string)
SetContext updates the base context of the error.
type RequestCanceledError ¶
type RequestCanceledError struct {
Err error
}
RequestCanceledError is the error that will be returned by an API request that was canceled. Requests given a Context may return this error when canceled.
func (*RequestCanceledError) CanceledError ¶
func (*RequestCanceledError) CanceledError() bool
CanceledError returns true to satisfy interfaces checking for canceled errors.
func (*RequestCanceledError) Error ¶
func (e *RequestCanceledError) Error() string
func (*RequestCanceledError) Unwrap ¶
func (e *RequestCanceledError) Unwrap() error
Unwrap returns the underlying error, if there was one.
type RetryMode ¶
type RetryMode string
RetryMode provides the mode the API client will use to create a retryer based on.
const ( // RetryModeStandard model provides rate limited retry attempts with // exponential backoff delay. RetryModeStandard RetryMode = "standard" // RetryModeAdaptive model provides attempt send rate limiting on throttle // responses in addition to standard mode's retry rate limiting. // // Adaptive retry mode is experimental and is subject to change in the // future. RetryModeAdaptive RetryMode = "adaptive" )
func ParseRetryMode ¶
ParseRetryMode attempts to parse a RetryMode from the given string. Returning error if the value is not a known RetryMode.
type Retryer ¶
type Retryer interface { // IsErrorRetryable returns if the failed attempt is retryable. This check // should determine if the error can be retried, or if the error is // terminal. IsErrorRetryable(error) bool // MaxAttempts returns the maximum number of attempts that can be made for // an attempt before failing. A value of 0 implies that the attempt should // be retried until it succeeds if the errors are retryable. MaxAttempts() int // RetryDelay returns the delay that should be used before retrying the // attempt. Will return error if the delay could not be determined. RetryDelay(attempt int, opErr error) (time.Duration, error) // GetRetryToken attempts to deduct the retry cost from the retry token pool. // Returning the token release function, or error. GetRetryToken(ctx context.Context, opErr error) (releaseToken func(error) error, err error) // GetInitialToken returns the initial attempt token that can increment the // retry token pool if the attempt is successful. GetInitialToken() (releaseToken func(error) error) }
Retryer is an interface to determine if a given error from a attempt should be retried, and if so what backoff delay to apply. The default implementation used by most services is the retry package's Standard type. Which contains basic retry logic using exponential backoff.
type RetryerV2 ¶
type RetryerV2 interface { Retryer // GetInitialToken returns the initial attempt token that can increment the // retry token pool if the attempt is successful. // // Deprecated: This method does not provide a way to block using Context, // nor can it return an error. Use RetryerV2, and GetAttemptToken instead. GetInitialToken() (releaseToken func(error) error) // GetAttemptToken returns the send token that can be used to rate limit // attempt calls. Will be used by the SDK's retry package's Attempt // middleware to get a send token prior to calling the temp and releasing // the send token after the attempt has been made. GetAttemptToken(context.Context) (func(error) error, error) }
RetryerV2 is an interface to determine if a given error from an attempt should be retried, and if so what backoff delay to apply. The default implementation used by most services is the retry package's Standard type. Which contains basic retry logic using exponential backoff.
RetryerV2 replaces the Retryer interface, deprecating the GetInitialToken method in favor of GetAttemptToken which takes a context, and can return an error.
The SDK's retry package's Attempt middleware, and utilities will always wrap a Retryer as a RetryerV2. Delegating to GetInitialToken, only if GetAttemptToken is not implemented.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package defaults provides recommended configuration values for CYBR SDKs and CLIs.
|
Package defaults provides recommended configuration values for CYBR SDKs and CLIs. |
Package middleware provides transport agnostic middleware for decorating SDK handlers.
|
Package middleware provides transport agnostic middleware for decorating SDK handlers. |
protocol
|
|
transport
|
|