aws

package
v0.0.0-...-69b7239 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2016 License: Apache-2.0 Imports: 22 Imported by: 13

Documentation

Overview

Package aws contains support code for the various AWS clients in the github.com/awslabs/aws-sdk-go/gen subpackages.

Index

Constants

This section is empty.

Variables

View Source
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")
)
View Source
var IAMClient = http.Client{
	Timeout: 1 * time.Second,
}

IAMClient is the HTTP client used to query the metadata endpoint for IAM credentials.

Functions

func EscapePath

func EscapePath(path string) string

EscapePath escapes part of a URL path in Amazon style

func MarshalXML

func MarshalXML(v interface{}, e *xml.Encoder, start xml.StartElement) error

MarshalXML is a weird and stunted version of xml.Marshal which is used by the REST-XML request types to get around a bug in encoding/xml which doesn't allow us to marshal pointers to zero values:

https://github.com/golang/go/issues/5452

Types

type APIError

type APIError struct {
	StatusCode int // HTTP status code e.g. 200
	Type       string
	Code       string
	Message    string
	RequestID  string
	HostID     string
	Specifics  map[string]string
}

An APIError is an error returned by an AWS API.

func (APIError) Error

func (e APIError) Error() string

type BooleanValue

type BooleanValue *bool

A BooleanValue is a boolean which may or may not be present.

func Boolean

func Boolean(v bool) BooleanValue

Boolean converts a Go bool into a BooleanValue.

func False

func False() BooleanValue

False is the BooleanValue equivalent of the Go literal false.

func True

func True() BooleanValue

True is the BooleanValue equivalent of the Go literal true.

type Context

type Context struct {
	Service     string
	Region      string
	Credentials CredentialsProvider
}

Context encapsulates the context of a client's connection to an AWS service.

type Credentials

type Credentials struct {
	AccessKeyID     string
	SecretAccessKey string
	SecurityToken   string
}

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, securityToken string) CredentialsProvider

Creds returns a static provider of credentials.

func DetectCreds

func DetectCreds(accessKeyID, secretAccessKey, securityToken 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 DoubleValue

type DoubleValue *float64

A DoubleValue is a 64-bit floating point number which may or may not be present.

func Double

func Double(v float64) DoubleValue

Double converts a Go float64 into a DoubleValue.

type EC2Client

type EC2Client struct {
	Context    Context
	Client     *http.Client
	Endpoint   string
	APIVersion string
}

EC2Client is the underlying client for EC2 APIs.

func (*EC2Client) Do

func (c *EC2Client) Do(op, method, uri string, req, resp interface{}) error

Do sends an HTTP request and returns an HTTP response, following policy (e.g. redirects, cookies, auth) as configured on the client.

type FloatValue

type FloatValue *float32

A FloatValue is a 32-bit floating point number which may or may not be present.

func Float

func Float(v float32) FloatValue

Float converts a Go float32 into a FloatValue.

type IntegerValue

type IntegerValue *int

An IntegerValue is an integer which may or may not be present.

func Integer

func Integer(v int) IntegerValue

Integer converts a Go int into an IntegerValue.

type JSONClient

type JSONClient struct {
	Context      Context
	Client       *http.Client
	Endpoint     string
	TargetPrefix string
	JSONVersion  string
}

JSONClient is the underlying client for JSON APIs.

func (*JSONClient) Do

func (c *JSONClient) Do(op, method, uri string, req, resp interface{}) error

Do sends an HTTP request and returns an HTTP response, following policy (e.g. redirects, cookies, auth) as configured on the client.

type LongValue

type LongValue *int64

A LongValue is a 64-bit integer which may or may not be present.

func Long

func Long(v int64) LongValue

Long converts a Go int64 into a LongValue.

type QueryClient

type QueryClient struct {
	Context    Context
	Client     *http.Client
	Endpoint   string
	APIVersion string
}

QueryClient is the underlying client for Query APIs.

func (*QueryClient) Do

func (c *QueryClient) Do(op, method, uri string, req, resp interface{}) error

Do sends an HTTP request and returns an HTTP response, following policy (e.g. redirects, cookies, auth) as configured on the client.

type RestClient

type RestClient struct {
	Context    Context
	Client     *http.Client
	Endpoint   string
	APIVersion string
}

RestClient is the underlying client for REST-JSON and REST-XML APIs.

func (*RestClient) Do

func (c *RestClient) Do(req *http.Request) (*http.Response, error)

Do sends an HTTP request and returns an HTTP response, following policy (e.g. redirects, cookies, auth) as configured on the client.

type StringValue

type StringValue *string

A StringValue is a string which may or may not be present.

func String

func String(v string) StringValue

String converts a Go string into a StringValue.

type UnixTimestamp

type UnixTimestamp struct {
	Time time.Time
}

A UnixTimestamp is a Unix timestamp represented as fractional seconds since the Unix epoch.

func (UnixTimestamp) MarshalJSON

func (t UnixTimestamp) MarshalJSON() (text []byte, err error)

MarshalJSON marshals the timestamp as a float.

func (*UnixTimestamp) UnmarshalJSON

func (t *UnixTimestamp) UnmarshalJSON(text []byte) error

UnmarshalJSON unmarshals the timestamp from a float.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL