Documentation ¶
Overview ¶
awsgo
Awsgo is a wrapper around AWS API calls. It is divided into separate namespaces for each AWS service. Check each package for their documentation.
This package holds the base/shared functionality between all requests. Most likely, from this package, you will only be using a few methods, and now the AwsRequest object directly.
Credentials ¶
Awsgo supports two 'automatic' methods for getting your security keys.
The first is via a json file. THis is useful when testing locally. It expects a file named 'awskeys.json' to exist in your working directory. This json should marshall to awsgo.Credentials struct.
The second is via the EC2 Security Role. This is done via a request to http://169.254.169.254/latest/meta-data/iam/security-credentials. The EC2 Security Role is only used if 'awskeys.json' does not exist.
In order to use these 'automatic' methods of Key population, you should call awsgo.GetSecurityKeys()
Index ¶
- Constants
- Variables
- func CheckForErrorXml(response []byte) error
- func ConvertToAwsItem(unknown interface{}) interface{}
- func CreateCertApprovedClient(certsToAdd []*x509.Certificate) *http.Client
- func Escape(it string) string
- func FromRawMapToEasyTypedMap(raw map[string]map[string]interface{}, item map[string]interface{})
- func IsoDate(t time.Time) string
- func SetDefaultHttpClient(client *http.Client)
- type AwsHost
- type AwsNumberItem
- type AwsRequest
- type AwsStringItem
- type CredentialMetaData
- type Credentials
- type Error
- type ErrorResponse
- type RequestBuilder
- type RequestBuilderInterface
- type RequestError
- type ResponseMetaData
- type UnmarhsallingError
Constants ¶
const ( RequestSigningType_AWS4 = 1 RequestSigningType_REST = 2 RequestSigningType_AWS2 = 3 RequestSigningType_AWS3 = 4 )
Variables ¶
var ( Verification_Error_AccessKeyEmpty = errors.New("Key.AccessKeyId cannot be empty") Verification_Error_SecretAccessKeyEmpty = errors.New("Key.SecretAccessKey cannot be empty") Error_Code_InvalidParameterValue = "InvalidParameterValue" )
Functions ¶
func CheckForErrorXml ¶
Looks at a raw response for an XML error response
func ConvertToAwsItem ¶
func ConvertToAwsItem(unknown interface{}) interface{}
Converts from an unknown interface... like:
string, []string, float, []float64
into the expected awsgo.AwsStringItem or awsgo.AwsNumberItem
func CreateCertApprovedClient ¶
func CreateCertApprovedClient(certsToAdd []*x509.Certificate) *http.Client
helper function to create a http client that accepts certain certs
func FromRawMapToEasyTypedMap ¶
converts from raw JSON map to the expected types Eg. float64, string
func SetDefaultHttpClient ¶
Types ¶
type AwsHost ¶
type AwsHost struct { // Eg. dynamo Service string // Eg us-west-2 Region string // Eg. amazonaws.com Domain string // Overrides the url actuall hit Override string }
The host of the service we are hitting. Urls are formed by taking Service.Region.Domain
type AwsNumberItem ¶
type AwsRequest ¶
type AwsRequest struct { Host AwsHost Date time.Time Headers map[string]string Payload string PayloadReader io.ReadCloser Key Credentials RequestMethod string CanonicalUri string RequestSigningType int HttpClient *http.Client // contains filtered or unexported fields }
func BuildEmptyContentRequest ¶
func BuildEmptyContentRequest(rb RequestBuilderInterface) (request AwsRequest, verifyError error)
func NewAwsRequest ¶
func NewAwsRequest(rb RequestBuilderInterface, marsh interface{}) (request AwsRequest, verifyError error)
Given the RequestBuilderInterface this will verify the underlying request and then create a new AwsRequest instance. returned Request is only valid if error is not nill
func (AwsRequest) Do ¶
func (req AwsRequest) Do() (io.ReadCloser, map[string]string, int, error)
Performs the actual request Returns:
io.ReaderCloser - the unclosed response of the request map[string]string - the headers in the response int - that status code the response error - any errors that occured
func (AwsRequest) DoAndDemarshall ¶
func (request AwsRequest) DoAndDemarshall(rb RequestBuilderInterface) (interface{}, error)
Perform the actual request, calling the demarshall on the RequestBuilderInterface returns the result of the Demarshall, or other errors.
type AwsStringItem ¶
type CredentialMetaData ¶
type Credentials ¶
type Credentials struct { AccessKeyId string SecretAccessKey string // contains filtered or unexported fields }
Aws credentials
func GetSecurityKeys ¶
func GetSecurityKeys() (finalCred Credentials, err error)
* Returns security credentials either from a JSON file 'awskeys.json' or
- from AWS Metadata service
- @return credentials, error
func (Credentials) GetToken ¶
func (c Credentials) GetToken() string
type ErrorResponse ¶
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
type RequestBuilder ¶
type RequestBuilder struct { // The Host we are hitting Host AwsHost `json:"-"` // The Credentials to use Key Credentials `json:"-"` // Any custom headers Headers map[string]string `json:"-"` // The method we are using GET, PUT, POST, ... RequestMethod string `json:"-"` // The uri we are hitting. CanonicalUri string `json:"-"` // The http client to use. A default one will be used if not specified HttpClient *http.Client `json:"-"` }
Base of a request. Used across all requests.
func (*RequestBuilder) GetRequestBuilder ¶
func (r *RequestBuilder) GetRequestBuilder() *RequestBuilder
type RequestBuilderInterface ¶
type RequestBuilderInterface interface { // verify the request before we send it VerifyInput() error // Get the underlying RequestBuilder in the struct GetRequestBuilder() *RequestBuilder // Unmarshal the response DeMarshalResponse(response []byte, headers map[string]string, statusCode int) interface{} }
Implemented by each AWS request Provides some standard steps to doing a request, and handling its response.
type RequestError ¶
func (RequestError) Error ¶
func (r RequestError) Error() string
type ResponseMetaData ¶
type ResponseMetaData struct {
RequestId string
}
Meta data in a lot of aws requests
type UnmarhsallingError ¶
func (*UnmarhsallingError) Error ¶
func (e *UnmarhsallingError) Error() string
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Dynamo This package contains objects needed to do request to DynamoDB.
|
Dynamo This package contains objects needed to do request to DynamoDB. |
* Copyright (c) 2013, fromkeith * All rights reserved.
|
* Copyright (c) 2013, fromkeith * All rights reserved. |
swfhelper
The SwfHelper is meant to make the decision process execution task easier.
|
The SwfHelper is meant to make the decision process execution task easier. |