Documentation

Index

Constants

View Source
const (
	// InvalidParameterErrCode is the error code for invalid parameters errors
	InvalidParameterErrCode = "InvalidParameter"
	// ParamRequiredErrCode is the error code for required parameter errors
	ParamRequiredErrCode = "ParamRequiredError"
	// ParamMinValueErrCode is the error code for fields with too low of a
	// number value.
	ParamMinValueErrCode = "ParamMinValueError"
	// ParamMinLenErrCode is the error code for fields without enough elements.
	ParamMinLenErrCode = "ParamMinLenError"
)

Variables

This section is empty.

Functions

func AddToUserAgent

func AddToUserAgent(r *Request, s string)

    AddToUserAgent adds the string to the end of the request's current user agent.

    func HandlerListLogItem

    func HandlerListLogItem(item HandlerListRunItem) bool

      HandlerListLogItem logs the request handler and the state of the request's Error value. Always returns true to continue iterating request handlers in a HandlerList.

      func HandlerListStopOnError

      func HandlerListStopOnError(item HandlerListRunItem) bool

        HandlerListStopOnError returns false to stop the HandlerList iterating over request handlers if Request.Error is not nil. True otherwise to continue iterating.

        func MakeAddToUserAgentFreeFormHandler

        func MakeAddToUserAgentFreeFormHandler(s string) func(*Request)

          MakeAddToUserAgentFreeFormHandler adds the input to the User-Agent request header. The input string will be concatenated with the current request's user agent string.

          func MakeAddToUserAgentHandler

          func MakeAddToUserAgentHandler(name, version string, extra ...string) func(*Request)

            MakeAddToUserAgentHandler will add the name/version pair to the User-Agent request header. If the extra parameters are provided they will be added as metadata to the name/version pair resulting in the following format. "name/version (extra0; extra1; ...)" The user agent part will be concatenated with this current request's user agent string.

            func WithRetryer

            func WithRetryer(cfg *aws.Config, retryer Retryer) *aws.Config

              WithRetryer sets a config Retryer value to the given Config returning it for chaining.

              Types

              type ErrInvalidParam

              type ErrInvalidParam interface {
              	awserr.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 ErrInvalidParam represents an invalid parameter error type.

                type ErrInvalidParams

                type ErrInvalidParams struct {
                	// Context is the base context of the invalid parameter group.
                	Context string
                	// contains filtered or unexported fields
                }

                  An ErrInvalidParams provides wrapping of invalid parameter errors found when validating API operation input parameters.

                  func (*ErrInvalidParams) Add

                  func (e *ErrInvalidParams) Add(err ErrInvalidParam)

                    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 (*ErrInvalidParams) AddNested

                    func (e *ErrInvalidParams) AddNested(nestedCtx string, nested ErrInvalidParams)

                      AddNested adds the invalid parameter errors from another ErrInvalidParams 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 (ErrInvalidParams) Code

                      func (e ErrInvalidParams) Code() string

                        Code returns the code of the error

                        func (ErrInvalidParams) Error

                        func (e ErrInvalidParams) Error() string

                          Error returns the string formatted form of the invalid parameters.

                          func (ErrInvalidParams) Len

                          func (e ErrInvalidParams) Len() int

                            Len returns the number of invalid parameter errors

                            func (ErrInvalidParams) Message

                            func (e ErrInvalidParams) Message() string

                              Message returns the message of the error

                              func (ErrInvalidParams) OrigErr

                              func (e ErrInvalidParams) OrigErr() error

                                OrigErr returns the invalid parameters as a awserr.BatchedErrors value

                                func (ErrInvalidParams) OrigErrs

                                func (e ErrInvalidParams) OrigErrs() []error

                                  OrigErrs returns a slice of the invalid parameters

                                  type ErrParamMinLen

                                  type ErrParamMinLen struct {
                                  	// contains filtered or unexported fields
                                  }

                                    An ErrParamMinLen represents a minimum length parameter error.

                                    func NewErrParamMinLen

                                    func NewErrParamMinLen(field string, min int) *ErrParamMinLen

                                      NewErrParamMinLen creates a new minimum length parameter error.

                                      func (*ErrParamMinLen) AddNestedContext

                                      func (e *ErrParamMinLen) AddNestedContext(ctx string)

                                        AddNestedContext prepends a context to the field's path.

                                        func (*ErrParamMinLen) Code

                                        func (e *ErrParamMinLen) Code() string

                                          Code returns the error code for the type of invalid parameter.

                                          func (*ErrParamMinLen) Error

                                          func (e *ErrParamMinLen) Error() string

                                            Error returns the string version of the invalid parameter error.

                                            func (*ErrParamMinLen) Field

                                            func (e *ErrParamMinLen) Field() string

                                              Field Returns the field and context the error occurred.

                                              func (*ErrParamMinLen) Message

                                              func (e *ErrParamMinLen) Message() string

                                                Message returns the reason the parameter was invalid, and its context.

                                                func (*ErrParamMinLen) MinLen

                                                func (e *ErrParamMinLen) MinLen() int

                                                  MinLen returns the field's required minimum length.

                                                  func (*ErrParamMinLen) OrigErr

                                                  func (e *ErrParamMinLen) OrigErr() error

                                                    OrigErr returns nil, Implemented for awserr.Error interface.

                                                    func (*ErrParamMinLen) SetContext

                                                    func (e *ErrParamMinLen) SetContext(ctx string)

                                                      SetContext updates the base context of the error.

                                                      type ErrParamMinValue

                                                      type ErrParamMinValue struct {
                                                      	// contains filtered or unexported fields
                                                      }

                                                        An ErrParamMinValue represents a minimum value parameter error.

                                                        func NewErrParamMinValue

                                                        func NewErrParamMinValue(field string, min float64) *ErrParamMinValue

                                                          NewErrParamMinValue creates a new minimum value parameter error.

                                                          func (*ErrParamMinValue) AddNestedContext

                                                          func (e *ErrParamMinValue) AddNestedContext(ctx string)

                                                            AddNestedContext prepends a context to the field's path.

                                                            func (*ErrParamMinValue) Code

                                                            func (e *ErrParamMinValue) Code() string

                                                              Code returns the error code for the type of invalid parameter.

                                                              func (*ErrParamMinValue) Error

                                                              func (e *ErrParamMinValue) Error() string

                                                                Error returns the string version of the invalid parameter error.

                                                                func (*ErrParamMinValue) Field

                                                                func (e *ErrParamMinValue) Field() string

                                                                  Field Returns the field and context the error occurred.

                                                                  func (*ErrParamMinValue) Message

                                                                  func (e *ErrParamMinValue) Message() string

                                                                    Message returns the reason the parameter was invalid, and its context.

                                                                    func (*ErrParamMinValue) MinValue

                                                                    func (e *ErrParamMinValue) MinValue() float64

                                                                      MinValue returns the field's require minimum value.

                                                                      float64 is returned for both int and float min values.

                                                                      func (*ErrParamMinValue) OrigErr

                                                                      func (e *ErrParamMinValue) OrigErr() error

                                                                        OrigErr returns nil, Implemented for awserr.Error interface.

                                                                        func (*ErrParamMinValue) SetContext

                                                                        func (e *ErrParamMinValue) SetContext(ctx string)

                                                                          SetContext updates the base context of the error.

                                                                          type ErrParamRequired

                                                                          type ErrParamRequired struct {
                                                                          	// contains filtered or unexported fields
                                                                          }

                                                                            An ErrParamRequired represents an required parameter error.

                                                                            func NewErrParamRequired

                                                                            func NewErrParamRequired(field string) *ErrParamRequired

                                                                              NewErrParamRequired creates a new required parameter error.

                                                                              func (*ErrParamRequired) AddNestedContext

                                                                              func (e *ErrParamRequired) AddNestedContext(ctx string)

                                                                                AddNestedContext prepends a context to the field's path.

                                                                                func (*ErrParamRequired) Code

                                                                                func (e *ErrParamRequired) Code() string

                                                                                  Code returns the error code for the type of invalid parameter.

                                                                                  func (*ErrParamRequired) Error

                                                                                  func (e *ErrParamRequired) Error() string

                                                                                    Error returns the string version of the invalid parameter error.

                                                                                    func (*ErrParamRequired) Field

                                                                                    func (e *ErrParamRequired) Field() string

                                                                                      Field Returns the field and context the error occurred.

                                                                                      func (*ErrParamRequired) Message

                                                                                      func (e *ErrParamRequired) Message() string

                                                                                        Message returns the reason the parameter was invalid, and its context.

                                                                                        func (*ErrParamRequired) OrigErr

                                                                                        func (e *ErrParamRequired) OrigErr() error

                                                                                          OrigErr returns nil, Implemented for awserr.Error interface.

                                                                                          func (*ErrParamRequired) SetContext

                                                                                          func (e *ErrParamRequired) SetContext(ctx string)

                                                                                            SetContext updates the base context of the error.

                                                                                            type HandlerList

                                                                                            type HandlerList struct {
                                                                                            
                                                                                            	// Called after each request handler in the list is called. If set
                                                                                            	// and the func returns true the HandlerList will continue to iterate
                                                                                            	// over the request handlers. If false is returned the HandlerList
                                                                                            	// will stop iterating.
                                                                                            	//
                                                                                            	// Should be used if extra logic to be performed between each handler
                                                                                            	// in the list. This can be used to terminate a list's iteration
                                                                                            	// based on a condition such as error like, HandlerListStopOnError.
                                                                                            	// Or for logging like HandlerListLogItem.
                                                                                            	AfterEachFn func(item HandlerListRunItem) bool
                                                                                            	// contains filtered or unexported fields
                                                                                            }

                                                                                              A HandlerList manages zero or more handlers in a list.

                                                                                              func (*HandlerList) Clear

                                                                                              func (l *HandlerList) Clear()

                                                                                                Clear clears the handler list.

                                                                                                func (*HandlerList) Len

                                                                                                func (l *HandlerList) Len() int

                                                                                                  Len returns the number of handlers in the list.

                                                                                                  func (*HandlerList) PushBack

                                                                                                  func (l *HandlerList) PushBack(f func(*Request))

                                                                                                    PushBack pushes handler f to the back of the handler list.

                                                                                                    func (*HandlerList) PushBackNamed

                                                                                                    func (l *HandlerList) PushBackNamed(n NamedHandler)

                                                                                                      PushBackNamed pushes named handler f to the back of the handler list.

                                                                                                      func (*HandlerList) PushFront

                                                                                                      func (l *HandlerList) PushFront(f func(*Request))

                                                                                                        PushFront pushes handler f to the front of the handler list.

                                                                                                        func (*HandlerList) PushFrontNamed

                                                                                                        func (l *HandlerList) PushFrontNamed(n NamedHandler)

                                                                                                          PushFrontNamed pushes named handler f to the front of the handler list.

                                                                                                          func (*HandlerList) Remove

                                                                                                          func (l *HandlerList) Remove(n NamedHandler)

                                                                                                            Remove removes a NamedHandler n

                                                                                                            func (*HandlerList) Run

                                                                                                            func (l *HandlerList) Run(r *Request)

                                                                                                              Run executes all handlers in the list with a given request object.

                                                                                                              type HandlerListRunItem

                                                                                                              type HandlerListRunItem struct {
                                                                                                              	Index   int
                                                                                                              	Handler NamedHandler
                                                                                                              	Request *Request
                                                                                                              }

                                                                                                                A HandlerListRunItem represents an entry in the HandlerList which is being run.

                                                                                                                type Handlers

                                                                                                                type Handlers struct {
                                                                                                                	Validate         HandlerList
                                                                                                                	Build            HandlerList
                                                                                                                	Sign             HandlerList
                                                                                                                	Send             HandlerList
                                                                                                                	ValidateResponse HandlerList
                                                                                                                	Unmarshal        HandlerList
                                                                                                                	UnmarshalMeta    HandlerList
                                                                                                                	UnmarshalError   HandlerList
                                                                                                                	Retry            HandlerList
                                                                                                                	AfterRetry       HandlerList
                                                                                                                }

                                                                                                                  A Handlers provides a collection of request handlers for various stages of handling requests.

                                                                                                                  func (*Handlers) Clear

                                                                                                                  func (h *Handlers) Clear()

                                                                                                                    Clear removes callback functions for all handlers

                                                                                                                    func (*Handlers) Copy

                                                                                                                    func (h *Handlers) Copy() Handlers

                                                                                                                      Copy returns of this handler's lists.

                                                                                                                      type NamedHandler

                                                                                                                      type NamedHandler struct {
                                                                                                                      	Name string
                                                                                                                      	Fn   func(*Request)
                                                                                                                      }

                                                                                                                        A NamedHandler is a struct that contains a name and function callback.

                                                                                                                        type Operation

                                                                                                                        type Operation struct {
                                                                                                                        	Name       string
                                                                                                                        	HTTPMethod string
                                                                                                                        	HTTPPath   string
                                                                                                                        	*Paginator
                                                                                                                        }

                                                                                                                          An Operation is the service API operation to be made.

                                                                                                                          type Paginator

                                                                                                                          type Paginator struct {
                                                                                                                          	InputTokens     []string
                                                                                                                          	OutputTokens    []string
                                                                                                                          	LimitToken      string
                                                                                                                          	TruncationToken string
                                                                                                                          }

                                                                                                                            Paginator keeps track of pagination configuration for an API operation.

                                                                                                                            type Request

                                                                                                                            type Request struct {
                                                                                                                            	Config     aws.Config
                                                                                                                            	ClientInfo metadata.ClientInfo
                                                                                                                            	Handlers   Handlers
                                                                                                                            
                                                                                                                            	Retryer
                                                                                                                            	Time             time.Time
                                                                                                                            	ExpireTime       time.Duration
                                                                                                                            	Operation        *Operation
                                                                                                                            	HTTPRequest      *http.Request
                                                                                                                            	HTTPResponse     *http.Response
                                                                                                                            	Body             io.ReadSeeker
                                                                                                                            	BodyStart        int64 // offset from beginning of Body that the request body starts
                                                                                                                            	Params           interface{}
                                                                                                                            	Error            error
                                                                                                                            	Data             interface{}
                                                                                                                            	RequestID        string
                                                                                                                            	RetryCount       int
                                                                                                                            	Retryable        *bool
                                                                                                                            	RetryDelay       time.Duration
                                                                                                                            	NotHoist         bool
                                                                                                                            	SignedHeaderVals http.Header
                                                                                                                            	// contains filtered or unexported fields
                                                                                                                            }

                                                                                                                              A Request is the service request to be made.

                                                                                                                              func New

                                                                                                                              func New(cfg aws.Config, clientInfo metadata.ClientInfo, handlers Handlers,
                                                                                                                              	retryer Retryer, operation *Operation, params interface{}, data interface{}) *Request

                                                                                                                                New returns a new Request pointer for the service API operation and parameters.

                                                                                                                                Params is any value of input parameters to be the request payload. Data is pointer value to an object which the request's response payload will be deserialized to.

                                                                                                                                func (*Request) Build

                                                                                                                                func (r *Request) Build() error

                                                                                                                                  Build will build the request's object so it can be signed and sent to the service. Build will also validate all the request's parameters. Anny additional build Handlers set on this request will be run in the order they were set.

                                                                                                                                  The request will only be built once. Multiple calls to build will have no effect.

                                                                                                                                  If any Validate or Build errors occur the build will stop and the error which occurred will be returned.

                                                                                                                                  func (*Request) DataFilled

                                                                                                                                  func (r *Request) DataFilled() bool

                                                                                                                                    DataFilled returns true if the request's data for response deserialization target has been set and is a valid. False is returned if data is not set, or is invalid.

                                                                                                                                    func (*Request) EachPage

                                                                                                                                    func (r *Request) EachPage(fn func(data interface{}, isLastPage bool) (shouldContinue bool)) error

                                                                                                                                      EachPage iterates over each page of a paginated request object. The fn parameter should be a function with the following sample signature:

                                                                                                                                      func(page *T, lastPage bool) bool {
                                                                                                                                          return true // return false to stop iterating
                                                                                                                                      }
                                                                                                                                      

                                                                                                                                      Where "T" is the structure type matching the output structure of the given operation. For example, a request object generated by DynamoDB.ListTablesRequest() would expect to see dynamodb.ListTablesOutput as the structure "T". The lastPage value represents whether the page is the last page of data or not. The return value of this function should return true to keep iterating or false to stop.

                                                                                                                                      func (*Request) HasNextPage

                                                                                                                                      func (r *Request) HasNextPage() bool

                                                                                                                                        HasNextPage returns true if this request has more pages of data available.

                                                                                                                                        func (*Request) IsErrorExpired

                                                                                                                                        func (r *Request) IsErrorExpired() bool

                                                                                                                                          IsErrorExpired returns whether the error code is a credential expiry error. Returns false if the request has no Error set.

                                                                                                                                          func (*Request) IsErrorRetryable

                                                                                                                                          func (r *Request) IsErrorRetryable() bool

                                                                                                                                            IsErrorRetryable returns whether the error is retryable, based on its Code. Returns false if the request has no Error set.

                                                                                                                                            func (*Request) IsErrorThrottle

                                                                                                                                            func (r *Request) IsErrorThrottle() bool

                                                                                                                                              IsErrorThrottle returns whether the error is to be throttled based on its code. Returns false if the request has no Error set

                                                                                                                                              func (*Request) NextPage

                                                                                                                                              func (r *Request) NextPage() *Request

                                                                                                                                                NextPage returns a new Request that can be executed to return the next page of result data. Call .Send() on this request to execute it.

                                                                                                                                                func (*Request) ParamsFilled

                                                                                                                                                func (r *Request) ParamsFilled() bool

                                                                                                                                                  ParamsFilled returns if the request's parameters have been populated and the parameters are valid. False is returned if no parameters are provided or invalid.

                                                                                                                                                  func (*Request) Presign

                                                                                                                                                  func (r *Request) Presign(expireTime time.Duration) (string, error)

                                                                                                                                                    Presign returns the request's signed URL. Error will be returned if the signing fails.

                                                                                                                                                    func (*Request) PresignRequest

                                                                                                                                                    func (r *Request) PresignRequest(expireTime time.Duration) (string, http.Header, error)

                                                                                                                                                      PresignRequest behaves just like presign, but hoists all headers and signs them. Also returns the signed hash back to the user

                                                                                                                                                      func (*Request) Send

                                                                                                                                                      func (r *Request) Send() error

                                                                                                                                                        Send will send the request returning error if errors are encountered.

                                                                                                                                                        Send will sign the request prior to sending. All Send Handlers will be executed in the order they were set.

                                                                                                                                                        Canceling a request is non-deterministic. If a request has been canceled, then the transport will choose, randomly, one of the state channels during reads or getting the connection.

                                                                                                                                                        readLoop() and getConn(req *Request, cm connectMethod) https://github.com/golang/go/blob/master/src/net/http/transport.go

                                                                                                                                                        func (*Request) SetBufferBody

                                                                                                                                                        func (r *Request) SetBufferBody(buf []byte)

                                                                                                                                                          SetBufferBody will set the request's body bytes that will be sent to the service API.

                                                                                                                                                          func (*Request) SetReaderBody

                                                                                                                                                          func (r *Request) SetReaderBody(reader io.ReadSeeker)

                                                                                                                                                            SetReaderBody will set the request's body reader.

                                                                                                                                                            func (*Request) SetStringBody

                                                                                                                                                            func (r *Request) SetStringBody(s string)

                                                                                                                                                              SetStringBody sets the body of the request to be backed by a string.

                                                                                                                                                              func (*Request) Sign

                                                                                                                                                              func (r *Request) Sign() error

                                                                                                                                                                Sign will sign the request retuning error if errors are encountered.

                                                                                                                                                                Send will build the request prior to signing. All Sign Handlers will be executed in the order they were set.

                                                                                                                                                                func (*Request) WillRetry

                                                                                                                                                                func (r *Request) WillRetry() bool

                                                                                                                                                                  WillRetry returns if the request's can be retried.

                                                                                                                                                                  type Retryer

                                                                                                                                                                  type Retryer interface {
                                                                                                                                                                  	RetryRules(*Request) time.Duration
                                                                                                                                                                  	ShouldRetry(*Request) bool
                                                                                                                                                                  	MaxRetries() int
                                                                                                                                                                  }

                                                                                                                                                                    Retryer is an interface to control retry logic for a given service. The default implementation used by most services is the service.DefaultRetryer structure, which contains basic retry logic using exponential backoff.

                                                                                                                                                                    type Validator

                                                                                                                                                                    type Validator interface {
                                                                                                                                                                    	Validate() error
                                                                                                                                                                    }

                                                                                                                                                                      Validator provides a way for types to perform validation logic on their input values that external code can use to determine if a type's values are valid.