Documentation ¶
Overview ¶
Copyright 2014-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at
http://aws.amazon.com/apache2.0/
or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func AddJitter(duration time.Duration, jitter time.Duration) time.Duration
- func CompleteJsonUnmarshal(b []byte, iface interface{}) error
- func DefaultIfBlank(str string, default_value string) string
- func ExtractVersion(input string) string
- func JsonKeys(b []byte) ([]string, error)
- func NewMultiError(errs ...error) error
- func ParseBool(str string, default_ bool) bool
- func RandHex() string
- func RetryNWithBackoff(backoff Backoff, n int, fn func() error) error
- func RetryNWithBackoffCtx(ctx context.Context, backoff Backoff, n int, fn func() error) error
- func RetryWithBackoff(backoff Backoff, fn func() error) error
- func RetryWithBackoffCtx(ctx context.Context, backoff Backoff, fn func() error) error
- func SignHTTPRequest(req *http.Request, region, service string, creds *credentials.Credentials, ...)
- func SlicesDeepEqual(slice1, slice2 interface{}) bool
- func StrSliceEqual(s1, s2 []string) bool
- func Strptr(s string) *string
- func Uint16SliceToStringSlice(slice []uint16) []*string
- func ZeroOrNil(obj interface{}) bool
- type AttributeError
- type Backoff
- type ChanSemaphore
- type DefaultRetriable
- type DefaultRetriableError
- type LicenseProvider
- type MultiErr
- type Retriable
- type RetriableError
- type Semaphore
- type SimpleBackoff
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddJitter ¶
AddJitter adds an amount of jitter between 0 and the given jitter to the given duration
func CompleteJsonUnmarshal ¶
CompleteJsonUnmarshal determines if a given struct has members corresponding to every key of a json object (passed as the json string). By default, Go ignores fields in an object which have no corresponding struct member and this can be used to determine if this ignoring has occurred Errors will result in "false" as a return value
func DefaultIfBlank ¶
func ExtractVersion ¶ added in v1.14.0
ExtractVersion extracts a matching version from the version number string
func JsonKeys ¶
JsonKeys takes an arbitrary byte array representing a json stringified object and returns all the keys of that object.
func NewMultiError ¶
NewMultiError creates a new MultErr object
func RetryNWithBackoff ¶
RetryNWithBackoff takes a Backoff, a maximum number of tries 'n', and a function that returns an error. The function is called until either it does not return an error or the maximum tries have been reached. If the error returned is Retriable, the Retriability of it will be respected. If the number of tries is exhausted, the last error will be returned.
func RetryNWithBackoffCtx ¶ added in v1.14.5
RetryNWithBackoffCtx takes a context, a Backoff, a maximum number of tries 'n', and a function that returns an error. The function is called until it does not return an error, the context is done, or the maximum tries have been reached. If the error returned is Retriable, the Retriability of it will be respected. If the number of tries is exhausted, the last error will be returned.
func RetryWithBackoff ¶
RetryWithBackoff takes a Backoff and a function to call that returns an error If the error is nil then the function will no longer be called If the error is Retriable then that will be used to determine if it should be retried
func RetryWithBackoffCtx ¶ added in v1.14.5
RetryWithBackoffCtx takes a context, a Backoff, and a function to call that returns an error If the context is done, nil will be returned If the error is nil then the function will no longer be called If the error is Retriable then that will be used to determine if it should be retried
func SignHTTPRequest ¶ added in v1.3.1
func SignHTTPRequest(req *http.Request, region, service string, creds *credentials.Credentials, body io.ReadSeeker)
SignHTTPRequest signs an http.Request struct with authv4 using the given region, service, and credentials.
func SlicesDeepEqual ¶
func SlicesDeepEqual(slice1, slice2 interface{}) bool
SlicesDeepEqual checks if slice1 and slice2 are equal, disregarding order.
func StrSliceEqual ¶
func Uint16SliceToStringSlice ¶
Uint16SliceToStringSlice converts a slice of type uint16 to a slice of type *string. It uses strconv.Itoa on each element
Types ¶
type AttributeError ¶ added in v1.14.0
type AttributeError struct {
// contains filtered or unexported fields
}
AttributeError defines an error type to indicate an error with an ECS attribute
func NewAttributeError ¶ added in v1.14.0
func NewAttributeError(err string) AttributeError
NewAttributeError creates a new AttributeError object
func (AttributeError) Error ¶ added in v1.14.0
func (e AttributeError) Error() string
Error returns the error string for AttributeError
type ChanSemaphore ¶
type ChanSemaphore struct { Count int // Public for introspection; should not be written to // contains filtered or unexported fields }
Implements semaphore
func (*ChanSemaphore) Post ¶
func (s *ChanSemaphore) Post()
func (*ChanSemaphore) Wait ¶
func (s *ChanSemaphore) Wait()
type DefaultRetriable ¶
type DefaultRetriable struct {
// contains filtered or unexported fields
}
DefaultRetriable implements the Retriable interface with a boolean to indicate if retry should occur
func (DefaultRetriable) Retry ¶
func (dr DefaultRetriable) Retry() bool
Retry returns true if the operation can be retried
type DefaultRetriableError ¶
type DefaultRetriableError struct { Retriable // contains filtered or unexported fields }
DefaultRetriableError is used to wrap a retriable error
type LicenseProvider ¶ added in v1.5.0
func NewLicenseProvider ¶ added in v1.5.0
func NewLicenseProvider() LicenseProvider
type MultiErr ¶
type MultiErr struct {
// contains filtered or unexported fields
}
MultiErr wraps multiple errors
type Retriable ¶
type Retriable interface { // Retry returns true if the operation can be retried Retry() bool }
Retriable defines an interface for retriable methods
func NewRetriable ¶
NewRetriable creates a new DefaultRetriable object
type RetriableError ¶
RetriableError defines an interface for a retriable error
func NewRetriableError ¶
func NewRetriableError(retriable Retriable, err error) RetriableError
NewRetriableError creates a new DefaultRetriableError object
type SimpleBackoff ¶
type SimpleBackoff struct {
// contains filtered or unexported fields
}
func NewSimpleBackoff ¶
func NewSimpleBackoff(min, max time.Duration, jitterMultiple, multiple float64) *SimpleBackoff
NewSimpleBackoff creates a Backoff which ranges from min to max increasing by multiple each time. It also adds (and yes, the jitter is always added, never subtracted) a random amount of jitter up to jitterMultiple percent (that is, jitterMultiple = 0.0 is no jitter, 0.15 is 15% added jitter). The total time may exceed "max" when accounting for jitter, such that the absolute max is max + max * jiterMultiple
func (*SimpleBackoff) Duration ¶
func (sb *SimpleBackoff) Duration() time.Duration
func (*SimpleBackoff) Reset ¶
func (sb *SimpleBackoff) Reset()
type Version ¶ added in v1.14.0
type Version string
func (Version) Matches ¶ added in v1.14.0
Matches returns whether or not a version matches a given selector. The selector can be any of the following:
* x.y.z -- Matches a version exactly the same as the selector version * >=x.y.z -- Matches a version greater than or equal to the selector version * >x.y.z -- Matches a version greater than the selector version * <=x.y.z -- Matches a version less than or equal to the selector version * <x.y.z -- Matches a version less than the selector version * x.y.z,a.b.c -- Matches if the version matches either of the two selector versions
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package sync is an analogue to the stdlib sync package.
|
Package sync is an analogue to the stdlib sync package. |
Package ttime implements a testable alternative to the Go "time" package.
|
Package ttime implements a testable alternative to the Go "time" package. |