Documentation
¶
Overview ¶
Package aws provides core functionality for making requests to AWS services.
Index ¶
- Constants
- Variables
- func AfterRetryHandler(r *Request)
- func Boolean(v bool) *bool
- func BuildContentLength(r *Request)
- func Double(v float64) *float64
- func Long(v int64) *int64
- func SendHandler(r *Request)
- func String(v string) *string
- func Time(t time.Time) *time.Time
- func UserAgentHandler(r *Request)
- func ValidateParameters(r *Request)
- func ValidateResponseHandler(r *Request)
- type APIError
- type Config
- type Credentials
- type CredentialsProvider
- func Creds(accessKeyID, secretAccessKey, sessionToken string) CredentialsProvider
- func DefaultCreds() CredentialsProvider
- func DetectCreds(accessKeyID, secretAccessKey, sessionToken string) CredentialsProvider
- func EnvCreds() (CredentialsProvider, error)
- func IAMCreds() CredentialsProvider
- func ProfileCreds(filename, profile string, expiry time.Duration) (CredentialsProvider, error)
- type DefaultCredentialsProvider
- type HandlerList
- type Handlers
- type Operation
- type ReaderSeekerCloser
- type Request
- func (r *Request) Build() error
- func (r *Request) DataFilled() bool
- func (r *Request) ParamsFilled() bool
- func (r *Request) Presign(expireTime time.Duration) (string, error)
- func (r *Request) Send() error
- func (r *Request) SetBufferBody(buf []byte)
- func (r *Request) SetReaderBody(reader io.ReadSeeker)
- func (r *Request) Sign() error
- type Service
Constants ¶
const DEFAULT_RETRIES = -1
const SDKName = "aws-sdk-go"
const SDKVersion = "0.5.0"
Variables ¶
var ( // ErrAccessKeyIDNotFound is returned when the AWS Access Key ID can't be // found in the process's environment. ErrAccessKeyIDNotFound = fmt.Errorf("AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY not found in environment") // ErrSecretAccessKeyNotFound is returned when the AWS Secret Access Key // can't be found in the process's environment. ErrSecretAccessKeyNotFound = fmt.Errorf("AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY not found in environment") )
var DefaultConfig = &Config{ Credentials: DefaultCreds(), Endpoint: "", Region: os.Getenv("AWS_REGION"), DisableSSL: false, ManualSend: false, HTTPClient: http.DefaultClient, LogLevel: 0, Logger: os.Stdout, MaxRetries: DEFAULT_RETRIES, DisableParamValidation: false, }
var IAMClient = http.Client{ Timeout: 1 * time.Second, }
IAMClient is the HTTP client used to query the metadata endpoint for IAM credentials.
Functions ¶
func AfterRetryHandler ¶
func AfterRetryHandler(r *Request)
func BuildContentLength ¶
func BuildContentLength(r *Request)
func SendHandler ¶
func SendHandler(r *Request)
func UserAgentHandler ¶
func UserAgentHandler(r *Request)
func ValidateParameters ¶
func ValidateParameters(r *Request)
func ValidateResponseHandler ¶
func ValidateResponseHandler(r *Request)
Types ¶
type APIError ¶
type APIError struct {
StatusCode int // HTTP status code e.g. 200
Code string
Message string
RequestID string
Retryable bool
RetryDelay time.Duration
RetryCount uint
}
An APIError is an error returned by an AWS API.
type Config ¶
type Credentials ¶
Credentials are used to authenticate and authorize calls that you make to AWS.
type CredentialsProvider ¶
type CredentialsProvider interface {
// Credentials returns a set of credentials (or an error if no credentials
// could be provided).
Credentials() (*Credentials, error)
}
A CredentialsProvider is a provider of credentials.
func Creds ¶
func Creds(accessKeyID, secretAccessKey, sessionToken string) CredentialsProvider
Creds returns a static provider of credentials.
func DefaultCreds ¶
func DefaultCreds() CredentialsProvider
func DetectCreds ¶
func DetectCreds(accessKeyID, secretAccessKey, sessionToken string) CredentialsProvider
DetectCreds returns a CredentialsProvider based on the available information.
If the access key ID and secret access key are provided, it returns a basic provider.
If credentials are available via environment variables, it returns an environment provider.
If a profile configuration file is available in the default location and has a default profile configured, it returns a profile provider.
Otherwise, it returns an IAM instance provider.
func EnvCreds ¶
func EnvCreds() (CredentialsProvider, error)
EnvCreds returns a static provider of AWS credentials from the process's environment, or an error if none are found.
func IAMCreds ¶
func IAMCreds() CredentialsProvider
IAMCreds returns a provider which pulls credentials from the local EC2 instance's IAM roles.
func ProfileCreds ¶
func ProfileCreds(filename, profile string, expiry time.Duration) (CredentialsProvider, error)
ProfileCreds returns a provider which pulls credentials from the profile configuration file.
type DefaultCredentialsProvider ¶
type DefaultCredentialsProvider struct {
}
func (*DefaultCredentialsProvider) Credentials ¶
func (p *DefaultCredentialsProvider) Credentials() (*Credentials, error)
type HandlerList ¶
func (*HandlerList) Run ¶
func (l *HandlerList) Run(r *Request)
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
}
type ReaderSeekerCloser ¶
type ReaderSeekerCloser struct {
// contains filtered or unexported fields
}
func ReadSeekCloser ¶
func ReadSeekCloser(r io.Reader) ReaderSeekerCloser
func (ReaderSeekerCloser) Close ¶
func (r ReaderSeekerCloser) Close() error
type Request ¶
type Request struct {
*Service
Handlers Handlers
Time time.Time
ExpireTime time.Duration
Operation *Operation
HTTPRequest *http.Request
HTTPResponse *http.Response
Body io.ReadSeeker
Params interface{}
Error error
Data interface{}
RequestID string
RetryCount uint
// contains filtered or unexported fields
}
func NewRequest ¶
func (*Request) DataFilled ¶
func (*Request) ParamsFilled ¶
func (*Request) SetBufferBody ¶
func (*Request) SetReaderBody ¶
func (r *Request) SetReaderBody(reader io.ReadSeeker)
type Service ¶
type Service struct {
Config *Config
Handlers Handlers
ManualSend bool
ServiceName string
APIVersion string
Endpoint string
JSONVersion string
TargetPrefix string
RetryRules func(*Request) time.Duration
ShouldRetry func(*Request) bool
DefaultMaxRetries uint
}
func NewService ¶
func (*Service) AddDebugHandlers ¶
func (s *Service) AddDebugHandlers()
func (*Service) Initialize ¶
func (s *Service) Initialize()