aws

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2016 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package aws handles AWS signature v4 and other AWS-specific auth functions.

This package is internalized because we don't want to have the interface of methodology such as request signing to have to be solidified to external users of dynago yet, and so we can iterate rapidly on this.

Index

Constants

View Source
const DynamoTargetPrefix = "DynamoDB_20120810."

DynamoTargetPrefix is the Dynamo API version we support.

Variables

View Source
var ErrMaxResponse = errors.New("Exceeded maximum response size of 25MB")

ErrMaxResponse is returned when responses are too big.

View Source
var MaxResponseSize int64 = 25 * 1024 * 1024 // 25MB maximum response

MaxResponseSize is the maximum size of a response.

Functions

func FixEndpointUrl added in v1.2.1

func FixEndpointUrl(endpoint string) string

Types

type AwsSigner

type AwsSigner struct {
	AccessKey string
	SecretKey string
	Region    string
	Service   string
}

AwsSigner signs requests with the AWS v4 request signing algorithm.

This is required for all aws requests to ensure:

  1. request bodies and headers are not tampered with in flight.
  2. It also prevents replay attacks
  3. It also handles authentication without sending or revealing the shared secret

func (*AwsSigner) SignRequest

func (info *AwsSigner) SignRequest(request *http.Request, bodyBytes []byte)

type RequestMaker

type RequestMaker struct {
	// These are required to be set
	Endpoint   string
	Signer     Signer
	BuildError func(*http.Request, []byte, *http.Response, []byte) error

	// These can be optionally set
	Caller         http.Client
	DebugRequests  bool
	DebugResponses bool
	DebugFunc      func(string, ...interface{})
}

RequestMaker is the default AwsRequester used by Dynago.

The RequestMaker has its properties exposed as public to allow easier construction. Directly modifying properties on the RequestMaker after construction is not goroutine-safe so it should be avoided except for in special cases (testing, mocking).

func (*RequestMaker) MakeRequest

func (r *RequestMaker) MakeRequest(target string, body []byte) ([]byte, error)

type Signer

type Signer interface {
	SignRequest(*http.Request, []byte)
}

A Signer's job is to perform API signing.

Jump to

Keyboard shortcuts

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