Merge pull request #501 from hashicorp/sethvargo/godepsurself
Trying to understand the magic of godeps
This commit is contained in:
commit
67e2f7a8d8
|
@ -2,7 +2,7 @@
|
|||
"ImportPath": "github.com/hashicorp/vault",
|
||||
"GoVersion": "go1.4.2",
|
||||
"Packages": [
|
||||
"."
|
||||
"./..."
|
||||
],
|
||||
"Deps": [
|
||||
{
|
||||
|
@ -15,43 +15,58 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/aws",
|
||||
"Comment": "v0.6.4-5-g127313c",
|
||||
"Rev": "127313c1b41e534a0456a68b6b3a16712dacb35d"
|
||||
"Comment": "v0.7.2-4-g5df83ba",
|
||||
"Rev": "5df83ba895b6ba073c0513dddcec6d7473c95592"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/internal/endpoints",
|
||||
"Comment": "v0.6.4-5-g127313c",
|
||||
"Rev": "127313c1b41e534a0456a68b6b3a16712dacb35d"
|
||||
"Comment": "v0.7.2-4-g5df83ba",
|
||||
"Rev": "5df83ba895b6ba073c0513dddcec6d7473c95592"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/internal/protocol/ec2query",
|
||||
"Comment": "v0.7.2-4-g5df83ba",
|
||||
"Rev": "5df83ba895b6ba073c0513dddcec6d7473c95592"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/internal/protocol/query",
|
||||
"Comment": "v0.6.4-5-g127313c",
|
||||
"Rev": "127313c1b41e534a0456a68b6b3a16712dacb35d"
|
||||
"Comment": "v0.7.2-4-g5df83ba",
|
||||
"Rev": "5df83ba895b6ba073c0513dddcec6d7473c95592"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/internal/protocol/rest",
|
||||
"Comment": "v0.6.4-5-g127313c",
|
||||
"Rev": "127313c1b41e534a0456a68b6b3a16712dacb35d"
|
||||
"Comment": "v0.7.2-4-g5df83ba",
|
||||
"Rev": "5df83ba895b6ba073c0513dddcec6d7473c95592"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/internal/protocol/restxml",
|
||||
"Comment": "v0.6.4-5-g127313c",
|
||||
"Rev": "127313c1b41e534a0456a68b6b3a16712dacb35d"
|
||||
"Comment": "v0.7.2-4-g5df83ba",
|
||||
"Rev": "5df83ba895b6ba073c0513dddcec6d7473c95592"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/internal/protocol/xml/xmlutil",
|
||||
"Comment": "v0.6.4-5-g127313c",
|
||||
"Rev": "127313c1b41e534a0456a68b6b3a16712dacb35d"
|
||||
"Comment": "v0.7.2-4-g5df83ba",
|
||||
"Rev": "5df83ba895b6ba073c0513dddcec6d7473c95592"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/internal/signer/v4",
|
||||
"Comment": "v0.6.4-5-g127313c",
|
||||
"Rev": "127313c1b41e534a0456a68b6b3a16712dacb35d"
|
||||
"Comment": "v0.7.2-4-g5df83ba",
|
||||
"Rev": "5df83ba895b6ba073c0513dddcec6d7473c95592"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/service/ec2",
|
||||
"Comment": "v0.7.2-4-g5df83ba",
|
||||
"Rev": "5df83ba895b6ba073c0513dddcec6d7473c95592"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/service/iam",
|
||||
"Comment": "v0.7.2-4-g5df83ba",
|
||||
"Rev": "5df83ba895b6ba073c0513dddcec6d7473c95592"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/service/s3",
|
||||
"Comment": "v0.6.4-5-g127313c",
|
||||
"Rev": "127313c1b41e534a0456a68b6b3a16712dacb35d"
|
||||
"Comment": "v0.7.2-4-g5df83ba",
|
||||
"Rev": "5df83ba895b6ba073c0513dddcec6d7473c95592"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/coreos/go-etcd/etcd",
|
||||
|
@ -78,16 +93,16 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/gocql/gocql",
|
||||
"Comment": "1st_gen_framing-187-g80e812a",
|
||||
"Rev": "80e812acf0ab386dd34271acc10d22514c0a67ba"
|
||||
"Comment": "1st_gen_framing-221-gf8fb76b",
|
||||
"Rev": "f8fb76bb772442ea938e4be46ab1666e542411a5"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/golang/groupcache/lru",
|
||||
"Rev": "604ed5785183e59ae2789449d89e73f3a2a77987"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/golang/snappy/snappy",
|
||||
"Rev": "eaa750b9bf4dcb7cb20454be850613b66cda3273"
|
||||
"ImportPath": "github.com/golang/snappy",
|
||||
"Rev": "723cc1e459b8eea2dea4583200fd60757d40097a"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/google/go-github/github",
|
||||
|
@ -97,26 +112,6 @@
|
|||
"ImportPath": "github.com/google/go-querystring/query",
|
||||
"Rev": "547ef5ac979778feb2f760cdb5f4eae1a2207b86"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/hashicorp/aws-sdk-go/aws",
|
||||
"Comment": "tf0.4.0-3-ge6ea019",
|
||||
"Rev": "e6ea0192eee4640f32ec73c0cbb71f63e4f2b65a"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/hashicorp/aws-sdk-go/gen/ec2",
|
||||
"Comment": "tf0.4.0-3-ge6ea019",
|
||||
"Rev": "e6ea0192eee4640f32ec73c0cbb71f63e4f2b65a"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/hashicorp/aws-sdk-go/gen/endpoints",
|
||||
"Comment": "tf0.4.0-3-ge6ea019",
|
||||
"Rev": "e6ea0192eee4640f32ec73c0cbb71f63e4f2b65a"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/hashicorp/aws-sdk-go/gen/iam",
|
||||
"Comment": "tf0.4.0-3-ge6ea019",
|
||||
"Rev": "e6ea0192eee4640f32ec73c0cbb71f63e4f2b65a"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/hashicorp/consul/api",
|
||||
"Comment": "v0.5.2-144-g2783f2b",
|
||||
|
@ -218,8 +213,8 @@
|
|||
"Rev": "9eae18c3681ae3d3c677ac2b80a8fe57de45fc09"
|
||||
},
|
||||
{
|
||||
"ImportPath": "speter.net/go/exp/math/dec/inf",
|
||||
"Rev": "42ca6cd68aa922bc3f32f1e056e61b65945d9ad7"
|
||||
"ImportPath": "gopkg.in/inf.v0",
|
||||
"Rev": "c85f1217d51339c0fa3a498cc8b2075de695dae6"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -10,23 +10,23 @@ package awserr
|
|||
//
|
||||
// Example:
|
||||
//
|
||||
// output, err := s3manage.Upload(svc, input, opts)
|
||||
// if err != nil {
|
||||
// if awsErr, ok := err.(awserr.Error); ok {
|
||||
// // Get error details
|
||||
// log.Println("Error:", err.Code(), err.Message())
|
||||
// output, err := s3manage.Upload(svc, input, opts)
|
||||
// if err != nil {
|
||||
// if awsErr, ok := err.(awserr.Error); ok {
|
||||
// // Get error details
|
||||
// log.Println("Error:", err.Code(), err.Message())
|
||||
//
|
||||
// Prints out full error message, including original error if there was one.
|
||||
// log.Println("Error:", err.Error())
|
||||
// // Prints out full error message, including original error if there was one.
|
||||
// log.Println("Error:", err.Error())
|
||||
//
|
||||
// // Get original error
|
||||
// if origErr := err.Err(); origErr != nil {
|
||||
// // operate on original error.
|
||||
// }
|
||||
// } else {
|
||||
// fmt.Println(err.Error())
|
||||
// }
|
||||
// }
|
||||
// // Get original error
|
||||
// if origErr := err.Err(); origErr != nil {
|
||||
// // operate on original error.
|
||||
// }
|
||||
// } else {
|
||||
// fmt.Println(err.Error())
|
||||
// }
|
||||
// }
|
||||
//
|
||||
type Error interface {
|
||||
// Satisfy the generic error interface.
|
||||
|
|
|
@ -70,12 +70,20 @@ func rcopy(dst, src reflect.Value, root bool) {
|
|||
}
|
||||
}
|
||||
case reflect.Slice:
|
||||
if src.IsNil() {
|
||||
break
|
||||
}
|
||||
|
||||
s := reflect.MakeSlice(src.Type(), src.Len(), src.Cap())
|
||||
dst.Set(s)
|
||||
for i := 0; i < src.Len(); i++ {
|
||||
rcopy(dst.Index(i), src.Index(i), false)
|
||||
}
|
||||
case reflect.Map:
|
||||
if src.IsNil() {
|
||||
break
|
||||
}
|
||||
|
||||
s := reflect.MakeMap(src.Type())
|
||||
dst.Set(s)
|
||||
for _, k := range src.MapKeys() {
|
||||
|
|
|
@ -27,7 +27,7 @@ func ExampleCopy() {
|
|||
awsutil.Copy(&f2, f1)
|
||||
|
||||
// Print the result
|
||||
fmt.Println(awsutil.StringValue(f2))
|
||||
fmt.Println(awsutil.Prettify(f2))
|
||||
|
||||
// Output:
|
||||
// {
|
||||
|
@ -80,18 +80,26 @@ func TestCopy(t *testing.T) {
|
|||
func TestCopyIgnoreNilMembers(t *testing.T) {
|
||||
type Foo struct {
|
||||
A *string
|
||||
B []string
|
||||
C map[string]string
|
||||
}
|
||||
|
||||
f := &Foo{}
|
||||
assert.Nil(t, f.A)
|
||||
assert.Nil(t, f.B)
|
||||
assert.Nil(t, f.C)
|
||||
|
||||
var f2 Foo
|
||||
awsutil.Copy(&f2, f)
|
||||
assert.Nil(t, f2.A)
|
||||
assert.Nil(t, f2.B)
|
||||
assert.Nil(t, f2.C)
|
||||
|
||||
fcopy := awsutil.CopyOf(f)
|
||||
f3 := fcopy.(*Foo)
|
||||
assert.Nil(t, f3.A)
|
||||
assert.Nil(t, f3.B)
|
||||
assert.Nil(t, f3.C)
|
||||
}
|
||||
|
||||
func TestCopyPrimitive(t *testing.T) {
|
||||
|
@ -183,7 +191,7 @@ func ExampleCopyOf() {
|
|||
var f2 *Foo = v.(*Foo)
|
||||
|
||||
// Print the result
|
||||
fmt.Println(awsutil.StringValue(f2))
|
||||
fmt.Println(awsutil.Prettify(f2))
|
||||
|
||||
// Output:
|
||||
// {
|
||||
|
|
|
@ -81,6 +81,12 @@ func rValuesAtPath(v interface{}, path string, create bool, caseSensitive bool)
|
|||
value = reflect.Indirect(value)
|
||||
}
|
||||
|
||||
if value.Kind() == reflect.Slice || value.Kind() == reflect.Map {
|
||||
if !create && value.IsNil() {
|
||||
value = reflect.ValueOf(nil)
|
||||
}
|
||||
}
|
||||
|
||||
if value.IsValid() {
|
||||
nextvals = append(nextvals, value)
|
||||
}
|
||||
|
@ -118,6 +124,12 @@ func rValuesAtPath(v interface{}, path string, create bool, caseSensitive bool)
|
|||
}
|
||||
value = reflect.Indirect(value.Index(i))
|
||||
|
||||
if value.Kind() == reflect.Slice || value.Kind() == reflect.Map {
|
||||
if !create && value.IsNil() {
|
||||
value = reflect.ValueOf(nil)
|
||||
}
|
||||
}
|
||||
|
||||
if value.IsValid() {
|
||||
nextvals = append(nextvals, value)
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ func TestValueAtPathFailure(t *testing.T) {
|
|||
assert.Equal(t, []interface{}{}, awsutil.ValuesAtPath(data, "B.B.C.Z"))
|
||||
assert.Equal(t, []interface{}(nil), awsutil.ValuesAtPath(data, "z[-1].C"))
|
||||
assert.Equal(t, []interface{}{}, awsutil.ValuesAtPath(nil, "A.B.C"))
|
||||
assert.Equal(t, []interface{}{}, awsutil.ValuesAtPath(Struct{}, "A"))
|
||||
}
|
||||
|
||||
func TestSetValueAtPathSuccess(t *testing.T) {
|
||||
|
@ -62,4 +63,6 @@ func TestSetValueAtPathSuccess(t *testing.T) {
|
|||
var s2 Struct
|
||||
awsutil.SetValueAtAnyPath(&s2, "b.b.c", "test0")
|
||||
assert.Equal(t, "test0", s2.B.B.C)
|
||||
awsutil.SetValueAtAnyPath(&s2, "A", []Struct{{}})
|
||||
assert.Equal(t, []Struct{{}}, s2.A)
|
||||
}
|
||||
|
|
|
@ -8,16 +8,16 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
// StringValue returns the string representation of a value.
|
||||
func StringValue(i interface{}) string {
|
||||
// Prettify returns the string representation of a value.
|
||||
func Prettify(i interface{}) string {
|
||||
var buf bytes.Buffer
|
||||
stringValue(reflect.ValueOf(i), 0, &buf)
|
||||
prettify(reflect.ValueOf(i), 0, &buf)
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
// stringValue will recursively walk value v to build a textual
|
||||
// prettify will recursively walk value v to build a textual
|
||||
// representation of the value.
|
||||
func stringValue(v reflect.Value, indent int, buf *bytes.Buffer) {
|
||||
func prettify(v reflect.Value, indent int, buf *bytes.Buffer) {
|
||||
for v.Kind() == reflect.Ptr {
|
||||
v = v.Elem()
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ func stringValue(v reflect.Value, indent int, buf *bytes.Buffer) {
|
|||
val := v.FieldByName(n)
|
||||
buf.WriteString(strings.Repeat(" ", indent+2))
|
||||
buf.WriteString(n + ": ")
|
||||
stringValue(val, indent+2, buf)
|
||||
prettify(val, indent+2, buf)
|
||||
|
||||
if i < len(names)-1 {
|
||||
buf.WriteString(",\n")
|
||||
|
@ -68,7 +68,7 @@ func stringValue(v reflect.Value, indent int, buf *bytes.Buffer) {
|
|||
buf.WriteString("[" + nl)
|
||||
for i := 0; i < v.Len(); i++ {
|
||||
buf.WriteString(id2)
|
||||
stringValue(v.Index(i), indent+2, buf)
|
||||
prettify(v.Index(i), indent+2, buf)
|
||||
|
||||
if i < v.Len()-1 {
|
||||
buf.WriteString("," + nl)
|
||||
|
@ -82,7 +82,7 @@ func stringValue(v reflect.Value, indent int, buf *bytes.Buffer) {
|
|||
for i, k := range v.MapKeys() {
|
||||
buf.WriteString(strings.Repeat(" ", indent+2))
|
||||
buf.WriteString(k.String() + ": ")
|
||||
stringValue(v.MapIndex(k), indent+2, buf)
|
||||
prettify(v.MapIndex(k), indent+2, buf)
|
||||
|
||||
if i < v.Len()-1 {
|
||||
buf.WriteString(",\n")
|
|
@ -1,7 +1,6 @@
|
|||
package aws
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
|
@ -26,148 +25,230 @@ var DefaultChainCredentials = credentials.NewChainCredentials(
|
|||
const DefaultRetries = -1
|
||||
|
||||
// DefaultConfig is the default all service configuration will be based off of.
|
||||
var DefaultConfig = &Config{
|
||||
Credentials: DefaultChainCredentials,
|
||||
Endpoint: "",
|
||||
Region: os.Getenv("AWS_REGION"),
|
||||
DisableSSL: false,
|
||||
ManualSend: false,
|
||||
HTTPClient: http.DefaultClient,
|
||||
LogHTTPBody: false,
|
||||
LogLevel: 0,
|
||||
Logger: os.Stdout,
|
||||
MaxRetries: DefaultRetries,
|
||||
DisableParamValidation: false,
|
||||
DisableComputeChecksums: false,
|
||||
S3ForcePathStyle: false,
|
||||
}
|
||||
// By default, all clients use this structure for initialization options unless
|
||||
// a custom configuration object is passed in.
|
||||
//
|
||||
// You may modify this global structure to change all default configuration
|
||||
// in the SDK. Note that configuration options are copied by value, so any
|
||||
// modifications must happen before constructing a client.
|
||||
var DefaultConfig = NewConfig().
|
||||
WithCredentials(DefaultChainCredentials).
|
||||
WithRegion(os.Getenv("AWS_REGION")).
|
||||
WithHTTPClient(http.DefaultClient).
|
||||
WithMaxRetries(DefaultRetries).
|
||||
WithLogger(NewDefaultLogger()).
|
||||
WithLogLevel(LogOff)
|
||||
|
||||
// A Config provides service configuration
|
||||
// A Config provides service configuration for service clients. By default,
|
||||
// all clients will use the {DefaultConfig} structure.
|
||||
type Config struct {
|
||||
Credentials *credentials.Credentials
|
||||
Endpoint string
|
||||
Region string
|
||||
DisableSSL bool
|
||||
ManualSend bool
|
||||
HTTPClient *http.Client
|
||||
LogHTTPBody bool
|
||||
LogLevel uint
|
||||
Logger io.Writer
|
||||
MaxRetries int
|
||||
DisableParamValidation bool
|
||||
DisableComputeChecksums bool
|
||||
S3ForcePathStyle bool
|
||||
// The credentials object to use when signing requests. Defaults to
|
||||
// {DefaultChainCredentials}.
|
||||
Credentials *credentials.Credentials
|
||||
|
||||
// An optional endpoint URL (hostname only or fully qualified URI)
|
||||
// that overrides the default generated endpoint for a client. Set this
|
||||
// to `""` to use the default generated endpoint.
|
||||
//
|
||||
// @note You must still provide a `Region` value when specifying an
|
||||
// endpoint for a client.
|
||||
Endpoint *string
|
||||
|
||||
// The region to send requests to. This parameter is required and must
|
||||
// be configured globally or on a per-client basis unless otherwise
|
||||
// noted. A full list of regions is found in the "Regions and Endpoints"
|
||||
// document.
|
||||
//
|
||||
// @see http://docs.aws.amazon.com/general/latest/gr/rande.html
|
||||
// AWS Regions and Endpoints
|
||||
Region *string
|
||||
|
||||
// Set this to `true` to disable SSL when sending requests. Defaults
|
||||
// to `false`.
|
||||
DisableSSL *bool
|
||||
|
||||
// The HTTP client to use when sending requests. Defaults to
|
||||
// `http.DefaultClient`.
|
||||
HTTPClient *http.Client
|
||||
|
||||
// An integer value representing the logging level. The default log level
|
||||
// is zero (LogOff), which represents no logging. To enable logging set
|
||||
// to a LogLevel Value.
|
||||
LogLevel *LogLevelType
|
||||
|
||||
// The logger writer interface to write logging messages to. Defaults to
|
||||
// standard out.
|
||||
Logger Logger
|
||||
|
||||
// The maximum number of times that a request will be retried for failures.
|
||||
// Defaults to -1, which defers the max retry setting to the service specific
|
||||
// configuration.
|
||||
MaxRetries *int
|
||||
|
||||
// Disables semantic parameter validation, which validates input for missing
|
||||
// required fields and/or other semantic request input errors.
|
||||
DisableParamValidation *bool
|
||||
|
||||
// Disables the computation of request and response checksums, e.g.,
|
||||
// CRC32 checksums in Amazon DynamoDB.
|
||||
DisableComputeChecksums *bool
|
||||
|
||||
// Set this to `true` to force the request to use path-style addressing,
|
||||
// i.e., `http://s3.amazonaws.com/BUCKET/KEY`. By default, the S3 client will
|
||||
// use virtual hosted bucket addressing when possible
|
||||
// (`http://BUCKET.s3.amazonaws.com/KEY`).
|
||||
//
|
||||
// @note This configuration option is specific to the Amazon S3 service.
|
||||
// @see http://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html
|
||||
// Amazon S3: Virtual Hosting of Buckets
|
||||
S3ForcePathStyle *bool
|
||||
}
|
||||
|
||||
// Copy will return a shallow copy of the Config object.
|
||||
func (c Config) Copy() Config {
|
||||
dst := Config{}
|
||||
dst.Credentials = c.Credentials
|
||||
dst.Endpoint = c.Endpoint
|
||||
dst.Region = c.Region
|
||||
dst.DisableSSL = c.DisableSSL
|
||||
dst.ManualSend = c.ManualSend
|
||||
dst.HTTPClient = c.HTTPClient
|
||||
dst.LogHTTPBody = c.LogHTTPBody
|
||||
dst.LogLevel = c.LogLevel
|
||||
dst.Logger = c.Logger
|
||||
dst.MaxRetries = c.MaxRetries
|
||||
dst.DisableParamValidation = c.DisableParamValidation
|
||||
dst.DisableComputeChecksums = c.DisableComputeChecksums
|
||||
dst.S3ForcePathStyle = c.S3ForcePathStyle
|
||||
|
||||
return dst
|
||||
// NewConfig returns a new Config pointer that can be chained with builder methods to
|
||||
// set multiple configuration values inline without using pointers.
|
||||
//
|
||||
// svc := s3.New(aws.NewConfig().WithRegion("us-west-2").WithMaxRetries(10))
|
||||
//
|
||||
func NewConfig() *Config {
|
||||
return &Config{}
|
||||
}
|
||||
|
||||
// Merge merges the newcfg attribute values into this Config. Each attribute
|
||||
// will be merged into this config if the newcfg attribute's value is non-zero.
|
||||
// Due to this, newcfg attributes with zero values cannot be merged in. For
|
||||
// example bool attributes cannot be cleared using Merge, and must be explicitly
|
||||
// set on the Config structure.
|
||||
func (c Config) Merge(newcfg *Config) *Config {
|
||||
if newcfg == nil {
|
||||
// WithCredentials sets a config Credentials value returning a Config pointer
|
||||
// for chaining.
|
||||
func (c *Config) WithCredentials(creds *credentials.Credentials) *Config {
|
||||
c.Credentials = creds
|
||||
return c
|
||||
}
|
||||
|
||||
// WithEndpoint sets a config Endpoint value returning a Config pointer for
|
||||
// chaining.
|
||||
func (c *Config) WithEndpoint(endpoint string) *Config {
|
||||
c.Endpoint = &endpoint
|
||||
return c
|
||||
}
|
||||
|
||||
// WithRegion sets a config Region value returning a Config pointer for
|
||||
// chaining.
|
||||
func (c *Config) WithRegion(region string) *Config {
|
||||
c.Region = ®ion
|
||||
return c
|
||||
}
|
||||
|
||||
// WithDisableSSL sets a config DisableSSL value returning a Config pointer
|
||||
// for chaining.
|
||||
func (c *Config) WithDisableSSL(disable bool) *Config {
|
||||
c.DisableSSL = &disable
|
||||
return c
|
||||
}
|
||||
|
||||
// WithHTTPClient sets a config HTTPClient value returning a Config pointer
|
||||
// for chaining.
|
||||
func (c *Config) WithHTTPClient(client *http.Client) *Config {
|
||||
c.HTTPClient = client
|
||||
return c
|
||||
}
|
||||
|
||||
// WithMaxRetries sets a config MaxRetries value returning a Config pointer
|
||||
// for chaining.
|
||||
func (c *Config) WithMaxRetries(max int) *Config {
|
||||
c.MaxRetries = &max
|
||||
return c
|
||||
}
|
||||
|
||||
// WithDisableParamValidation sets a config DisableParamValidation value
|
||||
// returning a Config pointer for chaining.
|
||||
func (c *Config) WithDisableParamValidation(disable bool) *Config {
|
||||
c.DisableParamValidation = &disable
|
||||
return c
|
||||
}
|
||||
|
||||
// WithDisableComputeChecksums sets a config DisableComputeChecksums value
|
||||
// returning a Config pointer for chaining.
|
||||
func (c *Config) WithDisableComputeChecksums(disable bool) *Config {
|
||||
c.DisableComputeChecksums = &disable
|
||||
return c
|
||||
}
|
||||
|
||||
// WithLogLevel sets a config LogLevel value returning a Config pointer for
|
||||
// chaining.
|
||||
func (c *Config) WithLogLevel(level LogLevelType) *Config {
|
||||
c.LogLevel = &level
|
||||
return c
|
||||
}
|
||||
|
||||
// WithLogger sets a config Logger value returning a Config pointer for
|
||||
// chaining.
|
||||
func (c *Config) WithLogger(logger Logger) *Config {
|
||||
c.Logger = logger
|
||||
return c
|
||||
}
|
||||
|
||||
// WithS3ForcePathStyle sets a config S3ForcePathStyle value returning a Config
|
||||
// pointer for chaining.
|
||||
func (c *Config) WithS3ForcePathStyle(force bool) *Config {
|
||||
c.S3ForcePathStyle = &force
|
||||
return c
|
||||
}
|
||||
|
||||
// Merge returns a new Config with the other Config's attribute values merged into
|
||||
// this Config. If the other Config's attribute is nil it will not be merged into
|
||||
// the new Config to be returned.
|
||||
func (c Config) Merge(other *Config) *Config {
|
||||
if other == nil {
|
||||
return &c
|
||||
}
|
||||
|
||||
cfg := Config{}
|
||||
dst := c
|
||||
|
||||
if newcfg.Credentials != nil {
|
||||
cfg.Credentials = newcfg.Credentials
|
||||
} else {
|
||||
cfg.Credentials = c.Credentials
|
||||
if other.Credentials != nil {
|
||||
dst.Credentials = other.Credentials
|
||||
}
|
||||
|
||||
if newcfg.Endpoint != "" {
|
||||
cfg.Endpoint = newcfg.Endpoint
|
||||
} else {
|
||||
cfg.Endpoint = c.Endpoint
|
||||
if other.Endpoint != nil {
|
||||
dst.Endpoint = other.Endpoint
|
||||
}
|
||||
|
||||
if newcfg.Region != "" {
|
||||
cfg.Region = newcfg.Region
|
||||
} else {
|
||||
cfg.Region = c.Region
|
||||
if other.Region != nil {
|
||||
dst.Region = other.Region
|
||||
}
|
||||
|
||||
if newcfg.DisableSSL {
|
||||
cfg.DisableSSL = newcfg.DisableSSL
|
||||
} else {
|
||||
cfg.DisableSSL = c.DisableSSL
|
||||
if other.DisableSSL != nil {
|
||||
dst.DisableSSL = other.DisableSSL
|
||||
}
|
||||
|
||||
if newcfg.ManualSend {
|
||||
cfg.ManualSend = newcfg.ManualSend
|
||||
} else {
|
||||
cfg.ManualSend = c.ManualSend
|
||||
if other.HTTPClient != nil {
|
||||
dst.HTTPClient = other.HTTPClient
|
||||
}
|
||||
|
||||
if newcfg.HTTPClient != nil {
|
||||
cfg.HTTPClient = newcfg.HTTPClient
|
||||
} else {
|
||||
cfg.HTTPClient = c.HTTPClient
|
||||
if other.LogLevel != nil {
|
||||
dst.LogLevel = other.LogLevel
|
||||
}
|
||||
|
||||
if newcfg.LogHTTPBody {
|
||||
cfg.LogHTTPBody = newcfg.LogHTTPBody
|
||||
} else {
|
||||
cfg.LogHTTPBody = c.LogHTTPBody
|
||||
if other.Logger != nil {
|
||||
dst.Logger = other.Logger
|
||||
}
|
||||
|
||||
if newcfg.LogLevel != 0 {
|
||||
cfg.LogLevel = newcfg.LogLevel
|
||||
} else {
|
||||
cfg.LogLevel = c.LogLevel
|
||||
if other.MaxRetries != nil {
|
||||
dst.MaxRetries = other.MaxRetries
|
||||
}
|
||||
|
||||
if newcfg.Logger != nil {
|
||||
cfg.Logger = newcfg.Logger
|
||||
} else {
|
||||
cfg.Logger = c.Logger
|
||||
if other.DisableParamValidation != nil {
|
||||
dst.DisableParamValidation = other.DisableParamValidation
|
||||
}
|
||||
|
||||
if newcfg.MaxRetries != DefaultRetries {
|
||||
cfg.MaxRetries = newcfg.MaxRetries
|
||||
} else {
|
||||
cfg.MaxRetries = c.MaxRetries
|
||||
if other.DisableComputeChecksums != nil {
|
||||
dst.DisableComputeChecksums = other.DisableComputeChecksums
|
||||
}
|
||||
|
||||
if newcfg.DisableParamValidation {
|
||||
cfg.DisableParamValidation = newcfg.DisableParamValidation
|
||||
} else {
|
||||
cfg.DisableParamValidation = c.DisableParamValidation
|
||||
if other.S3ForcePathStyle != nil {
|
||||
dst.S3ForcePathStyle = other.S3ForcePathStyle
|
||||
}
|
||||
|
||||
if newcfg.DisableComputeChecksums {
|
||||
cfg.DisableComputeChecksums = newcfg.DisableComputeChecksums
|
||||
} else {
|
||||
cfg.DisableComputeChecksums = c.DisableComputeChecksums
|
||||
}
|
||||
|
||||
if newcfg.S3ForcePathStyle {
|
||||
cfg.S3ForcePathStyle = newcfg.S3ForcePathStyle
|
||||
} else {
|
||||
cfg.S3ForcePathStyle = c.S3ForcePathStyle
|
||||
}
|
||||
|
||||
return &cfg
|
||||
return &dst
|
||||
}
|
||||
|
||||
// Copy will return a shallow copy of the Config object.
|
||||
func (c Config) Copy() *Config {
|
||||
dst := c
|
||||
return &dst
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package aws
|
|||
|
||||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
|
@ -20,24 +19,22 @@ var testCredentials = credentials.NewChainCredentials([]credentials.Provider{
|
|||
|
||||
var copyTestConfig = Config{
|
||||
Credentials: testCredentials,
|
||||
Endpoint: "CopyTestEndpoint",
|
||||
Region: "COPY_TEST_AWS_REGION",
|
||||
DisableSSL: true,
|
||||
ManualSend: true,
|
||||
Endpoint: String("CopyTestEndpoint"),
|
||||
Region: String("COPY_TEST_AWS_REGION"),
|
||||
DisableSSL: Bool(true),
|
||||
HTTPClient: http.DefaultClient,
|
||||
LogHTTPBody: true,
|
||||
LogLevel: 2,
|
||||
Logger: os.Stdout,
|
||||
MaxRetries: DefaultRetries,
|
||||
DisableParamValidation: true,
|
||||
DisableComputeChecksums: true,
|
||||
S3ForcePathStyle: true,
|
||||
LogLevel: LogLevel(LogDebug),
|
||||
Logger: NewDefaultLogger(),
|
||||
MaxRetries: Int(DefaultRetries),
|
||||
DisableParamValidation: Bool(true),
|
||||
DisableComputeChecksums: Bool(true),
|
||||
S3ForcePathStyle: Bool(true),
|
||||
}
|
||||
|
||||
func TestCopy(t *testing.T) {
|
||||
want := copyTestConfig
|
||||
got := copyTestConfig.Copy()
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
if !reflect.DeepEqual(*got, want) {
|
||||
t.Errorf("Copy() = %+v", got)
|
||||
t.Errorf(" want %+v", want)
|
||||
}
|
||||
|
@ -46,27 +43,25 @@ func TestCopy(t *testing.T) {
|
|||
func TestCopyReturnsNewInstance(t *testing.T) {
|
||||
want := copyTestConfig
|
||||
got := copyTestConfig.Copy()
|
||||
if &got == &want {
|
||||
t.Errorf("Copy() = %p; want different instance as source %p", &got, &want)
|
||||
if got == &want {
|
||||
t.Errorf("Copy() = %p; want different instance as source %p", got, &want)
|
||||
}
|
||||
}
|
||||
|
||||
var mergeTestZeroValueConfig = Config{MaxRetries: DefaultRetries}
|
||||
var mergeTestZeroValueConfig = Config{}
|
||||
|
||||
var mergeTestConfig = Config{
|
||||
Credentials: testCredentials,
|
||||
Endpoint: "MergeTestEndpoint",
|
||||
Region: "MERGE_TEST_AWS_REGION",
|
||||
DisableSSL: true,
|
||||
ManualSend: true,
|
||||
Endpoint: String("MergeTestEndpoint"),
|
||||
Region: String("MERGE_TEST_AWS_REGION"),
|
||||
DisableSSL: Bool(true),
|
||||
HTTPClient: http.DefaultClient,
|
||||
LogHTTPBody: true,
|
||||
LogLevel: 2,
|
||||
Logger: os.Stdout,
|
||||
MaxRetries: 10,
|
||||
DisableParamValidation: true,
|
||||
DisableComputeChecksums: true,
|
||||
S3ForcePathStyle: true,
|
||||
LogLevel: LogLevel(LogDebug),
|
||||
Logger: NewDefaultLogger(),
|
||||
MaxRetries: Int(10),
|
||||
DisableParamValidation: Bool(true),
|
||||
DisableComputeChecksums: Bool(true),
|
||||
S3ForcePathStyle: Bool(true),
|
||||
}
|
||||
|
||||
var mergeTests = []struct {
|
||||
|
@ -80,13 +75,13 @@ var mergeTests = []struct {
|
|||
}
|
||||
|
||||
func TestMerge(t *testing.T) {
|
||||
for _, tt := range mergeTests {
|
||||
for i, tt := range mergeTests {
|
||||
got := tt.cfg.Merge(tt.in)
|
||||
if !reflect.DeepEqual(got, tt.want) {
|
||||
t.Errorf("Config %+v", tt.cfg)
|
||||
t.Errorf(" Merge(%+v)", tt.in)
|
||||
t.Errorf(" got %+v", got)
|
||||
t.Errorf(" want %+v", tt.want)
|
||||
t.Errorf("Config %d %+v", i, tt.cfg)
|
||||
t.Errorf(" Merge(%+v)", tt.in)
|
||||
t.Errorf(" got %+v", got)
|
||||
t.Errorf(" want %+v", tt.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,357 @@
|
|||
package aws
|
||||
|
||||
import "time"
|
||||
|
||||
// String returns a pointer to of the string value passed in.
|
||||
func String(v string) *string {
|
||||
return &v
|
||||
}
|
||||
|
||||
// StringValue returns the value of the string pointer passed in or
|
||||
// "" if the pointer is nil.
|
||||
func StringValue(v *string) string {
|
||||
if v != nil {
|
||||
return *v
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// StringSlice converts a slice of string values into a slice of
|
||||
// string pointers
|
||||
func StringSlice(src []string) []*string {
|
||||
dst := make([]*string, len(src))
|
||||
for i := 0; i < len(src); i++ {
|
||||
dst[i] = &(src[i])
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// StringValueSlice converts a slice of string pointers into a slice of
|
||||
// string values
|
||||
func StringValueSlice(src []*string) []string {
|
||||
dst := make([]string, len(src))
|
||||
for i := 0; i < len(src); i++ {
|
||||
if src[i] != nil {
|
||||
dst[i] = *(src[i])
|
||||
}
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// StringMap converts a string map of string values into a string
|
||||
// map of string pointers
|
||||
func StringMap(src map[string]string) map[string]*string {
|
||||
dst := make(map[string]*string)
|
||||
for k, val := range src {
|
||||
v := val
|
||||
dst[k] = &v
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// StringValueMap converts a string map of string pointers into a string
|
||||
// map of string values
|
||||
func StringValueMap(src map[string]*string) map[string]string {
|
||||
dst := make(map[string]string)
|
||||
for k, val := range src {
|
||||
if val != nil {
|
||||
dst[k] = *val
|
||||
}
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// Bool returns a pointer to of the bool value passed in.
|
||||
func Bool(v bool) *bool {
|
||||
return &v
|
||||
}
|
||||
|
||||
// BoolValue returns the value of the bool pointer passed in or
|
||||
// false if the pointer is nil.
|
||||
func BoolValue(v *bool) bool {
|
||||
if v != nil {
|
||||
return *v
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// BoolSlice converts a slice of bool values into a slice of
|
||||
// bool pointers
|
||||
func BoolSlice(src []bool) []*bool {
|
||||
dst := make([]*bool, len(src))
|
||||
for i := 0; i < len(src); i++ {
|
||||
dst[i] = &(src[i])
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// BoolValueSlice converts a slice of bool pointers into a slice of
|
||||
// bool values
|
||||
func BoolValueSlice(src []*bool) []bool {
|
||||
dst := make([]bool, len(src))
|
||||
for i := 0; i < len(src); i++ {
|
||||
if src[i] != nil {
|
||||
dst[i] = *(src[i])
|
||||
}
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// BoolMap converts a string map of bool values into a string
|
||||
// map of bool pointers
|
||||
func BoolMap(src map[string]bool) map[string]*bool {
|
||||
dst := make(map[string]*bool)
|
||||
for k, val := range src {
|
||||
v := val
|
||||
dst[k] = &v
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// BoolValueMap converts a string map of bool pointers into a string
|
||||
// map of bool values
|
||||
func BoolValueMap(src map[string]*bool) map[string]bool {
|
||||
dst := make(map[string]bool)
|
||||
for k, val := range src {
|
||||
if val != nil {
|
||||
dst[k] = *val
|
||||
}
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// Int returns a pointer to of the int value passed in.
|
||||
func Int(v int) *int {
|
||||
return &v
|
||||
}
|
||||
|
||||
// IntValue returns the value of the int pointer passed in or
|
||||
// 0 if the pointer is nil.
|
||||
func IntValue(v *int) int {
|
||||
if v != nil {
|
||||
return *v
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// IntSlice converts a slice of int values into a slice of
|
||||
// int pointers
|
||||
func IntSlice(src []int) []*int {
|
||||
dst := make([]*int, len(src))
|
||||
for i := 0; i < len(src); i++ {
|
||||
dst[i] = &(src[i])
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// IntValueSlice converts a slice of int pointers into a slice of
|
||||
// int values
|
||||
func IntValueSlice(src []*int) []int {
|
||||
dst := make([]int, len(src))
|
||||
for i := 0; i < len(src); i++ {
|
||||
if src[i] != nil {
|
||||
dst[i] = *(src[i])
|
||||
}
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// IntMap converts a string map of int values into a string
|
||||
// map of int pointers
|
||||
func IntMap(src map[string]int) map[string]*int {
|
||||
dst := make(map[string]*int)
|
||||
for k, val := range src {
|
||||
v := val
|
||||
dst[k] = &v
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// IntValueMap converts a string map of int pointers into a string
|
||||
// map of int values
|
||||
func IntValueMap(src map[string]*int) map[string]int {
|
||||
dst := make(map[string]int)
|
||||
for k, val := range src {
|
||||
if val != nil {
|
||||
dst[k] = *val
|
||||
}
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// Int64 returns a pointer to of the int64 value passed in.
|
||||
func Int64(v int64) *int64 {
|
||||
return &v
|
||||
}
|
||||
|
||||
// Int64Value returns the value of the int64 pointer passed in or
|
||||
// 0 if the pointer is nil.
|
||||
func Int64Value(v *int64) int64 {
|
||||
if v != nil {
|
||||
return *v
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// Int64Slice converts a slice of int64 values into a slice of
|
||||
// int64 pointers
|
||||
func Int64Slice(src []int64) []*int64 {
|
||||
dst := make([]*int64, len(src))
|
||||
for i := 0; i < len(src); i++ {
|
||||
dst[i] = &(src[i])
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// Int64ValueSlice converts a slice of int64 pointers into a slice of
|
||||
// int64 values
|
||||
func Int64ValueSlice(src []*int64) []int64 {
|
||||
dst := make([]int64, len(src))
|
||||
for i := 0; i < len(src); i++ {
|
||||
if src[i] != nil {
|
||||
dst[i] = *(src[i])
|
||||
}
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// Int64Map converts a string map of int64 values into a string
|
||||
// map of int64 pointers
|
||||
func Int64Map(src map[string]int64) map[string]*int64 {
|
||||
dst := make(map[string]*int64)
|
||||
for k, val := range src {
|
||||
v := val
|
||||
dst[k] = &v
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// Int64ValueMap converts a string map of int64 pointers into a string
|
||||
// map of int64 values
|
||||
func Int64ValueMap(src map[string]*int64) map[string]int64 {
|
||||
dst := make(map[string]int64)
|
||||
for k, val := range src {
|
||||
if val != nil {
|
||||
dst[k] = *val
|
||||
}
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// Float64 returns a pointer to of the float64 value passed in.
|
||||
func Float64(v float64) *float64 {
|
||||
return &v
|
||||
}
|
||||
|
||||
// Float64Value returns the value of the float64 pointer passed in or
|
||||
// 0 if the pointer is nil.
|
||||
func Float64Value(v *float64) float64 {
|
||||
if v != nil {
|
||||
return *v
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// Float64Slice converts a slice of float64 values into a slice of
|
||||
// float64 pointers
|
||||
func Float64Slice(src []float64) []*float64 {
|
||||
dst := make([]*float64, len(src))
|
||||
for i := 0; i < len(src); i++ {
|
||||
dst[i] = &(src[i])
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// Float64ValueSlice converts a slice of float64 pointers into a slice of
|
||||
// float64 values
|
||||
func Float64ValueSlice(src []*float64) []float64 {
|
||||
dst := make([]float64, len(src))
|
||||
for i := 0; i < len(src); i++ {
|
||||
if src[i] != nil {
|
||||
dst[i] = *(src[i])
|
||||
}
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// Float64Map converts a string map of float64 values into a string
|
||||
// map of float64 pointers
|
||||
func Float64Map(src map[string]float64) map[string]*float64 {
|
||||
dst := make(map[string]*float64)
|
||||
for k, val := range src {
|
||||
v := val
|
||||
dst[k] = &v
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// Float64ValueMap converts a string map of float64 pointers into a string
|
||||
// map of float64 values
|
||||
func Float64ValueMap(src map[string]*float64) map[string]float64 {
|
||||
dst := make(map[string]float64)
|
||||
for k, val := range src {
|
||||
if val != nil {
|
||||
dst[k] = *val
|
||||
}
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// Time returns a pointer to of the time.Time value passed in.
|
||||
func Time(v time.Time) *time.Time {
|
||||
return &v
|
||||
}
|
||||
|
||||
// TimeValue returns the value of the time.Time pointer passed in or
|
||||
// time.Time{} if the pointer is nil.
|
||||
func TimeValue(v *time.Time) time.Time {
|
||||
if v != nil {
|
||||
return *v
|
||||
}
|
||||
return time.Time{}
|
||||
}
|
||||
|
||||
// TimeSlice converts a slice of time.Time values into a slice of
|
||||
// time.Time pointers
|
||||
func TimeSlice(src []time.Time) []*time.Time {
|
||||
dst := make([]*time.Time, len(src))
|
||||
for i := 0; i < len(src); i++ {
|
||||
dst[i] = &(src[i])
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// TimeValueSlice converts a slice of time.Time pointers into a slice of
|
||||
// time.Time values
|
||||
func TimeValueSlice(src []*time.Time) []time.Time {
|
||||
dst := make([]time.Time, len(src))
|
||||
for i := 0; i < len(src); i++ {
|
||||
if src[i] != nil {
|
||||
dst[i] = *(src[i])
|
||||
}
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// TimeMap converts a string map of time.Time values into a string
|
||||
// map of time.Time pointers
|
||||
func TimeMap(src map[string]time.Time) map[string]*time.Time {
|
||||
dst := make(map[string]*time.Time)
|
||||
for k, val := range src {
|
||||
v := val
|
||||
dst[k] = &v
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// TimeValueMap converts a string map of time.Time pointers into a string
|
||||
// map of time.Time values
|
||||
func TimeValueMap(src map[string]*time.Time) map[string]time.Time {
|
||||
dst := make(map[string]time.Time)
|
||||
for k, val := range src {
|
||||
if val != nil {
|
||||
dst[k] = *val
|
||||
}
|
||||
}
|
||||
return dst
|
||||
}
|
438
Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/convutil_test.go
generated
vendored
Normal file
438
Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/convutil_test.go
generated
vendored
Normal file
|
@ -0,0 +1,438 @@
|
|||
package aws_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var testCasesStringSlice = [][]string{
|
||||
{"a", "b", "c", "d", "e"},
|
||||
{"a", "b", "", "", "e"},
|
||||
}
|
||||
|
||||
func TestStringSlice(t *testing.T) {
|
||||
for idx, in := range testCasesStringSlice {
|
||||
if in == nil {
|
||||
continue
|
||||
}
|
||||
out := aws.StringSlice(in)
|
||||
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
|
||||
for i := range out {
|
||||
assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
|
||||
}
|
||||
|
||||
out2 := aws.StringValueSlice(out)
|
||||
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
|
||||
assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
|
||||
}
|
||||
}
|
||||
|
||||
var testCasesStringValueSlice = [][]*string{
|
||||
{aws.String("a"), aws.String("b"), nil, aws.String("c")},
|
||||
}
|
||||
|
||||
func TestStringValueSlice(t *testing.T) {
|
||||
for idx, in := range testCasesStringValueSlice {
|
||||
if in == nil {
|
||||
continue
|
||||
}
|
||||
out := aws.StringValueSlice(in)
|
||||
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
|
||||
for i := range out {
|
||||
if in[i] == nil {
|
||||
assert.Empty(t, out[i], "Unexpected value at idx %d", idx)
|
||||
} else {
|
||||
assert.Equal(t, *(in[i]), out[i], "Unexpected value at idx %d", idx)
|
||||
}
|
||||
}
|
||||
|
||||
out2 := aws.StringSlice(out)
|
||||
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
|
||||
for i := range out2 {
|
||||
if in[i] == nil {
|
||||
assert.Empty(t, *(out2[i]), "Unexpected value at idx %d", idx)
|
||||
} else {
|
||||
assert.Equal(t, in[i], out2[i], "Unexpected value at idx %d", idx)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var testCasesStringMap = []map[string]string{
|
||||
{"a": "1", "b": "2", "c": "3"},
|
||||
}
|
||||
|
||||
func TestStringMap(t *testing.T) {
|
||||
for idx, in := range testCasesStringMap {
|
||||
if in == nil {
|
||||
continue
|
||||
}
|
||||
out := aws.StringMap(in)
|
||||
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
|
||||
for i := range out {
|
||||
assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
|
||||
}
|
||||
|
||||
out2 := aws.StringValueMap(out)
|
||||
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
|
||||
assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
|
||||
}
|
||||
}
|
||||
|
||||
var testCasesBoolSlice = [][]bool{
|
||||
{true, true, false, false},
|
||||
}
|
||||
|
||||
func TestBoolSlice(t *testing.T) {
|
||||
for idx, in := range testCasesBoolSlice {
|
||||
if in == nil {
|
||||
continue
|
||||
}
|
||||
out := aws.BoolSlice(in)
|
||||
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
|
||||
for i := range out {
|
||||
assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
|
||||
}
|
||||
|
||||
out2 := aws.BoolValueSlice(out)
|
||||
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
|
||||
assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
|
||||
}
|
||||
}
|
||||
|
||||
var testCasesBoolValueSlice = [][]*bool{}
|
||||
|
||||
func TestBoolValueSlice(t *testing.T) {
|
||||
for idx, in := range testCasesBoolValueSlice {
|
||||
if in == nil {
|
||||
continue
|
||||
}
|
||||
out := aws.BoolValueSlice(in)
|
||||
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
|
||||
for i := range out {
|
||||
if in[i] == nil {
|
||||
assert.Empty(t, out[i], "Unexpected value at idx %d", idx)
|
||||
} else {
|
||||
assert.Equal(t, *(in[i]), out[i], "Unexpected value at idx %d", idx)
|
||||
}
|
||||
}
|
||||
|
||||
out2 := aws.BoolSlice(out)
|
||||
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
|
||||
for i := range out2 {
|
||||
if in[i] == nil {
|
||||
assert.Empty(t, *(out2[i]), "Unexpected value at idx %d", idx)
|
||||
} else {
|
||||
assert.Equal(t, in[i], out2[i], "Unexpected value at idx %d", idx)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var testCasesBoolMap = []map[string]bool{
|
||||
{"a": true, "b": false, "c": true},
|
||||
}
|
||||
|
||||
func TestBoolMap(t *testing.T) {
|
||||
for idx, in := range testCasesBoolMap {
|
||||
if in == nil {
|
||||
continue
|
||||
}
|
||||
out := aws.BoolMap(in)
|
||||
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
|
||||
for i := range out {
|
||||
assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
|
||||
}
|
||||
|
||||
out2 := aws.BoolValueMap(out)
|
||||
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
|
||||
assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
|
||||
}
|
||||
}
|
||||
|
||||
var testCasesIntSlice = [][]int{
|
||||
{1, 2, 3, 4},
|
||||
}
|
||||
|
||||
func TestIntSlice(t *testing.T) {
|
||||
for idx, in := range testCasesIntSlice {
|
||||
if in == nil {
|
||||
continue
|
||||
}
|
||||
out := aws.IntSlice(in)
|
||||
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
|
||||
for i := range out {
|
||||
assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
|
||||
}
|
||||
|
||||
out2 := aws.IntValueSlice(out)
|
||||
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
|
||||
assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
|
||||
}
|
||||
}
|
||||
|
||||
var testCasesIntValueSlice = [][]*int{}
|
||||
|
||||
func TestIntValueSlice(t *testing.T) {
|
||||
for idx, in := range testCasesIntValueSlice {
|
||||
if in == nil {
|
||||
continue
|
||||
}
|
||||
out := aws.IntValueSlice(in)
|
||||
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
|
||||
for i := range out {
|
||||
if in[i] == nil {
|
||||
assert.Empty(t, out[i], "Unexpected value at idx %d", idx)
|
||||
} else {
|
||||
assert.Equal(t, *(in[i]), out[i], "Unexpected value at idx %d", idx)
|
||||
}
|
||||
}
|
||||
|
||||
out2 := aws.IntSlice(out)
|
||||
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
|
||||
for i := range out2 {
|
||||
if in[i] == nil {
|
||||
assert.Empty(t, *(out2[i]), "Unexpected value at idx %d", idx)
|
||||
} else {
|
||||
assert.Equal(t, in[i], out2[i], "Unexpected value at idx %d", idx)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var testCasesIntMap = []map[string]int{
|
||||
{"a": 3, "b": 2, "c": 1},
|
||||
}
|
||||
|
||||
func TestIntMap(t *testing.T) {
|
||||
for idx, in := range testCasesIntMap {
|
||||
if in == nil {
|
||||
continue
|
||||
}
|
||||
out := aws.IntMap(in)
|
||||
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
|
||||
for i := range out {
|
||||
assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
|
||||
}
|
||||
|
||||
out2 := aws.IntValueMap(out)
|
||||
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
|
||||
assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
|
||||
}
|
||||
}
|
||||
|
||||
var testCasesInt64Slice = [][]int64{
|
||||
{1, 2, 3, 4},
|
||||
}
|
||||
|
||||
func TestInt64Slice(t *testing.T) {
|
||||
for idx, in := range testCasesInt64Slice {
|
||||
if in == nil {
|
||||
continue
|
||||
}
|
||||
out := aws.Int64Slice(in)
|
||||
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
|
||||
for i := range out {
|
||||
assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
|
||||
}
|
||||
|
||||
out2 := aws.Int64ValueSlice(out)
|
||||
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
|
||||
assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
|
||||
}
|
||||
}
|
||||
|
||||
var testCasesInt64ValueSlice = [][]*int64{}
|
||||
|
||||
func TestInt64ValueSlice(t *testing.T) {
|
||||
for idx, in := range testCasesInt64ValueSlice {
|
||||
if in == nil {
|
||||
continue
|
||||
}
|
||||
out := aws.Int64ValueSlice(in)
|
||||
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
|
||||
for i := range out {
|
||||
if in[i] == nil {
|
||||
assert.Empty(t, out[i], "Unexpected value at idx %d", idx)
|
||||
} else {
|
||||
assert.Equal(t, *(in[i]), out[i], "Unexpected value at idx %d", idx)
|
||||
}
|
||||
}
|
||||
|
||||
out2 := aws.Int64Slice(out)
|
||||
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
|
||||
for i := range out2 {
|
||||
if in[i] == nil {
|
||||
assert.Empty(t, *(out2[i]), "Unexpected value at idx %d", idx)
|
||||
} else {
|
||||
assert.Equal(t, in[i], out2[i], "Unexpected value at idx %d", idx)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var testCasesInt64Map = []map[string]int64{
|
||||
{"a": 3, "b": 2, "c": 1},
|
||||
}
|
||||
|
||||
func TestInt64Map(t *testing.T) {
|
||||
for idx, in := range testCasesInt64Map {
|
||||
if in == nil {
|
||||
continue
|
||||
}
|
||||
out := aws.Int64Map(in)
|
||||
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
|
||||
for i := range out {
|
||||
assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
|
||||
}
|
||||
|
||||
out2 := aws.Int64ValueMap(out)
|
||||
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
|
||||
assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
|
||||
}
|
||||
}
|
||||
|
||||
var testCasesFloat64Slice = [][]float64{
|
||||
{1, 2, 3, 4},
|
||||
}
|
||||
|
||||
func TestFloat64Slice(t *testing.T) {
|
||||
for idx, in := range testCasesFloat64Slice {
|
||||
if in == nil {
|
||||
continue
|
||||
}
|
||||
out := aws.Float64Slice(in)
|
||||
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
|
||||
for i := range out {
|
||||
assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
|
||||
}
|
||||
|
||||
out2 := aws.Float64ValueSlice(out)
|
||||
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
|
||||
assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
|
||||
}
|
||||
}
|
||||
|
||||
var testCasesFloat64ValueSlice = [][]*float64{}
|
||||
|
||||
func TestFloat64ValueSlice(t *testing.T) {
|
||||
for idx, in := range testCasesFloat64ValueSlice {
|
||||
if in == nil {
|
||||
continue
|
||||
}
|
||||
out := aws.Float64ValueSlice(in)
|
||||
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
|
||||
for i := range out {
|
||||
if in[i] == nil {
|
||||
assert.Empty(t, out[i], "Unexpected value at idx %d", idx)
|
||||
} else {
|
||||
assert.Equal(t, *(in[i]), out[i], "Unexpected value at idx %d", idx)
|
||||
}
|
||||
}
|
||||
|
||||
out2 := aws.Float64Slice(out)
|
||||
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
|
||||
for i := range out2 {
|
||||
if in[i] == nil {
|
||||
assert.Empty(t, *(out2[i]), "Unexpected value at idx %d", idx)
|
||||
} else {
|
||||
assert.Equal(t, in[i], out2[i], "Unexpected value at idx %d", idx)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var testCasesFloat64Map = []map[string]float64{
|
||||
{"a": 3, "b": 2, "c": 1},
|
||||
}
|
||||
|
||||
func TestFloat64Map(t *testing.T) {
|
||||
for idx, in := range testCasesFloat64Map {
|
||||
if in == nil {
|
||||
continue
|
||||
}
|
||||
out := aws.Float64Map(in)
|
||||
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
|
||||
for i := range out {
|
||||
assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
|
||||
}
|
||||
|
||||
out2 := aws.Float64ValueMap(out)
|
||||
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
|
||||
assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
|
||||
}
|
||||
}
|
||||
|
||||
var testCasesTimeSlice = [][]time.Time{
|
||||
{time.Now(), time.Now().AddDate(100, 0, 0)},
|
||||
}
|
||||
|
||||
func TestTimeSlice(t *testing.T) {
|
||||
for idx, in := range testCasesTimeSlice {
|
||||
if in == nil {
|
||||
continue
|
||||
}
|
||||
out := aws.TimeSlice(in)
|
||||
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
|
||||
for i := range out {
|
||||
assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
|
||||
}
|
||||
|
||||
out2 := aws.TimeValueSlice(out)
|
||||
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
|
||||
assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
|
||||
}
|
||||
}
|
||||
|
||||
var testCasesTimeValueSlice = [][]*time.Time{}
|
||||
|
||||
func TestTimeValueSlice(t *testing.T) {
|
||||
for idx, in := range testCasesTimeValueSlice {
|
||||
if in == nil {
|
||||
continue
|
||||
}
|
||||
out := aws.TimeValueSlice(in)
|
||||
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
|
||||
for i := range out {
|
||||
if in[i] == nil {
|
||||
assert.Empty(t, out[i], "Unexpected value at idx %d", idx)
|
||||
} else {
|
||||
assert.Equal(t, *(in[i]), out[i], "Unexpected value at idx %d", idx)
|
||||
}
|
||||
}
|
||||
|
||||
out2 := aws.TimeSlice(out)
|
||||
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
|
||||
for i := range out2 {
|
||||
if in[i] == nil {
|
||||
assert.Empty(t, *(out2[i]), "Unexpected value at idx %d", idx)
|
||||
} else {
|
||||
assert.Equal(t, in[i], out2[i], "Unexpected value at idx %d", idx)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var testCasesTimeMap = []map[string]time.Time{
|
||||
{"a": time.Now().AddDate(-100, 0, 0), "b": time.Now()},
|
||||
}
|
||||
|
||||
func TestTimeMap(t *testing.T) {
|
||||
for idx, in := range testCasesTimeMap {
|
||||
if in == nil {
|
||||
continue
|
||||
}
|
||||
out := aws.TimeMap(in)
|
||||
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
|
||||
for i := range out {
|
||||
assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
|
||||
}
|
||||
|
||||
out2 := aws.TimeValueMap(out)
|
||||
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
|
||||
assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
|
||||
}
|
||||
}
|
2
Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/chain_provider.go
generated
vendored
2
Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/chain_provider.go
generated
vendored
|
@ -7,6 +7,8 @@ import (
|
|||
var (
|
||||
// ErrNoValidProvidersFoundInChain Is returned when there are no valid
|
||||
// providers in the ChainProvider.
|
||||
//
|
||||
// @readonly
|
||||
ErrNoValidProvidersFoundInChain = awserr.New("NoCredentialProviders", "no valid providers in chain", nil)
|
||||
)
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@ import (
|
|||
// svc := s3.New(&aws.Config{Credentials: AnonymousCredentials})
|
||||
// // Access public S3 buckets.
|
||||
//
|
||||
// @readonly
|
||||
var AnonymousCredentials = NewStaticCredentials("", "", "")
|
||||
|
||||
// A Value is the AWS credentials value for individual credential fields.
|
||||
|
|
1
Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/ec2_role_provider.go
generated
vendored
1
Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/ec2_role_provider.go
generated
vendored
|
@ -31,7 +31,6 @@ const metadataCredentialsEndpoint = "http://169.254.169.254/latest/meta-data/iam
|
|||
// // specified the credentials will be expired early
|
||||
// ExpiryWindow: 0,
|
||||
// }
|
||||
//
|
||||
type EC2RoleProvider struct {
|
||||
Expiry
|
||||
|
||||
|
|
10
Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/env_provider.go
generated
vendored
10
Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/env_provider.go
generated
vendored
|
@ -9,9 +9,14 @@ import (
|
|||
var (
|
||||
// ErrAccessKeyIDNotFound is returned when the AWS Access Key ID can't be
|
||||
// found in the process's environment.
|
||||
//
|
||||
// @readonly
|
||||
ErrAccessKeyIDNotFound = awserr.New("EnvAccessKeyNotFound", "AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY not found in environment", nil)
|
||||
|
||||
// ErrSecretAccessKeyNotFound is returned when the AWS Secret Access Key
|
||||
// can't be found in the process's environment.
|
||||
//
|
||||
// @readonly
|
||||
ErrSecretAccessKeyNotFound = awserr.New("EnvSecretNotFound", "AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY not found in environment", nil)
|
||||
)
|
||||
|
||||
|
@ -19,8 +24,9 @@ var (
|
|||
// running process. Environment credentials never expire.
|
||||
//
|
||||
// Environment variables used:
|
||||
// - Access Key ID: AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY
|
||||
// - Secret Access Key: AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY
|
||||
//
|
||||
// * Access Key ID: AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY
|
||||
// * Secret Access Key: AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY
|
||||
type EnvProvider struct {
|
||||
retrieved bool
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@ import (
|
|||
|
||||
var (
|
||||
// ErrSharedCredentialsHomeNotFound is emitted when the user directory cannot be found.
|
||||
//
|
||||
// @readonly
|
||||
ErrSharedCredentialsHomeNotFound = awserr.New("UserHomeNotFound", "user home directory not found.", nil)
|
||||
)
|
||||
|
||||
|
|
2
Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/static_provider.go
generated
vendored
2
Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/static_provider.go
generated
vendored
|
@ -6,6 +6,8 @@ import (
|
|||
|
||||
var (
|
||||
// ErrStaticCredentialsEmpty is emitted when static credentials are empty.
|
||||
//
|
||||
// @readonly
|
||||
ErrStaticCredentialsEmpty = awserr.New("EmptyStaticCreds", "static credentials are empty", nil)
|
||||
)
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ func (p *AssumeRoleProvider) Retrieve() (credentials.Value, error) {
|
|||
}
|
||||
|
||||
roleOutput, err := p.Client.AssumeRole(&sts.AssumeRoleInput{
|
||||
DurationSeconds: aws.Long(int64(p.Duration / time.Second)),
|
||||
DurationSeconds: aws.Int64(int64(p.Duration / time.Second)),
|
||||
RoleARN: aws.String(p.RoleARN),
|
||||
RoleSessionName: aws.String(p.RoleSessionName),
|
||||
})
|
||||
|
|
|
@ -90,7 +90,7 @@ func SendHandler(r *Request) {
|
|||
}
|
||||
// Catch all other request errors.
|
||||
r.Error = awserr.New("RequestError", "send request failed", err)
|
||||
r.Retryable.Set(true) // network errors are retryable
|
||||
r.Retryable = Bool(true) // network errors are retryable
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,8 +107,8 @@ func ValidateResponseHandler(r *Request) {
|
|||
func AfterRetryHandler(r *Request) {
|
||||
// If one of the other handlers already set the retry state
|
||||
// we don't want to override it based on the service's state
|
||||
if !r.Retryable.IsSet() {
|
||||
r.Retryable.Set(r.Service.ShouldRetry(r))
|
||||
if r.Retryable == nil {
|
||||
r.Retryable = Bool(r.Service.ShouldRetry(r))
|
||||
}
|
||||
|
||||
if r.WillRetry() {
|
||||
|
@ -134,10 +134,14 @@ func AfterRetryHandler(r *Request) {
|
|||
var (
|
||||
// ErrMissingRegion is an error that is returned if region configuration is
|
||||
// not found.
|
||||
//
|
||||
// @readonly
|
||||
ErrMissingRegion error = awserr.New("MissingRegion", "could not find region configuration", nil)
|
||||
|
||||
// ErrMissingEndpoint is an error that is returned if an endpoint cannot be
|
||||
// resolved for a service.
|
||||
//
|
||||
// @readonly
|
||||
ErrMissingEndpoint error = awserr.New("MissingEndpoint", "'Endpoint' configuration is required for this service", nil)
|
||||
)
|
||||
|
||||
|
@ -145,7 +149,7 @@ var (
|
|||
// appropriate Region and Endpoint set. Will set r.Error if the endpoint or
|
||||
// region is not valid.
|
||||
func ValidateEndpointHandler(r *Request) {
|
||||
if r.Service.SigningRegion == "" && r.Service.Config.Region == "" {
|
||||
if r.Service.SigningRegion == "" && StringValue(r.Service.Config.Region) == "" {
|
||||
r.Error = ErrMissingRegion
|
||||
} else if r.Service.Endpoint == "" {
|
||||
r.Error = ErrMissingEndpoint
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
|
||||
func TestValidateEndpointHandler(t *testing.T) {
|
||||
os.Clearenv()
|
||||
svc := NewService(&Config{Region: "us-west-2"})
|
||||
svc := NewService(NewConfig().WithRegion("us-west-2"))
|
||||
svc.Handlers.Clear()
|
||||
svc.Handlers.Validate.PushBack(ValidateEndpointHandler)
|
||||
|
||||
|
@ -37,11 +37,11 @@ func TestValidateEndpointHandlerErrorRegion(t *testing.T) {
|
|||
|
||||
type mockCredsProvider struct {
|
||||
expired bool
|
||||
retreiveCalled bool
|
||||
retrieveCalled bool
|
||||
}
|
||||
|
||||
func (m *mockCredsProvider) Retrieve() (credentials.Value, error) {
|
||||
m.retreiveCalled = true
|
||||
m.retrieveCalled = true
|
||||
return credentials.Value{}, nil
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ func (m *mockCredsProvider) IsExpired() bool {
|
|||
func TestAfterRetryRefreshCreds(t *testing.T) {
|
||||
os.Clearenv()
|
||||
credProvider := &mockCredsProvider{}
|
||||
svc := NewService(&Config{Credentials: credentials.NewCredentials(credProvider), MaxRetries: 1})
|
||||
svc := NewService(&Config{Credentials: credentials.NewCredentials(credProvider), MaxRetries: Int(1)})
|
||||
|
||||
svc.Handlers.Clear()
|
||||
svc.Handlers.ValidateResponse.PushBack(func(r *Request) {
|
||||
|
@ -67,15 +67,15 @@ func TestAfterRetryRefreshCreds(t *testing.T) {
|
|||
})
|
||||
|
||||
assert.True(t, svc.Config.Credentials.IsExpired(), "Expect to start out expired")
|
||||
assert.False(t, credProvider.retreiveCalled)
|
||||
assert.False(t, credProvider.retrieveCalled)
|
||||
|
||||
req := NewRequest(svc, &Operation{Name: "Operation"}, nil, nil)
|
||||
req.Send()
|
||||
|
||||
assert.True(t, svc.Config.Credentials.IsExpired())
|
||||
assert.False(t, credProvider.retreiveCalled)
|
||||
assert.False(t, credProvider.retrieveCalled)
|
||||
|
||||
_, err := svc.Config.Credentials.Get()
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, credProvider.retreiveCalled)
|
||||
assert.True(t, credProvider.retrieveCalled)
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ func TestMultipleHandlers(t *testing.T) {
|
|||
r := &Request{}
|
||||
l := HandlerList{}
|
||||
l.PushBack(func(r *Request) { r.Data = nil })
|
||||
l.PushFront(func(r *Request) { r.Data = Boolean(true) })
|
||||
l.PushFront(func(r *Request) { r.Data = Bool(true) })
|
||||
l.Run(r)
|
||||
if r.Data != nil {
|
||||
t.Error("Expected handler to execute")
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
package aws
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
// A LogLevelType defines the level logging should be performed at. Used to instruct
|
||||
// the SDK which statements should be logged.
|
||||
type LogLevelType uint
|
||||
|
||||
// LogLevel returns the pointer to a LogLevel. Should be used to workaround
|
||||
// not being able to take the address of a non-composite literal.
|
||||
func LogLevel(l LogLevelType) *LogLevelType {
|
||||
return &l
|
||||
}
|
||||
|
||||
// Value returns the LogLevel value or the default value LogOff if the LogLevel
|
||||
// is nil. Safe to use on nil value LogLevelTypes.
|
||||
func (l *LogLevelType) Value() LogLevelType {
|
||||
if l != nil {
|
||||
return *l
|
||||
}
|
||||
return LogOff
|
||||
}
|
||||
|
||||
// Matches returns true if the v LogLevel is enabled by this LogLevel. Should be
|
||||
// used with logging sub levels. Is safe to use on nil value LogLevelTypes. If
|
||||
// LogLevel is nill, will default to LogOff comparison.
|
||||
func (l *LogLevelType) Matches(v LogLevelType) bool {
|
||||
c := l.Value()
|
||||
return c&v == v
|
||||
}
|
||||
|
||||
// AtLeast returns true if this LogLevel is at least high enough to satisfies v.
|
||||
// Is safe to use on nil value LogLevelTypes. If LogLevel is nill, will default
|
||||
// to LogOff comparison.
|
||||
func (l *LogLevelType) AtLeast(v LogLevelType) bool {
|
||||
c := l.Value()
|
||||
return c >= v
|
||||
}
|
||||
|
||||
const (
|
||||
// LogOff states that no logging should be performed by the SDK. This is the
|
||||
// default state of the SDK, and should be use to disable all logging.
|
||||
LogOff LogLevelType = iota * 0x1000
|
||||
|
||||
// LogDebug state that debug output should be logged by the SDK. This should
|
||||
// be used to inspect request made and responses received.
|
||||
LogDebug
|
||||
)
|
||||
|
||||
// Debug Logging Sub Levels
|
||||
const (
|
||||
// LogDebugWithSigning states that the SDK should log request signing and
|
||||
// presigning events. This should be used to log the signing details of
|
||||
// requests for debugging. Will also enable LogDebug.
|
||||
LogDebugWithSigning LogLevelType = LogDebug | (1 << iota)
|
||||
|
||||
// LogDebugWithHTTPBody states the SDK should log HTTP request and response
|
||||
// HTTP bodys in addition to the headers and path. This should be used to
|
||||
// see the body content of requests and responses made while using the SDK
|
||||
// Will also enable LogDebug.
|
||||
LogDebugWithHTTPBody
|
||||
)
|
||||
|
||||
// A Logger is a minimalistic interface for the SDK to log messages to. Should
|
||||
// be used to provide custom logging writers for the SDK to use.
|
||||
type Logger interface {
|
||||
Log(...interface{})
|
||||
}
|
||||
|
||||
// NewDefaultLogger returns a Logger which will write log messages to stdout, and
|
||||
// use same formatting runes as the stdlib log.Logger
|
||||
func NewDefaultLogger() Logger {
|
||||
return &defaultLogger{
|
||||
logger: log.New(os.Stdout, "", log.LstdFlags),
|
||||
}
|
||||
}
|
||||
|
||||
// A defaultLogger provides a minimalistic logger satisfying the Logger interface.
|
||||
type defaultLogger struct {
|
||||
logger *log.Logger
|
||||
}
|
||||
|
||||
// Log logs the parameters to the stdlib logger. See log.Println.
|
||||
func (l defaultLogger) Log(args ...interface{}) {
|
||||
l.logger.Println(args...)
|
||||
}
|
|
@ -44,7 +44,7 @@ func TestNoErrors(t *testing.T) {
|
|||
"key1": {Name: aws.String("Name")},
|
||||
"key2": {Name: aws.String("Name")},
|
||||
},
|
||||
RequiredBool: aws.Boolean(true),
|
||||
RequiredBool: aws.Bool(true),
|
||||
OptionalStruct: &ConditionalStructShape{Name: aws.String("Name")},
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ func TestNestedMissingRequiredParameters(t *testing.T) {
|
|||
"key1": {Name: aws.String("Name")},
|
||||
"key2": {},
|
||||
},
|
||||
RequiredBool: aws.Boolean(true),
|
||||
RequiredBool: aws.Bool(true),
|
||||
OptionalStruct: &ConditionalStructShape{},
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ type Request struct {
|
|||
Data interface{}
|
||||
RequestID string
|
||||
RetryCount uint
|
||||
Retryable SettableBool
|
||||
Retryable *bool
|
||||
RetryDelay time.Duration
|
||||
|
||||
built bool
|
||||
|
@ -89,7 +89,7 @@ func NewRequest(service *Service, operation *Operation, params interface{}, data
|
|||
|
||||
// WillRetry returns if the request's can be retried.
|
||||
func (r *Request) WillRetry() bool {
|
||||
return r.Error != nil && r.Retryable.Get() && r.RetryCount < r.Service.MaxRetries()
|
||||
return r.Error != nil && BoolValue(r.Retryable) && r.RetryCount < r.Service.MaxRetries()
|
||||
}
|
||||
|
||||
// ParamsFilled returns if the request's parameters have been populated
|
||||
|
@ -183,12 +183,12 @@ func (r *Request) Send() error {
|
|||
return r.Error
|
||||
}
|
||||
|
||||
if r.Retryable.Get() {
|
||||
if BoolValue(r.Retryable) {
|
||||
// Re-seek the body back to the original point in for a retry so that
|
||||
// send will send the body's contents again in the upcoming request.
|
||||
r.Body.Seek(r.bodyStart, 0)
|
||||
}
|
||||
r.Retryable.Reset()
|
||||
r.Retryable = nil
|
||||
|
||||
r.Handlers.Send.Run(r)
|
||||
if r.Error != nil {
|
||||
|
|
20
Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request_pagination_test.go
generated
vendored
20
Godeps/_workspace/src/github.com/aws/aws-sdk-go/aws/request_pagination_test.go
generated
vendored
|
@ -41,7 +41,7 @@ func TestPagination(t *testing.T) {
|
|||
reqNum++
|
||||
})
|
||||
|
||||
params := &dynamodb.ListTablesInput{Limit: aws.Long(2)}
|
||||
params := &dynamodb.ListTablesInput{Limit: aws.Int64(2)}
|
||||
err := db.ListTablesPages(params, func(p *dynamodb.ListTablesOutput, last bool) bool {
|
||||
numPages++
|
||||
for _, t := range p.TableNames {
|
||||
|
@ -93,7 +93,7 @@ func TestPaginationEachPage(t *testing.T) {
|
|||
reqNum++
|
||||
})
|
||||
|
||||
params := &dynamodb.ListTablesInput{Limit: aws.Long(2)}
|
||||
params := &dynamodb.ListTablesInput{Limit: aws.Int64(2)}
|
||||
req, _ := db.ListTablesRequest(params)
|
||||
err := req.EachPage(func(p interface{}, last bool) bool {
|
||||
numPages++
|
||||
|
@ -138,7 +138,7 @@ func TestPaginationEarlyExit(t *testing.T) {
|
|||
reqNum++
|
||||
})
|
||||
|
||||
params := &dynamodb.ListTablesInput{Limit: aws.Long(2)}
|
||||
params := &dynamodb.ListTablesInput{Limit: aws.Int64(2)}
|
||||
err := db.ListTablesPages(params, func(p *dynamodb.ListTablesOutput, last bool) bool {
|
||||
numPages++
|
||||
if numPages == 2 {
|
||||
|
@ -189,10 +189,10 @@ func TestPaginationTruncation(t *testing.T) {
|
|||
|
||||
reqNum := &count
|
||||
resps := []*s3.ListObjectsOutput{
|
||||
{IsTruncated: aws.Boolean(true), Contents: []*s3.Object{{Key: aws.String("Key1")}}},
|
||||
{IsTruncated: aws.Boolean(true), Contents: []*s3.Object{{Key: aws.String("Key2")}}},
|
||||
{IsTruncated: aws.Boolean(false), Contents: []*s3.Object{{Key: aws.String("Key3")}}},
|
||||
{IsTruncated: aws.Boolean(true), Contents: []*s3.Object{{Key: aws.String("Key4")}}},
|
||||
{IsTruncated: aws.Bool(true), Contents: []*s3.Object{{Key: aws.String("Key1")}}},
|
||||
{IsTruncated: aws.Bool(true), Contents: []*s3.Object{{Key: aws.String("Key2")}}},
|
||||
{IsTruncated: aws.Bool(false), Contents: []*s3.Object{{Key: aws.String("Key3")}}},
|
||||
{IsTruncated: aws.Bool(true), Contents: []*s3.Object{{Key: aws.String("Key4")}}},
|
||||
}
|
||||
|
||||
client.Handlers.Send.Clear() // mock sending
|
||||
|
@ -218,7 +218,7 @@ func TestPaginationTruncation(t *testing.T) {
|
|||
// Try again without truncation token at all
|
||||
count = 0
|
||||
resps[1].IsTruncated = nil
|
||||
resps[2].IsTruncated = aws.Boolean(true)
|
||||
resps[2].IsTruncated = aws.Bool(true)
|
||||
results = []string{}
|
||||
err = client.ListObjectsPages(params, func(p *s3.ListObjectsOutput, last bool) bool {
|
||||
results = append(results, *p.Contents[0].Key)
|
||||
|
@ -265,7 +265,7 @@ func BenchmarkCodegenIterator(b *testing.B) {
|
|||
reqNum++
|
||||
})
|
||||
|
||||
input := &dynamodb.ListTablesInput{Limit: aws.Long(2)}
|
||||
input := &dynamodb.ListTablesInput{Limit: aws.Int64(2)}
|
||||
iter := func(fn func(*dynamodb.ListTablesOutput, bool) bool) error {
|
||||
page, _ := db.ListTablesRequest(input)
|
||||
for ; page != nil; page = page.NextPage() {
|
||||
|
@ -294,7 +294,7 @@ func BenchmarkEachPageIterator(b *testing.B) {
|
|||
reqNum++
|
||||
})
|
||||
|
||||
input := &dynamodb.ListTablesInput{Limit: aws.Long(2)}
|
||||
input := &dynamodb.ListTablesInput{Limit: aws.Int64(2)}
|
||||
for i := 0; i < b.N; i++ {
|
||||
reqNum = 0
|
||||
req, _ := db.ListTablesRequest(input)
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
@ -72,7 +71,7 @@ func TestRequestRecoverRetry5xx(t *testing.T) {
|
|||
{StatusCode: 200, Body: body(`{"data":"valid"}`)},
|
||||
}
|
||||
|
||||
s := NewService(&Config{MaxRetries: 10})
|
||||
s := NewService(NewConfig().WithMaxRetries(10))
|
||||
s.Handlers.Validate.Clear()
|
||||
s.Handlers.Unmarshal.PushBack(unmarshal)
|
||||
s.Handlers.UnmarshalError.PushBack(unmarshalError)
|
||||
|
@ -98,7 +97,7 @@ func TestRequestRecoverRetry4xxRetryable(t *testing.T) {
|
|||
{StatusCode: 200, Body: body(`{"data":"valid"}`)},
|
||||
}
|
||||
|
||||
s := NewService(&Config{MaxRetries: 10})
|
||||
s := NewService(NewConfig().WithMaxRetries(10))
|
||||
s.Handlers.Validate.Clear()
|
||||
s.Handlers.Unmarshal.PushBack(unmarshal)
|
||||
s.Handlers.UnmarshalError.PushBack(unmarshalError)
|
||||
|
@ -117,7 +116,7 @@ func TestRequestRecoverRetry4xxRetryable(t *testing.T) {
|
|||
|
||||
// test that retries don't occur for 4xx status codes with a response type that can't be retried
|
||||
func TestRequest4xxUnretryable(t *testing.T) {
|
||||
s := NewService(&Config{MaxRetries: 10})
|
||||
s := NewService(NewConfig().WithMaxRetries(10))
|
||||
s.Handlers.Validate.Clear()
|
||||
s.Handlers.Unmarshal.PushBack(unmarshal)
|
||||
s.Handlers.UnmarshalError.PushBack(unmarshalError)
|
||||
|
@ -153,7 +152,7 @@ func TestRequestExhaustRetries(t *testing.T) {
|
|||
{StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
|
||||
}
|
||||
|
||||
s := NewService(&Config{MaxRetries: -1})
|
||||
s := NewService(NewConfig().WithMaxRetries(DefaultRetries))
|
||||
s.Handlers.Validate.Clear()
|
||||
s.Handlers.Unmarshal.PushBack(unmarshal)
|
||||
s.Handlers.UnmarshalError.PushBack(unmarshalError)
|
||||
|
@ -173,7 +172,14 @@ func TestRequestExhaustRetries(t *testing.T) {
|
|||
assert.Equal(t, "UnknownError", err.(awserr.Error).Code())
|
||||
assert.Equal(t, "An error occurred.", err.(awserr.Error).Message())
|
||||
assert.Equal(t, 3, int(r.RetryCount))
|
||||
assert.True(t, reflect.DeepEqual([]time.Duration{30 * time.Millisecond, 60 * time.Millisecond, 120 * time.Millisecond}, delays))
|
||||
|
||||
expectDelays := []struct{ min, max time.Duration }{{30, 59}, {60, 118}, {120, 236}}
|
||||
for i, v := range delays {
|
||||
min := expectDelays[i].min * time.Millisecond
|
||||
max := expectDelays[i].max * time.Millisecond
|
||||
assert.True(t, min <= v && v <= max,
|
||||
"Expect delay to be within range, i:%d, v:%s, min:%s, max:%s", i, v, min, max)
|
||||
}
|
||||
}
|
||||
|
||||
// test that the request is retried after the credentials are expired.
|
||||
|
@ -184,7 +190,7 @@ func TestRequestRecoverExpiredCreds(t *testing.T) {
|
|||
{StatusCode: 200, Body: body(`{"data":"valid"}`)},
|
||||
}
|
||||
|
||||
s := NewService(&Config{MaxRetries: 10, Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "")})
|
||||
s := NewService(&Config{MaxRetries: Int(10), Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "")})
|
||||
s.Handlers.Validate.Clear()
|
||||
s.Handlers.Unmarshal.PushBack(unmarshal)
|
||||
s.Handlers.UnmarshalError.PushBack(unmarshalError)
|
||||
|
|
|
@ -3,6 +3,7 @@ package aws
|
|||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
"regexp"
|
||||
|
@ -17,7 +18,6 @@ import (
|
|||
type Service struct {
|
||||
Config *Config
|
||||
Handlers Handlers
|
||||
ManualSend bool
|
||||
ServiceName string
|
||||
APIVersion string
|
||||
Endpoint string
|
||||
|
@ -66,23 +66,23 @@ func (s *Service) Initialize() {
|
|||
s.AddDebugHandlers()
|
||||
s.buildEndpoint()
|
||||
|
||||
if !s.Config.DisableParamValidation {
|
||||
if !BoolValue(s.Config.DisableParamValidation) {
|
||||
s.Handlers.Validate.PushBack(ValidateParameters)
|
||||
}
|
||||
}
|
||||
|
||||
// buildEndpoint builds the endpoint values the service will use to make requests with.
|
||||
func (s *Service) buildEndpoint() {
|
||||
if s.Config.Endpoint != "" {
|
||||
s.Endpoint = s.Config.Endpoint
|
||||
if StringValue(s.Config.Endpoint) != "" {
|
||||
s.Endpoint = *s.Config.Endpoint
|
||||
} else {
|
||||
s.Endpoint, s.SigningRegion =
|
||||
endpoints.EndpointForRegion(s.ServiceName, s.Config.Region)
|
||||
endpoints.EndpointForRegion(s.ServiceName, StringValue(s.Config.Region))
|
||||
}
|
||||
|
||||
if s.Endpoint != "" && !schemeRE.MatchString(s.Endpoint) {
|
||||
scheme := "https"
|
||||
if s.Config.DisableSSL {
|
||||
if BoolValue(s.Config.DisableSSL) {
|
||||
scheme = "http"
|
||||
}
|
||||
s.Endpoint = scheme + "://" + s.Endpoint
|
||||
|
@ -92,45 +92,59 @@ func (s *Service) buildEndpoint() {
|
|||
// AddDebugHandlers injects debug logging handlers into the service to log request
|
||||
// debug information.
|
||||
func (s *Service) AddDebugHandlers() {
|
||||
out := s.Config.Logger
|
||||
if s.Config.LogLevel == 0 {
|
||||
if !s.Config.LogLevel.AtLeast(LogDebug) {
|
||||
return
|
||||
}
|
||||
|
||||
s.Handlers.Send.PushFront(func(r *Request) {
|
||||
logBody := r.Config.LogHTTPBody
|
||||
dumpedBody, _ := httputil.DumpRequestOut(r.HTTPRequest, logBody)
|
||||
s.Handlers.Send.PushFront(logRequest)
|
||||
s.Handlers.Send.PushBack(logResponse)
|
||||
}
|
||||
|
||||
fmt.Fprintf(out, "---[ REQUEST POST-SIGN ]-----------------------------\n")
|
||||
fmt.Fprintf(out, "%s\n", string(dumpedBody))
|
||||
fmt.Fprintf(out, "-----------------------------------------------------\n")
|
||||
})
|
||||
s.Handlers.Send.PushBack(func(r *Request) {
|
||||
fmt.Fprintf(out, "---[ RESPONSE ]--------------------------------------\n")
|
||||
if r.HTTPResponse != nil {
|
||||
logBody := r.Config.LogHTTPBody
|
||||
dumpedBody, _ := httputil.DumpResponse(r.HTTPResponse, logBody)
|
||||
fmt.Fprintf(out, "%s\n", string(dumpedBody))
|
||||
} else if r.Error != nil {
|
||||
fmt.Fprintf(out, "%s\n", r.Error)
|
||||
}
|
||||
fmt.Fprintf(out, "-----------------------------------------------------\n")
|
||||
})
|
||||
const logReqMsg = `DEBUG: Request %s/%s Details:
|
||||
---[ REQUEST POST-SIGN ]-----------------------------
|
||||
%s
|
||||
-----------------------------------------------------`
|
||||
|
||||
func logRequest(r *Request) {
|
||||
logBody := r.Config.LogLevel.Matches(LogDebugWithHTTPBody)
|
||||
dumpedBody, _ := httputil.DumpRequestOut(r.HTTPRequest, logBody)
|
||||
|
||||
r.Config.Logger.Log(fmt.Sprintf(logReqMsg, r.ServiceName, r.Operation.Name, string(dumpedBody)))
|
||||
}
|
||||
|
||||
const logRespMsg = `DEBUG: Response %s/%s Details:
|
||||
---[ RESPONSE ]--------------------------------------
|
||||
%s
|
||||
-----------------------------------------------------`
|
||||
|
||||
func logResponse(r *Request) {
|
||||
var msg = "no reponse data"
|
||||
if r.HTTPResponse != nil {
|
||||
logBody := r.Config.LogLevel.Matches(LogDebugWithHTTPBody)
|
||||
dumpedBody, _ := httputil.DumpResponse(r.HTTPResponse, logBody)
|
||||
msg = string(dumpedBody)
|
||||
} else if r.Error != nil {
|
||||
msg = r.Error.Error()
|
||||
}
|
||||
r.Config.Logger.Log(fmt.Sprintf(logRespMsg, r.ServiceName, r.Operation.Name, msg))
|
||||
}
|
||||
|
||||
// MaxRetries returns the number of maximum returns the service will use to make
|
||||
// an individual API request.
|
||||
func (s *Service) MaxRetries() uint {
|
||||
if s.Config.MaxRetries < 0 {
|
||||
if IntValue(s.Config.MaxRetries) < 0 {
|
||||
return s.DefaultMaxRetries
|
||||
}
|
||||
return uint(s.Config.MaxRetries)
|
||||
return uint(IntValue(s.Config.MaxRetries))
|
||||
}
|
||||
|
||||
var seededRand = rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
|
||||
// retryRules returns the delay duration before retrying this request again
|
||||
func retryRules(r *Request) time.Duration {
|
||||
delay := time.Duration(math.Pow(2, float64(r.RetryCount))) * 30
|
||||
return delay * time.Millisecond
|
||||
|
||||
delay := int(math.Pow(2, float64(r.RetryCount))) * (seededRand.Intn(30) + 30)
|
||||
return time.Duration(delay) * time.Millisecond
|
||||
}
|
||||
|
||||
// retryableCodes is a collection of service response codes which are retry-able
|
||||
|
@ -139,6 +153,9 @@ var retryableCodes = map[string]struct{}{
|
|||
"RequestError": {},
|
||||
"ProvisionedThroughputExceededException": {},
|
||||
"Throttling": {},
|
||||
"ThrottlingException": {},
|
||||
"RequestLimitExceeded": {},
|
||||
"RequestThrottled": {},
|
||||
}
|
||||
|
||||
// credsExpiredCodes is a collection of error codes which signify the credentials
|
||||
|
|
|
@ -1,36 +1,9 @@
|
|||
package aws
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"time"
|
||||
)
|
||||
|
||||
// String converts a Go string into a string pointer.
|
||||
func String(v string) *string {
|
||||
return &v
|
||||
}
|
||||
|
||||
// Boolean converts a Go bool into a boolean pointer.
|
||||
func Boolean(v bool) *bool {
|
||||
return &v
|
||||
}
|
||||
|
||||
// Long converts a Go int64 into a long pointer.
|
||||
func Long(v int64) *int64 {
|
||||
return &v
|
||||
}
|
||||
|
||||
// Double converts a Go float64 into a double pointer.
|
||||
func Double(v float64) *float64 {
|
||||
return &v
|
||||
}
|
||||
|
||||
// Time converts a Go Time into a Time pointer
|
||||
func Time(t time.Time) *time.Time {
|
||||
return &t
|
||||
}
|
||||
|
||||
// ReadSeekCloser wraps a io.Reader returning a ReaderSeakerCloser
|
||||
func ReadSeekCloser(r io.Reader) ReaderSeekerCloser {
|
||||
return ReaderSeekerCloser{r}
|
||||
|
@ -80,52 +53,3 @@ func (r ReaderSeekerCloser) Close() error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// A SettableBool provides a boolean value which includes the state if
|
||||
// the value was set or unset. The set state is in addition to the value's
|
||||
// value(true|false)
|
||||
type SettableBool struct {
|
||||
value bool
|
||||
set bool
|
||||
}
|
||||
|
||||
// SetBool returns a SettableBool with a value set
|
||||
func SetBool(value bool) SettableBool {
|
||||
return SettableBool{value: value, set: true}
|
||||
}
|
||||
|
||||
// Get returns the value. Will always be false if the SettableBool was not set.
|
||||
func (b *SettableBool) Get() bool {
|
||||
if !b.set {
|
||||
return false
|
||||
}
|
||||
return b.value
|
||||
}
|
||||
|
||||
// Set sets the value and updates the state that the value has been set.
|
||||
func (b *SettableBool) Set(value bool) {
|
||||
b.value = value
|
||||
b.set = true
|
||||
}
|
||||
|
||||
// IsSet returns if the value has been set
|
||||
func (b *SettableBool) IsSet() bool {
|
||||
return b.set
|
||||
}
|
||||
|
||||
// Reset resets the state and value of the SettableBool to its initial default
|
||||
// state of not set and zero value.
|
||||
func (b *SettableBool) Reset() {
|
||||
b.value = false
|
||||
b.set = false
|
||||
}
|
||||
|
||||
// String returns the string representation of the value if set. Zero if not set.
|
||||
func (b *SettableBool) String() string {
|
||||
return fmt.Sprintf("%t", b.Get())
|
||||
}
|
||||
|
||||
// GoString returns the string representation of the SettableBool value and state
|
||||
func (b *SettableBool) GoString() string {
|
||||
return fmt.Sprintf("Bool{value:%t, set:%t}", b.value, b.set)
|
||||
}
|
||||
|
|
|
@ -5,4 +5,4 @@ package aws
|
|||
const SDKName = "aws-sdk-go"
|
||||
|
||||
// SDKVersion is the version of this SDK
|
||||
const SDKVersion = "0.6.4"
|
||||
const SDKVersion = "0.7.2"
|
||||
|
|
32
Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/ec2query/build.go
generated
vendored
Normal file
32
Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/ec2query/build.go
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
// Package ec2query provides serialisation of AWS EC2 requests and responses.
|
||||
package ec2query
|
||||
|
||||
//go:generate go run ../../fixtures/protocol/generate.go ../../fixtures/protocol/input/ec2.json build_test.go
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||
"github.com/aws/aws-sdk-go/internal/protocol/query/queryutil"
|
||||
)
|
||||
|
||||
// Build builds a request for the EC2 protocol.
|
||||
func Build(r *aws.Request) {
|
||||
body := url.Values{
|
||||
"Action": {r.Operation.Name},
|
||||
"Version": {r.Service.APIVersion},
|
||||
}
|
||||
if err := queryutil.Parse(body, r.Params, true); err != nil {
|
||||
r.Error = awserr.New("SerializationError", "failed encoding EC2 Query request", err)
|
||||
}
|
||||
|
||||
if r.ExpireTime == 0 {
|
||||
r.HTTPRequest.Method = "POST"
|
||||
r.HTTPRequest.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=utf-8")
|
||||
r.SetBufferBody([]byte(body.Encode()))
|
||||
} else { // This is a pre-signed request
|
||||
r.HTTPRequest.Method = "GET"
|
||||
r.HTTPRequest.URL.RawQuery = body.Encode()
|
||||
}
|
||||
}
|
860
Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/ec2query/build_test.go
generated
vendored
Normal file
860
Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/ec2query/build_test.go
generated
vendored
Normal file
|
@ -0,0 +1,860 @@
|
|||
package ec2query_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/internal/protocol/ec2query"
|
||||
"github.com/aws/aws-sdk-go/internal/protocol/xml/xmlutil"
|
||||
"github.com/aws/aws-sdk-go/internal/signer/v4"
|
||||
"github.com/aws/aws-sdk-go/internal/util"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var _ bytes.Buffer // always import bytes
|
||||
var _ http.Request
|
||||
var _ json.Marshaler
|
||||
var _ time.Time
|
||||
var _ xmlutil.XMLNode
|
||||
var _ xml.Attr
|
||||
var _ = ioutil.Discard
|
||||
var _ = util.Trim("")
|
||||
var _ = url.Values{}
|
||||
var _ = io.EOF
|
||||
|
||||
type InputService1ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
||||
// New returns a new InputService1ProtocolTest client.
|
||||
func NewInputService1ProtocolTest(config *aws.Config) *InputService1ProtocolTest {
|
||||
service := &aws.Service{
|
||||
Config: aws.DefaultConfig.Merge(config),
|
||||
ServiceName: "inputservice1protocoltest",
|
||||
APIVersion: "2014-01-01",
|
||||
}
|
||||
service.Initialize()
|
||||
|
||||
// Handlers
|
||||
service.Handlers.Sign.PushBack(v4.Sign)
|
||||
service.Handlers.Build.PushBack(ec2query.Build)
|
||||
service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
|
||||
service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
|
||||
service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
|
||||
|
||||
return &InputService1ProtocolTest{service}
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a InputService1ProtocolTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *InputService1ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {
|
||||
req := aws.NewRequest(c.Service, op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
const opInputService1TestCaseOperation1 = "OperationName"
|
||||
|
||||
// InputService1TestCaseOperation1Request generates a request for the InputService1TestCaseOperation1 operation.
|
||||
func (c *InputService1ProtocolTest) InputService1TestCaseOperation1Request(input *InputService1TestShapeInputShape) (req *aws.Request, output *InputService1TestShapeInputService1TestCaseOperation1Output) {
|
||||
op := &aws.Operation{
|
||||
Name: opInputService1TestCaseOperation1,
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &InputService1TestShapeInputShape{}
|
||||
}
|
||||
|
||||
req = c.newRequest(op, input, output)
|
||||
output = &InputService1TestShapeInputService1TestCaseOperation1Output{}
|
||||
req.Data = output
|
||||
return
|
||||
}
|
||||
|
||||
func (c *InputService1ProtocolTest) InputService1TestCaseOperation1(input *InputService1TestShapeInputShape) (*InputService1TestShapeInputService1TestCaseOperation1Output, error) {
|
||||
req, out := c.InputService1TestCaseOperation1Request(input)
|
||||
err := req.Send()
|
||||
return out, err
|
||||
}
|
||||
|
||||
type InputService1TestShapeInputService1TestCaseOperation1Output struct {
|
||||
metadataInputService1TestShapeInputService1TestCaseOperation1Output `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataInputService1TestShapeInputService1TestCaseOperation1Output struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type InputService1TestShapeInputShape struct {
|
||||
Bar *string `type:"string"`
|
||||
|
||||
Foo *string `type:"string"`
|
||||
|
||||
metadataInputService1TestShapeInputShape `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataInputService1TestShapeInputShape struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type InputService2ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
||||
// New returns a new InputService2ProtocolTest client.
|
||||
func NewInputService2ProtocolTest(config *aws.Config) *InputService2ProtocolTest {
|
||||
service := &aws.Service{
|
||||
Config: aws.DefaultConfig.Merge(config),
|
||||
ServiceName: "inputservice2protocoltest",
|
||||
APIVersion: "2014-01-01",
|
||||
}
|
||||
service.Initialize()
|
||||
|
||||
// Handlers
|
||||
service.Handlers.Sign.PushBack(v4.Sign)
|
||||
service.Handlers.Build.PushBack(ec2query.Build)
|
||||
service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
|
||||
service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
|
||||
service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
|
||||
|
||||
return &InputService2ProtocolTest{service}
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a InputService2ProtocolTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *InputService2ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {
|
||||
req := aws.NewRequest(c.Service, op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
const opInputService2TestCaseOperation1 = "OperationName"
|
||||
|
||||
// InputService2TestCaseOperation1Request generates a request for the InputService2TestCaseOperation1 operation.
|
||||
func (c *InputService2ProtocolTest) InputService2TestCaseOperation1Request(input *InputService2TestShapeInputShape) (req *aws.Request, output *InputService2TestShapeInputService2TestCaseOperation1Output) {
|
||||
op := &aws.Operation{
|
||||
Name: opInputService2TestCaseOperation1,
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &InputService2TestShapeInputShape{}
|
||||
}
|
||||
|
||||
req = c.newRequest(op, input, output)
|
||||
output = &InputService2TestShapeInputService2TestCaseOperation1Output{}
|
||||
req.Data = output
|
||||
return
|
||||
}
|
||||
|
||||
func (c *InputService2ProtocolTest) InputService2TestCaseOperation1(input *InputService2TestShapeInputShape) (*InputService2TestShapeInputService2TestCaseOperation1Output, error) {
|
||||
req, out := c.InputService2TestCaseOperation1Request(input)
|
||||
err := req.Send()
|
||||
return out, err
|
||||
}
|
||||
|
||||
type InputService2TestShapeInputService2TestCaseOperation1Output struct {
|
||||
metadataInputService2TestShapeInputService2TestCaseOperation1Output `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataInputService2TestShapeInputService2TestCaseOperation1Output struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type InputService2TestShapeInputShape struct {
|
||||
Bar *string `locationName:"barLocationName" type:"string"`
|
||||
|
||||
Foo *string `type:"string"`
|
||||
|
||||
Yuck *string `locationName:"yuckLocationName" queryName:"yuckQueryName" type:"string"`
|
||||
|
||||
metadataInputService2TestShapeInputShape `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataInputService2TestShapeInputShape struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type InputService3ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
||||
// New returns a new InputService3ProtocolTest client.
|
||||
func NewInputService3ProtocolTest(config *aws.Config) *InputService3ProtocolTest {
|
||||
service := &aws.Service{
|
||||
Config: aws.DefaultConfig.Merge(config),
|
||||
ServiceName: "inputservice3protocoltest",
|
||||
APIVersion: "2014-01-01",
|
||||
}
|
||||
service.Initialize()
|
||||
|
||||
// Handlers
|
||||
service.Handlers.Sign.PushBack(v4.Sign)
|
||||
service.Handlers.Build.PushBack(ec2query.Build)
|
||||
service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
|
||||
service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
|
||||
service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
|
||||
|
||||
return &InputService3ProtocolTest{service}
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a InputService3ProtocolTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *InputService3ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {
|
||||
req := aws.NewRequest(c.Service, op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
const opInputService3TestCaseOperation1 = "OperationName"
|
||||
|
||||
// InputService3TestCaseOperation1Request generates a request for the InputService3TestCaseOperation1 operation.
|
||||
func (c *InputService3ProtocolTest) InputService3TestCaseOperation1Request(input *InputService3TestShapeInputShape) (req *aws.Request, output *InputService3TestShapeInputService3TestCaseOperation1Output) {
|
||||
op := &aws.Operation{
|
||||
Name: opInputService3TestCaseOperation1,
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &InputService3TestShapeInputShape{}
|
||||
}
|
||||
|
||||
req = c.newRequest(op, input, output)
|
||||
output = &InputService3TestShapeInputService3TestCaseOperation1Output{}
|
||||
req.Data = output
|
||||
return
|
||||
}
|
||||
|
||||
func (c *InputService3ProtocolTest) InputService3TestCaseOperation1(input *InputService3TestShapeInputShape) (*InputService3TestShapeInputService3TestCaseOperation1Output, error) {
|
||||
req, out := c.InputService3TestCaseOperation1Request(input)
|
||||
err := req.Send()
|
||||
return out, err
|
||||
}
|
||||
|
||||
type InputService3TestShapeInputService3TestCaseOperation1Output struct {
|
||||
metadataInputService3TestShapeInputService3TestCaseOperation1Output `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataInputService3TestShapeInputService3TestCaseOperation1Output struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type InputService3TestShapeInputShape struct {
|
||||
StructArg *InputService3TestShapeStructType `locationName:"Struct" type:"structure"`
|
||||
|
||||
metadataInputService3TestShapeInputShape `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataInputService3TestShapeInputShape struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type InputService3TestShapeStructType struct {
|
||||
ScalarArg *string `locationName:"Scalar" type:"string"`
|
||||
|
||||
metadataInputService3TestShapeStructType `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataInputService3TestShapeStructType struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type InputService4ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
||||
// New returns a new InputService4ProtocolTest client.
|
||||
func NewInputService4ProtocolTest(config *aws.Config) *InputService4ProtocolTest {
|
||||
service := &aws.Service{
|
||||
Config: aws.DefaultConfig.Merge(config),
|
||||
ServiceName: "inputservice4protocoltest",
|
||||
APIVersion: "2014-01-01",
|
||||
}
|
||||
service.Initialize()
|
||||
|
||||
// Handlers
|
||||
service.Handlers.Sign.PushBack(v4.Sign)
|
||||
service.Handlers.Build.PushBack(ec2query.Build)
|
||||
service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
|
||||
service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
|
||||
service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
|
||||
|
||||
return &InputService4ProtocolTest{service}
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a InputService4ProtocolTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *InputService4ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {
|
||||
req := aws.NewRequest(c.Service, op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
const opInputService4TestCaseOperation1 = "OperationName"
|
||||
|
||||
// InputService4TestCaseOperation1Request generates a request for the InputService4TestCaseOperation1 operation.
|
||||
func (c *InputService4ProtocolTest) InputService4TestCaseOperation1Request(input *InputService4TestShapeInputShape) (req *aws.Request, output *InputService4TestShapeInputService4TestCaseOperation1Output) {
|
||||
op := &aws.Operation{
|
||||
Name: opInputService4TestCaseOperation1,
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &InputService4TestShapeInputShape{}
|
||||
}
|
||||
|
||||
req = c.newRequest(op, input, output)
|
||||
output = &InputService4TestShapeInputService4TestCaseOperation1Output{}
|
||||
req.Data = output
|
||||
return
|
||||
}
|
||||
|
||||
func (c *InputService4ProtocolTest) InputService4TestCaseOperation1(input *InputService4TestShapeInputShape) (*InputService4TestShapeInputService4TestCaseOperation1Output, error) {
|
||||
req, out := c.InputService4TestCaseOperation1Request(input)
|
||||
err := req.Send()
|
||||
return out, err
|
||||
}
|
||||
|
||||
type InputService4TestShapeInputService4TestCaseOperation1Output struct {
|
||||
metadataInputService4TestShapeInputService4TestCaseOperation1Output `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataInputService4TestShapeInputService4TestCaseOperation1Output struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type InputService4TestShapeInputShape struct {
|
||||
ListArg []*string `type:"list"`
|
||||
|
||||
metadataInputService4TestShapeInputShape `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataInputService4TestShapeInputShape struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type InputService5ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
||||
// New returns a new InputService5ProtocolTest client.
|
||||
func NewInputService5ProtocolTest(config *aws.Config) *InputService5ProtocolTest {
|
||||
service := &aws.Service{
|
||||
Config: aws.DefaultConfig.Merge(config),
|
||||
ServiceName: "inputservice5protocoltest",
|
||||
APIVersion: "2014-01-01",
|
||||
}
|
||||
service.Initialize()
|
||||
|
||||
// Handlers
|
||||
service.Handlers.Sign.PushBack(v4.Sign)
|
||||
service.Handlers.Build.PushBack(ec2query.Build)
|
||||
service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
|
||||
service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
|
||||
service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
|
||||
|
||||
return &InputService5ProtocolTest{service}
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a InputService5ProtocolTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *InputService5ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {
|
||||
req := aws.NewRequest(c.Service, op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
const opInputService5TestCaseOperation1 = "OperationName"
|
||||
|
||||
// InputService5TestCaseOperation1Request generates a request for the InputService5TestCaseOperation1 operation.
|
||||
func (c *InputService5ProtocolTest) InputService5TestCaseOperation1Request(input *InputService5TestShapeInputShape) (req *aws.Request, output *InputService5TestShapeInputService5TestCaseOperation1Output) {
|
||||
op := &aws.Operation{
|
||||
Name: opInputService5TestCaseOperation1,
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &InputService5TestShapeInputShape{}
|
||||
}
|
||||
|
||||
req = c.newRequest(op, input, output)
|
||||
output = &InputService5TestShapeInputService5TestCaseOperation1Output{}
|
||||
req.Data = output
|
||||
return
|
||||
}
|
||||
|
||||
func (c *InputService5ProtocolTest) InputService5TestCaseOperation1(input *InputService5TestShapeInputShape) (*InputService5TestShapeInputService5TestCaseOperation1Output, error) {
|
||||
req, out := c.InputService5TestCaseOperation1Request(input)
|
||||
err := req.Send()
|
||||
return out, err
|
||||
}
|
||||
|
||||
type InputService5TestShapeInputService5TestCaseOperation1Output struct {
|
||||
metadataInputService5TestShapeInputService5TestCaseOperation1Output `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataInputService5TestShapeInputService5TestCaseOperation1Output struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type InputService5TestShapeInputShape struct {
|
||||
ListArg []*string `locationName:"ListMemberName" locationNameList:"item" type:"list"`
|
||||
|
||||
metadataInputService5TestShapeInputShape `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataInputService5TestShapeInputShape struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type InputService6ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
||||
// New returns a new InputService6ProtocolTest client.
|
||||
func NewInputService6ProtocolTest(config *aws.Config) *InputService6ProtocolTest {
|
||||
service := &aws.Service{
|
||||
Config: aws.DefaultConfig.Merge(config),
|
||||
ServiceName: "inputservice6protocoltest",
|
||||
APIVersion: "2014-01-01",
|
||||
}
|
||||
service.Initialize()
|
||||
|
||||
// Handlers
|
||||
service.Handlers.Sign.PushBack(v4.Sign)
|
||||
service.Handlers.Build.PushBack(ec2query.Build)
|
||||
service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
|
||||
service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
|
||||
service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
|
||||
|
||||
return &InputService6ProtocolTest{service}
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a InputService6ProtocolTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *InputService6ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {
|
||||
req := aws.NewRequest(c.Service, op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
const opInputService6TestCaseOperation1 = "OperationName"
|
||||
|
||||
// InputService6TestCaseOperation1Request generates a request for the InputService6TestCaseOperation1 operation.
|
||||
func (c *InputService6ProtocolTest) InputService6TestCaseOperation1Request(input *InputService6TestShapeInputShape) (req *aws.Request, output *InputService6TestShapeInputService6TestCaseOperation1Output) {
|
||||
op := &aws.Operation{
|
||||
Name: opInputService6TestCaseOperation1,
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &InputService6TestShapeInputShape{}
|
||||
}
|
||||
|
||||
req = c.newRequest(op, input, output)
|
||||
output = &InputService6TestShapeInputService6TestCaseOperation1Output{}
|
||||
req.Data = output
|
||||
return
|
||||
}
|
||||
|
||||
func (c *InputService6ProtocolTest) InputService6TestCaseOperation1(input *InputService6TestShapeInputShape) (*InputService6TestShapeInputService6TestCaseOperation1Output, error) {
|
||||
req, out := c.InputService6TestCaseOperation1Request(input)
|
||||
err := req.Send()
|
||||
return out, err
|
||||
}
|
||||
|
||||
type InputService6TestShapeInputService6TestCaseOperation1Output struct {
|
||||
metadataInputService6TestShapeInputService6TestCaseOperation1Output `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataInputService6TestShapeInputService6TestCaseOperation1Output struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type InputService6TestShapeInputShape struct {
|
||||
ListArg []*string `locationName:"ListMemberName" queryName:"ListQueryName" locationNameList:"item" type:"list"`
|
||||
|
||||
metadataInputService6TestShapeInputShape `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataInputService6TestShapeInputShape struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type InputService7ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
||||
// New returns a new InputService7ProtocolTest client.
|
||||
func NewInputService7ProtocolTest(config *aws.Config) *InputService7ProtocolTest {
|
||||
service := &aws.Service{
|
||||
Config: aws.DefaultConfig.Merge(config),
|
||||
ServiceName: "inputservice7protocoltest",
|
||||
APIVersion: "2014-01-01",
|
||||
}
|
||||
service.Initialize()
|
||||
|
||||
// Handlers
|
||||
service.Handlers.Sign.PushBack(v4.Sign)
|
||||
service.Handlers.Build.PushBack(ec2query.Build)
|
||||
service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
|
||||
service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
|
||||
service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
|
||||
|
||||
return &InputService7ProtocolTest{service}
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a InputService7ProtocolTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *InputService7ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {
|
||||
req := aws.NewRequest(c.Service, op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
const opInputService7TestCaseOperation1 = "OperationName"
|
||||
|
||||
// InputService7TestCaseOperation1Request generates a request for the InputService7TestCaseOperation1 operation.
|
||||
func (c *InputService7ProtocolTest) InputService7TestCaseOperation1Request(input *InputService7TestShapeInputShape) (req *aws.Request, output *InputService7TestShapeInputService7TestCaseOperation1Output) {
|
||||
op := &aws.Operation{
|
||||
Name: opInputService7TestCaseOperation1,
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &InputService7TestShapeInputShape{}
|
||||
}
|
||||
|
||||
req = c.newRequest(op, input, output)
|
||||
output = &InputService7TestShapeInputService7TestCaseOperation1Output{}
|
||||
req.Data = output
|
||||
return
|
||||
}
|
||||
|
||||
func (c *InputService7ProtocolTest) InputService7TestCaseOperation1(input *InputService7TestShapeInputShape) (*InputService7TestShapeInputService7TestCaseOperation1Output, error) {
|
||||
req, out := c.InputService7TestCaseOperation1Request(input)
|
||||
err := req.Send()
|
||||
return out, err
|
||||
}
|
||||
|
||||
type InputService7TestShapeInputService7TestCaseOperation1Output struct {
|
||||
metadataInputService7TestShapeInputService7TestCaseOperation1Output `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataInputService7TestShapeInputService7TestCaseOperation1Output struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type InputService7TestShapeInputShape struct {
|
||||
BlobArg []byte `type:"blob"`
|
||||
|
||||
metadataInputService7TestShapeInputShape `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataInputService7TestShapeInputShape struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type InputService8ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
||||
// New returns a new InputService8ProtocolTest client.
|
||||
func NewInputService8ProtocolTest(config *aws.Config) *InputService8ProtocolTest {
|
||||
service := &aws.Service{
|
||||
Config: aws.DefaultConfig.Merge(config),
|
||||
ServiceName: "inputservice8protocoltest",
|
||||
APIVersion: "2014-01-01",
|
||||
}
|
||||
service.Initialize()
|
||||
|
||||
// Handlers
|
||||
service.Handlers.Sign.PushBack(v4.Sign)
|
||||
service.Handlers.Build.PushBack(ec2query.Build)
|
||||
service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
|
||||
service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
|
||||
service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
|
||||
|
||||
return &InputService8ProtocolTest{service}
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a InputService8ProtocolTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *InputService8ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {
|
||||
req := aws.NewRequest(c.Service, op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
const opInputService8TestCaseOperation1 = "OperationName"
|
||||
|
||||
// InputService8TestCaseOperation1Request generates a request for the InputService8TestCaseOperation1 operation.
|
||||
func (c *InputService8ProtocolTest) InputService8TestCaseOperation1Request(input *InputService8TestShapeInputShape) (req *aws.Request, output *InputService8TestShapeInputService8TestCaseOperation1Output) {
|
||||
op := &aws.Operation{
|
||||
Name: opInputService8TestCaseOperation1,
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &InputService8TestShapeInputShape{}
|
||||
}
|
||||
|
||||
req = c.newRequest(op, input, output)
|
||||
output = &InputService8TestShapeInputService8TestCaseOperation1Output{}
|
||||
req.Data = output
|
||||
return
|
||||
}
|
||||
|
||||
func (c *InputService8ProtocolTest) InputService8TestCaseOperation1(input *InputService8TestShapeInputShape) (*InputService8TestShapeInputService8TestCaseOperation1Output, error) {
|
||||
req, out := c.InputService8TestCaseOperation1Request(input)
|
||||
err := req.Send()
|
||||
return out, err
|
||||
}
|
||||
|
||||
type InputService8TestShapeInputService8TestCaseOperation1Output struct {
|
||||
metadataInputService8TestShapeInputService8TestCaseOperation1Output `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataInputService8TestShapeInputService8TestCaseOperation1Output struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type InputService8TestShapeInputShape struct {
|
||||
TimeArg *time.Time `type:"timestamp" timestampFormat:"iso8601"`
|
||||
|
||||
metadataInputService8TestShapeInputShape `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataInputService8TestShapeInputShape struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
//
|
||||
// Tests begin here
|
||||
//
|
||||
|
||||
func TestInputService1ProtocolTestScalarMembersCase1(t *testing.T) {
|
||||
svc := NewInputService1ProtocolTest(nil)
|
||||
svc.Endpoint = "https://test"
|
||||
|
||||
input := &InputService1TestShapeInputShape{
|
||||
Bar: aws.String("val2"),
|
||||
Foo: aws.String("val1"),
|
||||
}
|
||||
req, _ := svc.InputService1TestCaseOperation1Request(input)
|
||||
r := req.HTTPRequest
|
||||
|
||||
// build request
|
||||
ec2query.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
assert.Equal(t, util.Trim(`Action=OperationName&Bar=val2&Foo=val1&Version=2014-01-01`), util.Trim(string(body)))
|
||||
|
||||
// assert URL
|
||||
assert.Equal(t, "https://test/", r.URL.String())
|
||||
|
||||
// assert headers
|
||||
|
||||
}
|
||||
|
||||
func TestInputService2ProtocolTestStructureWithLocationNameAndQueryNameAppliedToMembersCase1(t *testing.T) {
|
||||
svc := NewInputService2ProtocolTest(nil)
|
||||
svc.Endpoint = "https://test"
|
||||
|
||||
input := &InputService2TestShapeInputShape{
|
||||
Bar: aws.String("val2"),
|
||||
Foo: aws.String("val1"),
|
||||
Yuck: aws.String("val3"),
|
||||
}
|
||||
req, _ := svc.InputService2TestCaseOperation1Request(input)
|
||||
r := req.HTTPRequest
|
||||
|
||||
// build request
|
||||
ec2query.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
assert.Equal(t, util.Trim(`Action=OperationName&BarLocationName=val2&Foo=val1&Version=2014-01-01&yuckQueryName=val3`), util.Trim(string(body)))
|
||||
|
||||
// assert URL
|
||||
assert.Equal(t, "https://test/", r.URL.String())
|
||||
|
||||
// assert headers
|
||||
|
||||
}
|
||||
|
||||
func TestInputService3ProtocolTestNestedStructureMembersCase1(t *testing.T) {
|
||||
svc := NewInputService3ProtocolTest(nil)
|
||||
svc.Endpoint = "https://test"
|
||||
|
||||
input := &InputService3TestShapeInputShape{
|
||||
StructArg: &InputService3TestShapeStructType{
|
||||
ScalarArg: aws.String("foo"),
|
||||
},
|
||||
}
|
||||
req, _ := svc.InputService3TestCaseOperation1Request(input)
|
||||
r := req.HTTPRequest
|
||||
|
||||
// build request
|
||||
ec2query.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
assert.Equal(t, util.Trim(`Action=OperationName&Struct.Scalar=foo&Version=2014-01-01`), util.Trim(string(body)))
|
||||
|
||||
// assert URL
|
||||
assert.Equal(t, "https://test/", r.URL.String())
|
||||
|
||||
// assert headers
|
||||
|
||||
}
|
||||
|
||||
func TestInputService4ProtocolTestListTypesCase1(t *testing.T) {
|
||||
svc := NewInputService4ProtocolTest(nil)
|
||||
svc.Endpoint = "https://test"
|
||||
|
||||
input := &InputService4TestShapeInputShape{
|
||||
ListArg: []*string{
|
||||
aws.String("foo"),
|
||||
aws.String("bar"),
|
||||
aws.String("baz"),
|
||||
},
|
||||
}
|
||||
req, _ := svc.InputService4TestCaseOperation1Request(input)
|
||||
r := req.HTTPRequest
|
||||
|
||||
// build request
|
||||
ec2query.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
assert.Equal(t, util.Trim(`Action=OperationName&ListArg.1=foo&ListArg.2=bar&ListArg.3=baz&Version=2014-01-01`), util.Trim(string(body)))
|
||||
|
||||
// assert URL
|
||||
assert.Equal(t, "https://test/", r.URL.String())
|
||||
|
||||
// assert headers
|
||||
|
||||
}
|
||||
|
||||
func TestInputService5ProtocolTestListWithLocationNameAppliedToMemberCase1(t *testing.T) {
|
||||
svc := NewInputService5ProtocolTest(nil)
|
||||
svc.Endpoint = "https://test"
|
||||
|
||||
input := &InputService5TestShapeInputShape{
|
||||
ListArg: []*string{
|
||||
aws.String("a"),
|
||||
aws.String("b"),
|
||||
aws.String("c"),
|
||||
},
|
||||
}
|
||||
req, _ := svc.InputService5TestCaseOperation1Request(input)
|
||||
r := req.HTTPRequest
|
||||
|
||||
// build request
|
||||
ec2query.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
assert.Equal(t, util.Trim(`Action=OperationName&ListMemberName.1=a&ListMemberName.2=b&ListMemberName.3=c&Version=2014-01-01`), util.Trim(string(body)))
|
||||
|
||||
// assert URL
|
||||
assert.Equal(t, "https://test/", r.URL.String())
|
||||
|
||||
// assert headers
|
||||
|
||||
}
|
||||
|
||||
func TestInputService6ProtocolTestListWithLocationNameAndQueryNameCase1(t *testing.T) {
|
||||
svc := NewInputService6ProtocolTest(nil)
|
||||
svc.Endpoint = "https://test"
|
||||
|
||||
input := &InputService6TestShapeInputShape{
|
||||
ListArg: []*string{
|
||||
aws.String("a"),
|
||||
aws.String("b"),
|
||||
aws.String("c"),
|
||||
},
|
||||
}
|
||||
req, _ := svc.InputService6TestCaseOperation1Request(input)
|
||||
r := req.HTTPRequest
|
||||
|
||||
// build request
|
||||
ec2query.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
assert.Equal(t, util.Trim(`Action=OperationName&ListQueryName.1=a&ListQueryName.2=b&ListQueryName.3=c&Version=2014-01-01`), util.Trim(string(body)))
|
||||
|
||||
// assert URL
|
||||
assert.Equal(t, "https://test/", r.URL.String())
|
||||
|
||||
// assert headers
|
||||
|
||||
}
|
||||
|
||||
func TestInputService7ProtocolTestBase64EncodedBlobsCase1(t *testing.T) {
|
||||
svc := NewInputService7ProtocolTest(nil)
|
||||
svc.Endpoint = "https://test"
|
||||
|
||||
input := &InputService7TestShapeInputShape{
|
||||
BlobArg: []byte("foo"),
|
||||
}
|
||||
req, _ := svc.InputService7TestCaseOperation1Request(input)
|
||||
r := req.HTTPRequest
|
||||
|
||||
// build request
|
||||
ec2query.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
assert.Equal(t, util.Trim(`Action=OperationName&BlobArg=Zm9v&Version=2014-01-01`), util.Trim(string(body)))
|
||||
|
||||
// assert URL
|
||||
assert.Equal(t, "https://test/", r.URL.String())
|
||||
|
||||
// assert headers
|
||||
|
||||
}
|
||||
|
||||
func TestInputService8ProtocolTestTimestampValuesCase1(t *testing.T) {
|
||||
svc := NewInputService8ProtocolTest(nil)
|
||||
svc.Endpoint = "https://test"
|
||||
|
||||
input := &InputService8TestShapeInputShape{
|
||||
TimeArg: aws.Time(time.Unix(1422172800, 0)),
|
||||
}
|
||||
req, _ := svc.InputService8TestCaseOperation1Request(input)
|
||||
r := req.HTTPRequest
|
||||
|
||||
// build request
|
||||
ec2query.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
assert.Equal(t, util.Trim(`Action=OperationName&TimeArg=2015-01-25T08%3A00%3A00Z&Version=2014-01-01`), util.Trim(string(body)))
|
||||
|
||||
// assert URL
|
||||
assert.Equal(t, "https://test/", r.URL.String())
|
||||
|
||||
// assert headers
|
||||
|
||||
}
|
54
Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/ec2query/unmarshal.go
generated
vendored
Normal file
54
Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/ec2query/unmarshal.go
generated
vendored
Normal file
|
@ -0,0 +1,54 @@
|
|||
package ec2query
|
||||
|
||||
//go:generate go run ../../fixtures/protocol/generate.go ../../fixtures/protocol/output/ec2.json unmarshal_test.go
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"io"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||
"github.com/aws/aws-sdk-go/internal/protocol/xml/xmlutil"
|
||||
)
|
||||
|
||||
// Unmarshal unmarshals a response body for the EC2 protocol.
|
||||
func Unmarshal(r *aws.Request) {
|
||||
defer r.HTTPResponse.Body.Close()
|
||||
if r.DataFilled() {
|
||||
decoder := xml.NewDecoder(r.HTTPResponse.Body)
|
||||
err := xmlutil.UnmarshalXML(r.Data, decoder, "")
|
||||
if err != nil {
|
||||
r.Error = awserr.New("SerializationError", "failed decoding EC2 Query response", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalMeta unmarshals response headers for the EC2 protocol.
|
||||
func UnmarshalMeta(r *aws.Request) {
|
||||
// TODO implement unmarshaling of request IDs
|
||||
}
|
||||
|
||||
type xmlErrorResponse struct {
|
||||
XMLName xml.Name `xml:"Response"`
|
||||
Code string `xml:"Errors>Error>Code"`
|
||||
Message string `xml:"Errors>Error>Message"`
|
||||
RequestID string `xml:"RequestId"`
|
||||
}
|
||||
|
||||
// UnmarshalError unmarshals a response error for the EC2 protocol.
|
||||
func UnmarshalError(r *aws.Request) {
|
||||
defer r.HTTPResponse.Body.Close()
|
||||
|
||||
resp := &xmlErrorResponse{}
|
||||
err := xml.NewDecoder(r.HTTPResponse.Body).Decode(resp)
|
||||
if err != nil && err != io.EOF {
|
||||
r.Error = awserr.New("SerializationError", "failed decoding EC2 Query error response", err)
|
||||
} else {
|
||||
r.Error = awserr.NewRequestFailure(
|
||||
awserr.New(resp.Code, resp.Message, nil),
|
||||
r.HTTPResponse.StatusCode,
|
||||
resp.RequestID,
|
||||
)
|
||||
}
|
||||
}
|
816
Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/ec2query/unmarshal_test.go
generated
vendored
Normal file
816
Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/ec2query/unmarshal_test.go
generated
vendored
Normal file
|
@ -0,0 +1,816 @@
|
|||
package ec2query_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/internal/protocol/ec2query"
|
||||
"github.com/aws/aws-sdk-go/internal/protocol/xml/xmlutil"
|
||||
"github.com/aws/aws-sdk-go/internal/signer/v4"
|
||||
"github.com/aws/aws-sdk-go/internal/util"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var _ bytes.Buffer // always import bytes
|
||||
var _ http.Request
|
||||
var _ json.Marshaler
|
||||
var _ time.Time
|
||||
var _ xmlutil.XMLNode
|
||||
var _ xml.Attr
|
||||
var _ = ioutil.Discard
|
||||
var _ = util.Trim("")
|
||||
var _ = url.Values{}
|
||||
var _ = io.EOF
|
||||
|
||||
type OutputService1ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
||||
// New returns a new OutputService1ProtocolTest client.
|
||||
func NewOutputService1ProtocolTest(config *aws.Config) *OutputService1ProtocolTest {
|
||||
service := &aws.Service{
|
||||
Config: aws.DefaultConfig.Merge(config),
|
||||
ServiceName: "outputservice1protocoltest",
|
||||
APIVersion: "",
|
||||
}
|
||||
service.Initialize()
|
||||
|
||||
// Handlers
|
||||
service.Handlers.Sign.PushBack(v4.Sign)
|
||||
service.Handlers.Build.PushBack(ec2query.Build)
|
||||
service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
|
||||
service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
|
||||
service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
|
||||
|
||||
return &OutputService1ProtocolTest{service}
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a OutputService1ProtocolTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *OutputService1ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {
|
||||
req := aws.NewRequest(c.Service, op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
const opOutputService1TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService1TestCaseOperation1Request generates a request for the OutputService1TestCaseOperation1 operation.
|
||||
func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1Request(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (req *aws.Request, output *OutputService1TestShapeOutputShape) {
|
||||
op := &aws.Operation{
|
||||
Name: opOutputService1TestCaseOperation1,
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &OutputService1TestShapeOutputService1TestCaseOperation1Input{}
|
||||
}
|
||||
|
||||
req = c.newRequest(op, input, output)
|
||||
output = &OutputService1TestShapeOutputShape{}
|
||||
req.Data = output
|
||||
return
|
||||
}
|
||||
|
||||
func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (*OutputService1TestShapeOutputShape, error) {
|
||||
req, out := c.OutputService1TestCaseOperation1Request(input)
|
||||
err := req.Send()
|
||||
return out, err
|
||||
}
|
||||
|
||||
type OutputService1TestShapeOutputService1TestCaseOperation1Input struct {
|
||||
metadataOutputService1TestShapeOutputService1TestCaseOperation1Input `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataOutputService1TestShapeOutputService1TestCaseOperation1Input struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type OutputService1TestShapeOutputShape struct {
|
||||
Char *string `type:"character"`
|
||||
|
||||
Double *float64 `type:"double"`
|
||||
|
||||
FalseBool *bool `type:"boolean"`
|
||||
|
||||
Float *float64 `type:"float"`
|
||||
|
||||
Long *int64 `type:"long"`
|
||||
|
||||
Num *int64 `locationName:"FooNum" type:"integer"`
|
||||
|
||||
Str *string `type:"string"`
|
||||
|
||||
TrueBool *bool `type:"boolean"`
|
||||
|
||||
metadataOutputService1TestShapeOutputShape `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataOutputService1TestShapeOutputShape struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type OutputService2ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
||||
// New returns a new OutputService2ProtocolTest client.
|
||||
func NewOutputService2ProtocolTest(config *aws.Config) *OutputService2ProtocolTest {
|
||||
service := &aws.Service{
|
||||
Config: aws.DefaultConfig.Merge(config),
|
||||
ServiceName: "outputservice2protocoltest",
|
||||
APIVersion: "",
|
||||
}
|
||||
service.Initialize()
|
||||
|
||||
// Handlers
|
||||
service.Handlers.Sign.PushBack(v4.Sign)
|
||||
service.Handlers.Build.PushBack(ec2query.Build)
|
||||
service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
|
||||
service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
|
||||
service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
|
||||
|
||||
return &OutputService2ProtocolTest{service}
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a OutputService2ProtocolTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *OutputService2ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {
|
||||
req := aws.NewRequest(c.Service, op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
const opOutputService2TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService2TestCaseOperation1Request generates a request for the OutputService2TestCaseOperation1 operation.
|
||||
func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1Request(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (req *aws.Request, output *OutputService2TestShapeOutputShape) {
|
||||
op := &aws.Operation{
|
||||
Name: opOutputService2TestCaseOperation1,
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &OutputService2TestShapeOutputService2TestCaseOperation1Input{}
|
||||
}
|
||||
|
||||
req = c.newRequest(op, input, output)
|
||||
output = &OutputService2TestShapeOutputShape{}
|
||||
req.Data = output
|
||||
return
|
||||
}
|
||||
|
||||
func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (*OutputService2TestShapeOutputShape, error) {
|
||||
req, out := c.OutputService2TestCaseOperation1Request(input)
|
||||
err := req.Send()
|
||||
return out, err
|
||||
}
|
||||
|
||||
type OutputService2TestShapeOutputService2TestCaseOperation1Input struct {
|
||||
metadataOutputService2TestShapeOutputService2TestCaseOperation1Input `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataOutputService2TestShapeOutputService2TestCaseOperation1Input struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type OutputService2TestShapeOutputShape struct {
|
||||
Blob []byte `type:"blob"`
|
||||
|
||||
metadataOutputService2TestShapeOutputShape `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataOutputService2TestShapeOutputShape struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type OutputService3ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
||||
// New returns a new OutputService3ProtocolTest client.
|
||||
func NewOutputService3ProtocolTest(config *aws.Config) *OutputService3ProtocolTest {
|
||||
service := &aws.Service{
|
||||
Config: aws.DefaultConfig.Merge(config),
|
||||
ServiceName: "outputservice3protocoltest",
|
||||
APIVersion: "",
|
||||
}
|
||||
service.Initialize()
|
||||
|
||||
// Handlers
|
||||
service.Handlers.Sign.PushBack(v4.Sign)
|
||||
service.Handlers.Build.PushBack(ec2query.Build)
|
||||
service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
|
||||
service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
|
||||
service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
|
||||
|
||||
return &OutputService3ProtocolTest{service}
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a OutputService3ProtocolTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *OutputService3ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {
|
||||
req := aws.NewRequest(c.Service, op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
const opOutputService3TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService3TestCaseOperation1Request generates a request for the OutputService3TestCaseOperation1 operation.
|
||||
func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1Request(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (req *aws.Request, output *OutputService3TestShapeOutputShape) {
|
||||
op := &aws.Operation{
|
||||
Name: opOutputService3TestCaseOperation1,
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &OutputService3TestShapeOutputService3TestCaseOperation1Input{}
|
||||
}
|
||||
|
||||
req = c.newRequest(op, input, output)
|
||||
output = &OutputService3TestShapeOutputShape{}
|
||||
req.Data = output
|
||||
return
|
||||
}
|
||||
|
||||
func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (*OutputService3TestShapeOutputShape, error) {
|
||||
req, out := c.OutputService3TestCaseOperation1Request(input)
|
||||
err := req.Send()
|
||||
return out, err
|
||||
}
|
||||
|
||||
type OutputService3TestShapeOutputService3TestCaseOperation1Input struct {
|
||||
metadataOutputService3TestShapeOutputService3TestCaseOperation1Input `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataOutputService3TestShapeOutputService3TestCaseOperation1Input struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type OutputService3TestShapeOutputShape struct {
|
||||
ListMember []*string `type:"list"`
|
||||
|
||||
metadataOutputService3TestShapeOutputShape `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataOutputService3TestShapeOutputShape struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type OutputService4ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
||||
// New returns a new OutputService4ProtocolTest client.
|
||||
func NewOutputService4ProtocolTest(config *aws.Config) *OutputService4ProtocolTest {
|
||||
service := &aws.Service{
|
||||
Config: aws.DefaultConfig.Merge(config),
|
||||
ServiceName: "outputservice4protocoltest",
|
||||
APIVersion: "",
|
||||
}
|
||||
service.Initialize()
|
||||
|
||||
// Handlers
|
||||
service.Handlers.Sign.PushBack(v4.Sign)
|
||||
service.Handlers.Build.PushBack(ec2query.Build)
|
||||
service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
|
||||
service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
|
||||
service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
|
||||
|
||||
return &OutputService4ProtocolTest{service}
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a OutputService4ProtocolTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *OutputService4ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {
|
||||
req := aws.NewRequest(c.Service, op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
const opOutputService4TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService4TestCaseOperation1Request generates a request for the OutputService4TestCaseOperation1 operation.
|
||||
func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1Request(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (req *aws.Request, output *OutputService4TestShapeOutputShape) {
|
||||
op := &aws.Operation{
|
||||
Name: opOutputService4TestCaseOperation1,
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &OutputService4TestShapeOutputService4TestCaseOperation1Input{}
|
||||
}
|
||||
|
||||
req = c.newRequest(op, input, output)
|
||||
output = &OutputService4TestShapeOutputShape{}
|
||||
req.Data = output
|
||||
return
|
||||
}
|
||||
|
||||
func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (*OutputService4TestShapeOutputShape, error) {
|
||||
req, out := c.OutputService4TestCaseOperation1Request(input)
|
||||
err := req.Send()
|
||||
return out, err
|
||||
}
|
||||
|
||||
type OutputService4TestShapeOutputService4TestCaseOperation1Input struct {
|
||||
metadataOutputService4TestShapeOutputService4TestCaseOperation1Input `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataOutputService4TestShapeOutputService4TestCaseOperation1Input struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type OutputService4TestShapeOutputShape struct {
|
||||
ListMember []*string `locationNameList:"item" type:"list"`
|
||||
|
||||
metadataOutputService4TestShapeOutputShape `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataOutputService4TestShapeOutputShape struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type OutputService5ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
||||
// New returns a new OutputService5ProtocolTest client.
|
||||
func NewOutputService5ProtocolTest(config *aws.Config) *OutputService5ProtocolTest {
|
||||
service := &aws.Service{
|
||||
Config: aws.DefaultConfig.Merge(config),
|
||||
ServiceName: "outputservice5protocoltest",
|
||||
APIVersion: "",
|
||||
}
|
||||
service.Initialize()
|
||||
|
||||
// Handlers
|
||||
service.Handlers.Sign.PushBack(v4.Sign)
|
||||
service.Handlers.Build.PushBack(ec2query.Build)
|
||||
service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
|
||||
service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
|
||||
service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
|
||||
|
||||
return &OutputService5ProtocolTest{service}
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a OutputService5ProtocolTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *OutputService5ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {
|
||||
req := aws.NewRequest(c.Service, op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
const opOutputService5TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService5TestCaseOperation1Request generates a request for the OutputService5TestCaseOperation1 operation.
|
||||
func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1Request(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (req *aws.Request, output *OutputService5TestShapeOutputShape) {
|
||||
op := &aws.Operation{
|
||||
Name: opOutputService5TestCaseOperation1,
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &OutputService5TestShapeOutputService5TestCaseOperation1Input{}
|
||||
}
|
||||
|
||||
req = c.newRequest(op, input, output)
|
||||
output = &OutputService5TestShapeOutputShape{}
|
||||
req.Data = output
|
||||
return
|
||||
}
|
||||
|
||||
func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (*OutputService5TestShapeOutputShape, error) {
|
||||
req, out := c.OutputService5TestCaseOperation1Request(input)
|
||||
err := req.Send()
|
||||
return out, err
|
||||
}
|
||||
|
||||
type OutputService5TestShapeOutputService5TestCaseOperation1Input struct {
|
||||
metadataOutputService5TestShapeOutputService5TestCaseOperation1Input `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataOutputService5TestShapeOutputService5TestCaseOperation1Input struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type OutputService5TestShapeOutputShape struct {
|
||||
ListMember []*string `type:"list" flattened:"true"`
|
||||
|
||||
metadataOutputService5TestShapeOutputShape `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataOutputService5TestShapeOutputShape struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type OutputService6ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
||||
// New returns a new OutputService6ProtocolTest client.
|
||||
func NewOutputService6ProtocolTest(config *aws.Config) *OutputService6ProtocolTest {
|
||||
service := &aws.Service{
|
||||
Config: aws.DefaultConfig.Merge(config),
|
||||
ServiceName: "outputservice6protocoltest",
|
||||
APIVersion: "",
|
||||
}
|
||||
service.Initialize()
|
||||
|
||||
// Handlers
|
||||
service.Handlers.Sign.PushBack(v4.Sign)
|
||||
service.Handlers.Build.PushBack(ec2query.Build)
|
||||
service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
|
||||
service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
|
||||
service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
|
||||
|
||||
return &OutputService6ProtocolTest{service}
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a OutputService6ProtocolTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *OutputService6ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {
|
||||
req := aws.NewRequest(c.Service, op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
const opOutputService6TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService6TestCaseOperation1Request generates a request for the OutputService6TestCaseOperation1 operation.
|
||||
func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1Request(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (req *aws.Request, output *OutputService6TestShapeOutputShape) {
|
||||
op := &aws.Operation{
|
||||
Name: opOutputService6TestCaseOperation1,
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &OutputService6TestShapeOutputService6TestCaseOperation1Input{}
|
||||
}
|
||||
|
||||
req = c.newRequest(op, input, output)
|
||||
output = &OutputService6TestShapeOutputShape{}
|
||||
req.Data = output
|
||||
return
|
||||
}
|
||||
|
||||
func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (*OutputService6TestShapeOutputShape, error) {
|
||||
req, out := c.OutputService6TestCaseOperation1Request(input)
|
||||
err := req.Send()
|
||||
return out, err
|
||||
}
|
||||
|
||||
type OutputService6TestShapeOutputService6TestCaseOperation1Input struct {
|
||||
metadataOutputService6TestShapeOutputService6TestCaseOperation1Input `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataOutputService6TestShapeOutputService6TestCaseOperation1Input struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type OutputService6TestShapeOutputShape struct {
|
||||
Map map[string]*OutputService6TestShapeStructureType `type:"map"`
|
||||
|
||||
metadataOutputService6TestShapeOutputShape `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataOutputService6TestShapeOutputShape struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type OutputService6TestShapeStructureType struct {
|
||||
Foo *string `locationName:"foo" type:"string"`
|
||||
|
||||
metadataOutputService6TestShapeStructureType `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataOutputService6TestShapeStructureType struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type OutputService7ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
||||
// New returns a new OutputService7ProtocolTest client.
|
||||
func NewOutputService7ProtocolTest(config *aws.Config) *OutputService7ProtocolTest {
|
||||
service := &aws.Service{
|
||||
Config: aws.DefaultConfig.Merge(config),
|
||||
ServiceName: "outputservice7protocoltest",
|
||||
APIVersion: "",
|
||||
}
|
||||
service.Initialize()
|
||||
|
||||
// Handlers
|
||||
service.Handlers.Sign.PushBack(v4.Sign)
|
||||
service.Handlers.Build.PushBack(ec2query.Build)
|
||||
service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
|
||||
service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
|
||||
service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
|
||||
|
||||
return &OutputService7ProtocolTest{service}
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a OutputService7ProtocolTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *OutputService7ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {
|
||||
req := aws.NewRequest(c.Service, op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
const opOutputService7TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService7TestCaseOperation1Request generates a request for the OutputService7TestCaseOperation1 operation.
|
||||
func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1Request(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (req *aws.Request, output *OutputService7TestShapeOutputShape) {
|
||||
op := &aws.Operation{
|
||||
Name: opOutputService7TestCaseOperation1,
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &OutputService7TestShapeOutputService7TestCaseOperation1Input{}
|
||||
}
|
||||
|
||||
req = c.newRequest(op, input, output)
|
||||
output = &OutputService7TestShapeOutputShape{}
|
||||
req.Data = output
|
||||
return
|
||||
}
|
||||
|
||||
func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (*OutputService7TestShapeOutputShape, error) {
|
||||
req, out := c.OutputService7TestCaseOperation1Request(input)
|
||||
err := req.Send()
|
||||
return out, err
|
||||
}
|
||||
|
||||
type OutputService7TestShapeOutputService7TestCaseOperation1Input struct {
|
||||
metadataOutputService7TestShapeOutputService7TestCaseOperation1Input `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataOutputService7TestShapeOutputService7TestCaseOperation1Input struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type OutputService7TestShapeOutputShape struct {
|
||||
Map map[string]*string `type:"map" flattened:"true"`
|
||||
|
||||
metadataOutputService7TestShapeOutputShape `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataOutputService7TestShapeOutputShape struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type OutputService8ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
||||
// New returns a new OutputService8ProtocolTest client.
|
||||
func NewOutputService8ProtocolTest(config *aws.Config) *OutputService8ProtocolTest {
|
||||
service := &aws.Service{
|
||||
Config: aws.DefaultConfig.Merge(config),
|
||||
ServiceName: "outputservice8protocoltest",
|
||||
APIVersion: "",
|
||||
}
|
||||
service.Initialize()
|
||||
|
||||
// Handlers
|
||||
service.Handlers.Sign.PushBack(v4.Sign)
|
||||
service.Handlers.Build.PushBack(ec2query.Build)
|
||||
service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
|
||||
service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
|
||||
service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
|
||||
|
||||
return &OutputService8ProtocolTest{service}
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a OutputService8ProtocolTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *OutputService8ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {
|
||||
req := aws.NewRequest(c.Service, op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
const opOutputService8TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService8TestCaseOperation1Request generates a request for the OutputService8TestCaseOperation1 operation.
|
||||
func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1Request(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (req *aws.Request, output *OutputService8TestShapeOutputShape) {
|
||||
op := &aws.Operation{
|
||||
Name: opOutputService8TestCaseOperation1,
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &OutputService8TestShapeOutputService8TestCaseOperation1Input{}
|
||||
}
|
||||
|
||||
req = c.newRequest(op, input, output)
|
||||
output = &OutputService8TestShapeOutputShape{}
|
||||
req.Data = output
|
||||
return
|
||||
}
|
||||
|
||||
func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (*OutputService8TestShapeOutputShape, error) {
|
||||
req, out := c.OutputService8TestCaseOperation1Request(input)
|
||||
err := req.Send()
|
||||
return out, err
|
||||
}
|
||||
|
||||
type OutputService8TestShapeOutputService8TestCaseOperation1Input struct {
|
||||
metadataOutputService8TestShapeOutputService8TestCaseOperation1Input `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataOutputService8TestShapeOutputService8TestCaseOperation1Input struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
type OutputService8TestShapeOutputShape struct {
|
||||
Map map[string]*string `locationNameKey:"foo" locationNameValue:"bar" type:"map" flattened:"true"`
|
||||
|
||||
metadataOutputService8TestShapeOutputShape `json:"-" xml:"-"`
|
||||
}
|
||||
|
||||
type metadataOutputService8TestShapeOutputShape struct {
|
||||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
//
|
||||
// Tests begin here
|
||||
//
|
||||
|
||||
func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) {
|
||||
svc := NewOutputService1ProtocolTest(nil)
|
||||
|
||||
buf := bytes.NewReader([]byte("<OperationNameResponse><Str>myname</Str><FooNum>123</FooNum><FalseBool>false</FalseBool><TrueBool>true</TrueBool><Float>1.2</Float><Double>1.3</Double><Long>200</Long><Char>a</Char><RequestId>request-id</RequestId></OperationNameResponse>"))
|
||||
req, out := svc.OutputService1TestCaseOperation1Request(nil)
|
||||
req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
|
||||
|
||||
// set headers
|
||||
|
||||
// unmarshal response
|
||||
ec2query.UnmarshalMeta(req)
|
||||
ec2query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "a", *out.Char)
|
||||
assert.Equal(t, 1.3, *out.Double)
|
||||
assert.Equal(t, false, *out.FalseBool)
|
||||
assert.Equal(t, 1.2, *out.Float)
|
||||
assert.Equal(t, int64(200), *out.Long)
|
||||
assert.Equal(t, int64(123), *out.Num)
|
||||
assert.Equal(t, "myname", *out.Str)
|
||||
assert.Equal(t, true, *out.TrueBool)
|
||||
|
||||
}
|
||||
|
||||
func TestOutputService2ProtocolTestBlobCase1(t *testing.T) {
|
||||
svc := NewOutputService2ProtocolTest(nil)
|
||||
|
||||
buf := bytes.NewReader([]byte("<OperationNameResponse><Blob>dmFsdWU=</Blob><RequestId>requestid</RequestId></OperationNameResponse>"))
|
||||
req, out := svc.OutputService2TestCaseOperation1Request(nil)
|
||||
req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
|
||||
|
||||
// set headers
|
||||
|
||||
// unmarshal response
|
||||
ec2query.UnmarshalMeta(req)
|
||||
ec2query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "value", string(out.Blob))
|
||||
|
||||
}
|
||||
|
||||
func TestOutputService3ProtocolTestListsCase1(t *testing.T) {
|
||||
svc := NewOutputService3ProtocolTest(nil)
|
||||
|
||||
buf := bytes.NewReader([]byte("<OperationNameResponse><ListMember><member>abc</member><member>123</member></ListMember><RequestId>requestid</RequestId></OperationNameResponse>"))
|
||||
req, out := svc.OutputService3TestCaseOperation1Request(nil)
|
||||
req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
|
||||
|
||||
// set headers
|
||||
|
||||
// unmarshal response
|
||||
ec2query.UnmarshalMeta(req)
|
||||
ec2query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "abc", *out.ListMember[0])
|
||||
assert.Equal(t, "123", *out.ListMember[1])
|
||||
|
||||
}
|
||||
|
||||
func TestOutputService4ProtocolTestListWithCustomMemberNameCase1(t *testing.T) {
|
||||
svc := NewOutputService4ProtocolTest(nil)
|
||||
|
||||
buf := bytes.NewReader([]byte("<OperationNameResponse><ListMember><item>abc</item><item>123</item></ListMember><RequestId>requestid</RequestId></OperationNameResponse>"))
|
||||
req, out := svc.OutputService4TestCaseOperation1Request(nil)
|
||||
req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
|
||||
|
||||
// set headers
|
||||
|
||||
// unmarshal response
|
||||
ec2query.UnmarshalMeta(req)
|
||||
ec2query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "abc", *out.ListMember[0])
|
||||
assert.Equal(t, "123", *out.ListMember[1])
|
||||
|
||||
}
|
||||
|
||||
func TestOutputService5ProtocolTestFlattenedListCase1(t *testing.T) {
|
||||
svc := NewOutputService5ProtocolTest(nil)
|
||||
|
||||
buf := bytes.NewReader([]byte("<OperationNameResponse><ListMember>abc</ListMember><ListMember>123</ListMember><RequestId>requestid</RequestId></OperationNameResponse>"))
|
||||
req, out := svc.OutputService5TestCaseOperation1Request(nil)
|
||||
req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
|
||||
|
||||
// set headers
|
||||
|
||||
// unmarshal response
|
||||
ec2query.UnmarshalMeta(req)
|
||||
ec2query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "abc", *out.ListMember[0])
|
||||
assert.Equal(t, "123", *out.ListMember[1])
|
||||
|
||||
}
|
||||
|
||||
func TestOutputService6ProtocolTestNormalMapCase1(t *testing.T) {
|
||||
svc := NewOutputService6ProtocolTest(nil)
|
||||
|
||||
buf := bytes.NewReader([]byte("<OperationNameResponse><Map><entry><key>qux</key><value><foo>bar</foo></value></entry><entry><key>baz</key><value><foo>bam</foo></value></entry></Map><RequestId>requestid</RequestId></OperationNameResponse>"))
|
||||
req, out := svc.OutputService6TestCaseOperation1Request(nil)
|
||||
req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
|
||||
|
||||
// set headers
|
||||
|
||||
// unmarshal response
|
||||
ec2query.UnmarshalMeta(req)
|
||||
ec2query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "bam", *out.Map["baz"].Foo)
|
||||
assert.Equal(t, "bar", *out.Map["qux"].Foo)
|
||||
|
||||
}
|
||||
|
||||
func TestOutputService7ProtocolTestFlattenedMapCase1(t *testing.T) {
|
||||
svc := NewOutputService7ProtocolTest(nil)
|
||||
|
||||
buf := bytes.NewReader([]byte("<OperationNameResponse><Map><key>qux</key><value>bar</value></Map><Map><key>baz</key><value>bam</value></Map><RequestId>requestid</RequestId></OperationNameResponse>"))
|
||||
req, out := svc.OutputService7TestCaseOperation1Request(nil)
|
||||
req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
|
||||
|
||||
// set headers
|
||||
|
||||
// unmarshal response
|
||||
ec2query.UnmarshalMeta(req)
|
||||
ec2query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "bam", *out.Map["baz"])
|
||||
assert.Equal(t, "bar", *out.Map["qux"])
|
||||
|
||||
}
|
||||
|
||||
func TestOutputService8ProtocolTestNamedMapCase1(t *testing.T) {
|
||||
svc := NewOutputService8ProtocolTest(nil)
|
||||
|
||||
buf := bytes.NewReader([]byte("<OperationNameResponse><Map><foo>qux</foo><bar>bar</bar></Map><Map><foo>baz</foo><bar>bam</bar></Map><RequestId>requestid</RequestId></OperationNameResponse>"))
|
||||
req, out := svc.OutputService8TestCaseOperation1Request(nil)
|
||||
req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
|
||||
|
||||
// set headers
|
||||
|
||||
// unmarshal response
|
||||
ec2query.UnmarshalMeta(req)
|
||||
ec2query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "bam", *out.Map["baz"])
|
||||
assert.Equal(t, "bar", *out.Map["qux"])
|
||||
|
||||
}
|
|
@ -30,7 +30,6 @@ var _ = util.Trim("")
|
|||
var _ = url.Values{}
|
||||
var _ = io.EOF
|
||||
|
||||
// InputService1ProtocolTest is a client for InputService1ProtocolTest.
|
||||
type InputService1ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -106,7 +105,6 @@ type metadataInputService1TestShapeInputShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// InputService2ProtocolTest is a client for InputService2ProtocolTest.
|
||||
type InputService2ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -190,7 +188,6 @@ type metadataInputService2TestShapeStructType struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// InputService3ProtocolTest is a client for InputService3ProtocolTest.
|
||||
type InputService3ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -296,7 +293,6 @@ type metadataInputService3TestShapeInputShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// InputService4ProtocolTest is a client for InputService4ProtocolTest.
|
||||
type InputService4ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -404,7 +400,6 @@ type metadataInputService4TestShapeInputShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// InputService5ProtocolTest is a client for InputService5ProtocolTest.
|
||||
type InputService5ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -510,7 +505,6 @@ type metadataInputService5TestShapeInputShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// InputService6ProtocolTest is a client for InputService6ProtocolTest.
|
||||
type InputService6ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -584,7 +578,6 @@ type metadataInputService6TestShapeInputShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// InputService7ProtocolTest is a client for InputService7ProtocolTest.
|
||||
type InputService7ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -658,7 +651,6 @@ type metadataInputService7TestShapeInputShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// InputService8ProtocolTest is a client for InputService8ProtocolTest.
|
||||
type InputService8ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -732,7 +724,6 @@ type metadataInputService8TestShapeInputShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// InputService9ProtocolTest is a client for InputService9ProtocolTest.
|
||||
type InputService9ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ var _ = util.Trim("")
|
|||
var _ = url.Values{}
|
||||
var _ = io.EOF
|
||||
|
||||
// OutputService1ProtocolTest is a client for OutputService1ProtocolTest.
|
||||
type OutputService1ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -120,7 +119,6 @@ type metadataOutputService1TestShapeOutputShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// OutputService2ProtocolTest is a client for OutputService2ProtocolTest.
|
||||
type OutputService2ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -196,7 +194,6 @@ type metadataOutputService2TestShapeOutputShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// OutputService3ProtocolTest is a client for OutputService3ProtocolTest.
|
||||
type OutputService3ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -270,7 +267,6 @@ type metadataOutputService3TestShapeOutputShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// OutputService4ProtocolTest is a client for OutputService4ProtocolTest.
|
||||
type OutputService4ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -344,7 +340,6 @@ type metadataOutputService4TestShapeOutputShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// OutputService5ProtocolTest is a client for OutputService5ProtocolTest.
|
||||
type OutputService5ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -418,7 +413,6 @@ type metadataOutputService5TestShapeOutputShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// OutputService6ProtocolTest is a client for OutputService6ProtocolTest.
|
||||
type OutputService6ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -492,7 +486,6 @@ type metadataOutputService6TestShapeOutputShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// OutputService7ProtocolTest is a client for OutputService7ProtocolTest.
|
||||
type OutputService7ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -566,7 +559,6 @@ type metadataOutputService7TestShapeOutputShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// OutputService8ProtocolTest is a client for OutputService8ProtocolTest.
|
||||
type OutputService8ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -654,7 +646,6 @@ type metadataOutputService8TestShapeStructureShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// OutputService9ProtocolTest is a client for OutputService9ProtocolTest.
|
||||
type OutputService9ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -742,7 +733,6 @@ type metadataOutputService9TestShapeStructureShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// OutputService10ProtocolTest is a client for OutputService10ProtocolTest.
|
||||
type OutputService10ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -816,7 +806,6 @@ type metadataOutputService10TestShapeOutputShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// OutputService11ProtocolTest is a client for OutputService11ProtocolTest.
|
||||
type OutputService11ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -900,7 +889,6 @@ type metadataOutputService11TestShapeStructType struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// OutputService12ProtocolTest is a client for OutputService12ProtocolTest.
|
||||
type OutputService12ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -974,7 +962,6 @@ type metadataOutputService12TestShapeOutputShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// OutputService13ProtocolTest is a client for OutputService13ProtocolTest.
|
||||
type OutputService13ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -1048,7 +1035,6 @@ type metadataOutputService13TestShapeOutputShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// OutputService14ProtocolTest is a client for OutputService14ProtocolTest.
|
||||
type OutputService14ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
|
5
Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/rest/build.go
generated
vendored
5
Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/rest/build.go
generated
vendored
|
@ -156,8 +156,13 @@ func buildQueryString(r *aws.Request, v reflect.Value, name string, query url.Va
|
|||
func updatePath(url *url.URL, urlPath string) {
|
||||
scheme, query := url.Scheme, url.RawQuery
|
||||
|
||||
hasSlash := strings.HasSuffix(urlPath, "/")
|
||||
|
||||
// clean up path
|
||||
urlPath = path.Clean(urlPath)
|
||||
if hasSlash && !strings.HasSuffix(urlPath, "/") {
|
||||
urlPath += "/"
|
||||
}
|
||||
|
||||
// get formatted URL minus scheme so we can build this into Opaque
|
||||
url.Scheme, url.Path, url.RawQuery = "", "", ""
|
||||
|
|
27
Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/restxml/build_test.go
generated
vendored
27
Godeps/_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/restxml/build_test.go
generated
vendored
|
@ -30,7 +30,6 @@ var _ = util.Trim("")
|
|||
var _ = url.Values{}
|
||||
var _ = io.EOF
|
||||
|
||||
// InputService1ProtocolTest is a client for InputService1ProtocolTest.
|
||||
type InputService1ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -142,7 +141,6 @@ type metadataInputService1TestShapeInputShape struct {
|
|||
SDKShapeTraits bool `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"`
|
||||
}
|
||||
|
||||
// InputService2ProtocolTest is a client for InputService2ProtocolTest.
|
||||
type InputService2ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -224,7 +222,6 @@ type metadataInputService2TestShapeInputShape struct {
|
|||
SDKShapeTraits bool `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"`
|
||||
}
|
||||
|
||||
// InputService3ProtocolTest is a client for InputService3ProtocolTest.
|
||||
type InputService3ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -314,7 +311,6 @@ type metadataInputService3TestShapeSubStructure struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// InputService4ProtocolTest is a client for InputService4ProtocolTest.
|
||||
type InputService4ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -404,7 +400,6 @@ type metadataInputService4TestShapeSubStructure struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// InputService5ProtocolTest is a client for InputService5ProtocolTest.
|
||||
type InputService5ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -480,7 +475,6 @@ type metadataInputService5TestShapeInputShape struct {
|
|||
SDKShapeTraits bool `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"`
|
||||
}
|
||||
|
||||
// InputService6ProtocolTest is a client for InputService6ProtocolTest.
|
||||
type InputService6ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -556,7 +550,6 @@ type metadataInputService6TestShapeInputShape struct {
|
|||
SDKShapeTraits bool `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"`
|
||||
}
|
||||
|
||||
// InputService7ProtocolTest is a client for InputService7ProtocolTest.
|
||||
type InputService7ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -632,7 +625,6 @@ type metadataInputService7TestShapeInputShape struct {
|
|||
SDKShapeTraits bool `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"`
|
||||
}
|
||||
|
||||
// InputService8ProtocolTest is a client for InputService8ProtocolTest.
|
||||
type InputService8ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -708,7 +700,6 @@ type metadataInputService8TestShapeInputShape struct {
|
|||
SDKShapeTraits bool `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"`
|
||||
}
|
||||
|
||||
// InputService9ProtocolTest is a client for InputService9ProtocolTest.
|
||||
type InputService9ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -794,7 +785,6 @@ type metadataInputService9TestShapeSingleFieldStruct struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// InputService10ProtocolTest is a client for InputService10ProtocolTest.
|
||||
type InputService10ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -882,7 +872,6 @@ type metadataInputService10TestShapeStructureShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// InputService11ProtocolTest is a client for InputService11ProtocolTest.
|
||||
type InputService11ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -958,7 +947,6 @@ type metadataInputService11TestShapeInputShape struct {
|
|||
SDKShapeTraits bool `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"`
|
||||
}
|
||||
|
||||
// InputService12ProtocolTest is a client for InputService12ProtocolTest.
|
||||
type InputService12ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -1034,7 +1022,6 @@ type metadataInputService12TestShapeInputShape struct {
|
|||
SDKShapeTraits bool `type:"structure" payload:"Foo"`
|
||||
}
|
||||
|
||||
// InputService13ProtocolTest is a client for InputService13ProtocolTest.
|
||||
type InputService13ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -1144,7 +1131,6 @@ type metadataInputService13TestShapeInputShape struct {
|
|||
SDKShapeTraits bool `type:"structure" payload:"Foo"`
|
||||
}
|
||||
|
||||
// InputService14ProtocolTest is a client for InputService14ProtocolTest.
|
||||
type InputService14ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -1298,7 +1284,6 @@ type metadataInputService14TestShapeInputShape struct {
|
|||
SDKShapeTraits bool `type:"structure" payload:"Foo"`
|
||||
}
|
||||
|
||||
// InputService15ProtocolTest is a client for InputService15ProtocolTest.
|
||||
type InputService15ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -1396,7 +1381,6 @@ type metadataInputService15TestShapeInputShape struct {
|
|||
SDKShapeTraits bool `type:"structure" payload:"Grant"`
|
||||
}
|
||||
|
||||
// InputService16ProtocolTest is a client for InputService16ProtocolTest.
|
||||
type InputService16ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -1474,7 +1458,6 @@ type metadataInputService16TestShapeInputShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// InputService17ProtocolTest is a client for InputService17ProtocolTest.
|
||||
type InputService17ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -1584,7 +1567,6 @@ type metadataInputService17TestShapeInputShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// InputService18ProtocolTest is a client for InputService18ProtocolTest.
|
||||
type InputService18ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -1846,7 +1828,6 @@ type metadataInputService18TestShapeRecursiveStructType struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// InputService19ProtocolTest is a client for InputService19ProtocolTest.
|
||||
type InputService19ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -1985,10 +1966,10 @@ func TestInputService2ProtocolTestSerializeOtherScalarTypesCase1(t *testing.T) {
|
|||
svc.Endpoint = "https://test"
|
||||
|
||||
input := &InputService2TestShapeInputShape{
|
||||
First: aws.Boolean(true),
|
||||
Fourth: aws.Long(3),
|
||||
Second: aws.Boolean(false),
|
||||
Third: aws.Double(1.2),
|
||||
First: aws.Bool(true),
|
||||
Fourth: aws.Int64(3),
|
||||
Second: aws.Bool(false),
|
||||
Third: aws.Float64(1.2),
|
||||
}
|
||||
req, _ := svc.InputService2TestCaseOperation1Request(input)
|
||||
r := req.HTTPRequest
|
||||
|
|
|
@ -30,7 +30,6 @@ var _ = util.Trim("")
|
|||
var _ = url.Values{}
|
||||
var _ = io.EOF
|
||||
|
||||
// OutputService1ProtocolTest is a client for OutputService1ProtocolTest.
|
||||
type OutputService1ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -156,7 +155,6 @@ type metadataOutputService1TestShapeOutputShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// OutputService2ProtocolTest is a client for OutputService2ProtocolTest.
|
||||
type OutputService2ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -230,7 +228,6 @@ type metadataOutputService2TestShapeOutputShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// OutputService3ProtocolTest is a client for OutputService3ProtocolTest.
|
||||
type OutputService3ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -304,7 +301,6 @@ type metadataOutputService3TestShapeOutputShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// OutputService4ProtocolTest is a client for OutputService4ProtocolTest.
|
||||
type OutputService4ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -378,7 +374,6 @@ type metadataOutputService4TestShapeOutputShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// OutputService5ProtocolTest is a client for OutputService5ProtocolTest.
|
||||
type OutputService5ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -452,7 +447,6 @@ type metadataOutputService5TestShapeOutputShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// OutputService6ProtocolTest is a client for OutputService6ProtocolTest.
|
||||
type OutputService6ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -536,7 +530,6 @@ type metadataOutputService6TestShapeSingleStructure struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// OutputService7ProtocolTest is a client for OutputService7ProtocolTest.
|
||||
type OutputService7ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -610,7 +603,6 @@ type metadataOutputService7TestShapeOutputShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// OutputService8ProtocolTest is a client for OutputService8ProtocolTest.
|
||||
type OutputService8ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -684,7 +676,6 @@ type metadataOutputService8TestShapeOutputShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// OutputService9ProtocolTest is a client for OutputService9ProtocolTest.
|
||||
type OutputService9ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -770,7 +761,6 @@ type metadataOutputService9TestShapeSingleStructure struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// OutputService10ProtocolTest is a client for OutputService10ProtocolTest.
|
||||
type OutputService10ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -844,7 +834,6 @@ type metadataOutputService10TestShapeOutputShape struct {
|
|||
SDKShapeTraits bool `type:"structure" payload:"Stream"`
|
||||
}
|
||||
|
||||
// OutputService11ProtocolTest is a client for OutputService11ProtocolTest.
|
||||
type OutputService11ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
@ -934,7 +923,6 @@ type metadataOutputService11TestShapeOutputShape struct {
|
|||
SDKShapeTraits bool `type:"structure"`
|
||||
}
|
||||
|
||||
// OutputService12ProtocolTest is a client for OutputService12ProtocolTest.
|
||||
type OutputService12ProtocolTest struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
|
|
@ -14,10 +14,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/credentials"
|
||||
"github.com/aws/aws-sdk-go/internal/protocol/rest"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -43,8 +42,8 @@ type signer struct {
|
|||
Credentials *credentials.Credentials
|
||||
Query url.Values
|
||||
Body io.ReadSeeker
|
||||
Debug uint
|
||||
Logger io.Writer
|
||||
Debug aws.LogLevelType
|
||||
Logger aws.Logger
|
||||
|
||||
isPresign bool
|
||||
formattedTime string
|
||||
|
@ -73,7 +72,7 @@ func Sign(req *aws.Request) {
|
|||
|
||||
region := req.Service.SigningRegion
|
||||
if region == "" {
|
||||
region = req.Service.Config.Region
|
||||
region = aws.StringValue(req.Service.Config.Region)
|
||||
}
|
||||
|
||||
name := req.Service.SigningName
|
||||
|
@ -90,7 +89,7 @@ func Sign(req *aws.Request) {
|
|||
ServiceName: name,
|
||||
Region: region,
|
||||
Credentials: req.Service.Config.Credentials,
|
||||
Debug: req.Service.Config.LogLevel,
|
||||
Debug: req.Service.Config.LogLevel.Value(),
|
||||
Logger: req.Service.Config.Logger,
|
||||
}
|
||||
|
||||
|
@ -138,28 +137,33 @@ func (v4 *signer) sign() error {
|
|||
|
||||
v4.build()
|
||||
|
||||
if v4.Debug > 0 {
|
||||
if v4.Debug.Matches(aws.LogDebugWithSigning) {
|
||||
v4.logSigningInfo()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
const logSignInfoMsg = `DEBUG: Request Signiture:
|
||||
---[ CANONICAL STRING ]-----------------------------
|
||||
%s
|
||||
---[ STRING TO SIGN ]--------------------------------
|
||||
%s%s
|
||||
-----------------------------------------------------`
|
||||
const logSignedURLMsg = `
|
||||
---[ SIGNED URL ]------------------------------------
|
||||
%s`
|
||||
|
||||
func (v4 *signer) logSigningInfo() {
|
||||
out := v4.Logger
|
||||
fmt.Fprintf(out, "---[ CANONICAL STRING ]-----------------------------\n")
|
||||
fmt.Fprintln(out, v4.canonicalString)
|
||||
fmt.Fprintf(out, "---[ STRING TO SIGN ]--------------------------------\n")
|
||||
fmt.Fprintln(out, v4.stringToSign)
|
||||
signedURLMsg := ""
|
||||
if v4.isPresign {
|
||||
fmt.Fprintf(out, "---[ SIGNED URL ]--------------------------------\n")
|
||||
fmt.Fprintln(out, v4.Request.URL)
|
||||
signedURLMsg = fmt.Sprintf(logSignedURLMsg, v4.Request.URL.String())
|
||||
}
|
||||
fmt.Fprintf(out, "-----------------------------------------------------\n")
|
||||
msg := fmt.Sprintf(logSignInfoMsg, v4.canonicalString, v4.stringToSign, signedURLMsg)
|
||||
v4.Logger.Log(msg)
|
||||
}
|
||||
|
||||
func (v4 *signer) build() {
|
||||
|
||||
v4.buildTime() // no depends
|
||||
v4.buildCredentialString() // no depends
|
||||
if v4.isPresign {
|
||||
|
|
|
@ -143,7 +143,7 @@ func TestIgnoreResignRequestWithValidCreds(t *testing.T) {
|
|||
r := aws.NewRequest(
|
||||
aws.NewService(&aws.Config{
|
||||
Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "SESSION"),
|
||||
Region: "us-west-2",
|
||||
Region: aws.String("us-west-2"),
|
||||
}),
|
||||
&aws.Operation{
|
||||
Name: "BatchGetItem",
|
||||
|
@ -165,7 +165,7 @@ func TestIgnorePreResignRequestWithValidCreds(t *testing.T) {
|
|||
r := aws.NewRequest(
|
||||
aws.NewService(&aws.Config{
|
||||
Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "SESSION"),
|
||||
Region: "us-west-2",
|
||||
Region: aws.String("us-west-2"),
|
||||
}),
|
||||
&aws.Operation{
|
||||
Name: "BatchGetItem",
|
||||
|
|
24490
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/api.go
generated
vendored
Normal file
24490
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/api.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
57
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/customizations.go
generated
vendored
Normal file
57
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/customizations.go
generated
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
package ec2
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/awsutil"
|
||||
)
|
||||
|
||||
func init() {
|
||||
initRequest = func(r *aws.Request) {
|
||||
if r.Operation.Name == opCopySnapshot { // fill the PresignedURL parameter
|
||||
r.Handlers.Build.PushFront(fillPresignedURL)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func fillPresignedURL(r *aws.Request) {
|
||||
if !r.ParamsFilled() {
|
||||
return
|
||||
}
|
||||
|
||||
params := r.Params.(*CopySnapshotInput)
|
||||
|
||||
// Stop if PresignedURL/DestinationRegion is set
|
||||
if params.PresignedURL != nil || params.DestinationRegion != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// First generate a copy of parameters
|
||||
r.Params = awsutil.CopyOf(r.Params)
|
||||
params = r.Params.(*CopySnapshotInput)
|
||||
|
||||
// Set destination region. Avoids infinite handler loop.
|
||||
// Also needed to sign sub-request.
|
||||
params.DestinationRegion = r.Service.Config.Region
|
||||
|
||||
// Create a new client pointing at source region.
|
||||
// We will use this to presign the CopySnapshot request against
|
||||
// the source region
|
||||
config := r.Service.Config.Copy().
|
||||
WithEndpoint("").
|
||||
WithRegion(*params.SourceRegion)
|
||||
|
||||
client := New(config)
|
||||
|
||||
// Presign a CopySnapshot request with modified params
|
||||
req, _ := client.CopySnapshotRequest(params)
|
||||
url, err := req.Presign(300 * time.Second) // 5 minutes should be enough.
|
||||
|
||||
if err != nil { // bubble error back up to original request
|
||||
r.Error = err
|
||||
}
|
||||
|
||||
// We have our URL, set it on params
|
||||
params.PresignedURL = &url
|
||||
}
|
36
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/customizations_test.go
generated
vendored
Normal file
36
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/customizations_test.go
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
package ec2_test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"testing"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/internal/test/unit"
|
||||
"github.com/aws/aws-sdk-go/service/ec2"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var _ = unit.Imported
|
||||
|
||||
func TestCopySnapshotPresignedURL(t *testing.T) {
|
||||
svc := ec2.New(&aws.Config{Region: aws.String("us-west-2")})
|
||||
|
||||
assert.NotPanics(t, func() {
|
||||
// Doesn't panic on nil input
|
||||
req, _ := svc.CopySnapshotRequest(nil)
|
||||
req.Sign()
|
||||
})
|
||||
|
||||
req, _ := svc.CopySnapshotRequest(&ec2.CopySnapshotInput{
|
||||
SourceRegion: aws.String("us-west-1"),
|
||||
SourceSnapshotID: aws.String("snap-id"),
|
||||
})
|
||||
req.Sign()
|
||||
|
||||
b, _ := ioutil.ReadAll(req.HTTPRequest.Body)
|
||||
q, _ := url.ParseQuery(string(b))
|
||||
url, _ := url.QueryUnescape(q.Get("PresignedUrl"))
|
||||
assert.Equal(t, "us-west-2", q.Get("DestinationRegion"))
|
||||
assert.Regexp(t, `^https://ec2\.us-west-1\.amazon.+&DestinationRegion=us-west-2`, url)
|
||||
}
|
756
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface.go
generated
vendored
Normal file
756
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface.go
generated
vendored
Normal file
|
@ -0,0 +1,756 @@
|
|||
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
|
||||
// Package ec2iface provides an interface for the Amazon Elastic Compute Cloud.
|
||||
package ec2iface
|
||||
|
||||
import (
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/service/ec2"
|
||||
)
|
||||
|
||||
// EC2API is the interface type for ec2.EC2.
|
||||
type EC2API interface {
|
||||
AcceptVPCPeeringConnectionRequest(*ec2.AcceptVPCPeeringConnectionInput) (*aws.Request, *ec2.AcceptVPCPeeringConnectionOutput)
|
||||
|
||||
AcceptVPCPeeringConnection(*ec2.AcceptVPCPeeringConnectionInput) (*ec2.AcceptVPCPeeringConnectionOutput, error)
|
||||
|
||||
AllocateAddressRequest(*ec2.AllocateAddressInput) (*aws.Request, *ec2.AllocateAddressOutput)
|
||||
|
||||
AllocateAddress(*ec2.AllocateAddressInput) (*ec2.AllocateAddressOutput, error)
|
||||
|
||||
AssignPrivateIPAddressesRequest(*ec2.AssignPrivateIPAddressesInput) (*aws.Request, *ec2.AssignPrivateIPAddressesOutput)
|
||||
|
||||
AssignPrivateIPAddresses(*ec2.AssignPrivateIPAddressesInput) (*ec2.AssignPrivateIPAddressesOutput, error)
|
||||
|
||||
AssociateAddressRequest(*ec2.AssociateAddressInput) (*aws.Request, *ec2.AssociateAddressOutput)
|
||||
|
||||
AssociateAddress(*ec2.AssociateAddressInput) (*ec2.AssociateAddressOutput, error)
|
||||
|
||||
AssociateDHCPOptionsRequest(*ec2.AssociateDHCPOptionsInput) (*aws.Request, *ec2.AssociateDHCPOptionsOutput)
|
||||
|
||||
AssociateDHCPOptions(*ec2.AssociateDHCPOptionsInput) (*ec2.AssociateDHCPOptionsOutput, error)
|
||||
|
||||
AssociateRouteTableRequest(*ec2.AssociateRouteTableInput) (*aws.Request, *ec2.AssociateRouteTableOutput)
|
||||
|
||||
AssociateRouteTable(*ec2.AssociateRouteTableInput) (*ec2.AssociateRouteTableOutput, error)
|
||||
|
||||
AttachClassicLinkVPCRequest(*ec2.AttachClassicLinkVPCInput) (*aws.Request, *ec2.AttachClassicLinkVPCOutput)
|
||||
|
||||
AttachClassicLinkVPC(*ec2.AttachClassicLinkVPCInput) (*ec2.AttachClassicLinkVPCOutput, error)
|
||||
|
||||
AttachInternetGatewayRequest(*ec2.AttachInternetGatewayInput) (*aws.Request, *ec2.AttachInternetGatewayOutput)
|
||||
|
||||
AttachInternetGateway(*ec2.AttachInternetGatewayInput) (*ec2.AttachInternetGatewayOutput, error)
|
||||
|
||||
AttachNetworkInterfaceRequest(*ec2.AttachNetworkInterfaceInput) (*aws.Request, *ec2.AttachNetworkInterfaceOutput)
|
||||
|
||||
AttachNetworkInterface(*ec2.AttachNetworkInterfaceInput) (*ec2.AttachNetworkInterfaceOutput, error)
|
||||
|
||||
AttachVPNGatewayRequest(*ec2.AttachVPNGatewayInput) (*aws.Request, *ec2.AttachVPNGatewayOutput)
|
||||
|
||||
AttachVPNGateway(*ec2.AttachVPNGatewayInput) (*ec2.AttachVPNGatewayOutput, error)
|
||||
|
||||
AttachVolumeRequest(*ec2.AttachVolumeInput) (*aws.Request, *ec2.VolumeAttachment)
|
||||
|
||||
AttachVolume(*ec2.AttachVolumeInput) (*ec2.VolumeAttachment, error)
|
||||
|
||||
AuthorizeSecurityGroupEgressRequest(*ec2.AuthorizeSecurityGroupEgressInput) (*aws.Request, *ec2.AuthorizeSecurityGroupEgressOutput)
|
||||
|
||||
AuthorizeSecurityGroupEgress(*ec2.AuthorizeSecurityGroupEgressInput) (*ec2.AuthorizeSecurityGroupEgressOutput, error)
|
||||
|
||||
AuthorizeSecurityGroupIngressRequest(*ec2.AuthorizeSecurityGroupIngressInput) (*aws.Request, *ec2.AuthorizeSecurityGroupIngressOutput)
|
||||
|
||||
AuthorizeSecurityGroupIngress(*ec2.AuthorizeSecurityGroupIngressInput) (*ec2.AuthorizeSecurityGroupIngressOutput, error)
|
||||
|
||||
BundleInstanceRequest(*ec2.BundleInstanceInput) (*aws.Request, *ec2.BundleInstanceOutput)
|
||||
|
||||
BundleInstance(*ec2.BundleInstanceInput) (*ec2.BundleInstanceOutput, error)
|
||||
|
||||
CancelBundleTaskRequest(*ec2.CancelBundleTaskInput) (*aws.Request, *ec2.CancelBundleTaskOutput)
|
||||
|
||||
CancelBundleTask(*ec2.CancelBundleTaskInput) (*ec2.CancelBundleTaskOutput, error)
|
||||
|
||||
CancelConversionTaskRequest(*ec2.CancelConversionTaskInput) (*aws.Request, *ec2.CancelConversionTaskOutput)
|
||||
|
||||
CancelConversionTask(*ec2.CancelConversionTaskInput) (*ec2.CancelConversionTaskOutput, error)
|
||||
|
||||
CancelExportTaskRequest(*ec2.CancelExportTaskInput) (*aws.Request, *ec2.CancelExportTaskOutput)
|
||||
|
||||
CancelExportTask(*ec2.CancelExportTaskInput) (*ec2.CancelExportTaskOutput, error)
|
||||
|
||||
CancelImportTaskRequest(*ec2.CancelImportTaskInput) (*aws.Request, *ec2.CancelImportTaskOutput)
|
||||
|
||||
CancelImportTask(*ec2.CancelImportTaskInput) (*ec2.CancelImportTaskOutput, error)
|
||||
|
||||
CancelReservedInstancesListingRequest(*ec2.CancelReservedInstancesListingInput) (*aws.Request, *ec2.CancelReservedInstancesListingOutput)
|
||||
|
||||
CancelReservedInstancesListing(*ec2.CancelReservedInstancesListingInput) (*ec2.CancelReservedInstancesListingOutput, error)
|
||||
|
||||
CancelSpotFleetRequestsRequest(*ec2.CancelSpotFleetRequestsInput) (*aws.Request, *ec2.CancelSpotFleetRequestsOutput)
|
||||
|
||||
CancelSpotFleetRequests(*ec2.CancelSpotFleetRequestsInput) (*ec2.CancelSpotFleetRequestsOutput, error)
|
||||
|
||||
CancelSpotInstanceRequestsRequest(*ec2.CancelSpotInstanceRequestsInput) (*aws.Request, *ec2.CancelSpotInstanceRequestsOutput)
|
||||
|
||||
CancelSpotInstanceRequests(*ec2.CancelSpotInstanceRequestsInput) (*ec2.CancelSpotInstanceRequestsOutput, error)
|
||||
|
||||
ConfirmProductInstanceRequest(*ec2.ConfirmProductInstanceInput) (*aws.Request, *ec2.ConfirmProductInstanceOutput)
|
||||
|
||||
ConfirmProductInstance(*ec2.ConfirmProductInstanceInput) (*ec2.ConfirmProductInstanceOutput, error)
|
||||
|
||||
CopyImageRequest(*ec2.CopyImageInput) (*aws.Request, *ec2.CopyImageOutput)
|
||||
|
||||
CopyImage(*ec2.CopyImageInput) (*ec2.CopyImageOutput, error)
|
||||
|
||||
CopySnapshotRequest(*ec2.CopySnapshotInput) (*aws.Request, *ec2.CopySnapshotOutput)
|
||||
|
||||
CopySnapshot(*ec2.CopySnapshotInput) (*ec2.CopySnapshotOutput, error)
|
||||
|
||||
CreateCustomerGatewayRequest(*ec2.CreateCustomerGatewayInput) (*aws.Request, *ec2.CreateCustomerGatewayOutput)
|
||||
|
||||
CreateCustomerGateway(*ec2.CreateCustomerGatewayInput) (*ec2.CreateCustomerGatewayOutput, error)
|
||||
|
||||
CreateDHCPOptionsRequest(*ec2.CreateDHCPOptionsInput) (*aws.Request, *ec2.CreateDHCPOptionsOutput)
|
||||
|
||||
CreateDHCPOptions(*ec2.CreateDHCPOptionsInput) (*ec2.CreateDHCPOptionsOutput, error)
|
||||
|
||||
CreateFlowLogsRequest(*ec2.CreateFlowLogsInput) (*aws.Request, *ec2.CreateFlowLogsOutput)
|
||||
|
||||
CreateFlowLogs(*ec2.CreateFlowLogsInput) (*ec2.CreateFlowLogsOutput, error)
|
||||
|
||||
CreateImageRequest(*ec2.CreateImageInput) (*aws.Request, *ec2.CreateImageOutput)
|
||||
|
||||
CreateImage(*ec2.CreateImageInput) (*ec2.CreateImageOutput, error)
|
||||
|
||||
CreateInstanceExportTaskRequest(*ec2.CreateInstanceExportTaskInput) (*aws.Request, *ec2.CreateInstanceExportTaskOutput)
|
||||
|
||||
CreateInstanceExportTask(*ec2.CreateInstanceExportTaskInput) (*ec2.CreateInstanceExportTaskOutput, error)
|
||||
|
||||
CreateInternetGatewayRequest(*ec2.CreateInternetGatewayInput) (*aws.Request, *ec2.CreateInternetGatewayOutput)
|
||||
|
||||
CreateInternetGateway(*ec2.CreateInternetGatewayInput) (*ec2.CreateInternetGatewayOutput, error)
|
||||
|
||||
CreateKeyPairRequest(*ec2.CreateKeyPairInput) (*aws.Request, *ec2.CreateKeyPairOutput)
|
||||
|
||||
CreateKeyPair(*ec2.CreateKeyPairInput) (*ec2.CreateKeyPairOutput, error)
|
||||
|
||||
CreateNetworkACLRequest(*ec2.CreateNetworkACLInput) (*aws.Request, *ec2.CreateNetworkACLOutput)
|
||||
|
||||
CreateNetworkACL(*ec2.CreateNetworkACLInput) (*ec2.CreateNetworkACLOutput, error)
|
||||
|
||||
CreateNetworkACLEntryRequest(*ec2.CreateNetworkACLEntryInput) (*aws.Request, *ec2.CreateNetworkACLEntryOutput)
|
||||
|
||||
CreateNetworkACLEntry(*ec2.CreateNetworkACLEntryInput) (*ec2.CreateNetworkACLEntryOutput, error)
|
||||
|
||||
CreateNetworkInterfaceRequest(*ec2.CreateNetworkInterfaceInput) (*aws.Request, *ec2.CreateNetworkInterfaceOutput)
|
||||
|
||||
CreateNetworkInterface(*ec2.CreateNetworkInterfaceInput) (*ec2.CreateNetworkInterfaceOutput, error)
|
||||
|
||||
CreatePlacementGroupRequest(*ec2.CreatePlacementGroupInput) (*aws.Request, *ec2.CreatePlacementGroupOutput)
|
||||
|
||||
CreatePlacementGroup(*ec2.CreatePlacementGroupInput) (*ec2.CreatePlacementGroupOutput, error)
|
||||
|
||||
CreateReservedInstancesListingRequest(*ec2.CreateReservedInstancesListingInput) (*aws.Request, *ec2.CreateReservedInstancesListingOutput)
|
||||
|
||||
CreateReservedInstancesListing(*ec2.CreateReservedInstancesListingInput) (*ec2.CreateReservedInstancesListingOutput, error)
|
||||
|
||||
CreateRouteRequest(*ec2.CreateRouteInput) (*aws.Request, *ec2.CreateRouteOutput)
|
||||
|
||||
CreateRoute(*ec2.CreateRouteInput) (*ec2.CreateRouteOutput, error)
|
||||
|
||||
CreateRouteTableRequest(*ec2.CreateRouteTableInput) (*aws.Request, *ec2.CreateRouteTableOutput)
|
||||
|
||||
CreateRouteTable(*ec2.CreateRouteTableInput) (*ec2.CreateRouteTableOutput, error)
|
||||
|
||||
CreateSecurityGroupRequest(*ec2.CreateSecurityGroupInput) (*aws.Request, *ec2.CreateSecurityGroupOutput)
|
||||
|
||||
CreateSecurityGroup(*ec2.CreateSecurityGroupInput) (*ec2.CreateSecurityGroupOutput, error)
|
||||
|
||||
CreateSnapshotRequest(*ec2.CreateSnapshotInput) (*aws.Request, *ec2.Snapshot)
|
||||
|
||||
CreateSnapshot(*ec2.CreateSnapshotInput) (*ec2.Snapshot, error)
|
||||
|
||||
CreateSpotDatafeedSubscriptionRequest(*ec2.CreateSpotDatafeedSubscriptionInput) (*aws.Request, *ec2.CreateSpotDatafeedSubscriptionOutput)
|
||||
|
||||
CreateSpotDatafeedSubscription(*ec2.CreateSpotDatafeedSubscriptionInput) (*ec2.CreateSpotDatafeedSubscriptionOutput, error)
|
||||
|
||||
CreateSubnetRequest(*ec2.CreateSubnetInput) (*aws.Request, *ec2.CreateSubnetOutput)
|
||||
|
||||
CreateSubnet(*ec2.CreateSubnetInput) (*ec2.CreateSubnetOutput, error)
|
||||
|
||||
CreateTagsRequest(*ec2.CreateTagsInput) (*aws.Request, *ec2.CreateTagsOutput)
|
||||
|
||||
CreateTags(*ec2.CreateTagsInput) (*ec2.CreateTagsOutput, error)
|
||||
|
||||
CreateVPCRequest(*ec2.CreateVPCInput) (*aws.Request, *ec2.CreateVPCOutput)
|
||||
|
||||
CreateVPC(*ec2.CreateVPCInput) (*ec2.CreateVPCOutput, error)
|
||||
|
||||
CreateVPCEndpointRequest(*ec2.CreateVPCEndpointInput) (*aws.Request, *ec2.CreateVPCEndpointOutput)
|
||||
|
||||
CreateVPCEndpoint(*ec2.CreateVPCEndpointInput) (*ec2.CreateVPCEndpointOutput, error)
|
||||
|
||||
CreateVPCPeeringConnectionRequest(*ec2.CreateVPCPeeringConnectionInput) (*aws.Request, *ec2.CreateVPCPeeringConnectionOutput)
|
||||
|
||||
CreateVPCPeeringConnection(*ec2.CreateVPCPeeringConnectionInput) (*ec2.CreateVPCPeeringConnectionOutput, error)
|
||||
|
||||
CreateVPNConnectionRequest(*ec2.CreateVPNConnectionInput) (*aws.Request, *ec2.CreateVPNConnectionOutput)
|
||||
|
||||
CreateVPNConnection(*ec2.CreateVPNConnectionInput) (*ec2.CreateVPNConnectionOutput, error)
|
||||
|
||||
CreateVPNConnectionRouteRequest(*ec2.CreateVPNConnectionRouteInput) (*aws.Request, *ec2.CreateVPNConnectionRouteOutput)
|
||||
|
||||
CreateVPNConnectionRoute(*ec2.CreateVPNConnectionRouteInput) (*ec2.CreateVPNConnectionRouteOutput, error)
|
||||
|
||||
CreateVPNGatewayRequest(*ec2.CreateVPNGatewayInput) (*aws.Request, *ec2.CreateVPNGatewayOutput)
|
||||
|
||||
CreateVPNGateway(*ec2.CreateVPNGatewayInput) (*ec2.CreateVPNGatewayOutput, error)
|
||||
|
||||
CreateVolumeRequest(*ec2.CreateVolumeInput) (*aws.Request, *ec2.Volume)
|
||||
|
||||
CreateVolume(*ec2.CreateVolumeInput) (*ec2.Volume, error)
|
||||
|
||||
DeleteCustomerGatewayRequest(*ec2.DeleteCustomerGatewayInput) (*aws.Request, *ec2.DeleteCustomerGatewayOutput)
|
||||
|
||||
DeleteCustomerGateway(*ec2.DeleteCustomerGatewayInput) (*ec2.DeleteCustomerGatewayOutput, error)
|
||||
|
||||
DeleteDHCPOptionsRequest(*ec2.DeleteDHCPOptionsInput) (*aws.Request, *ec2.DeleteDHCPOptionsOutput)
|
||||
|
||||
DeleteDHCPOptions(*ec2.DeleteDHCPOptionsInput) (*ec2.DeleteDHCPOptionsOutput, error)
|
||||
|
||||
DeleteFlowLogsRequest(*ec2.DeleteFlowLogsInput) (*aws.Request, *ec2.DeleteFlowLogsOutput)
|
||||
|
||||
DeleteFlowLogs(*ec2.DeleteFlowLogsInput) (*ec2.DeleteFlowLogsOutput, error)
|
||||
|
||||
DeleteInternetGatewayRequest(*ec2.DeleteInternetGatewayInput) (*aws.Request, *ec2.DeleteInternetGatewayOutput)
|
||||
|
||||
DeleteInternetGateway(*ec2.DeleteInternetGatewayInput) (*ec2.DeleteInternetGatewayOutput, error)
|
||||
|
||||
DeleteKeyPairRequest(*ec2.DeleteKeyPairInput) (*aws.Request, *ec2.DeleteKeyPairOutput)
|
||||
|
||||
DeleteKeyPair(*ec2.DeleteKeyPairInput) (*ec2.DeleteKeyPairOutput, error)
|
||||
|
||||
DeleteNetworkACLRequest(*ec2.DeleteNetworkACLInput) (*aws.Request, *ec2.DeleteNetworkACLOutput)
|
||||
|
||||
DeleteNetworkACL(*ec2.DeleteNetworkACLInput) (*ec2.DeleteNetworkACLOutput, error)
|
||||
|
||||
DeleteNetworkACLEntryRequest(*ec2.DeleteNetworkACLEntryInput) (*aws.Request, *ec2.DeleteNetworkACLEntryOutput)
|
||||
|
||||
DeleteNetworkACLEntry(*ec2.DeleteNetworkACLEntryInput) (*ec2.DeleteNetworkACLEntryOutput, error)
|
||||
|
||||
DeleteNetworkInterfaceRequest(*ec2.DeleteNetworkInterfaceInput) (*aws.Request, *ec2.DeleteNetworkInterfaceOutput)
|
||||
|
||||
DeleteNetworkInterface(*ec2.DeleteNetworkInterfaceInput) (*ec2.DeleteNetworkInterfaceOutput, error)
|
||||
|
||||
DeletePlacementGroupRequest(*ec2.DeletePlacementGroupInput) (*aws.Request, *ec2.DeletePlacementGroupOutput)
|
||||
|
||||
DeletePlacementGroup(*ec2.DeletePlacementGroupInput) (*ec2.DeletePlacementGroupOutput, error)
|
||||
|
||||
DeleteRouteRequest(*ec2.DeleteRouteInput) (*aws.Request, *ec2.DeleteRouteOutput)
|
||||
|
||||
DeleteRoute(*ec2.DeleteRouteInput) (*ec2.DeleteRouteOutput, error)
|
||||
|
||||
DeleteRouteTableRequest(*ec2.DeleteRouteTableInput) (*aws.Request, *ec2.DeleteRouteTableOutput)
|
||||
|
||||
DeleteRouteTable(*ec2.DeleteRouteTableInput) (*ec2.DeleteRouteTableOutput, error)
|
||||
|
||||
DeleteSecurityGroupRequest(*ec2.DeleteSecurityGroupInput) (*aws.Request, *ec2.DeleteSecurityGroupOutput)
|
||||
|
||||
DeleteSecurityGroup(*ec2.DeleteSecurityGroupInput) (*ec2.DeleteSecurityGroupOutput, error)
|
||||
|
||||
DeleteSnapshotRequest(*ec2.DeleteSnapshotInput) (*aws.Request, *ec2.DeleteSnapshotOutput)
|
||||
|
||||
DeleteSnapshot(*ec2.DeleteSnapshotInput) (*ec2.DeleteSnapshotOutput, error)
|
||||
|
||||
DeleteSpotDatafeedSubscriptionRequest(*ec2.DeleteSpotDatafeedSubscriptionInput) (*aws.Request, *ec2.DeleteSpotDatafeedSubscriptionOutput)
|
||||
|
||||
DeleteSpotDatafeedSubscription(*ec2.DeleteSpotDatafeedSubscriptionInput) (*ec2.DeleteSpotDatafeedSubscriptionOutput, error)
|
||||
|
||||
DeleteSubnetRequest(*ec2.DeleteSubnetInput) (*aws.Request, *ec2.DeleteSubnetOutput)
|
||||
|
||||
DeleteSubnet(*ec2.DeleteSubnetInput) (*ec2.DeleteSubnetOutput, error)
|
||||
|
||||
DeleteTagsRequest(*ec2.DeleteTagsInput) (*aws.Request, *ec2.DeleteTagsOutput)
|
||||
|
||||
DeleteTags(*ec2.DeleteTagsInput) (*ec2.DeleteTagsOutput, error)
|
||||
|
||||
DeleteVPCRequest(*ec2.DeleteVPCInput) (*aws.Request, *ec2.DeleteVPCOutput)
|
||||
|
||||
DeleteVPC(*ec2.DeleteVPCInput) (*ec2.DeleteVPCOutput, error)
|
||||
|
||||
DeleteVPCEndpointsRequest(*ec2.DeleteVPCEndpointsInput) (*aws.Request, *ec2.DeleteVPCEndpointsOutput)
|
||||
|
||||
DeleteVPCEndpoints(*ec2.DeleteVPCEndpointsInput) (*ec2.DeleteVPCEndpointsOutput, error)
|
||||
|
||||
DeleteVPCPeeringConnectionRequest(*ec2.DeleteVPCPeeringConnectionInput) (*aws.Request, *ec2.DeleteVPCPeeringConnectionOutput)
|
||||
|
||||
DeleteVPCPeeringConnection(*ec2.DeleteVPCPeeringConnectionInput) (*ec2.DeleteVPCPeeringConnectionOutput, error)
|
||||
|
||||
DeleteVPNConnectionRequest(*ec2.DeleteVPNConnectionInput) (*aws.Request, *ec2.DeleteVPNConnectionOutput)
|
||||
|
||||
DeleteVPNConnection(*ec2.DeleteVPNConnectionInput) (*ec2.DeleteVPNConnectionOutput, error)
|
||||
|
||||
DeleteVPNConnectionRouteRequest(*ec2.DeleteVPNConnectionRouteInput) (*aws.Request, *ec2.DeleteVPNConnectionRouteOutput)
|
||||
|
||||
DeleteVPNConnectionRoute(*ec2.DeleteVPNConnectionRouteInput) (*ec2.DeleteVPNConnectionRouteOutput, error)
|
||||
|
||||
DeleteVPNGatewayRequest(*ec2.DeleteVPNGatewayInput) (*aws.Request, *ec2.DeleteVPNGatewayOutput)
|
||||
|
||||
DeleteVPNGateway(*ec2.DeleteVPNGatewayInput) (*ec2.DeleteVPNGatewayOutput, error)
|
||||
|
||||
DeleteVolumeRequest(*ec2.DeleteVolumeInput) (*aws.Request, *ec2.DeleteVolumeOutput)
|
||||
|
||||
DeleteVolume(*ec2.DeleteVolumeInput) (*ec2.DeleteVolumeOutput, error)
|
||||
|
||||
DeregisterImageRequest(*ec2.DeregisterImageInput) (*aws.Request, *ec2.DeregisterImageOutput)
|
||||
|
||||
DeregisterImage(*ec2.DeregisterImageInput) (*ec2.DeregisterImageOutput, error)
|
||||
|
||||
DescribeAccountAttributesRequest(*ec2.DescribeAccountAttributesInput) (*aws.Request, *ec2.DescribeAccountAttributesOutput)
|
||||
|
||||
DescribeAccountAttributes(*ec2.DescribeAccountAttributesInput) (*ec2.DescribeAccountAttributesOutput, error)
|
||||
|
||||
DescribeAddressesRequest(*ec2.DescribeAddressesInput) (*aws.Request, *ec2.DescribeAddressesOutput)
|
||||
|
||||
DescribeAddresses(*ec2.DescribeAddressesInput) (*ec2.DescribeAddressesOutput, error)
|
||||
|
||||
DescribeAvailabilityZonesRequest(*ec2.DescribeAvailabilityZonesInput) (*aws.Request, *ec2.DescribeAvailabilityZonesOutput)
|
||||
|
||||
DescribeAvailabilityZones(*ec2.DescribeAvailabilityZonesInput) (*ec2.DescribeAvailabilityZonesOutput, error)
|
||||
|
||||
DescribeBundleTasksRequest(*ec2.DescribeBundleTasksInput) (*aws.Request, *ec2.DescribeBundleTasksOutput)
|
||||
|
||||
DescribeBundleTasks(*ec2.DescribeBundleTasksInput) (*ec2.DescribeBundleTasksOutput, error)
|
||||
|
||||
DescribeClassicLinkInstancesRequest(*ec2.DescribeClassicLinkInstancesInput) (*aws.Request, *ec2.DescribeClassicLinkInstancesOutput)
|
||||
|
||||
DescribeClassicLinkInstances(*ec2.DescribeClassicLinkInstancesInput) (*ec2.DescribeClassicLinkInstancesOutput, error)
|
||||
|
||||
DescribeConversionTasksRequest(*ec2.DescribeConversionTasksInput) (*aws.Request, *ec2.DescribeConversionTasksOutput)
|
||||
|
||||
DescribeConversionTasks(*ec2.DescribeConversionTasksInput) (*ec2.DescribeConversionTasksOutput, error)
|
||||
|
||||
DescribeCustomerGatewaysRequest(*ec2.DescribeCustomerGatewaysInput) (*aws.Request, *ec2.DescribeCustomerGatewaysOutput)
|
||||
|
||||
DescribeCustomerGateways(*ec2.DescribeCustomerGatewaysInput) (*ec2.DescribeCustomerGatewaysOutput, error)
|
||||
|
||||
DescribeDHCPOptionsRequest(*ec2.DescribeDHCPOptionsInput) (*aws.Request, *ec2.DescribeDHCPOptionsOutput)
|
||||
|
||||
DescribeDHCPOptions(*ec2.DescribeDHCPOptionsInput) (*ec2.DescribeDHCPOptionsOutput, error)
|
||||
|
||||
DescribeExportTasksRequest(*ec2.DescribeExportTasksInput) (*aws.Request, *ec2.DescribeExportTasksOutput)
|
||||
|
||||
DescribeExportTasks(*ec2.DescribeExportTasksInput) (*ec2.DescribeExportTasksOutput, error)
|
||||
|
||||
DescribeFlowLogsRequest(*ec2.DescribeFlowLogsInput) (*aws.Request, *ec2.DescribeFlowLogsOutput)
|
||||
|
||||
DescribeFlowLogs(*ec2.DescribeFlowLogsInput) (*ec2.DescribeFlowLogsOutput, error)
|
||||
|
||||
DescribeImageAttributeRequest(*ec2.DescribeImageAttributeInput) (*aws.Request, *ec2.DescribeImageAttributeOutput)
|
||||
|
||||
DescribeImageAttribute(*ec2.DescribeImageAttributeInput) (*ec2.DescribeImageAttributeOutput, error)
|
||||
|
||||
DescribeImagesRequest(*ec2.DescribeImagesInput) (*aws.Request, *ec2.DescribeImagesOutput)
|
||||
|
||||
DescribeImages(*ec2.DescribeImagesInput) (*ec2.DescribeImagesOutput, error)
|
||||
|
||||
DescribeImportImageTasksRequest(*ec2.DescribeImportImageTasksInput) (*aws.Request, *ec2.DescribeImportImageTasksOutput)
|
||||
|
||||
DescribeImportImageTasks(*ec2.DescribeImportImageTasksInput) (*ec2.DescribeImportImageTasksOutput, error)
|
||||
|
||||
DescribeImportSnapshotTasksRequest(*ec2.DescribeImportSnapshotTasksInput) (*aws.Request, *ec2.DescribeImportSnapshotTasksOutput)
|
||||
|
||||
DescribeImportSnapshotTasks(*ec2.DescribeImportSnapshotTasksInput) (*ec2.DescribeImportSnapshotTasksOutput, error)
|
||||
|
||||
DescribeInstanceAttributeRequest(*ec2.DescribeInstanceAttributeInput) (*aws.Request, *ec2.DescribeInstanceAttributeOutput)
|
||||
|
||||
DescribeInstanceAttribute(*ec2.DescribeInstanceAttributeInput) (*ec2.DescribeInstanceAttributeOutput, error)
|
||||
|
||||
DescribeInstanceStatusRequest(*ec2.DescribeInstanceStatusInput) (*aws.Request, *ec2.DescribeInstanceStatusOutput)
|
||||
|
||||
DescribeInstanceStatus(*ec2.DescribeInstanceStatusInput) (*ec2.DescribeInstanceStatusOutput, error)
|
||||
|
||||
DescribeInstanceStatusPages(*ec2.DescribeInstanceStatusInput, func(*ec2.DescribeInstanceStatusOutput, bool) bool) error
|
||||
|
||||
DescribeInstancesRequest(*ec2.DescribeInstancesInput) (*aws.Request, *ec2.DescribeInstancesOutput)
|
||||
|
||||
DescribeInstances(*ec2.DescribeInstancesInput) (*ec2.DescribeInstancesOutput, error)
|
||||
|
||||
DescribeInstancesPages(*ec2.DescribeInstancesInput, func(*ec2.DescribeInstancesOutput, bool) bool) error
|
||||
|
||||
DescribeInternetGatewaysRequest(*ec2.DescribeInternetGatewaysInput) (*aws.Request, *ec2.DescribeInternetGatewaysOutput)
|
||||
|
||||
DescribeInternetGateways(*ec2.DescribeInternetGatewaysInput) (*ec2.DescribeInternetGatewaysOutput, error)
|
||||
|
||||
DescribeKeyPairsRequest(*ec2.DescribeKeyPairsInput) (*aws.Request, *ec2.DescribeKeyPairsOutput)
|
||||
|
||||
DescribeKeyPairs(*ec2.DescribeKeyPairsInput) (*ec2.DescribeKeyPairsOutput, error)
|
||||
|
||||
DescribeMovingAddressesRequest(*ec2.DescribeMovingAddressesInput) (*aws.Request, *ec2.DescribeMovingAddressesOutput)
|
||||
|
||||
DescribeMovingAddresses(*ec2.DescribeMovingAddressesInput) (*ec2.DescribeMovingAddressesOutput, error)
|
||||
|
||||
DescribeNetworkACLsRequest(*ec2.DescribeNetworkACLsInput) (*aws.Request, *ec2.DescribeNetworkACLsOutput)
|
||||
|
||||
DescribeNetworkACLs(*ec2.DescribeNetworkACLsInput) (*ec2.DescribeNetworkACLsOutput, error)
|
||||
|
||||
DescribeNetworkInterfaceAttributeRequest(*ec2.DescribeNetworkInterfaceAttributeInput) (*aws.Request, *ec2.DescribeNetworkInterfaceAttributeOutput)
|
||||
|
||||
DescribeNetworkInterfaceAttribute(*ec2.DescribeNetworkInterfaceAttributeInput) (*ec2.DescribeNetworkInterfaceAttributeOutput, error)
|
||||
|
||||
DescribeNetworkInterfacesRequest(*ec2.DescribeNetworkInterfacesInput) (*aws.Request, *ec2.DescribeNetworkInterfacesOutput)
|
||||
|
||||
DescribeNetworkInterfaces(*ec2.DescribeNetworkInterfacesInput) (*ec2.DescribeNetworkInterfacesOutput, error)
|
||||
|
||||
DescribePlacementGroupsRequest(*ec2.DescribePlacementGroupsInput) (*aws.Request, *ec2.DescribePlacementGroupsOutput)
|
||||
|
||||
DescribePlacementGroups(*ec2.DescribePlacementGroupsInput) (*ec2.DescribePlacementGroupsOutput, error)
|
||||
|
||||
DescribePrefixListsRequest(*ec2.DescribePrefixListsInput) (*aws.Request, *ec2.DescribePrefixListsOutput)
|
||||
|
||||
DescribePrefixLists(*ec2.DescribePrefixListsInput) (*ec2.DescribePrefixListsOutput, error)
|
||||
|
||||
DescribeRegionsRequest(*ec2.DescribeRegionsInput) (*aws.Request, *ec2.DescribeRegionsOutput)
|
||||
|
||||
DescribeRegions(*ec2.DescribeRegionsInput) (*ec2.DescribeRegionsOutput, error)
|
||||
|
||||
DescribeReservedInstancesRequest(*ec2.DescribeReservedInstancesInput) (*aws.Request, *ec2.DescribeReservedInstancesOutput)
|
||||
|
||||
DescribeReservedInstances(*ec2.DescribeReservedInstancesInput) (*ec2.DescribeReservedInstancesOutput, error)
|
||||
|
||||
DescribeReservedInstancesListingsRequest(*ec2.DescribeReservedInstancesListingsInput) (*aws.Request, *ec2.DescribeReservedInstancesListingsOutput)
|
||||
|
||||
DescribeReservedInstancesListings(*ec2.DescribeReservedInstancesListingsInput) (*ec2.DescribeReservedInstancesListingsOutput, error)
|
||||
|
||||
DescribeReservedInstancesModificationsRequest(*ec2.DescribeReservedInstancesModificationsInput) (*aws.Request, *ec2.DescribeReservedInstancesModificationsOutput)
|
||||
|
||||
DescribeReservedInstancesModifications(*ec2.DescribeReservedInstancesModificationsInput) (*ec2.DescribeReservedInstancesModificationsOutput, error)
|
||||
|
||||
DescribeReservedInstancesModificationsPages(*ec2.DescribeReservedInstancesModificationsInput, func(*ec2.DescribeReservedInstancesModificationsOutput, bool) bool) error
|
||||
|
||||
DescribeReservedInstancesOfferingsRequest(*ec2.DescribeReservedInstancesOfferingsInput) (*aws.Request, *ec2.DescribeReservedInstancesOfferingsOutput)
|
||||
|
||||
DescribeReservedInstancesOfferings(*ec2.DescribeReservedInstancesOfferingsInput) (*ec2.DescribeReservedInstancesOfferingsOutput, error)
|
||||
|
||||
DescribeReservedInstancesOfferingsPages(*ec2.DescribeReservedInstancesOfferingsInput, func(*ec2.DescribeReservedInstancesOfferingsOutput, bool) bool) error
|
||||
|
||||
DescribeRouteTablesRequest(*ec2.DescribeRouteTablesInput) (*aws.Request, *ec2.DescribeRouteTablesOutput)
|
||||
|
||||
DescribeRouteTables(*ec2.DescribeRouteTablesInput) (*ec2.DescribeRouteTablesOutput, error)
|
||||
|
||||
DescribeSecurityGroupsRequest(*ec2.DescribeSecurityGroupsInput) (*aws.Request, *ec2.DescribeSecurityGroupsOutput)
|
||||
|
||||
DescribeSecurityGroups(*ec2.DescribeSecurityGroupsInput) (*ec2.DescribeSecurityGroupsOutput, error)
|
||||
|
||||
DescribeSnapshotAttributeRequest(*ec2.DescribeSnapshotAttributeInput) (*aws.Request, *ec2.DescribeSnapshotAttributeOutput)
|
||||
|
||||
DescribeSnapshotAttribute(*ec2.DescribeSnapshotAttributeInput) (*ec2.DescribeSnapshotAttributeOutput, error)
|
||||
|
||||
DescribeSnapshotsRequest(*ec2.DescribeSnapshotsInput) (*aws.Request, *ec2.DescribeSnapshotsOutput)
|
||||
|
||||
DescribeSnapshots(*ec2.DescribeSnapshotsInput) (*ec2.DescribeSnapshotsOutput, error)
|
||||
|
||||
DescribeSnapshotsPages(*ec2.DescribeSnapshotsInput, func(*ec2.DescribeSnapshotsOutput, bool) bool) error
|
||||
|
||||
DescribeSpotDatafeedSubscriptionRequest(*ec2.DescribeSpotDatafeedSubscriptionInput) (*aws.Request, *ec2.DescribeSpotDatafeedSubscriptionOutput)
|
||||
|
||||
DescribeSpotDatafeedSubscription(*ec2.DescribeSpotDatafeedSubscriptionInput) (*ec2.DescribeSpotDatafeedSubscriptionOutput, error)
|
||||
|
||||
DescribeSpotFleetInstancesRequest(*ec2.DescribeSpotFleetInstancesInput) (*aws.Request, *ec2.DescribeSpotFleetInstancesOutput)
|
||||
|
||||
DescribeSpotFleetInstances(*ec2.DescribeSpotFleetInstancesInput) (*ec2.DescribeSpotFleetInstancesOutput, error)
|
||||
|
||||
DescribeSpotFleetRequestHistoryRequest(*ec2.DescribeSpotFleetRequestHistoryInput) (*aws.Request, *ec2.DescribeSpotFleetRequestHistoryOutput)
|
||||
|
||||
DescribeSpotFleetRequestHistory(*ec2.DescribeSpotFleetRequestHistoryInput) (*ec2.DescribeSpotFleetRequestHistoryOutput, error)
|
||||
|
||||
DescribeSpotFleetRequestsRequest(*ec2.DescribeSpotFleetRequestsInput) (*aws.Request, *ec2.DescribeSpotFleetRequestsOutput)
|
||||
|
||||
DescribeSpotFleetRequests(*ec2.DescribeSpotFleetRequestsInput) (*ec2.DescribeSpotFleetRequestsOutput, error)
|
||||
|
||||
DescribeSpotInstanceRequestsRequest(*ec2.DescribeSpotInstanceRequestsInput) (*aws.Request, *ec2.DescribeSpotInstanceRequestsOutput)
|
||||
|
||||
DescribeSpotInstanceRequests(*ec2.DescribeSpotInstanceRequestsInput) (*ec2.DescribeSpotInstanceRequestsOutput, error)
|
||||
|
||||
DescribeSpotPriceHistoryRequest(*ec2.DescribeSpotPriceHistoryInput) (*aws.Request, *ec2.DescribeSpotPriceHistoryOutput)
|
||||
|
||||
DescribeSpotPriceHistory(*ec2.DescribeSpotPriceHistoryInput) (*ec2.DescribeSpotPriceHistoryOutput, error)
|
||||
|
||||
DescribeSpotPriceHistoryPages(*ec2.DescribeSpotPriceHistoryInput, func(*ec2.DescribeSpotPriceHistoryOutput, bool) bool) error
|
||||
|
||||
DescribeSubnetsRequest(*ec2.DescribeSubnetsInput) (*aws.Request, *ec2.DescribeSubnetsOutput)
|
||||
|
||||
DescribeSubnets(*ec2.DescribeSubnetsInput) (*ec2.DescribeSubnetsOutput, error)
|
||||
|
||||
DescribeTagsRequest(*ec2.DescribeTagsInput) (*aws.Request, *ec2.DescribeTagsOutput)
|
||||
|
||||
DescribeTags(*ec2.DescribeTagsInput) (*ec2.DescribeTagsOutput, error)
|
||||
|
||||
DescribeVPCAttributeRequest(*ec2.DescribeVPCAttributeInput) (*aws.Request, *ec2.DescribeVPCAttributeOutput)
|
||||
|
||||
DescribeVPCAttribute(*ec2.DescribeVPCAttributeInput) (*ec2.DescribeVPCAttributeOutput, error)
|
||||
|
||||
DescribeVPCClassicLinkRequest(*ec2.DescribeVPCClassicLinkInput) (*aws.Request, *ec2.DescribeVPCClassicLinkOutput)
|
||||
|
||||
DescribeVPCClassicLink(*ec2.DescribeVPCClassicLinkInput) (*ec2.DescribeVPCClassicLinkOutput, error)
|
||||
|
||||
DescribeVPCEndpointServicesRequest(*ec2.DescribeVPCEndpointServicesInput) (*aws.Request, *ec2.DescribeVPCEndpointServicesOutput)
|
||||
|
||||
DescribeVPCEndpointServices(*ec2.DescribeVPCEndpointServicesInput) (*ec2.DescribeVPCEndpointServicesOutput, error)
|
||||
|
||||
DescribeVPCEndpointsRequest(*ec2.DescribeVPCEndpointsInput) (*aws.Request, *ec2.DescribeVPCEndpointsOutput)
|
||||
|
||||
DescribeVPCEndpoints(*ec2.DescribeVPCEndpointsInput) (*ec2.DescribeVPCEndpointsOutput, error)
|
||||
|
||||
DescribeVPCPeeringConnectionsRequest(*ec2.DescribeVPCPeeringConnectionsInput) (*aws.Request, *ec2.DescribeVPCPeeringConnectionsOutput)
|
||||
|
||||
DescribeVPCPeeringConnections(*ec2.DescribeVPCPeeringConnectionsInput) (*ec2.DescribeVPCPeeringConnectionsOutput, error)
|
||||
|
||||
DescribeVPCsRequest(*ec2.DescribeVPCsInput) (*aws.Request, *ec2.DescribeVPCsOutput)
|
||||
|
||||
DescribeVPCs(*ec2.DescribeVPCsInput) (*ec2.DescribeVPCsOutput, error)
|
||||
|
||||
DescribeVPNConnectionsRequest(*ec2.DescribeVPNConnectionsInput) (*aws.Request, *ec2.DescribeVPNConnectionsOutput)
|
||||
|
||||
DescribeVPNConnections(*ec2.DescribeVPNConnectionsInput) (*ec2.DescribeVPNConnectionsOutput, error)
|
||||
|
||||
DescribeVPNGatewaysRequest(*ec2.DescribeVPNGatewaysInput) (*aws.Request, *ec2.DescribeVPNGatewaysOutput)
|
||||
|
||||
DescribeVPNGateways(*ec2.DescribeVPNGatewaysInput) (*ec2.DescribeVPNGatewaysOutput, error)
|
||||
|
||||
DescribeVolumeAttributeRequest(*ec2.DescribeVolumeAttributeInput) (*aws.Request, *ec2.DescribeVolumeAttributeOutput)
|
||||
|
||||
DescribeVolumeAttribute(*ec2.DescribeVolumeAttributeInput) (*ec2.DescribeVolumeAttributeOutput, error)
|
||||
|
||||
DescribeVolumeStatusRequest(*ec2.DescribeVolumeStatusInput) (*aws.Request, *ec2.DescribeVolumeStatusOutput)
|
||||
|
||||
DescribeVolumeStatus(*ec2.DescribeVolumeStatusInput) (*ec2.DescribeVolumeStatusOutput, error)
|
||||
|
||||
DescribeVolumeStatusPages(*ec2.DescribeVolumeStatusInput, func(*ec2.DescribeVolumeStatusOutput, bool) bool) error
|
||||
|
||||
DescribeVolumesRequest(*ec2.DescribeVolumesInput) (*aws.Request, *ec2.DescribeVolumesOutput)
|
||||
|
||||
DescribeVolumes(*ec2.DescribeVolumesInput) (*ec2.DescribeVolumesOutput, error)
|
||||
|
||||
DescribeVolumesPages(*ec2.DescribeVolumesInput, func(*ec2.DescribeVolumesOutput, bool) bool) error
|
||||
|
||||
DetachClassicLinkVPCRequest(*ec2.DetachClassicLinkVPCInput) (*aws.Request, *ec2.DetachClassicLinkVPCOutput)
|
||||
|
||||
DetachClassicLinkVPC(*ec2.DetachClassicLinkVPCInput) (*ec2.DetachClassicLinkVPCOutput, error)
|
||||
|
||||
DetachInternetGatewayRequest(*ec2.DetachInternetGatewayInput) (*aws.Request, *ec2.DetachInternetGatewayOutput)
|
||||
|
||||
DetachInternetGateway(*ec2.DetachInternetGatewayInput) (*ec2.DetachInternetGatewayOutput, error)
|
||||
|
||||
DetachNetworkInterfaceRequest(*ec2.DetachNetworkInterfaceInput) (*aws.Request, *ec2.DetachNetworkInterfaceOutput)
|
||||
|
||||
DetachNetworkInterface(*ec2.DetachNetworkInterfaceInput) (*ec2.DetachNetworkInterfaceOutput, error)
|
||||
|
||||
DetachVPNGatewayRequest(*ec2.DetachVPNGatewayInput) (*aws.Request, *ec2.DetachVPNGatewayOutput)
|
||||
|
||||
DetachVPNGateway(*ec2.DetachVPNGatewayInput) (*ec2.DetachVPNGatewayOutput, error)
|
||||
|
||||
DetachVolumeRequest(*ec2.DetachVolumeInput) (*aws.Request, *ec2.VolumeAttachment)
|
||||
|
||||
DetachVolume(*ec2.DetachVolumeInput) (*ec2.VolumeAttachment, error)
|
||||
|
||||
DisableVGWRoutePropagationRequest(*ec2.DisableVGWRoutePropagationInput) (*aws.Request, *ec2.DisableVGWRoutePropagationOutput)
|
||||
|
||||
DisableVGWRoutePropagation(*ec2.DisableVGWRoutePropagationInput) (*ec2.DisableVGWRoutePropagationOutput, error)
|
||||
|
||||
DisableVPCClassicLinkRequest(*ec2.DisableVPCClassicLinkInput) (*aws.Request, *ec2.DisableVPCClassicLinkOutput)
|
||||
|
||||
DisableVPCClassicLink(*ec2.DisableVPCClassicLinkInput) (*ec2.DisableVPCClassicLinkOutput, error)
|
||||
|
||||
DisassociateAddressRequest(*ec2.DisassociateAddressInput) (*aws.Request, *ec2.DisassociateAddressOutput)
|
||||
|
||||
DisassociateAddress(*ec2.DisassociateAddressInput) (*ec2.DisassociateAddressOutput, error)
|
||||
|
||||
DisassociateRouteTableRequest(*ec2.DisassociateRouteTableInput) (*aws.Request, *ec2.DisassociateRouteTableOutput)
|
||||
|
||||
DisassociateRouteTable(*ec2.DisassociateRouteTableInput) (*ec2.DisassociateRouteTableOutput, error)
|
||||
|
||||
EnableVGWRoutePropagationRequest(*ec2.EnableVGWRoutePropagationInput) (*aws.Request, *ec2.EnableVGWRoutePropagationOutput)
|
||||
|
||||
EnableVGWRoutePropagation(*ec2.EnableVGWRoutePropagationInput) (*ec2.EnableVGWRoutePropagationOutput, error)
|
||||
|
||||
EnableVPCClassicLinkRequest(*ec2.EnableVPCClassicLinkInput) (*aws.Request, *ec2.EnableVPCClassicLinkOutput)
|
||||
|
||||
EnableVPCClassicLink(*ec2.EnableVPCClassicLinkInput) (*ec2.EnableVPCClassicLinkOutput, error)
|
||||
|
||||
EnableVolumeIORequest(*ec2.EnableVolumeIOInput) (*aws.Request, *ec2.EnableVolumeIOOutput)
|
||||
|
||||
EnableVolumeIO(*ec2.EnableVolumeIOInput) (*ec2.EnableVolumeIOOutput, error)
|
||||
|
||||
GetConsoleOutputRequest(*ec2.GetConsoleOutputInput) (*aws.Request, *ec2.GetConsoleOutputOutput)
|
||||
|
||||
GetConsoleOutput(*ec2.GetConsoleOutputInput) (*ec2.GetConsoleOutputOutput, error)
|
||||
|
||||
GetPasswordDataRequest(*ec2.GetPasswordDataInput) (*aws.Request, *ec2.GetPasswordDataOutput)
|
||||
|
||||
GetPasswordData(*ec2.GetPasswordDataInput) (*ec2.GetPasswordDataOutput, error)
|
||||
|
||||
ImportImageRequest(*ec2.ImportImageInput) (*aws.Request, *ec2.ImportImageOutput)
|
||||
|
||||
ImportImage(*ec2.ImportImageInput) (*ec2.ImportImageOutput, error)
|
||||
|
||||
ImportInstanceRequest(*ec2.ImportInstanceInput) (*aws.Request, *ec2.ImportInstanceOutput)
|
||||
|
||||
ImportInstance(*ec2.ImportInstanceInput) (*ec2.ImportInstanceOutput, error)
|
||||
|
||||
ImportKeyPairRequest(*ec2.ImportKeyPairInput) (*aws.Request, *ec2.ImportKeyPairOutput)
|
||||
|
||||
ImportKeyPair(*ec2.ImportKeyPairInput) (*ec2.ImportKeyPairOutput, error)
|
||||
|
||||
ImportSnapshotRequest(*ec2.ImportSnapshotInput) (*aws.Request, *ec2.ImportSnapshotOutput)
|
||||
|
||||
ImportSnapshot(*ec2.ImportSnapshotInput) (*ec2.ImportSnapshotOutput, error)
|
||||
|
||||
ImportVolumeRequest(*ec2.ImportVolumeInput) (*aws.Request, *ec2.ImportVolumeOutput)
|
||||
|
||||
ImportVolume(*ec2.ImportVolumeInput) (*ec2.ImportVolumeOutput, error)
|
||||
|
||||
ModifyImageAttributeRequest(*ec2.ModifyImageAttributeInput) (*aws.Request, *ec2.ModifyImageAttributeOutput)
|
||||
|
||||
ModifyImageAttribute(*ec2.ModifyImageAttributeInput) (*ec2.ModifyImageAttributeOutput, error)
|
||||
|
||||
ModifyInstanceAttributeRequest(*ec2.ModifyInstanceAttributeInput) (*aws.Request, *ec2.ModifyInstanceAttributeOutput)
|
||||
|
||||
ModifyInstanceAttribute(*ec2.ModifyInstanceAttributeInput) (*ec2.ModifyInstanceAttributeOutput, error)
|
||||
|
||||
ModifyNetworkInterfaceAttributeRequest(*ec2.ModifyNetworkInterfaceAttributeInput) (*aws.Request, *ec2.ModifyNetworkInterfaceAttributeOutput)
|
||||
|
||||
ModifyNetworkInterfaceAttribute(*ec2.ModifyNetworkInterfaceAttributeInput) (*ec2.ModifyNetworkInterfaceAttributeOutput, error)
|
||||
|
||||
ModifyReservedInstancesRequest(*ec2.ModifyReservedInstancesInput) (*aws.Request, *ec2.ModifyReservedInstancesOutput)
|
||||
|
||||
ModifyReservedInstances(*ec2.ModifyReservedInstancesInput) (*ec2.ModifyReservedInstancesOutput, error)
|
||||
|
||||
ModifySnapshotAttributeRequest(*ec2.ModifySnapshotAttributeInput) (*aws.Request, *ec2.ModifySnapshotAttributeOutput)
|
||||
|
||||
ModifySnapshotAttribute(*ec2.ModifySnapshotAttributeInput) (*ec2.ModifySnapshotAttributeOutput, error)
|
||||
|
||||
ModifySubnetAttributeRequest(*ec2.ModifySubnetAttributeInput) (*aws.Request, *ec2.ModifySubnetAttributeOutput)
|
||||
|
||||
ModifySubnetAttribute(*ec2.ModifySubnetAttributeInput) (*ec2.ModifySubnetAttributeOutput, error)
|
||||
|
||||
ModifyVPCAttributeRequest(*ec2.ModifyVPCAttributeInput) (*aws.Request, *ec2.ModifyVPCAttributeOutput)
|
||||
|
||||
ModifyVPCAttribute(*ec2.ModifyVPCAttributeInput) (*ec2.ModifyVPCAttributeOutput, error)
|
||||
|
||||
ModifyVPCEndpointRequest(*ec2.ModifyVPCEndpointInput) (*aws.Request, *ec2.ModifyVPCEndpointOutput)
|
||||
|
||||
ModifyVPCEndpoint(*ec2.ModifyVPCEndpointInput) (*ec2.ModifyVPCEndpointOutput, error)
|
||||
|
||||
ModifyVolumeAttributeRequest(*ec2.ModifyVolumeAttributeInput) (*aws.Request, *ec2.ModifyVolumeAttributeOutput)
|
||||
|
||||
ModifyVolumeAttribute(*ec2.ModifyVolumeAttributeInput) (*ec2.ModifyVolumeAttributeOutput, error)
|
||||
|
||||
MonitorInstancesRequest(*ec2.MonitorInstancesInput) (*aws.Request, *ec2.MonitorInstancesOutput)
|
||||
|
||||
MonitorInstances(*ec2.MonitorInstancesInput) (*ec2.MonitorInstancesOutput, error)
|
||||
|
||||
MoveAddressToVPCRequest(*ec2.MoveAddressToVPCInput) (*aws.Request, *ec2.MoveAddressToVPCOutput)
|
||||
|
||||
MoveAddressToVPC(*ec2.MoveAddressToVPCInput) (*ec2.MoveAddressToVPCOutput, error)
|
||||
|
||||
PurchaseReservedInstancesOfferingRequest(*ec2.PurchaseReservedInstancesOfferingInput) (*aws.Request, *ec2.PurchaseReservedInstancesOfferingOutput)
|
||||
|
||||
PurchaseReservedInstancesOffering(*ec2.PurchaseReservedInstancesOfferingInput) (*ec2.PurchaseReservedInstancesOfferingOutput, error)
|
||||
|
||||
RebootInstancesRequest(*ec2.RebootInstancesInput) (*aws.Request, *ec2.RebootInstancesOutput)
|
||||
|
||||
RebootInstances(*ec2.RebootInstancesInput) (*ec2.RebootInstancesOutput, error)
|
||||
|
||||
RegisterImageRequest(*ec2.RegisterImageInput) (*aws.Request, *ec2.RegisterImageOutput)
|
||||
|
||||
RegisterImage(*ec2.RegisterImageInput) (*ec2.RegisterImageOutput, error)
|
||||
|
||||
RejectVPCPeeringConnectionRequest(*ec2.RejectVPCPeeringConnectionInput) (*aws.Request, *ec2.RejectVPCPeeringConnectionOutput)
|
||||
|
||||
RejectVPCPeeringConnection(*ec2.RejectVPCPeeringConnectionInput) (*ec2.RejectVPCPeeringConnectionOutput, error)
|
||||
|
||||
ReleaseAddressRequest(*ec2.ReleaseAddressInput) (*aws.Request, *ec2.ReleaseAddressOutput)
|
||||
|
||||
ReleaseAddress(*ec2.ReleaseAddressInput) (*ec2.ReleaseAddressOutput, error)
|
||||
|
||||
ReplaceNetworkACLAssociationRequest(*ec2.ReplaceNetworkACLAssociationInput) (*aws.Request, *ec2.ReplaceNetworkACLAssociationOutput)
|
||||
|
||||
ReplaceNetworkACLAssociation(*ec2.ReplaceNetworkACLAssociationInput) (*ec2.ReplaceNetworkACLAssociationOutput, error)
|
||||
|
||||
ReplaceNetworkACLEntryRequest(*ec2.ReplaceNetworkACLEntryInput) (*aws.Request, *ec2.ReplaceNetworkACLEntryOutput)
|
||||
|
||||
ReplaceNetworkACLEntry(*ec2.ReplaceNetworkACLEntryInput) (*ec2.ReplaceNetworkACLEntryOutput, error)
|
||||
|
||||
ReplaceRouteRequest(*ec2.ReplaceRouteInput) (*aws.Request, *ec2.ReplaceRouteOutput)
|
||||
|
||||
ReplaceRoute(*ec2.ReplaceRouteInput) (*ec2.ReplaceRouteOutput, error)
|
||||
|
||||
ReplaceRouteTableAssociationRequest(*ec2.ReplaceRouteTableAssociationInput) (*aws.Request, *ec2.ReplaceRouteTableAssociationOutput)
|
||||
|
||||
ReplaceRouteTableAssociation(*ec2.ReplaceRouteTableAssociationInput) (*ec2.ReplaceRouteTableAssociationOutput, error)
|
||||
|
||||
ReportInstanceStatusRequest(*ec2.ReportInstanceStatusInput) (*aws.Request, *ec2.ReportInstanceStatusOutput)
|
||||
|
||||
ReportInstanceStatus(*ec2.ReportInstanceStatusInput) (*ec2.ReportInstanceStatusOutput, error)
|
||||
|
||||
RequestSpotFleetRequest(*ec2.RequestSpotFleetInput) (*aws.Request, *ec2.RequestSpotFleetOutput)
|
||||
|
||||
RequestSpotFleet(*ec2.RequestSpotFleetInput) (*ec2.RequestSpotFleetOutput, error)
|
||||
|
||||
RequestSpotInstancesRequest(*ec2.RequestSpotInstancesInput) (*aws.Request, *ec2.RequestSpotInstancesOutput)
|
||||
|
||||
RequestSpotInstances(*ec2.RequestSpotInstancesInput) (*ec2.RequestSpotInstancesOutput, error)
|
||||
|
||||
ResetImageAttributeRequest(*ec2.ResetImageAttributeInput) (*aws.Request, *ec2.ResetImageAttributeOutput)
|
||||
|
||||
ResetImageAttribute(*ec2.ResetImageAttributeInput) (*ec2.ResetImageAttributeOutput, error)
|
||||
|
||||
ResetInstanceAttributeRequest(*ec2.ResetInstanceAttributeInput) (*aws.Request, *ec2.ResetInstanceAttributeOutput)
|
||||
|
||||
ResetInstanceAttribute(*ec2.ResetInstanceAttributeInput) (*ec2.ResetInstanceAttributeOutput, error)
|
||||
|
||||
ResetNetworkInterfaceAttributeRequest(*ec2.ResetNetworkInterfaceAttributeInput) (*aws.Request, *ec2.ResetNetworkInterfaceAttributeOutput)
|
||||
|
||||
ResetNetworkInterfaceAttribute(*ec2.ResetNetworkInterfaceAttributeInput) (*ec2.ResetNetworkInterfaceAttributeOutput, error)
|
||||
|
||||
ResetSnapshotAttributeRequest(*ec2.ResetSnapshotAttributeInput) (*aws.Request, *ec2.ResetSnapshotAttributeOutput)
|
||||
|
||||
ResetSnapshotAttribute(*ec2.ResetSnapshotAttributeInput) (*ec2.ResetSnapshotAttributeOutput, error)
|
||||
|
||||
RestoreAddressToClassicRequest(*ec2.RestoreAddressToClassicInput) (*aws.Request, *ec2.RestoreAddressToClassicOutput)
|
||||
|
||||
RestoreAddressToClassic(*ec2.RestoreAddressToClassicInput) (*ec2.RestoreAddressToClassicOutput, error)
|
||||
|
||||
RevokeSecurityGroupEgressRequest(*ec2.RevokeSecurityGroupEgressInput) (*aws.Request, *ec2.RevokeSecurityGroupEgressOutput)
|
||||
|
||||
RevokeSecurityGroupEgress(*ec2.RevokeSecurityGroupEgressInput) (*ec2.RevokeSecurityGroupEgressOutput, error)
|
||||
|
||||
RevokeSecurityGroupIngressRequest(*ec2.RevokeSecurityGroupIngressInput) (*aws.Request, *ec2.RevokeSecurityGroupIngressOutput)
|
||||
|
||||
RevokeSecurityGroupIngress(*ec2.RevokeSecurityGroupIngressInput) (*ec2.RevokeSecurityGroupIngressOutput, error)
|
||||
|
||||
RunInstancesRequest(*ec2.RunInstancesInput) (*aws.Request, *ec2.Reservation)
|
||||
|
||||
RunInstances(*ec2.RunInstancesInput) (*ec2.Reservation, error)
|
||||
|
||||
StartInstancesRequest(*ec2.StartInstancesInput) (*aws.Request, *ec2.StartInstancesOutput)
|
||||
|
||||
StartInstances(*ec2.StartInstancesInput) (*ec2.StartInstancesOutput, error)
|
||||
|
||||
StopInstancesRequest(*ec2.StopInstancesInput) (*aws.Request, *ec2.StopInstancesOutput)
|
||||
|
||||
StopInstances(*ec2.StopInstancesInput) (*ec2.StopInstancesOutput, error)
|
||||
|
||||
TerminateInstancesRequest(*ec2.TerminateInstancesInput) (*aws.Request, *ec2.TerminateInstancesOutput)
|
||||
|
||||
TerminateInstances(*ec2.TerminateInstancesInput) (*ec2.TerminateInstancesOutput, error)
|
||||
|
||||
UnassignPrivateIPAddressesRequest(*ec2.UnassignPrivateIPAddressesInput) (*aws.Request, *ec2.UnassignPrivateIPAddressesOutput)
|
||||
|
||||
UnassignPrivateIPAddresses(*ec2.UnassignPrivateIPAddressesInput) (*ec2.UnassignPrivateIPAddressesOutput, error)
|
||||
|
||||
UnmonitorInstancesRequest(*ec2.UnmonitorInstancesInput) (*aws.Request, *ec2.UnmonitorInstancesOutput)
|
||||
|
||||
UnmonitorInstances(*ec2.UnmonitorInstancesInput) (*ec2.UnmonitorInstancesOutput, error)
|
||||
}
|
15
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface_test.go
generated
vendored
Normal file
15
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface_test.go
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
|
||||
package ec2iface_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/aws/aws-sdk-go/service/ec2"
|
||||
"github.com/aws/aws-sdk-go/service/ec2/ec2iface"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestInterface(t *testing.T) {
|
||||
assert.Implements(t, (*ec2iface.EC2API)(nil), ec2.New(nil))
|
||||
}
|
6619
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/examples_test.go
generated
vendored
Normal file
6619
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/examples_test.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
60
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/service.go
generated
vendored
Normal file
60
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/ec2/service.go
generated
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
|
||||
package ec2
|
||||
|
||||
import (
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/internal/protocol/ec2query"
|
||||
"github.com/aws/aws-sdk-go/internal/signer/v4"
|
||||
)
|
||||
|
||||
// Amazon Elastic Compute Cloud (Amazon EC2) provides resizable computing capacity
|
||||
// in the Amazon Web Services (AWS) cloud. Using Amazon EC2 eliminates your
|
||||
// need to invest in hardware up front, so you can develop and deploy applications
|
||||
// faster.
|
||||
type EC2 struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
||||
// Used for custom service initialization logic
|
||||
var initService func(*aws.Service)
|
||||
|
||||
// Used for custom request initialization logic
|
||||
var initRequest func(*aws.Request)
|
||||
|
||||
// New returns a new EC2 client.
|
||||
func New(config *aws.Config) *EC2 {
|
||||
service := &aws.Service{
|
||||
Config: aws.DefaultConfig.Merge(config),
|
||||
ServiceName: "ec2",
|
||||
APIVersion: "2015-04-15",
|
||||
}
|
||||
service.Initialize()
|
||||
|
||||
// Handlers
|
||||
service.Handlers.Sign.PushBack(v4.Sign)
|
||||
service.Handlers.Build.PushBack(ec2query.Build)
|
||||
service.Handlers.Unmarshal.PushBack(ec2query.Unmarshal)
|
||||
service.Handlers.UnmarshalMeta.PushBack(ec2query.UnmarshalMeta)
|
||||
service.Handlers.UnmarshalError.PushBack(ec2query.UnmarshalError)
|
||||
|
||||
// Run custom service initialization if present
|
||||
if initService != nil {
|
||||
initService(service)
|
||||
}
|
||||
|
||||
return &EC2{service}
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a EC2 operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *EC2) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {
|
||||
req := aws.NewRequest(c.Service, op, params, data)
|
||||
|
||||
// Run custom request initialization if present
|
||||
if initRequest != nil {
|
||||
initRequest(req)
|
||||
}
|
||||
|
||||
return req
|
||||
}
|
11136
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/iam/api.go
generated
vendored
Normal file
11136
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/iam/api.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3099
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/iam/examples_test.go
generated
vendored
Normal file
3099
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/iam/examples_test.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
492
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/iam/iamiface/interface.go
generated
vendored
Normal file
492
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/iam/iamiface/interface.go
generated
vendored
Normal file
|
@ -0,0 +1,492 @@
|
|||
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
|
||||
// Package iamiface provides an interface for the AWS Identity and Access Management.
|
||||
package iamiface
|
||||
|
||||
import (
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/service/iam"
|
||||
)
|
||||
|
||||
// IAMAPI is the interface type for iam.IAM.
|
||||
type IAMAPI interface {
|
||||
AddClientIDToOpenIDConnectProviderRequest(*iam.AddClientIDToOpenIDConnectProviderInput) (*aws.Request, *iam.AddClientIDToOpenIDConnectProviderOutput)
|
||||
|
||||
AddClientIDToOpenIDConnectProvider(*iam.AddClientIDToOpenIDConnectProviderInput) (*iam.AddClientIDToOpenIDConnectProviderOutput, error)
|
||||
|
||||
AddRoleToInstanceProfileRequest(*iam.AddRoleToInstanceProfileInput) (*aws.Request, *iam.AddRoleToInstanceProfileOutput)
|
||||
|
||||
AddRoleToInstanceProfile(*iam.AddRoleToInstanceProfileInput) (*iam.AddRoleToInstanceProfileOutput, error)
|
||||
|
||||
AddUserToGroupRequest(*iam.AddUserToGroupInput) (*aws.Request, *iam.AddUserToGroupOutput)
|
||||
|
||||
AddUserToGroup(*iam.AddUserToGroupInput) (*iam.AddUserToGroupOutput, error)
|
||||
|
||||
AttachGroupPolicyRequest(*iam.AttachGroupPolicyInput) (*aws.Request, *iam.AttachGroupPolicyOutput)
|
||||
|
||||
AttachGroupPolicy(*iam.AttachGroupPolicyInput) (*iam.AttachGroupPolicyOutput, error)
|
||||
|
||||
AttachRolePolicyRequest(*iam.AttachRolePolicyInput) (*aws.Request, *iam.AttachRolePolicyOutput)
|
||||
|
||||
AttachRolePolicy(*iam.AttachRolePolicyInput) (*iam.AttachRolePolicyOutput, error)
|
||||
|
||||
AttachUserPolicyRequest(*iam.AttachUserPolicyInput) (*aws.Request, *iam.AttachUserPolicyOutput)
|
||||
|
||||
AttachUserPolicy(*iam.AttachUserPolicyInput) (*iam.AttachUserPolicyOutput, error)
|
||||
|
||||
ChangePasswordRequest(*iam.ChangePasswordInput) (*aws.Request, *iam.ChangePasswordOutput)
|
||||
|
||||
ChangePassword(*iam.ChangePasswordInput) (*iam.ChangePasswordOutput, error)
|
||||
|
||||
CreateAccessKeyRequest(*iam.CreateAccessKeyInput) (*aws.Request, *iam.CreateAccessKeyOutput)
|
||||
|
||||
CreateAccessKey(*iam.CreateAccessKeyInput) (*iam.CreateAccessKeyOutput, error)
|
||||
|
||||
CreateAccountAliasRequest(*iam.CreateAccountAliasInput) (*aws.Request, *iam.CreateAccountAliasOutput)
|
||||
|
||||
CreateAccountAlias(*iam.CreateAccountAliasInput) (*iam.CreateAccountAliasOutput, error)
|
||||
|
||||
CreateGroupRequest(*iam.CreateGroupInput) (*aws.Request, *iam.CreateGroupOutput)
|
||||
|
||||
CreateGroup(*iam.CreateGroupInput) (*iam.CreateGroupOutput, error)
|
||||
|
||||
CreateInstanceProfileRequest(*iam.CreateInstanceProfileInput) (*aws.Request, *iam.CreateInstanceProfileOutput)
|
||||
|
||||
CreateInstanceProfile(*iam.CreateInstanceProfileInput) (*iam.CreateInstanceProfileOutput, error)
|
||||
|
||||
CreateLoginProfileRequest(*iam.CreateLoginProfileInput) (*aws.Request, *iam.CreateLoginProfileOutput)
|
||||
|
||||
CreateLoginProfile(*iam.CreateLoginProfileInput) (*iam.CreateLoginProfileOutput, error)
|
||||
|
||||
CreateOpenIDConnectProviderRequest(*iam.CreateOpenIDConnectProviderInput) (*aws.Request, *iam.CreateOpenIDConnectProviderOutput)
|
||||
|
||||
CreateOpenIDConnectProvider(*iam.CreateOpenIDConnectProviderInput) (*iam.CreateOpenIDConnectProviderOutput, error)
|
||||
|
||||
CreatePolicyRequest(*iam.CreatePolicyInput) (*aws.Request, *iam.CreatePolicyOutput)
|
||||
|
||||
CreatePolicy(*iam.CreatePolicyInput) (*iam.CreatePolicyOutput, error)
|
||||
|
||||
CreatePolicyVersionRequest(*iam.CreatePolicyVersionInput) (*aws.Request, *iam.CreatePolicyVersionOutput)
|
||||
|
||||
CreatePolicyVersion(*iam.CreatePolicyVersionInput) (*iam.CreatePolicyVersionOutput, error)
|
||||
|
||||
CreateRoleRequest(*iam.CreateRoleInput) (*aws.Request, *iam.CreateRoleOutput)
|
||||
|
||||
CreateRole(*iam.CreateRoleInput) (*iam.CreateRoleOutput, error)
|
||||
|
||||
CreateSAMLProviderRequest(*iam.CreateSAMLProviderInput) (*aws.Request, *iam.CreateSAMLProviderOutput)
|
||||
|
||||
CreateSAMLProvider(*iam.CreateSAMLProviderInput) (*iam.CreateSAMLProviderOutput, error)
|
||||
|
||||
CreateUserRequest(*iam.CreateUserInput) (*aws.Request, *iam.CreateUserOutput)
|
||||
|
||||
CreateUser(*iam.CreateUserInput) (*iam.CreateUserOutput, error)
|
||||
|
||||
CreateVirtualMFADeviceRequest(*iam.CreateVirtualMFADeviceInput) (*aws.Request, *iam.CreateVirtualMFADeviceOutput)
|
||||
|
||||
CreateVirtualMFADevice(*iam.CreateVirtualMFADeviceInput) (*iam.CreateVirtualMFADeviceOutput, error)
|
||||
|
||||
DeactivateMFADeviceRequest(*iam.DeactivateMFADeviceInput) (*aws.Request, *iam.DeactivateMFADeviceOutput)
|
||||
|
||||
DeactivateMFADevice(*iam.DeactivateMFADeviceInput) (*iam.DeactivateMFADeviceOutput, error)
|
||||
|
||||
DeleteAccessKeyRequest(*iam.DeleteAccessKeyInput) (*aws.Request, *iam.DeleteAccessKeyOutput)
|
||||
|
||||
DeleteAccessKey(*iam.DeleteAccessKeyInput) (*iam.DeleteAccessKeyOutput, error)
|
||||
|
||||
DeleteAccountAliasRequest(*iam.DeleteAccountAliasInput) (*aws.Request, *iam.DeleteAccountAliasOutput)
|
||||
|
||||
DeleteAccountAlias(*iam.DeleteAccountAliasInput) (*iam.DeleteAccountAliasOutput, error)
|
||||
|
||||
DeleteAccountPasswordPolicyRequest(*iam.DeleteAccountPasswordPolicyInput) (*aws.Request, *iam.DeleteAccountPasswordPolicyOutput)
|
||||
|
||||
DeleteAccountPasswordPolicy(*iam.DeleteAccountPasswordPolicyInput) (*iam.DeleteAccountPasswordPolicyOutput, error)
|
||||
|
||||
DeleteGroupRequest(*iam.DeleteGroupInput) (*aws.Request, *iam.DeleteGroupOutput)
|
||||
|
||||
DeleteGroup(*iam.DeleteGroupInput) (*iam.DeleteGroupOutput, error)
|
||||
|
||||
DeleteGroupPolicyRequest(*iam.DeleteGroupPolicyInput) (*aws.Request, *iam.DeleteGroupPolicyOutput)
|
||||
|
||||
DeleteGroupPolicy(*iam.DeleteGroupPolicyInput) (*iam.DeleteGroupPolicyOutput, error)
|
||||
|
||||
DeleteInstanceProfileRequest(*iam.DeleteInstanceProfileInput) (*aws.Request, *iam.DeleteInstanceProfileOutput)
|
||||
|
||||
DeleteInstanceProfile(*iam.DeleteInstanceProfileInput) (*iam.DeleteInstanceProfileOutput, error)
|
||||
|
||||
DeleteLoginProfileRequest(*iam.DeleteLoginProfileInput) (*aws.Request, *iam.DeleteLoginProfileOutput)
|
||||
|
||||
DeleteLoginProfile(*iam.DeleteLoginProfileInput) (*iam.DeleteLoginProfileOutput, error)
|
||||
|
||||
DeleteOpenIDConnectProviderRequest(*iam.DeleteOpenIDConnectProviderInput) (*aws.Request, *iam.DeleteOpenIDConnectProviderOutput)
|
||||
|
||||
DeleteOpenIDConnectProvider(*iam.DeleteOpenIDConnectProviderInput) (*iam.DeleteOpenIDConnectProviderOutput, error)
|
||||
|
||||
DeletePolicyRequest(*iam.DeletePolicyInput) (*aws.Request, *iam.DeletePolicyOutput)
|
||||
|
||||
DeletePolicy(*iam.DeletePolicyInput) (*iam.DeletePolicyOutput, error)
|
||||
|
||||
DeletePolicyVersionRequest(*iam.DeletePolicyVersionInput) (*aws.Request, *iam.DeletePolicyVersionOutput)
|
||||
|
||||
DeletePolicyVersion(*iam.DeletePolicyVersionInput) (*iam.DeletePolicyVersionOutput, error)
|
||||
|
||||
DeleteRoleRequest(*iam.DeleteRoleInput) (*aws.Request, *iam.DeleteRoleOutput)
|
||||
|
||||
DeleteRole(*iam.DeleteRoleInput) (*iam.DeleteRoleOutput, error)
|
||||
|
||||
DeleteRolePolicyRequest(*iam.DeleteRolePolicyInput) (*aws.Request, *iam.DeleteRolePolicyOutput)
|
||||
|
||||
DeleteRolePolicy(*iam.DeleteRolePolicyInput) (*iam.DeleteRolePolicyOutput, error)
|
||||
|
||||
DeleteSAMLProviderRequest(*iam.DeleteSAMLProviderInput) (*aws.Request, *iam.DeleteSAMLProviderOutput)
|
||||
|
||||
DeleteSAMLProvider(*iam.DeleteSAMLProviderInput) (*iam.DeleteSAMLProviderOutput, error)
|
||||
|
||||
DeleteSSHPublicKeyRequest(*iam.DeleteSSHPublicKeyInput) (*aws.Request, *iam.DeleteSSHPublicKeyOutput)
|
||||
|
||||
DeleteSSHPublicKey(*iam.DeleteSSHPublicKeyInput) (*iam.DeleteSSHPublicKeyOutput, error)
|
||||
|
||||
DeleteServerCertificateRequest(*iam.DeleteServerCertificateInput) (*aws.Request, *iam.DeleteServerCertificateOutput)
|
||||
|
||||
DeleteServerCertificate(*iam.DeleteServerCertificateInput) (*iam.DeleteServerCertificateOutput, error)
|
||||
|
||||
DeleteSigningCertificateRequest(*iam.DeleteSigningCertificateInput) (*aws.Request, *iam.DeleteSigningCertificateOutput)
|
||||
|
||||
DeleteSigningCertificate(*iam.DeleteSigningCertificateInput) (*iam.DeleteSigningCertificateOutput, error)
|
||||
|
||||
DeleteUserRequest(*iam.DeleteUserInput) (*aws.Request, *iam.DeleteUserOutput)
|
||||
|
||||
DeleteUser(*iam.DeleteUserInput) (*iam.DeleteUserOutput, error)
|
||||
|
||||
DeleteUserPolicyRequest(*iam.DeleteUserPolicyInput) (*aws.Request, *iam.DeleteUserPolicyOutput)
|
||||
|
||||
DeleteUserPolicy(*iam.DeleteUserPolicyInput) (*iam.DeleteUserPolicyOutput, error)
|
||||
|
||||
DeleteVirtualMFADeviceRequest(*iam.DeleteVirtualMFADeviceInput) (*aws.Request, *iam.DeleteVirtualMFADeviceOutput)
|
||||
|
||||
DeleteVirtualMFADevice(*iam.DeleteVirtualMFADeviceInput) (*iam.DeleteVirtualMFADeviceOutput, error)
|
||||
|
||||
DetachGroupPolicyRequest(*iam.DetachGroupPolicyInput) (*aws.Request, *iam.DetachGroupPolicyOutput)
|
||||
|
||||
DetachGroupPolicy(*iam.DetachGroupPolicyInput) (*iam.DetachGroupPolicyOutput, error)
|
||||
|
||||
DetachRolePolicyRequest(*iam.DetachRolePolicyInput) (*aws.Request, *iam.DetachRolePolicyOutput)
|
||||
|
||||
DetachRolePolicy(*iam.DetachRolePolicyInput) (*iam.DetachRolePolicyOutput, error)
|
||||
|
||||
DetachUserPolicyRequest(*iam.DetachUserPolicyInput) (*aws.Request, *iam.DetachUserPolicyOutput)
|
||||
|
||||
DetachUserPolicy(*iam.DetachUserPolicyInput) (*iam.DetachUserPolicyOutput, error)
|
||||
|
||||
EnableMFADeviceRequest(*iam.EnableMFADeviceInput) (*aws.Request, *iam.EnableMFADeviceOutput)
|
||||
|
||||
EnableMFADevice(*iam.EnableMFADeviceInput) (*iam.EnableMFADeviceOutput, error)
|
||||
|
||||
GenerateCredentialReportRequest(*iam.GenerateCredentialReportInput) (*aws.Request, *iam.GenerateCredentialReportOutput)
|
||||
|
||||
GenerateCredentialReport(*iam.GenerateCredentialReportInput) (*iam.GenerateCredentialReportOutput, error)
|
||||
|
||||
GetAccessKeyLastUsedRequest(*iam.GetAccessKeyLastUsedInput) (*aws.Request, *iam.GetAccessKeyLastUsedOutput)
|
||||
|
||||
GetAccessKeyLastUsed(*iam.GetAccessKeyLastUsedInput) (*iam.GetAccessKeyLastUsedOutput, error)
|
||||
|
||||
GetAccountAuthorizationDetailsRequest(*iam.GetAccountAuthorizationDetailsInput) (*aws.Request, *iam.GetAccountAuthorizationDetailsOutput)
|
||||
|
||||
GetAccountAuthorizationDetails(*iam.GetAccountAuthorizationDetailsInput) (*iam.GetAccountAuthorizationDetailsOutput, error)
|
||||
|
||||
GetAccountAuthorizationDetailsPages(*iam.GetAccountAuthorizationDetailsInput, func(*iam.GetAccountAuthorizationDetailsOutput, bool) bool) error
|
||||
|
||||
GetAccountPasswordPolicyRequest(*iam.GetAccountPasswordPolicyInput) (*aws.Request, *iam.GetAccountPasswordPolicyOutput)
|
||||
|
||||
GetAccountPasswordPolicy(*iam.GetAccountPasswordPolicyInput) (*iam.GetAccountPasswordPolicyOutput, error)
|
||||
|
||||
GetAccountSummaryRequest(*iam.GetAccountSummaryInput) (*aws.Request, *iam.GetAccountSummaryOutput)
|
||||
|
||||
GetAccountSummary(*iam.GetAccountSummaryInput) (*iam.GetAccountSummaryOutput, error)
|
||||
|
||||
GetCredentialReportRequest(*iam.GetCredentialReportInput) (*aws.Request, *iam.GetCredentialReportOutput)
|
||||
|
||||
GetCredentialReport(*iam.GetCredentialReportInput) (*iam.GetCredentialReportOutput, error)
|
||||
|
||||
GetGroupRequest(*iam.GetGroupInput) (*aws.Request, *iam.GetGroupOutput)
|
||||
|
||||
GetGroup(*iam.GetGroupInput) (*iam.GetGroupOutput, error)
|
||||
|
||||
GetGroupPages(*iam.GetGroupInput, func(*iam.GetGroupOutput, bool) bool) error
|
||||
|
||||
GetGroupPolicyRequest(*iam.GetGroupPolicyInput) (*aws.Request, *iam.GetGroupPolicyOutput)
|
||||
|
||||
GetGroupPolicy(*iam.GetGroupPolicyInput) (*iam.GetGroupPolicyOutput, error)
|
||||
|
||||
GetInstanceProfileRequest(*iam.GetInstanceProfileInput) (*aws.Request, *iam.GetInstanceProfileOutput)
|
||||
|
||||
GetInstanceProfile(*iam.GetInstanceProfileInput) (*iam.GetInstanceProfileOutput, error)
|
||||
|
||||
GetLoginProfileRequest(*iam.GetLoginProfileInput) (*aws.Request, *iam.GetLoginProfileOutput)
|
||||
|
||||
GetLoginProfile(*iam.GetLoginProfileInput) (*iam.GetLoginProfileOutput, error)
|
||||
|
||||
GetOpenIDConnectProviderRequest(*iam.GetOpenIDConnectProviderInput) (*aws.Request, *iam.GetOpenIDConnectProviderOutput)
|
||||
|
||||
GetOpenIDConnectProvider(*iam.GetOpenIDConnectProviderInput) (*iam.GetOpenIDConnectProviderOutput, error)
|
||||
|
||||
GetPolicyRequest(*iam.GetPolicyInput) (*aws.Request, *iam.GetPolicyOutput)
|
||||
|
||||
GetPolicy(*iam.GetPolicyInput) (*iam.GetPolicyOutput, error)
|
||||
|
||||
GetPolicyVersionRequest(*iam.GetPolicyVersionInput) (*aws.Request, *iam.GetPolicyVersionOutput)
|
||||
|
||||
GetPolicyVersion(*iam.GetPolicyVersionInput) (*iam.GetPolicyVersionOutput, error)
|
||||
|
||||
GetRoleRequest(*iam.GetRoleInput) (*aws.Request, *iam.GetRoleOutput)
|
||||
|
||||
GetRole(*iam.GetRoleInput) (*iam.GetRoleOutput, error)
|
||||
|
||||
GetRolePolicyRequest(*iam.GetRolePolicyInput) (*aws.Request, *iam.GetRolePolicyOutput)
|
||||
|
||||
GetRolePolicy(*iam.GetRolePolicyInput) (*iam.GetRolePolicyOutput, error)
|
||||
|
||||
GetSAMLProviderRequest(*iam.GetSAMLProviderInput) (*aws.Request, *iam.GetSAMLProviderOutput)
|
||||
|
||||
GetSAMLProvider(*iam.GetSAMLProviderInput) (*iam.GetSAMLProviderOutput, error)
|
||||
|
||||
GetSSHPublicKeyRequest(*iam.GetSSHPublicKeyInput) (*aws.Request, *iam.GetSSHPublicKeyOutput)
|
||||
|
||||
GetSSHPublicKey(*iam.GetSSHPublicKeyInput) (*iam.GetSSHPublicKeyOutput, error)
|
||||
|
||||
GetServerCertificateRequest(*iam.GetServerCertificateInput) (*aws.Request, *iam.GetServerCertificateOutput)
|
||||
|
||||
GetServerCertificate(*iam.GetServerCertificateInput) (*iam.GetServerCertificateOutput, error)
|
||||
|
||||
GetUserRequest(*iam.GetUserInput) (*aws.Request, *iam.GetUserOutput)
|
||||
|
||||
GetUser(*iam.GetUserInput) (*iam.GetUserOutput, error)
|
||||
|
||||
GetUserPolicyRequest(*iam.GetUserPolicyInput) (*aws.Request, *iam.GetUserPolicyOutput)
|
||||
|
||||
GetUserPolicy(*iam.GetUserPolicyInput) (*iam.GetUserPolicyOutput, error)
|
||||
|
||||
ListAccessKeysRequest(*iam.ListAccessKeysInput) (*aws.Request, *iam.ListAccessKeysOutput)
|
||||
|
||||
ListAccessKeys(*iam.ListAccessKeysInput) (*iam.ListAccessKeysOutput, error)
|
||||
|
||||
ListAccessKeysPages(*iam.ListAccessKeysInput, func(*iam.ListAccessKeysOutput, bool) bool) error
|
||||
|
||||
ListAccountAliasesRequest(*iam.ListAccountAliasesInput) (*aws.Request, *iam.ListAccountAliasesOutput)
|
||||
|
||||
ListAccountAliases(*iam.ListAccountAliasesInput) (*iam.ListAccountAliasesOutput, error)
|
||||
|
||||
ListAccountAliasesPages(*iam.ListAccountAliasesInput, func(*iam.ListAccountAliasesOutput, bool) bool) error
|
||||
|
||||
ListAttachedGroupPoliciesRequest(*iam.ListAttachedGroupPoliciesInput) (*aws.Request, *iam.ListAttachedGroupPoliciesOutput)
|
||||
|
||||
ListAttachedGroupPolicies(*iam.ListAttachedGroupPoliciesInput) (*iam.ListAttachedGroupPoliciesOutput, error)
|
||||
|
||||
ListAttachedGroupPoliciesPages(*iam.ListAttachedGroupPoliciesInput, func(*iam.ListAttachedGroupPoliciesOutput, bool) bool) error
|
||||
|
||||
ListAttachedRolePoliciesRequest(*iam.ListAttachedRolePoliciesInput) (*aws.Request, *iam.ListAttachedRolePoliciesOutput)
|
||||
|
||||
ListAttachedRolePolicies(*iam.ListAttachedRolePoliciesInput) (*iam.ListAttachedRolePoliciesOutput, error)
|
||||
|
||||
ListAttachedRolePoliciesPages(*iam.ListAttachedRolePoliciesInput, func(*iam.ListAttachedRolePoliciesOutput, bool) bool) error
|
||||
|
||||
ListAttachedUserPoliciesRequest(*iam.ListAttachedUserPoliciesInput) (*aws.Request, *iam.ListAttachedUserPoliciesOutput)
|
||||
|
||||
ListAttachedUserPolicies(*iam.ListAttachedUserPoliciesInput) (*iam.ListAttachedUserPoliciesOutput, error)
|
||||
|
||||
ListAttachedUserPoliciesPages(*iam.ListAttachedUserPoliciesInput, func(*iam.ListAttachedUserPoliciesOutput, bool) bool) error
|
||||
|
||||
ListEntitiesForPolicyRequest(*iam.ListEntitiesForPolicyInput) (*aws.Request, *iam.ListEntitiesForPolicyOutput)
|
||||
|
||||
ListEntitiesForPolicy(*iam.ListEntitiesForPolicyInput) (*iam.ListEntitiesForPolicyOutput, error)
|
||||
|
||||
ListEntitiesForPolicyPages(*iam.ListEntitiesForPolicyInput, func(*iam.ListEntitiesForPolicyOutput, bool) bool) error
|
||||
|
||||
ListGroupPoliciesRequest(*iam.ListGroupPoliciesInput) (*aws.Request, *iam.ListGroupPoliciesOutput)
|
||||
|
||||
ListGroupPolicies(*iam.ListGroupPoliciesInput) (*iam.ListGroupPoliciesOutput, error)
|
||||
|
||||
ListGroupPoliciesPages(*iam.ListGroupPoliciesInput, func(*iam.ListGroupPoliciesOutput, bool) bool) error
|
||||
|
||||
ListGroupsRequest(*iam.ListGroupsInput) (*aws.Request, *iam.ListGroupsOutput)
|
||||
|
||||
ListGroups(*iam.ListGroupsInput) (*iam.ListGroupsOutput, error)
|
||||
|
||||
ListGroupsPages(*iam.ListGroupsInput, func(*iam.ListGroupsOutput, bool) bool) error
|
||||
|
||||
ListGroupsForUserRequest(*iam.ListGroupsForUserInput) (*aws.Request, *iam.ListGroupsForUserOutput)
|
||||
|
||||
ListGroupsForUser(*iam.ListGroupsForUserInput) (*iam.ListGroupsForUserOutput, error)
|
||||
|
||||
ListGroupsForUserPages(*iam.ListGroupsForUserInput, func(*iam.ListGroupsForUserOutput, bool) bool) error
|
||||
|
||||
ListInstanceProfilesRequest(*iam.ListInstanceProfilesInput) (*aws.Request, *iam.ListInstanceProfilesOutput)
|
||||
|
||||
ListInstanceProfiles(*iam.ListInstanceProfilesInput) (*iam.ListInstanceProfilesOutput, error)
|
||||
|
||||
ListInstanceProfilesPages(*iam.ListInstanceProfilesInput, func(*iam.ListInstanceProfilesOutput, bool) bool) error
|
||||
|
||||
ListInstanceProfilesForRoleRequest(*iam.ListInstanceProfilesForRoleInput) (*aws.Request, *iam.ListInstanceProfilesForRoleOutput)
|
||||
|
||||
ListInstanceProfilesForRole(*iam.ListInstanceProfilesForRoleInput) (*iam.ListInstanceProfilesForRoleOutput, error)
|
||||
|
||||
ListInstanceProfilesForRolePages(*iam.ListInstanceProfilesForRoleInput, func(*iam.ListInstanceProfilesForRoleOutput, bool) bool) error
|
||||
|
||||
ListMFADevicesRequest(*iam.ListMFADevicesInput) (*aws.Request, *iam.ListMFADevicesOutput)
|
||||
|
||||
ListMFADevices(*iam.ListMFADevicesInput) (*iam.ListMFADevicesOutput, error)
|
||||
|
||||
ListMFADevicesPages(*iam.ListMFADevicesInput, func(*iam.ListMFADevicesOutput, bool) bool) error
|
||||
|
||||
ListOpenIDConnectProvidersRequest(*iam.ListOpenIDConnectProvidersInput) (*aws.Request, *iam.ListOpenIDConnectProvidersOutput)
|
||||
|
||||
ListOpenIDConnectProviders(*iam.ListOpenIDConnectProvidersInput) (*iam.ListOpenIDConnectProvidersOutput, error)
|
||||
|
||||
ListPoliciesRequest(*iam.ListPoliciesInput) (*aws.Request, *iam.ListPoliciesOutput)
|
||||
|
||||
ListPolicies(*iam.ListPoliciesInput) (*iam.ListPoliciesOutput, error)
|
||||
|
||||
ListPoliciesPages(*iam.ListPoliciesInput, func(*iam.ListPoliciesOutput, bool) bool) error
|
||||
|
||||
ListPolicyVersionsRequest(*iam.ListPolicyVersionsInput) (*aws.Request, *iam.ListPolicyVersionsOutput)
|
||||
|
||||
ListPolicyVersions(*iam.ListPolicyVersionsInput) (*iam.ListPolicyVersionsOutput, error)
|
||||
|
||||
ListRolePoliciesRequest(*iam.ListRolePoliciesInput) (*aws.Request, *iam.ListRolePoliciesOutput)
|
||||
|
||||
ListRolePolicies(*iam.ListRolePoliciesInput) (*iam.ListRolePoliciesOutput, error)
|
||||
|
||||
ListRolePoliciesPages(*iam.ListRolePoliciesInput, func(*iam.ListRolePoliciesOutput, bool) bool) error
|
||||
|
||||
ListRolesRequest(*iam.ListRolesInput) (*aws.Request, *iam.ListRolesOutput)
|
||||
|
||||
ListRoles(*iam.ListRolesInput) (*iam.ListRolesOutput, error)
|
||||
|
||||
ListRolesPages(*iam.ListRolesInput, func(*iam.ListRolesOutput, bool) bool) error
|
||||
|
||||
ListSAMLProvidersRequest(*iam.ListSAMLProvidersInput) (*aws.Request, *iam.ListSAMLProvidersOutput)
|
||||
|
||||
ListSAMLProviders(*iam.ListSAMLProvidersInput) (*iam.ListSAMLProvidersOutput, error)
|
||||
|
||||
ListSSHPublicKeysRequest(*iam.ListSSHPublicKeysInput) (*aws.Request, *iam.ListSSHPublicKeysOutput)
|
||||
|
||||
ListSSHPublicKeys(*iam.ListSSHPublicKeysInput) (*iam.ListSSHPublicKeysOutput, error)
|
||||
|
||||
ListServerCertificatesRequest(*iam.ListServerCertificatesInput) (*aws.Request, *iam.ListServerCertificatesOutput)
|
||||
|
||||
ListServerCertificates(*iam.ListServerCertificatesInput) (*iam.ListServerCertificatesOutput, error)
|
||||
|
||||
ListServerCertificatesPages(*iam.ListServerCertificatesInput, func(*iam.ListServerCertificatesOutput, bool) bool) error
|
||||
|
||||
ListSigningCertificatesRequest(*iam.ListSigningCertificatesInput) (*aws.Request, *iam.ListSigningCertificatesOutput)
|
||||
|
||||
ListSigningCertificates(*iam.ListSigningCertificatesInput) (*iam.ListSigningCertificatesOutput, error)
|
||||
|
||||
ListSigningCertificatesPages(*iam.ListSigningCertificatesInput, func(*iam.ListSigningCertificatesOutput, bool) bool) error
|
||||
|
||||
ListUserPoliciesRequest(*iam.ListUserPoliciesInput) (*aws.Request, *iam.ListUserPoliciesOutput)
|
||||
|
||||
ListUserPolicies(*iam.ListUserPoliciesInput) (*iam.ListUserPoliciesOutput, error)
|
||||
|
||||
ListUserPoliciesPages(*iam.ListUserPoliciesInput, func(*iam.ListUserPoliciesOutput, bool) bool) error
|
||||
|
||||
ListUsersRequest(*iam.ListUsersInput) (*aws.Request, *iam.ListUsersOutput)
|
||||
|
||||
ListUsers(*iam.ListUsersInput) (*iam.ListUsersOutput, error)
|
||||
|
||||
ListUsersPages(*iam.ListUsersInput, func(*iam.ListUsersOutput, bool) bool) error
|
||||
|
||||
ListVirtualMFADevicesRequest(*iam.ListVirtualMFADevicesInput) (*aws.Request, *iam.ListVirtualMFADevicesOutput)
|
||||
|
||||
ListVirtualMFADevices(*iam.ListVirtualMFADevicesInput) (*iam.ListVirtualMFADevicesOutput, error)
|
||||
|
||||
ListVirtualMFADevicesPages(*iam.ListVirtualMFADevicesInput, func(*iam.ListVirtualMFADevicesOutput, bool) bool) error
|
||||
|
||||
PutGroupPolicyRequest(*iam.PutGroupPolicyInput) (*aws.Request, *iam.PutGroupPolicyOutput)
|
||||
|
||||
PutGroupPolicy(*iam.PutGroupPolicyInput) (*iam.PutGroupPolicyOutput, error)
|
||||
|
||||
PutRolePolicyRequest(*iam.PutRolePolicyInput) (*aws.Request, *iam.PutRolePolicyOutput)
|
||||
|
||||
PutRolePolicy(*iam.PutRolePolicyInput) (*iam.PutRolePolicyOutput, error)
|
||||
|
||||
PutUserPolicyRequest(*iam.PutUserPolicyInput) (*aws.Request, *iam.PutUserPolicyOutput)
|
||||
|
||||
PutUserPolicy(*iam.PutUserPolicyInput) (*iam.PutUserPolicyOutput, error)
|
||||
|
||||
RemoveClientIDFromOpenIDConnectProviderRequest(*iam.RemoveClientIDFromOpenIDConnectProviderInput) (*aws.Request, *iam.RemoveClientIDFromOpenIDConnectProviderOutput)
|
||||
|
||||
RemoveClientIDFromOpenIDConnectProvider(*iam.RemoveClientIDFromOpenIDConnectProviderInput) (*iam.RemoveClientIDFromOpenIDConnectProviderOutput, error)
|
||||
|
||||
RemoveRoleFromInstanceProfileRequest(*iam.RemoveRoleFromInstanceProfileInput) (*aws.Request, *iam.RemoveRoleFromInstanceProfileOutput)
|
||||
|
||||
RemoveRoleFromInstanceProfile(*iam.RemoveRoleFromInstanceProfileInput) (*iam.RemoveRoleFromInstanceProfileOutput, error)
|
||||
|
||||
RemoveUserFromGroupRequest(*iam.RemoveUserFromGroupInput) (*aws.Request, *iam.RemoveUserFromGroupOutput)
|
||||
|
||||
RemoveUserFromGroup(*iam.RemoveUserFromGroupInput) (*iam.RemoveUserFromGroupOutput, error)
|
||||
|
||||
ResyncMFADeviceRequest(*iam.ResyncMFADeviceInput) (*aws.Request, *iam.ResyncMFADeviceOutput)
|
||||
|
||||
ResyncMFADevice(*iam.ResyncMFADeviceInput) (*iam.ResyncMFADeviceOutput, error)
|
||||
|
||||
SetDefaultPolicyVersionRequest(*iam.SetDefaultPolicyVersionInput) (*aws.Request, *iam.SetDefaultPolicyVersionOutput)
|
||||
|
||||
SetDefaultPolicyVersion(*iam.SetDefaultPolicyVersionInput) (*iam.SetDefaultPolicyVersionOutput, error)
|
||||
|
||||
UpdateAccessKeyRequest(*iam.UpdateAccessKeyInput) (*aws.Request, *iam.UpdateAccessKeyOutput)
|
||||
|
||||
UpdateAccessKey(*iam.UpdateAccessKeyInput) (*iam.UpdateAccessKeyOutput, error)
|
||||
|
||||
UpdateAccountPasswordPolicyRequest(*iam.UpdateAccountPasswordPolicyInput) (*aws.Request, *iam.UpdateAccountPasswordPolicyOutput)
|
||||
|
||||
UpdateAccountPasswordPolicy(*iam.UpdateAccountPasswordPolicyInput) (*iam.UpdateAccountPasswordPolicyOutput, error)
|
||||
|
||||
UpdateAssumeRolePolicyRequest(*iam.UpdateAssumeRolePolicyInput) (*aws.Request, *iam.UpdateAssumeRolePolicyOutput)
|
||||
|
||||
UpdateAssumeRolePolicy(*iam.UpdateAssumeRolePolicyInput) (*iam.UpdateAssumeRolePolicyOutput, error)
|
||||
|
||||
UpdateGroupRequest(*iam.UpdateGroupInput) (*aws.Request, *iam.UpdateGroupOutput)
|
||||
|
||||
UpdateGroup(*iam.UpdateGroupInput) (*iam.UpdateGroupOutput, error)
|
||||
|
||||
UpdateLoginProfileRequest(*iam.UpdateLoginProfileInput) (*aws.Request, *iam.UpdateLoginProfileOutput)
|
||||
|
||||
UpdateLoginProfile(*iam.UpdateLoginProfileInput) (*iam.UpdateLoginProfileOutput, error)
|
||||
|
||||
UpdateOpenIDConnectProviderThumbprintRequest(*iam.UpdateOpenIDConnectProviderThumbprintInput) (*aws.Request, *iam.UpdateOpenIDConnectProviderThumbprintOutput)
|
||||
|
||||
UpdateOpenIDConnectProviderThumbprint(*iam.UpdateOpenIDConnectProviderThumbprintInput) (*iam.UpdateOpenIDConnectProviderThumbprintOutput, error)
|
||||
|
||||
UpdateSAMLProviderRequest(*iam.UpdateSAMLProviderInput) (*aws.Request, *iam.UpdateSAMLProviderOutput)
|
||||
|
||||
UpdateSAMLProvider(*iam.UpdateSAMLProviderInput) (*iam.UpdateSAMLProviderOutput, error)
|
||||
|
||||
UpdateSSHPublicKeyRequest(*iam.UpdateSSHPublicKeyInput) (*aws.Request, *iam.UpdateSSHPublicKeyOutput)
|
||||
|
||||
UpdateSSHPublicKey(*iam.UpdateSSHPublicKeyInput) (*iam.UpdateSSHPublicKeyOutput, error)
|
||||
|
||||
UpdateServerCertificateRequest(*iam.UpdateServerCertificateInput) (*aws.Request, *iam.UpdateServerCertificateOutput)
|
||||
|
||||
UpdateServerCertificate(*iam.UpdateServerCertificateInput) (*iam.UpdateServerCertificateOutput, error)
|
||||
|
||||
UpdateSigningCertificateRequest(*iam.UpdateSigningCertificateInput) (*aws.Request, *iam.UpdateSigningCertificateOutput)
|
||||
|
||||
UpdateSigningCertificate(*iam.UpdateSigningCertificateInput) (*iam.UpdateSigningCertificateOutput, error)
|
||||
|
||||
UpdateUserRequest(*iam.UpdateUserInput) (*aws.Request, *iam.UpdateUserOutput)
|
||||
|
||||
UpdateUser(*iam.UpdateUserInput) (*iam.UpdateUserOutput, error)
|
||||
|
||||
UploadSSHPublicKeyRequest(*iam.UploadSSHPublicKeyInput) (*aws.Request, *iam.UploadSSHPublicKeyOutput)
|
||||
|
||||
UploadSSHPublicKey(*iam.UploadSSHPublicKeyInput) (*iam.UploadSSHPublicKeyOutput, error)
|
||||
|
||||
UploadServerCertificateRequest(*iam.UploadServerCertificateInput) (*aws.Request, *iam.UploadServerCertificateOutput)
|
||||
|
||||
UploadServerCertificate(*iam.UploadServerCertificateInput) (*iam.UploadServerCertificateOutput, error)
|
||||
|
||||
UploadSigningCertificateRequest(*iam.UploadSigningCertificateInput) (*aws.Request, *iam.UploadSigningCertificateOutput)
|
||||
|
||||
UploadSigningCertificate(*iam.UploadSigningCertificateInput) (*iam.UploadSigningCertificateOutput, error)
|
||||
}
|
15
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/iam/iamiface/interface_test.go
generated
vendored
Normal file
15
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/iam/iamiface/interface_test.go
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
|
||||
package iamiface_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/aws/aws-sdk-go/service/iam"
|
||||
"github.com/aws/aws-sdk-go/service/iam/iamiface"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestInterface(t *testing.T) {
|
||||
assert.Implements(t, (*iamiface.IAMAPI)(nil), iam.New(nil))
|
||||
}
|
106
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/iam/service.go
generated
vendored
Normal file
106
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/iam/service.go
generated
vendored
Normal file
|
@ -0,0 +1,106 @@
|
|||
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
|
||||
package iam
|
||||
|
||||
import (
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/internal/protocol/query"
|
||||
"github.com/aws/aws-sdk-go/internal/signer/v4"
|
||||
)
|
||||
|
||||
// AWS Identity and Access Management (IAM) is a web service that you can use
|
||||
// to manage users and user permissions under your AWS account. This guide provides
|
||||
// descriptions of IAM actions that you can call programmatically. For general
|
||||
// information about IAM, see AWS Identity and Access Management (IAM) (http://aws.amazon.com/iam/).
|
||||
// For the user guide for IAM, see Using IAM (http://docs.aws.amazon.com/IAM/latest/UserGuide/).
|
||||
//
|
||||
// AWS provides SDKs that consist of libraries and sample code for various
|
||||
// programming languages and platforms (Java, Ruby, .NET, iOS, Android, etc.).
|
||||
// The SDKs provide a convenient way to create programmatic access to IAM and
|
||||
// AWS. For example, the SDKs take care of tasks such as cryptographically signing
|
||||
// requests (see below), managing errors, and retrying requests automatically.
|
||||
// For information about the AWS SDKs, including how to download and install
|
||||
// them, see the Tools for Amazon Web Services (http://aws.amazon.com/tools/)
|
||||
// page. We recommend that you use the AWS SDKs to make programmatic API calls
|
||||
// to IAM. However, you can also use the IAM Query API to make direct calls
|
||||
// to the IAM web service. To learn more about the IAM Query API, see Making
|
||||
// Query Requests (http://docs.aws.amazon.com/IAM/latest/UserGuide/IAM_UsingQueryAPI.html)
|
||||
// in the Using IAM guide. IAM supports GET and POST requests for all actions.
|
||||
// That is, the API does not require you to use GET for some actions and POST
|
||||
// for others. However, GET requests are subject to the limitation size of a
|
||||
// URL. Therefore, for operations that require larger sizes, use a POST request.
|
||||
//
|
||||
// Signing Requests
|
||||
//
|
||||
// Requests must be signed using an access key ID and a secret access key.
|
||||
// We strongly recommend that you do not use your AWS account access key ID
|
||||
// and secret access key for everyday work with IAM. You can use the access
|
||||
// key ID and secret access key for an IAM user or you can use the AWS Security
|
||||
// Token Service to generate temporary security credentials and use those to
|
||||
// sign requests.
|
||||
//
|
||||
// To sign requests, we recommend that you use Signature Version 4 (http://docs.aws.amazon.com/general/latest/gr/signature-version-4.html).
|
||||
// If you have an existing application that uses Signature Version 2, you do
|
||||
// not have to update it to use Signature Version 4. However, some operations
|
||||
// now require Signature Version 4. The documentation for operations that require
|
||||
// version 4 indicate this requirement.
|
||||
//
|
||||
// Additional Resources
|
||||
//
|
||||
// For more information, see the following:
|
||||
//
|
||||
// AWS Security Credentials (http://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html).
|
||||
// This topic provides general information about the types of credentials used
|
||||
// for accessing AWS. IAM Best Practices (http://docs.aws.amazon.com/IAM/latest/UserGuide/IAMBestPractices.html).
|
||||
// This topic presents a list of suggestions for using the IAM service to help
|
||||
// secure your AWS resources. AWS Security Token Service (http://docs.aws.amazon.com/STS/latest/UsingSTS/).
|
||||
// This guide describes how to create and use temporary security credentials.
|
||||
// Signing AWS API Requests (http://docs.aws.amazon.com/general/latest/gr/signing_aws_api_requests.html).
|
||||
// This set of topics walk you through the process of signing a request using
|
||||
// an access key ID and secret access key.
|
||||
type IAM struct {
|
||||
*aws.Service
|
||||
}
|
||||
|
||||
// Used for custom service initialization logic
|
||||
var initService func(*aws.Service)
|
||||
|
||||
// Used for custom request initialization logic
|
||||
var initRequest func(*aws.Request)
|
||||
|
||||
// New returns a new IAM client.
|
||||
func New(config *aws.Config) *IAM {
|
||||
service := &aws.Service{
|
||||
Config: aws.DefaultConfig.Merge(config),
|
||||
ServiceName: "iam",
|
||||
APIVersion: "2010-05-08",
|
||||
}
|
||||
service.Initialize()
|
||||
|
||||
// Handlers
|
||||
service.Handlers.Sign.PushBack(v4.Sign)
|
||||
service.Handlers.Build.PushBack(query.Build)
|
||||
service.Handlers.Unmarshal.PushBack(query.Unmarshal)
|
||||
service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta)
|
||||
service.Handlers.UnmarshalError.PushBack(query.UnmarshalError)
|
||||
|
||||
// Run custom service initialization if present
|
||||
if initService != nil {
|
||||
initService(service)
|
||||
}
|
||||
|
||||
return &IAM{service}
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a IAM operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *IAM) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {
|
||||
req := aws.NewRequest(c.Service, op, params, data)
|
||||
|
||||
// Run custom request initialization if present
|
||||
if initRequest != nil {
|
||||
initRequest(req)
|
||||
}
|
||||
|
||||
return req
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -29,13 +29,13 @@ func buildGetBucketLocation(r *aws.Request) {
|
|||
}
|
||||
|
||||
func populateLocationConstraint(r *aws.Request) {
|
||||
if r.ParamsFilled() && r.Config.Region != "us-east-1" {
|
||||
if r.ParamsFilled() && aws.StringValue(r.Config.Region) != "us-east-1" {
|
||||
in := r.Params.(*CreateBucketInput)
|
||||
if in.CreateBucketConfiguration == nil {
|
||||
r.Params = awsutil.CopyOf(r.Params)
|
||||
in = r.Params.(*CreateBucketInput)
|
||||
in.CreateBucketConfiguration = &CreateBucketConfiguration{
|
||||
LocationConstraint: &r.Config.Region,
|
||||
LocationConstraint: r.Config.Region,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
2
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/s3/bucket_location_test.go
generated
vendored
2
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/s3/bucket_location_test.go
generated
vendored
|
@ -65,7 +65,7 @@ func TestNoPopulateLocationConstraintIfProvided(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestNoPopulateLocationConstraintIfClassic(t *testing.T) {
|
||||
s := s3.New(&aws.Config{Region: "us-east-1"})
|
||||
s := s3.New(&aws.Config{Region: aws.String("us-east-1")})
|
||||
req, _ := s.CreateBucketRequest(&s3.CreateBucketInput{
|
||||
Bucket: aws.String("bucket"),
|
||||
})
|
||||
|
|
|
@ -29,7 +29,7 @@ func ExampleS3_AbortMultipartUpload() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -43,7 +43,7 @@ func ExampleS3_AbortMultipartUpload() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_CompleteMultipartUpload() {
|
||||
|
@ -57,7 +57,7 @@ func ExampleS3_CompleteMultipartUpload() {
|
|||
Parts: []*s3.CompletedPart{
|
||||
{ // Required
|
||||
ETag: aws.String("ETag"),
|
||||
PartNumber: aws.Long(1),
|
||||
PartNumber: aws.Int64(1),
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
|
@ -68,7 +68,7 @@ func ExampleS3_CompleteMultipartUpload() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -82,7 +82,7 @@ func ExampleS3_CompleteMultipartUpload() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_CopyObject() {
|
||||
|
@ -128,7 +128,7 @@ func ExampleS3_CopyObject() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -142,7 +142,7 @@ func ExampleS3_CopyObject() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_CreateBucket() {
|
||||
|
@ -164,7 +164,7 @@ func ExampleS3_CreateBucket() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -178,7 +178,7 @@ func ExampleS3_CreateBucket() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_CreateMultipartUpload() {
|
||||
|
@ -215,7 +215,7 @@ func ExampleS3_CreateMultipartUpload() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -229,7 +229,7 @@ func ExampleS3_CreateMultipartUpload() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_DeleteBucket() {
|
||||
|
@ -242,7 +242,7 @@ func ExampleS3_DeleteBucket() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -256,7 +256,7 @@ func ExampleS3_DeleteBucket() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_DeleteBucketCORS() {
|
||||
|
@ -269,7 +269,7 @@ func ExampleS3_DeleteBucketCORS() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -283,7 +283,7 @@ func ExampleS3_DeleteBucketCORS() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_DeleteBucketLifecycle() {
|
||||
|
@ -296,7 +296,7 @@ func ExampleS3_DeleteBucketLifecycle() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -310,7 +310,7 @@ func ExampleS3_DeleteBucketLifecycle() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_DeleteBucketPolicy() {
|
||||
|
@ -323,7 +323,7 @@ func ExampleS3_DeleteBucketPolicy() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -337,7 +337,7 @@ func ExampleS3_DeleteBucketPolicy() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_DeleteBucketReplication() {
|
||||
|
@ -350,7 +350,7 @@ func ExampleS3_DeleteBucketReplication() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -364,7 +364,7 @@ func ExampleS3_DeleteBucketReplication() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_DeleteBucketTagging() {
|
||||
|
@ -377,7 +377,7 @@ func ExampleS3_DeleteBucketTagging() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -391,7 +391,7 @@ func ExampleS3_DeleteBucketTagging() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_DeleteBucketWebsite() {
|
||||
|
@ -404,7 +404,7 @@ func ExampleS3_DeleteBucketWebsite() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -418,7 +418,7 @@ func ExampleS3_DeleteBucketWebsite() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_DeleteObject() {
|
||||
|
@ -435,7 +435,7 @@ func ExampleS3_DeleteObject() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -449,7 +449,7 @@ func ExampleS3_DeleteObject() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_DeleteObjects() {
|
||||
|
@ -465,7 +465,7 @@ func ExampleS3_DeleteObjects() {
|
|||
},
|
||||
// More values...
|
||||
},
|
||||
Quiet: aws.Boolean(true),
|
||||
Quiet: aws.Bool(true),
|
||||
},
|
||||
MFA: aws.String("MFA"),
|
||||
RequestPayer: aws.String("RequestPayer"),
|
||||
|
@ -474,7 +474,7 @@ func ExampleS3_DeleteObjects() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -488,7 +488,7 @@ func ExampleS3_DeleteObjects() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_GetBucketACL() {
|
||||
|
@ -501,7 +501,7 @@ func ExampleS3_GetBucketACL() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -515,7 +515,7 @@ func ExampleS3_GetBucketACL() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_GetBucketCORS() {
|
||||
|
@ -528,7 +528,7 @@ func ExampleS3_GetBucketCORS() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -542,7 +542,7 @@ func ExampleS3_GetBucketCORS() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_GetBucketLifecycle() {
|
||||
|
@ -555,7 +555,7 @@ func ExampleS3_GetBucketLifecycle() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -569,7 +569,7 @@ func ExampleS3_GetBucketLifecycle() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_GetBucketLocation() {
|
||||
|
@ -582,7 +582,7 @@ func ExampleS3_GetBucketLocation() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -596,7 +596,7 @@ func ExampleS3_GetBucketLocation() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_GetBucketLogging() {
|
||||
|
@ -609,7 +609,7 @@ func ExampleS3_GetBucketLogging() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -623,7 +623,7 @@ func ExampleS3_GetBucketLogging() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_GetBucketNotification() {
|
||||
|
@ -636,7 +636,7 @@ func ExampleS3_GetBucketNotification() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -650,7 +650,7 @@ func ExampleS3_GetBucketNotification() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_GetBucketNotificationConfiguration() {
|
||||
|
@ -663,7 +663,7 @@ func ExampleS3_GetBucketNotificationConfiguration() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -677,7 +677,7 @@ func ExampleS3_GetBucketNotificationConfiguration() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_GetBucketPolicy() {
|
||||
|
@ -690,7 +690,7 @@ func ExampleS3_GetBucketPolicy() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -704,7 +704,7 @@ func ExampleS3_GetBucketPolicy() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_GetBucketReplication() {
|
||||
|
@ -717,7 +717,7 @@ func ExampleS3_GetBucketReplication() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -731,7 +731,7 @@ func ExampleS3_GetBucketReplication() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_GetBucketRequestPayment() {
|
||||
|
@ -744,7 +744,7 @@ func ExampleS3_GetBucketRequestPayment() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -758,7 +758,7 @@ func ExampleS3_GetBucketRequestPayment() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_GetBucketTagging() {
|
||||
|
@ -771,7 +771,7 @@ func ExampleS3_GetBucketTagging() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -785,7 +785,7 @@ func ExampleS3_GetBucketTagging() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_GetBucketVersioning() {
|
||||
|
@ -798,7 +798,7 @@ func ExampleS3_GetBucketVersioning() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -812,7 +812,7 @@ func ExampleS3_GetBucketVersioning() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_GetBucketWebsite() {
|
||||
|
@ -825,7 +825,7 @@ func ExampleS3_GetBucketWebsite() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -839,7 +839,7 @@ func ExampleS3_GetBucketWebsite() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_GetObject() {
|
||||
|
@ -869,7 +869,7 @@ func ExampleS3_GetObject() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -883,7 +883,7 @@ func ExampleS3_GetObject() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_GetObjectACL() {
|
||||
|
@ -899,7 +899,7 @@ func ExampleS3_GetObjectACL() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -913,7 +913,7 @@ func ExampleS3_GetObjectACL() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_GetObjectTorrent() {
|
||||
|
@ -928,7 +928,7 @@ func ExampleS3_GetObjectTorrent() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -942,7 +942,7 @@ func ExampleS3_GetObjectTorrent() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_HeadBucket() {
|
||||
|
@ -955,7 +955,7 @@ func ExampleS3_HeadBucket() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -969,7 +969,7 @@ func ExampleS3_HeadBucket() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_HeadObject() {
|
||||
|
@ -993,7 +993,7 @@ func ExampleS3_HeadObject() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -1007,7 +1007,7 @@ func ExampleS3_HeadObject() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_ListBuckets() {
|
||||
|
@ -1018,7 +1018,7 @@ func ExampleS3_ListBuckets() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -1032,7 +1032,7 @@ func ExampleS3_ListBuckets() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_ListMultipartUploads() {
|
||||
|
@ -1043,7 +1043,7 @@ func ExampleS3_ListMultipartUploads() {
|
|||
Delimiter: aws.String("Delimiter"),
|
||||
EncodingType: aws.String("EncodingType"),
|
||||
KeyMarker: aws.String("KeyMarker"),
|
||||
MaxUploads: aws.Long(1),
|
||||
MaxUploads: aws.Int64(1),
|
||||
Prefix: aws.String("Prefix"),
|
||||
UploadIDMarker: aws.String("UploadIdMarker"),
|
||||
}
|
||||
|
@ -1051,7 +1051,7 @@ func ExampleS3_ListMultipartUploads() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -1065,7 +1065,7 @@ func ExampleS3_ListMultipartUploads() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_ListObjectVersions() {
|
||||
|
@ -1076,7 +1076,7 @@ func ExampleS3_ListObjectVersions() {
|
|||
Delimiter: aws.String("Delimiter"),
|
||||
EncodingType: aws.String("EncodingType"),
|
||||
KeyMarker: aws.String("KeyMarker"),
|
||||
MaxKeys: aws.Long(1),
|
||||
MaxKeys: aws.Int64(1),
|
||||
Prefix: aws.String("Prefix"),
|
||||
VersionIDMarker: aws.String("VersionIdMarker"),
|
||||
}
|
||||
|
@ -1084,7 +1084,7 @@ func ExampleS3_ListObjectVersions() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -1098,7 +1098,7 @@ func ExampleS3_ListObjectVersions() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_ListObjects() {
|
||||
|
@ -1109,14 +1109,14 @@ func ExampleS3_ListObjects() {
|
|||
Delimiter: aws.String("Delimiter"),
|
||||
EncodingType: aws.String("EncodingType"),
|
||||
Marker: aws.String("Marker"),
|
||||
MaxKeys: aws.Long(1),
|
||||
MaxKeys: aws.Int64(1),
|
||||
Prefix: aws.String("Prefix"),
|
||||
}
|
||||
resp, err := svc.ListObjects(params)
|
||||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -1130,7 +1130,7 @@ func ExampleS3_ListObjects() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_ListParts() {
|
||||
|
@ -1140,15 +1140,15 @@ func ExampleS3_ListParts() {
|
|||
Bucket: aws.String("BucketName"), // Required
|
||||
Key: aws.String("ObjectKey"), // Required
|
||||
UploadID: aws.String("MultipartUploadId"), // Required
|
||||
MaxParts: aws.Long(1),
|
||||
PartNumberMarker: aws.Long(1),
|
||||
MaxParts: aws.Int64(1),
|
||||
PartNumberMarker: aws.Int64(1),
|
||||
RequestPayer: aws.String("RequestPayer"),
|
||||
}
|
||||
resp, err := svc.ListParts(params)
|
||||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -1162,7 +1162,7 @@ func ExampleS3_ListParts() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_PutBucketACL() {
|
||||
|
@ -1200,7 +1200,7 @@ func ExampleS3_PutBucketACL() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -1214,7 +1214,7 @@ func ExampleS3_PutBucketACL() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_PutBucketCORS() {
|
||||
|
@ -1241,7 +1241,7 @@ func ExampleS3_PutBucketCORS() {
|
|||
aws.String("ExposeHeader"), // Required
|
||||
// More values...
|
||||
},
|
||||
MaxAgeSeconds: aws.Long(1),
|
||||
MaxAgeSeconds: aws.Int64(1),
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
|
@ -1251,7 +1251,7 @@ func ExampleS3_PutBucketCORS() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -1265,7 +1265,7 @@ func ExampleS3_PutBucketCORS() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_PutBucketLifecycle() {
|
||||
|
@ -1280,19 +1280,19 @@ func ExampleS3_PutBucketLifecycle() {
|
|||
Status: aws.String("ExpirationStatus"), // Required
|
||||
Expiration: &s3.LifecycleExpiration{
|
||||
Date: aws.Time(time.Now()),
|
||||
Days: aws.Long(1),
|
||||
Days: aws.Int64(1),
|
||||
},
|
||||
ID: aws.String("ID"),
|
||||
NoncurrentVersionExpiration: &s3.NoncurrentVersionExpiration{
|
||||
NoncurrentDays: aws.Long(1),
|
||||
NoncurrentDays: aws.Int64(1),
|
||||
},
|
||||
NoncurrentVersionTransition: &s3.NoncurrentVersionTransition{
|
||||
NoncurrentDays: aws.Long(1),
|
||||
NoncurrentDays: aws.Int64(1),
|
||||
StorageClass: aws.String("TransitionStorageClass"),
|
||||
},
|
||||
Transition: &s3.Transition{
|
||||
Date: aws.Time(time.Now()),
|
||||
Days: aws.Long(1),
|
||||
Days: aws.Int64(1),
|
||||
StorageClass: aws.String("TransitionStorageClass"),
|
||||
},
|
||||
},
|
||||
|
@ -1304,7 +1304,7 @@ func ExampleS3_PutBucketLifecycle() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -1318,7 +1318,7 @@ func ExampleS3_PutBucketLifecycle() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_PutBucketLogging() {
|
||||
|
@ -1350,7 +1350,7 @@ func ExampleS3_PutBucketLogging() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -1364,7 +1364,7 @@ func ExampleS3_PutBucketLogging() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_PutBucketNotification() {
|
||||
|
@ -1407,7 +1407,7 @@ func ExampleS3_PutBucketNotification() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -1421,7 +1421,7 @@ func ExampleS3_PutBucketNotification() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_PutBucketNotificationConfiguration() {
|
||||
|
@ -1469,7 +1469,7 @@ func ExampleS3_PutBucketNotificationConfiguration() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -1483,7 +1483,7 @@ func ExampleS3_PutBucketNotificationConfiguration() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_PutBucketPolicy() {
|
||||
|
@ -1497,7 +1497,7 @@ func ExampleS3_PutBucketPolicy() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -1511,7 +1511,7 @@ func ExampleS3_PutBucketPolicy() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_PutBucketReplication() {
|
||||
|
@ -1538,7 +1538,7 @@ func ExampleS3_PutBucketReplication() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -1552,7 +1552,7 @@ func ExampleS3_PutBucketReplication() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_PutBucketRequestPayment() {
|
||||
|
@ -1568,7 +1568,7 @@ func ExampleS3_PutBucketRequestPayment() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -1582,7 +1582,7 @@ func ExampleS3_PutBucketRequestPayment() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_PutBucketTagging() {
|
||||
|
@ -1604,7 +1604,7 @@ func ExampleS3_PutBucketTagging() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -1618,7 +1618,7 @@ func ExampleS3_PutBucketTagging() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_PutBucketVersioning() {
|
||||
|
@ -1636,7 +1636,7 @@ func ExampleS3_PutBucketVersioning() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -1650,7 +1650,7 @@ func ExampleS3_PutBucketVersioning() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_PutBucketWebsite() {
|
||||
|
@ -1691,7 +1691,7 @@ func ExampleS3_PutBucketWebsite() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -1705,7 +1705,7 @@ func ExampleS3_PutBucketWebsite() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_PutObject() {
|
||||
|
@ -1720,7 +1720,7 @@ func ExampleS3_PutObject() {
|
|||
ContentDisposition: aws.String("ContentDisposition"),
|
||||
ContentEncoding: aws.String("ContentEncoding"),
|
||||
ContentLanguage: aws.String("ContentLanguage"),
|
||||
ContentLength: aws.Long(1),
|
||||
ContentLength: aws.Int64(1),
|
||||
ContentType: aws.String("ContentType"),
|
||||
Expires: aws.Time(time.Now()),
|
||||
GrantFullControl: aws.String("GrantFullControl"),
|
||||
|
@ -1744,7 +1744,7 @@ func ExampleS3_PutObject() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -1758,7 +1758,7 @@ func ExampleS3_PutObject() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_PutObjectACL() {
|
||||
|
@ -1798,7 +1798,7 @@ func ExampleS3_PutObjectACL() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -1812,7 +1812,7 @@ func ExampleS3_PutObjectACL() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_RestoreObject() {
|
||||
|
@ -1823,7 +1823,7 @@ func ExampleS3_RestoreObject() {
|
|||
Key: aws.String("ObjectKey"), // Required
|
||||
RequestPayer: aws.String("RequestPayer"),
|
||||
RestoreRequest: &s3.RestoreRequest{
|
||||
Days: aws.Long(1), // Required
|
||||
Days: aws.Int64(1), // Required
|
||||
},
|
||||
VersionID: aws.String("ObjectVersionId"),
|
||||
}
|
||||
|
@ -1831,7 +1831,7 @@ func ExampleS3_RestoreObject() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -1845,7 +1845,7 @@ func ExampleS3_RestoreObject() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_UploadPart() {
|
||||
|
@ -1854,10 +1854,10 @@ func ExampleS3_UploadPart() {
|
|||
params := &s3.UploadPartInput{
|
||||
Bucket: aws.String("BucketName"), // Required
|
||||
Key: aws.String("ObjectKey"), // Required
|
||||
PartNumber: aws.Long(1), // Required
|
||||
PartNumber: aws.Int64(1), // Required
|
||||
UploadID: aws.String("MultipartUploadId"), // Required
|
||||
Body: bytes.NewReader([]byte("PAYLOAD")),
|
||||
ContentLength: aws.Long(1),
|
||||
ContentLength: aws.Int64(1),
|
||||
RequestPayer: aws.String("RequestPayer"),
|
||||
SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"),
|
||||
SSECustomerKey: aws.String("SSECustomerKey"),
|
||||
|
@ -1867,7 +1867,7 @@ func ExampleS3_UploadPart() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -1881,7 +1881,7 @@ func ExampleS3_UploadPart() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
||||
func ExampleS3_UploadPartCopy() {
|
||||
|
@ -1891,7 +1891,7 @@ func ExampleS3_UploadPartCopy() {
|
|||
Bucket: aws.String("BucketName"), // Required
|
||||
CopySource: aws.String("CopySource"), // Required
|
||||
Key: aws.String("ObjectKey"), // Required
|
||||
PartNumber: aws.Long(1), // Required
|
||||
PartNumber: aws.Int64(1), // Required
|
||||
UploadID: aws.String("MultipartUploadId"), // Required
|
||||
CopySourceIfMatch: aws.String("CopySourceIfMatch"),
|
||||
CopySourceIfModifiedSince: aws.Time(time.Now()),
|
||||
|
@ -1910,7 +1910,7 @@ func ExampleS3_UploadPartCopy() {
|
|||
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
// Generic AWS Error with Code, Message, and original error (if any)
|
||||
// Generic AWS error with Code, Message, and original error (if any)
|
||||
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
|
||||
if reqErr, ok := err.(awserr.RequestFailure); ok {
|
||||
// A service error occurred
|
||||
|
@ -1924,5 +1924,5 @@ func ExampleS3_UploadPartCopy() {
|
|||
}
|
||||
|
||||
// Pretty-print the response data.
|
||||
fmt.Println(awsutil.StringValue(resp))
|
||||
fmt.Println(awsutil.Prettify(resp))
|
||||
}
|
||||
|
|
2
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/s3/host_style_bucket.go
generated
vendored
2
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/s3/host_style_bucket.go
generated
vendored
|
@ -23,7 +23,7 @@ func dnsCompatibleBucketName(bucket string) bool {
|
|||
// the host. This is false if S3ForcePathStyle is explicitly set or if the
|
||||
// bucket is not DNS compatible.
|
||||
func hostStyleBucketName(r *aws.Request, bucket string) bool {
|
||||
if r.Config.S3ForcePathStyle {
|
||||
if aws.BoolValue(r.Config.S3ForcePathStyle) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
4
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/s3/host_style_bucket_test.go
generated
vendored
4
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/s3/host_style_bucket_test.go
generated
vendored
|
@ -51,11 +51,11 @@ func TestHostStyleBucketBuild(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestHostStyleBucketBuildNoSSL(t *testing.T) {
|
||||
s := s3.New(&aws.Config{DisableSSL: true})
|
||||
s := s3.New(&aws.Config{DisableSSL: aws.Bool(true)})
|
||||
runTests(t, s, nosslTests)
|
||||
}
|
||||
|
||||
func TestPathStyleBucketBuild(t *testing.T) {
|
||||
s := s3.New(&aws.Config{S3ForcePathStyle: true})
|
||||
s := s3.New(&aws.Config{S3ForcePathStyle: aws.Bool(true)})
|
||||
runTests(t, s, forcepathTests)
|
||||
}
|
||||
|
|
117
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/s3/s3iface/interface.go
generated
vendored
117
Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/s3/s3iface/interface.go
generated
vendored
|
@ -4,116 +4,233 @@
|
|||
package s3iface
|
||||
|
||||
import (
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/service/s3"
|
||||
)
|
||||
|
||||
// S3API is the interface type for s3.S3.
|
||||
type S3API interface {
|
||||
AbortMultipartUploadRequest(*s3.AbortMultipartUploadInput) (*aws.Request, *s3.AbortMultipartUploadOutput)
|
||||
|
||||
AbortMultipartUpload(*s3.AbortMultipartUploadInput) (*s3.AbortMultipartUploadOutput, error)
|
||||
|
||||
CompleteMultipartUploadRequest(*s3.CompleteMultipartUploadInput) (*aws.Request, *s3.CompleteMultipartUploadOutput)
|
||||
|
||||
CompleteMultipartUpload(*s3.CompleteMultipartUploadInput) (*s3.CompleteMultipartUploadOutput, error)
|
||||
|
||||
CopyObjectRequest(*s3.CopyObjectInput) (*aws.Request, *s3.CopyObjectOutput)
|
||||
|
||||
CopyObject(*s3.CopyObjectInput) (*s3.CopyObjectOutput, error)
|
||||
|
||||
CreateBucketRequest(*s3.CreateBucketInput) (*aws.Request, *s3.CreateBucketOutput)
|
||||
|
||||
CreateBucket(*s3.CreateBucketInput) (*s3.CreateBucketOutput, error)
|
||||
|
||||
CreateMultipartUploadRequest(*s3.CreateMultipartUploadInput) (*aws.Request, *s3.CreateMultipartUploadOutput)
|
||||
|
||||
CreateMultipartUpload(*s3.CreateMultipartUploadInput) (*s3.CreateMultipartUploadOutput, error)
|
||||
|
||||
DeleteBucketRequest(*s3.DeleteBucketInput) (*aws.Request, *s3.DeleteBucketOutput)
|
||||
|
||||
DeleteBucket(*s3.DeleteBucketInput) (*s3.DeleteBucketOutput, error)
|
||||
|
||||
DeleteBucketCORSRequest(*s3.DeleteBucketCORSInput) (*aws.Request, *s3.DeleteBucketCORSOutput)
|
||||
|
||||
DeleteBucketCORS(*s3.DeleteBucketCORSInput) (*s3.DeleteBucketCORSOutput, error)
|
||||
|
||||
DeleteBucketLifecycleRequest(*s3.DeleteBucketLifecycleInput) (*aws.Request, *s3.DeleteBucketLifecycleOutput)
|
||||
|
||||
DeleteBucketLifecycle(*s3.DeleteBucketLifecycleInput) (*s3.DeleteBucketLifecycleOutput, error)
|
||||
|
||||
DeleteBucketPolicyRequest(*s3.DeleteBucketPolicyInput) (*aws.Request, *s3.DeleteBucketPolicyOutput)
|
||||
|
||||
DeleteBucketPolicy(*s3.DeleteBucketPolicyInput) (*s3.DeleteBucketPolicyOutput, error)
|
||||
|
||||
DeleteBucketReplicationRequest(*s3.DeleteBucketReplicationInput) (*aws.Request, *s3.DeleteBucketReplicationOutput)
|
||||
|
||||
DeleteBucketReplication(*s3.DeleteBucketReplicationInput) (*s3.DeleteBucketReplicationOutput, error)
|
||||
|
||||
DeleteBucketTaggingRequest(*s3.DeleteBucketTaggingInput) (*aws.Request, *s3.DeleteBucketTaggingOutput)
|
||||
|
||||
DeleteBucketTagging(*s3.DeleteBucketTaggingInput) (*s3.DeleteBucketTaggingOutput, error)
|
||||
|
||||
DeleteBucketWebsiteRequest(*s3.DeleteBucketWebsiteInput) (*aws.Request, *s3.DeleteBucketWebsiteOutput)
|
||||
|
||||
DeleteBucketWebsite(*s3.DeleteBucketWebsiteInput) (*s3.DeleteBucketWebsiteOutput, error)
|
||||
|
||||
DeleteObjectRequest(*s3.DeleteObjectInput) (*aws.Request, *s3.DeleteObjectOutput)
|
||||
|
||||
DeleteObject(*s3.DeleteObjectInput) (*s3.DeleteObjectOutput, error)
|
||||
|
||||
DeleteObjectsRequest(*s3.DeleteObjectsInput) (*aws.Request, *s3.DeleteObjectsOutput)
|
||||
|
||||
DeleteObjects(*s3.DeleteObjectsInput) (*s3.DeleteObjectsOutput, error)
|
||||
|
||||
GetBucketACLRequest(*s3.GetBucketACLInput) (*aws.Request, *s3.GetBucketACLOutput)
|
||||
|
||||
GetBucketACL(*s3.GetBucketACLInput) (*s3.GetBucketACLOutput, error)
|
||||
|
||||
GetBucketCORSRequest(*s3.GetBucketCORSInput) (*aws.Request, *s3.GetBucketCORSOutput)
|
||||
|
||||
GetBucketCORS(*s3.GetBucketCORSInput) (*s3.GetBucketCORSOutput, error)
|
||||
|
||||
GetBucketLifecycleRequest(*s3.GetBucketLifecycleInput) (*aws.Request, *s3.GetBucketLifecycleOutput)
|
||||
|
||||
GetBucketLifecycle(*s3.GetBucketLifecycleInput) (*s3.GetBucketLifecycleOutput, error)
|
||||
|
||||
GetBucketLocationRequest(*s3.GetBucketLocationInput) (*aws.Request, *s3.GetBucketLocationOutput)
|
||||
|
||||
GetBucketLocation(*s3.GetBucketLocationInput) (*s3.GetBucketLocationOutput, error)
|
||||
|
||||
GetBucketLoggingRequest(*s3.GetBucketLoggingInput) (*aws.Request, *s3.GetBucketLoggingOutput)
|
||||
|
||||
GetBucketLogging(*s3.GetBucketLoggingInput) (*s3.GetBucketLoggingOutput, error)
|
||||
|
||||
GetBucketNotificationRequest(*s3.GetBucketNotificationConfigurationRequest) (*aws.Request, *s3.NotificationConfigurationDeprecated)
|
||||
|
||||
GetBucketNotification(*s3.GetBucketNotificationConfigurationRequest) (*s3.NotificationConfigurationDeprecated, error)
|
||||
|
||||
GetBucketNotificationConfigurationRequest(*s3.GetBucketNotificationConfigurationRequest) (*aws.Request, *s3.NotificationConfiguration)
|
||||
|
||||
GetBucketNotificationConfiguration(*s3.GetBucketNotificationConfigurationRequest) (*s3.NotificationConfiguration, error)
|
||||
|
||||
GetBucketPolicyRequest(*s3.GetBucketPolicyInput) (*aws.Request, *s3.GetBucketPolicyOutput)
|
||||
|
||||
GetBucketPolicy(*s3.GetBucketPolicyInput) (*s3.GetBucketPolicyOutput, error)
|
||||
|
||||
GetBucketReplicationRequest(*s3.GetBucketReplicationInput) (*aws.Request, *s3.GetBucketReplicationOutput)
|
||||
|
||||
GetBucketReplication(*s3.GetBucketReplicationInput) (*s3.GetBucketReplicationOutput, error)
|
||||
|
||||
GetBucketRequestPaymentRequest(*s3.GetBucketRequestPaymentInput) (*aws.Request, *s3.GetBucketRequestPaymentOutput)
|
||||
|
||||
GetBucketRequestPayment(*s3.GetBucketRequestPaymentInput) (*s3.GetBucketRequestPaymentOutput, error)
|
||||
|
||||
GetBucketTaggingRequest(*s3.GetBucketTaggingInput) (*aws.Request, *s3.GetBucketTaggingOutput)
|
||||
|
||||
GetBucketTagging(*s3.GetBucketTaggingInput) (*s3.GetBucketTaggingOutput, error)
|
||||
|
||||
GetBucketVersioningRequest(*s3.GetBucketVersioningInput) (*aws.Request, *s3.GetBucketVersioningOutput)
|
||||
|
||||
GetBucketVersioning(*s3.GetBucketVersioningInput) (*s3.GetBucketVersioningOutput, error)
|
||||
|
||||
GetBucketWebsiteRequest(*s3.GetBucketWebsiteInput) (*aws.Request, *s3.GetBucketWebsiteOutput)
|
||||
|
||||
GetBucketWebsite(*s3.GetBucketWebsiteInput) (*s3.GetBucketWebsiteOutput, error)
|
||||
|
||||
GetObjectRequest(*s3.GetObjectInput) (*aws.Request, *s3.GetObjectOutput)
|
||||
|
||||
GetObject(*s3.GetObjectInput) (*s3.GetObjectOutput, error)
|
||||
|
||||
GetObjectACLRequest(*s3.GetObjectACLInput) (*aws.Request, *s3.GetObjectACLOutput)
|
||||
|
||||
GetObjectACL(*s3.GetObjectACLInput) (*s3.GetObjectACLOutput, error)
|
||||
|
||||
GetObjectTorrentRequest(*s3.GetObjectTorrentInput) (*aws.Request, *s3.GetObjectTorrentOutput)
|
||||
|
||||
GetObjectTorrent(*s3.GetObjectTorrentInput) (*s3.GetObjectTorrentOutput, error)
|
||||
|
||||
HeadBucketRequest(*s3.HeadBucketInput) (*aws.Request, *s3.HeadBucketOutput)
|
||||
|
||||
HeadBucket(*s3.HeadBucketInput) (*s3.HeadBucketOutput, error)
|
||||
|
||||
HeadObjectRequest(*s3.HeadObjectInput) (*aws.Request, *s3.HeadObjectOutput)
|
||||
|
||||
HeadObject(*s3.HeadObjectInput) (*s3.HeadObjectOutput, error)
|
||||
|
||||
ListBucketsRequest(*s3.ListBucketsInput) (*aws.Request, *s3.ListBucketsOutput)
|
||||
|
||||
ListBuckets(*s3.ListBucketsInput) (*s3.ListBucketsOutput, error)
|
||||
|
||||
ListMultipartUploadsRequest(*s3.ListMultipartUploadsInput) (*aws.Request, *s3.ListMultipartUploadsOutput)
|
||||
|
||||
ListMultipartUploads(*s3.ListMultipartUploadsInput) (*s3.ListMultipartUploadsOutput, error)
|
||||
|
||||
ListMultipartUploadsPages(*s3.ListMultipartUploadsInput, func(*s3.ListMultipartUploadsOutput, bool) bool) error
|
||||
|
||||
ListObjectVersionsRequest(*s3.ListObjectVersionsInput) (*aws.Request, *s3.ListObjectVersionsOutput)
|
||||
|
||||
ListObjectVersions(*s3.ListObjectVersionsInput) (*s3.ListObjectVersionsOutput, error)
|
||||
|
||||
ListObjectVersionsPages(*s3.ListObjectVersionsInput, func(*s3.ListObjectVersionsOutput, bool) bool) error
|
||||
|
||||
ListObjectsRequest(*s3.ListObjectsInput) (*aws.Request, *s3.ListObjectsOutput)
|
||||
|
||||
ListObjects(*s3.ListObjectsInput) (*s3.ListObjectsOutput, error)
|
||||
|
||||
ListObjectsPages(*s3.ListObjectsInput, func(*s3.ListObjectsOutput, bool) bool) error
|
||||
|
||||
ListPartsRequest(*s3.ListPartsInput) (*aws.Request, *s3.ListPartsOutput)
|
||||
|
||||
ListParts(*s3.ListPartsInput) (*s3.ListPartsOutput, error)
|
||||
|
||||
ListPartsPages(*s3.ListPartsInput, func(*s3.ListPartsOutput, bool) bool) error
|
||||
|
||||
PutBucketACLRequest(*s3.PutBucketACLInput) (*aws.Request, *s3.PutBucketACLOutput)
|
||||
|
||||
PutBucketACL(*s3.PutBucketACLInput) (*s3.PutBucketACLOutput, error)
|
||||
|
||||
PutBucketCORSRequest(*s3.PutBucketCORSInput) (*aws.Request, *s3.PutBucketCORSOutput)
|
||||
|
||||
PutBucketCORS(*s3.PutBucketCORSInput) (*s3.PutBucketCORSOutput, error)
|
||||
|
||||
PutBucketLifecycleRequest(*s3.PutBucketLifecycleInput) (*aws.Request, *s3.PutBucketLifecycleOutput)
|
||||
|
||||
PutBucketLifecycle(*s3.PutBucketLifecycleInput) (*s3.PutBucketLifecycleOutput, error)
|
||||
|
||||
PutBucketLoggingRequest(*s3.PutBucketLoggingInput) (*aws.Request, *s3.PutBucketLoggingOutput)
|
||||
|
||||
PutBucketLogging(*s3.PutBucketLoggingInput) (*s3.PutBucketLoggingOutput, error)
|
||||
|
||||
PutBucketNotificationRequest(*s3.PutBucketNotificationInput) (*aws.Request, *s3.PutBucketNotificationOutput)
|
||||
|
||||
PutBucketNotification(*s3.PutBucketNotificationInput) (*s3.PutBucketNotificationOutput, error)
|
||||
|
||||
PutBucketNotificationConfigurationRequest(*s3.PutBucketNotificationConfigurationInput) (*aws.Request, *s3.PutBucketNotificationConfigurationOutput)
|
||||
|
||||
PutBucketNotificationConfiguration(*s3.PutBucketNotificationConfigurationInput) (*s3.PutBucketNotificationConfigurationOutput, error)
|
||||
|
||||
PutBucketPolicyRequest(*s3.PutBucketPolicyInput) (*aws.Request, *s3.PutBucketPolicyOutput)
|
||||
|
||||
PutBucketPolicy(*s3.PutBucketPolicyInput) (*s3.PutBucketPolicyOutput, error)
|
||||
|
||||
PutBucketReplicationRequest(*s3.PutBucketReplicationInput) (*aws.Request, *s3.PutBucketReplicationOutput)
|
||||
|
||||
PutBucketReplication(*s3.PutBucketReplicationInput) (*s3.PutBucketReplicationOutput, error)
|
||||
|
||||
PutBucketRequestPaymentRequest(*s3.PutBucketRequestPaymentInput) (*aws.Request, *s3.PutBucketRequestPaymentOutput)
|
||||
|
||||
PutBucketRequestPayment(*s3.PutBucketRequestPaymentInput) (*s3.PutBucketRequestPaymentOutput, error)
|
||||
|
||||
PutBucketTaggingRequest(*s3.PutBucketTaggingInput) (*aws.Request, *s3.PutBucketTaggingOutput)
|
||||
|
||||
PutBucketTagging(*s3.PutBucketTaggingInput) (*s3.PutBucketTaggingOutput, error)
|
||||
|
||||
PutBucketVersioningRequest(*s3.PutBucketVersioningInput) (*aws.Request, *s3.PutBucketVersioningOutput)
|
||||
|
||||
PutBucketVersioning(*s3.PutBucketVersioningInput) (*s3.PutBucketVersioningOutput, error)
|
||||
|
||||
PutBucketWebsiteRequest(*s3.PutBucketWebsiteInput) (*aws.Request, *s3.PutBucketWebsiteOutput)
|
||||
|
||||
PutBucketWebsite(*s3.PutBucketWebsiteInput) (*s3.PutBucketWebsiteOutput, error)
|
||||
|
||||
PutObjectRequest(*s3.PutObjectInput) (*aws.Request, *s3.PutObjectOutput)
|
||||
|
||||
PutObject(*s3.PutObjectInput) (*s3.PutObjectOutput, error)
|
||||
|
||||
PutObjectACLRequest(*s3.PutObjectACLInput) (*aws.Request, *s3.PutObjectACLOutput)
|
||||
|
||||
PutObjectACL(*s3.PutObjectACLInput) (*s3.PutObjectACLOutput, error)
|
||||
|
||||
RestoreObjectRequest(*s3.RestoreObjectInput) (*aws.Request, *s3.RestoreObjectOutput)
|
||||
|
||||
RestoreObject(*s3.RestoreObjectInput) (*s3.RestoreObjectOutput, error)
|
||||
|
||||
UploadPartRequest(*s3.UploadPartInput) (*aws.Request, *s3.UploadPartOutput)
|
||||
|
||||
UploadPart(*s3.UploadPartInput) (*s3.UploadPartOutput, error)
|
||||
|
||||
UploadPartCopyRequest(*s3.UploadPartCopyInput) (*aws.Request, *s3.UploadPartCopyOutput)
|
||||
|
||||
UploadPartCopy(*s3.UploadPartCopyInput) (*s3.UploadPartCopyOutput, error)
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
var _ = unit.Imported
|
||||
|
||||
func TestSSECustomerKeyOverHTTPError(t *testing.T) {
|
||||
s := s3.New(&aws.Config{DisableSSL: true})
|
||||
s := s3.New(&aws.Config{DisableSSL: aws.Bool(true)})
|
||||
req, _ := s.CopyObjectRequest(&s3.CopyObjectInput{
|
||||
Bucket: aws.String("bucket"),
|
||||
CopySource: aws.String("bucket/source"),
|
||||
|
@ -28,7 +28,7 @@ func TestSSECustomerKeyOverHTTPError(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCopySourceSSECustomerKeyOverHTTPError(t *testing.T) {
|
||||
s := s3.New(&aws.Config{DisableSSL: true})
|
||||
s := s3.New(&aws.Config{DisableSSL: aws.Bool(true)})
|
||||
req, _ := s.CopyObjectRequest(&s3.CopyObjectInput{
|
||||
Bucket: aws.String("bucket"),
|
||||
CopySource: aws.String("bucket/source"),
|
||||
|
|
|
@ -49,3 +49,6 @@ Zach Badgett <zach.badgett@gmail.com>
|
|||
Maciek Sakrejda <maciek@heroku.com>
|
||||
Jeff Mitchell <jeffrey.mitchell@gmail.com>
|
||||
Baptiste Fontaine <b@ptistefontaine.fr>
|
||||
Matt Heath <matt@mattheath.com>
|
||||
Jamie Cuthill <jamie.cuthill@gmail.com>
|
||||
Adrian Casajus <adriancasajus@gmail.com>
|
||||
|
|
|
@ -12,11 +12,6 @@ Project Website: http://gocql.github.io/<br>
|
|||
API documentation: http://godoc.org/github.com/gocql/gocql<br>
|
||||
Discussions: https://groups.google.com/forum/#!forum/gocql
|
||||
|
||||
Production Stability
|
||||
---------
|
||||
The underlying framing code was rewritten as part of [#339](https://github.com/gocql/gocql/pull/339) and as such may have
|
||||
unforseen bugs. If you run into a bug related to wire framing, please raise a ticket and we will try to resolve this as soon as we can. If you require a stable version to pin your production app against, we have tagged the previous stable version in source code, so you can build against this. The tag is called 1st_gen_framing ([180456fef0a3c6d02c51dc7211f49b55e9315867](https://github.com/gocql/gocql/commit/180456fef0a3c6d02c51dc7211f49b55e9315867)). This note will be removed as the new generation framing code base matures.
|
||||
|
||||
Supported Versions
|
||||
------------------
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
"time"
|
||||
"unicode"
|
||||
|
||||
"speter.net/go/exp/math/dec/inf"
|
||||
"gopkg.in/inf.v0"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -105,9 +105,7 @@ func createKeyspace(tb testing.TB, cluster *ClusterConfig, keyspace string) {
|
|||
tb.Logf("Created keyspace %s", keyspace)
|
||||
}
|
||||
|
||||
func createSession(tb testing.TB) *Session {
|
||||
cluster := createCluster()
|
||||
|
||||
func createSessionFromCluster(cluster *ClusterConfig, tb testing.TB) *Session {
|
||||
// Drop and re-create the keyspace once. Different tests should use their own
|
||||
// individual tables, but can assume that the table does not exist before.
|
||||
initOnce.Do(func() {
|
||||
|
@ -123,6 +121,11 @@ func createSession(tb testing.TB) *Session {
|
|||
return session
|
||||
}
|
||||
|
||||
func createSession(tb testing.TB) *Session {
|
||||
cluster := createCluster()
|
||||
return createSessionFromCluster(cluster, tb)
|
||||
}
|
||||
|
||||
// TestAuthentication verifies that gocql will work with a host configured to only accept authenticated connections
|
||||
func TestAuthentication(t *testing.T) {
|
||||
|
||||
|
@ -1979,3 +1982,79 @@ func TestTokenAwareConnPool(t *testing.T) {
|
|||
|
||||
// TODO add verification that the query went to the correct host
|
||||
}
|
||||
|
||||
type frameWriterFunc func(framer *framer, streamID int) error
|
||||
|
||||
func (f frameWriterFunc) writeFrame(framer *framer, streamID int) error {
|
||||
return f(framer, streamID)
|
||||
}
|
||||
|
||||
func TestStream0(t *testing.T) {
|
||||
session := createSession(t)
|
||||
defer session.Close()
|
||||
|
||||
var conn *Conn
|
||||
for i := 0; i < 5; i++ {
|
||||
if conn != nil {
|
||||
break
|
||||
}
|
||||
|
||||
conn = session.Pool.Pick(nil)
|
||||
}
|
||||
|
||||
if conn == nil {
|
||||
t.Fatal("no connections available in the pool")
|
||||
}
|
||||
|
||||
writer := frameWriterFunc(func(f *framer, streamID int) error {
|
||||
if streamID == 0 {
|
||||
t.Fatal("should not use stream 0 for requests")
|
||||
}
|
||||
f.writeHeader(0, opError, streamID)
|
||||
f.writeString("i am a bad frame")
|
||||
f.wbuf[0] = 0xFF
|
||||
return f.finishWrite()
|
||||
})
|
||||
|
||||
const expErr = "gocql: error on stream 0:"
|
||||
// need to write out an invalid frame, which we need a connection to do
|
||||
frame, err := conn.exec(writer, nil)
|
||||
if err == nil {
|
||||
t.Fatal("expected to get an error on stream 0")
|
||||
} else if !strings.HasPrefix(err.Error(), expErr) {
|
||||
t.Fatalf("expected to get error prefix %q got %q", expErr, err.Error())
|
||||
} else if frame != nil {
|
||||
t.Fatalf("expected to get nil frame got %+v", frame)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNegativeStream(t *testing.T) {
|
||||
session := createSession(t)
|
||||
defer session.Close()
|
||||
|
||||
var conn *Conn
|
||||
for i := 0; i < 5; i++ {
|
||||
if conn != nil {
|
||||
break
|
||||
}
|
||||
|
||||
conn = session.Pool.Pick(nil)
|
||||
}
|
||||
|
||||
if conn == nil {
|
||||
t.Fatal("no connections available in the pool")
|
||||
}
|
||||
|
||||
const stream = -50
|
||||
writer := frameWriterFunc(func(f *framer, streamID int) error {
|
||||
f.writeHeader(0, opOptions, stream)
|
||||
return f.finishWrite()
|
||||
})
|
||||
|
||||
frame, err := conn.exec(writer, nil)
|
||||
if err == nil {
|
||||
t.Fatalf("expected to get an error on stream %d", stream)
|
||||
} else if frame != nil {
|
||||
t.Fatalf("expected to get nil frame got %+v", frame)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ type ClusterConfig struct {
|
|||
DiscoverHosts bool // If set, gocql will attempt to automatically discover other members of the Cassandra cluster (default: false)
|
||||
MaxPreparedStmts int // Sets the maximum cache size for prepared statements globally for gocql (default: 1000)
|
||||
MaxRoutingKeyInfo int // Sets the maximum cache size for query info about statements for each session (default: 1000)
|
||||
PageSize int // Default page size to use for created sessions (default: 0)
|
||||
PageSize int // Default page size to use for created sessions (default: 5000)
|
||||
SerialConsistency SerialConsistency // Sets the consistency for the serial part of queries, values can be either SERIAL or LOCAL_SERIAL (default: unset)
|
||||
Discovery DiscoveryConfig
|
||||
SslOpts *SslOptions
|
||||
|
@ -93,6 +93,7 @@ func NewCluster(hosts ...string) *ClusterConfig {
|
|||
DiscoverHosts: false,
|
||||
MaxPreparedStmts: defaultMaxPreparedStmts,
|
||||
MaxRoutingKeyInfo: 1000,
|
||||
PageSize: 5000,
|
||||
DefaultTimestamp: true,
|
||||
}
|
||||
return cfg
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package gocql
|
||||
|
||||
import (
|
||||
"github.com/golang/snappy/snappy"
|
||||
"github.com/golang/snappy"
|
||||
)
|
||||
|
||||
type Compressor interface {
|
||||
|
@ -20,7 +20,7 @@ func (s SnappyCompressor) Name() string {
|
|||
}
|
||||
|
||||
func (s SnappyCompressor) Encode(data []byte) ([]byte, error) {
|
||||
return snappy.Encode(nil, data)
|
||||
return snappy.Encode(nil, data), nil
|
||||
}
|
||||
|
||||
func (s SnappyCompressor) Decode(data []byte) ([]byte, error) {
|
||||
|
|
|
@ -4,8 +4,9 @@ package gocql
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/golang/snappy/snappy"
|
||||
"testing"
|
||||
|
||||
"github.com/golang/snappy"
|
||||
)
|
||||
|
||||
func TestSnappyCompressor(t *testing.T) {
|
||||
|
@ -16,9 +17,8 @@ func TestSnappyCompressor(t *testing.T) {
|
|||
|
||||
str := "My Test String"
|
||||
//Test Encoding
|
||||
if expected, err := snappy.Encode(nil, []byte(str)); err != nil {
|
||||
t.Fatalf("failed to encode '%v' with error %v", str, err)
|
||||
} else if res, err := c.Encode([]byte(str)); err != nil {
|
||||
expected := snappy.Encode(nil, []byte(str))
|
||||
if res, err := c.Encode([]byte(str)); err != nil {
|
||||
t.Fatalf("failed to encode '%v' with error %v", str, err)
|
||||
} else if bytes.Compare(expected, res) != 0 {
|
||||
t.Fatal("failed to match the expected encoded value with the result encoded value.")
|
||||
|
|
|
@ -10,6 +10,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
"strconv"
|
||||
|
@ -156,8 +157,10 @@ func Connect(addr string, cfg ConnConfig, errorHandler ConnErrorHandler) (*Conn,
|
|||
headerSize = 9
|
||||
}
|
||||
|
||||
if cfg.NumStreams <= 0 || cfg.NumStreams > maxStreams {
|
||||
if cfg.NumStreams <= 0 || cfg.NumStreams >= maxStreams {
|
||||
cfg.NumStreams = maxStreams
|
||||
} else {
|
||||
cfg.NumStreams++
|
||||
}
|
||||
|
||||
c := &Conn{
|
||||
|
@ -179,8 +182,10 @@ func Connect(addr string, cfg ConnConfig, errorHandler ConnErrorHandler) (*Conn,
|
|||
c.setKeepalive(cfg.Keepalive)
|
||||
}
|
||||
|
||||
for i := 0; i < cfg.NumStreams; i++ {
|
||||
c.calls[i].resp = make(chan error, 1)
|
||||
// reserve stream 0 incase cassandra returns an error on it without us sending
|
||||
// a request.
|
||||
for i := 1; i < cfg.NumStreams; i++ {
|
||||
c.calls[i].resp = make(chan error)
|
||||
c.uniq <- i
|
||||
}
|
||||
|
||||
|
@ -293,6 +298,40 @@ func (c *Conn) authenticateHandshake(authFrame *authenticateFrame) error {
|
|||
}
|
||||
}
|
||||
|
||||
func (c *Conn) closeWithError(err error) {
|
||||
if !atomic.CompareAndSwapInt32(&c.closed, 0, 1) {
|
||||
return
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
// we should attempt to deliver the error back to the caller if it
|
||||
// exists
|
||||
for id := 0; id < len(c.calls); id++ {
|
||||
req := &c.calls[id]
|
||||
// we need to send the error to all waiting queries, put the state
|
||||
// of this conn into not active so that it can not execute any queries.
|
||||
if err != nil {
|
||||
select {
|
||||
case req.resp <- err:
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if error was nil then unblock the quit channel
|
||||
close(c.quit)
|
||||
c.conn.Close()
|
||||
|
||||
if c.started && err != nil {
|
||||
c.errorHandler.HandleError(c, err, true)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Conn) Close() {
|
||||
c.closeWithError(nil)
|
||||
}
|
||||
|
||||
// Serve starts the stream multiplexer for this connection, which is required
|
||||
// to execute any queries. This method runs as long as the connection is
|
||||
// open and is therefore usually called in a separate goroutine.
|
||||
|
@ -326,6 +365,36 @@ func (c *Conn) recv() error {
|
|||
return err
|
||||
}
|
||||
|
||||
if head.stream > len(c.calls) {
|
||||
return fmt.Errorf("gocql: frame header stream is beyond call exepected bounds: %d", head.stream)
|
||||
} else if head.stream == -1 {
|
||||
// TODO: handle cassandra event frames, we shouldnt get any currently
|
||||
_, err := io.CopyN(ioutil.Discard, c, int64(head.length))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
} else if head.stream <= 0 {
|
||||
// reserved stream that we dont use, probably due to a protocol error
|
||||
// or a bug in Cassandra, this should be an error, parse it and return.
|
||||
framer := newFramer(c, c, c.compressor, c.version)
|
||||
if err := framer.readFrame(&head); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
frame, err := framer.parseFrame()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
switch v := frame.(type) {
|
||||
case error:
|
||||
return fmt.Errorf("gocql: error on stream %d: %v", head.stream, v)
|
||||
default:
|
||||
return fmt.Errorf("gocql: received frame on stream %d: %v", head.stream, frame)
|
||||
}
|
||||
}
|
||||
|
||||
call := &c.calls[head.stream]
|
||||
err = call.framer.readFrame(&head)
|
||||
if err != nil {
|
||||
|
@ -336,13 +405,6 @@ func (c *Conn) recv() error {
|
|||
}
|
||||
}
|
||||
|
||||
if !atomic.CompareAndSwapInt32(&call.waiting, 1, 0) {
|
||||
// the waiting thread timed out and is no longer waiting, the stream has
|
||||
// not yet been readded to the chan so it cant be used again,
|
||||
c.releaseStream(head.stream)
|
||||
return nil
|
||||
}
|
||||
|
||||
// we either, return a response to the caller, the caller timedout, or the
|
||||
// connection has closed. Either way we should never block indefinatly here
|
||||
select {
|
||||
|
@ -359,7 +421,6 @@ type callReq struct {
|
|||
// could use a waitgroup but this allows us to do timeouts on the read/send
|
||||
resp chan error
|
||||
framer *framer
|
||||
waiting int32
|
||||
timeout chan struct{} // indicates to recv() that a call has timedout
|
||||
}
|
||||
|
||||
|
@ -370,7 +431,7 @@ func (c *Conn) releaseStream(stream int) {
|
|||
|
||||
select {
|
||||
case c.uniq <- stream:
|
||||
default:
|
||||
case <-c.quit:
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -389,9 +450,9 @@ func (c *Conn) exec(req frameWriter, tracer Tracer) (frame, error) {
|
|||
return nil, ErrConnectionClosed
|
||||
}
|
||||
|
||||
call := &c.calls[stream]
|
||||
// resp is basically a waiting semaphore protecting the framer
|
||||
framer := newFramer(c, c, c.compressor, c.version)
|
||||
call := &c.calls[stream]
|
||||
call.framer = framer
|
||||
call.timeout = make(chan struct{})
|
||||
|
||||
|
@ -399,11 +460,6 @@ func (c *Conn) exec(req frameWriter, tracer Tracer) (frame, error) {
|
|||
framer.trace()
|
||||
}
|
||||
|
||||
if !atomic.CompareAndSwapInt32(&call.waiting, 0, 1) {
|
||||
return nil, errors.New("gocql: stream is busy or closed")
|
||||
}
|
||||
defer atomic.StoreInt32(&call.waiting, 0)
|
||||
|
||||
err := req.writeFrame(framer, stream)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -411,11 +467,6 @@ func (c *Conn) exec(req frameWriter, tracer Tracer) (frame, error) {
|
|||
|
||||
select {
|
||||
case err := <-call.resp:
|
||||
// dont release the stream if detect a timeout as another request can reuse
|
||||
// that stream and get a response for the old request, which we have no
|
||||
// easy way of detecting.
|
||||
defer c.releaseStream(stream)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -427,6 +478,14 @@ func (c *Conn) exec(req frameWriter, tracer Tracer) (frame, error) {
|
|||
return nil, ErrConnectionClosed
|
||||
}
|
||||
|
||||
// dont release the stream if detect a timeout as another request can reuse
|
||||
// that stream and get a response for the old request, which we have no
|
||||
// easy way of detecting.
|
||||
//
|
||||
// Ensure that the stream is not released if there are potentially outstanding
|
||||
// requests on the stream to prevent nil pointer dereferences in recv().
|
||||
defer c.releaseStream(stream)
|
||||
|
||||
if v := framer.header.version.version(); v != c.version {
|
||||
return nil, NewErrProtocol("unexpected protocol version in response: got %d expected %d", v, c.version)
|
||||
}
|
||||
|
@ -617,37 +676,6 @@ func (c *Conn) Closed() bool {
|
|||
return atomic.LoadInt32(&c.closed) == 1
|
||||
}
|
||||
|
||||
func (c *Conn) closeWithError(err error) {
|
||||
if !atomic.CompareAndSwapInt32(&c.closed, 0, 1) {
|
||||
return
|
||||
}
|
||||
|
||||
for id := 0; id < len(c.calls); id++ {
|
||||
req := &c.calls[id]
|
||||
// we need to send the error to all waiting queries, put the state
|
||||
// of this conn into not active so that it can not execute any queries.
|
||||
atomic.StoreInt32(&req.waiting, -1)
|
||||
|
||||
if err != nil {
|
||||
select {
|
||||
case req.resp <- err:
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
close(c.quit)
|
||||
c.conn.Close()
|
||||
|
||||
if c.started && err != nil {
|
||||
c.errorHandler.HandleError(c, err, true)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Conn) Close() {
|
||||
c.closeWithError(nil)
|
||||
}
|
||||
|
||||
func (c *Conn) Address() string {
|
||||
return c.addr
|
||||
}
|
||||
|
@ -790,7 +818,7 @@ type inflightPrepare struct {
|
|||
|
||||
var (
|
||||
ErrQueryArgLength = errors.New("gocql: query argument length mismatch")
|
||||
ErrTimeoutNoResponse = errors.New("gocql: no response recieved from cassandra within timeout period")
|
||||
ErrTimeoutNoResponse = errors.New("gocql: no response received from cassandra within timeout period")
|
||||
ErrTooManyTimeouts = errors.New("gocql: too many query timeouts on the connection")
|
||||
ErrConnectionClosed = errors.New("gocql: connection closed waiting for response")
|
||||
)
|
||||
|
|
|
@ -284,7 +284,7 @@ func TestStreams_Protocol1(t *testing.T) {
|
|||
defer db.Close()
|
||||
|
||||
var wg sync.WaitGroup
|
||||
for i := 0; i < db.cfg.NumStreams; i++ {
|
||||
for i := 1; i < db.cfg.NumStreams; i++ {
|
||||
// here were just validating that if we send NumStream request we get
|
||||
// a response for every stream and the lengths for the queries are set
|
||||
// correctly.
|
||||
|
@ -315,7 +315,7 @@ func TestStreams_Protocol2(t *testing.T) {
|
|||
}
|
||||
defer db.Close()
|
||||
|
||||
for i := 0; i < db.cfg.NumStreams; i++ {
|
||||
for i := 1; i < db.cfg.NumStreams; i++ {
|
||||
// the test server processes each conn synchronously
|
||||
// here were just validating that if we send NumStream request we get
|
||||
// a response for every stream and the lengths for the queries are set
|
||||
|
@ -342,7 +342,7 @@ func TestStreams_Protocol3(t *testing.T) {
|
|||
}
|
||||
defer db.Close()
|
||||
|
||||
for i := 0; i < db.cfg.NumStreams; i++ {
|
||||
for i := 1; i < db.cfg.NumStreams; i++ {
|
||||
// the test server processes each conn synchronously
|
||||
// here were just validating that if we send NumStream request we get
|
||||
// a response for every stream and the lengths for the queries are set
|
||||
|
@ -569,6 +569,54 @@ func TestQueryTimeoutClose(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestExecPanic(t *testing.T) {
|
||||
t.Skip("test can cause unrelated failures, skipping until it can be fixed.")
|
||||
srv := NewTestServer(t, defaultProto)
|
||||
defer srv.Stop()
|
||||
|
||||
cluster := NewCluster(srv.Address)
|
||||
// Set the timeout arbitrarily low so that the query hits the timeout in a
|
||||
// timely manner.
|
||||
cluster.Timeout = 5 * time.Millisecond
|
||||
cluster.NumConns = 1
|
||||
// cluster.NumStreams = 1
|
||||
|
||||
db, err := cluster.CreateSession()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer db.Close()
|
||||
|
||||
streams := db.cfg.NumStreams
|
||||
|
||||
wg := &sync.WaitGroup{}
|
||||
wg.Add(streams)
|
||||
for i := 0; i < streams; i++ {
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
q := db.Query("void")
|
||||
for {
|
||||
if err := q.Exec(); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
wg.Add(1)
|
||||
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
for i := 0; i < int(TimeoutLimit); i++ {
|
||||
db.Query("timeout").Exec()
|
||||
}
|
||||
}()
|
||||
|
||||
wg.Wait()
|
||||
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
}
|
||||
|
||||
func NewTestServer(t testing.TB, protocol uint8) *TestServer {
|
||||
laddr, err := net.ResolveTCPAddr("tcp", "127.0.0.1:0")
|
||||
if err != nil {
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"speter.net/go/exp/math/dec/inf"
|
||||
"gopkg.in/inf.v0"
|
||||
)
|
||||
|
||||
type RowData struct {
|
||||
|
|
|
@ -17,7 +17,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"speter.net/go/exp/math/dec/inf"
|
||||
"gopkg.in/inf.v0"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -802,7 +802,10 @@ func marshalTimestamp(info TypeInfo, value interface{}) ([]byte, error) {
|
|||
case int64:
|
||||
return encBigInt(v), nil
|
||||
case time.Time:
|
||||
x := v.UnixNano() / int64(1000000)
|
||||
if v.IsZero() {
|
||||
return []byte{}, nil
|
||||
}
|
||||
x := int64(v.UTC().Unix()*1e3) + int64(v.UTC().Nanosecond()/1e6)
|
||||
return encBigInt(x), nil
|
||||
}
|
||||
rv := reflect.ValueOf(value)
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"speter.net/go/exp/math/dec/inf"
|
||||
"gopkg.in/inf.v0"
|
||||
)
|
||||
|
||||
var marshalTests = []struct {
|
||||
|
@ -794,3 +794,69 @@ func TestMarshalPointer(t *testing.T) {
|
|||
t.Errorf("Pointer marshaling failed. Expected %+v, got %+v", []byte{42}, data)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMarshalTimestamp(t *testing.T) {
|
||||
var marshalTimestampTests = []struct {
|
||||
Info TypeInfo
|
||||
Data []byte
|
||||
Value interface{}
|
||||
}{
|
||||
{
|
||||
NativeType{proto: 2, typ: TypeTimestamp},
|
||||
[]byte("\x00\x00\x01\x40\x77\x16\xe1\xb8"),
|
||||
time.Date(2013, time.August, 13, 9, 52, 3, 0, time.UTC),
|
||||
},
|
||||
{
|
||||
NativeType{proto: 2, typ: TypeTimestamp},
|
||||
[]byte("\x00\x00\x01\x40\x77\x16\xe1\xb8"),
|
||||
int64(1376387523000),
|
||||
},
|
||||
{
|
||||
// 9223372036854 is the maximum time representable in ms since the epoch
|
||||
// with int64 if using UnixNano to convert
|
||||
NativeType{proto: 2, typ: TypeTimestamp},
|
||||
[]byte("\x00\x00\x08\x63\x7b\xd0\x5a\xf6"),
|
||||
time.Date(2262, time.April, 11, 23, 47, 16, 854775807, time.UTC),
|
||||
},
|
||||
{
|
||||
// One nanosecond after causes overflow when using UnixNano
|
||||
// Instead it should resolve to the same time in ms
|
||||
NativeType{proto: 2, typ: TypeTimestamp},
|
||||
[]byte("\x00\x00\x08\x63\x7b\xd0\x5a\xf6"),
|
||||
time.Date(2262, time.April, 11, 23, 47, 16, 854775808, time.UTC),
|
||||
},
|
||||
{
|
||||
// -9223372036855 is the minimum time representable in ms since the epoch
|
||||
// with int64 if using UnixNano to convert
|
||||
NativeType{proto: 2, typ: TypeTimestamp},
|
||||
[]byte("\xff\xff\xf7\x9c\x84\x2f\xa5\x09"),
|
||||
time.Date(1677, time.September, 21, 00, 12, 43, 145224192, time.UTC),
|
||||
},
|
||||
{
|
||||
// One nanosecond earlier causes overflow when using UnixNano
|
||||
// it should resolve to the same time in ms
|
||||
NativeType{proto: 2, typ: TypeTimestamp},
|
||||
[]byte("\xff\xff\xf7\x9c\x84\x2f\xa5\x09"),
|
||||
time.Date(1677, time.September, 21, 00, 12, 43, 145224191, time.UTC),
|
||||
},
|
||||
{
|
||||
// Store the zero time as a blank slice
|
||||
NativeType{proto: 2, typ: TypeTimestamp},
|
||||
[]byte{},
|
||||
time.Time{},
|
||||
},
|
||||
}
|
||||
|
||||
for i, test := range marshalTimestampTests {
|
||||
t.Log(i, test)
|
||||
data, err := Marshal(test.Info, test.Value)
|
||||
if err != nil {
|
||||
t.Errorf("marshalTest[%d]: %v", i, err)
|
||||
continue
|
||||
}
|
||||
if !bytes.Equal(data, test.Data) {
|
||||
t.Errorf("marshalTest[%d]: expected %x (%v), got %x (%v) for time %s", i,
|
||||
test.Data, decBigInt(test.Data), data, decBigInt(data), test.Value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ type TableMetadata struct {
|
|||
PartitionKey []*ColumnMetadata
|
||||
ClusteringColumns []*ColumnMetadata
|
||||
Columns map[string]*ColumnMetadata
|
||||
OrderedColumns []string
|
||||
}
|
||||
|
||||
// schema metadata for a column
|
||||
|
@ -70,6 +71,7 @@ const (
|
|||
PARTITION_KEY = "partition_key"
|
||||
CLUSTERING_KEY = "clustering_key"
|
||||
REGULAR = "regular"
|
||||
COMPACT_VALUE = "compact_value"
|
||||
)
|
||||
|
||||
// default alias values
|
||||
|
@ -177,6 +179,7 @@ func compileMetadata(
|
|||
|
||||
table := keyspace.Tables[columns[i].Table]
|
||||
table.Columns[columns[i].Name] = &columns[i]
|
||||
table.OrderedColumns = append(table.OrderedColumns, columns[i].Name)
|
||||
}
|
||||
|
||||
if protoVersion == 1 {
|
||||
|
@ -302,13 +305,14 @@ func compileV2Metadata(tables []TableMetadata) {
|
|||
for i := range tables {
|
||||
table := &tables[i]
|
||||
|
||||
partitionColumnCount := countColumnsOfKind(table.Columns, PARTITION_KEY)
|
||||
table.PartitionKey = make([]*ColumnMetadata, partitionColumnCount)
|
||||
keyValidatorParsed := parseType(table.KeyValidator)
|
||||
table.PartitionKey = make([]*ColumnMetadata, len(keyValidatorParsed.types))
|
||||
|
||||
clusteringColumnCount := countColumnsOfKind(table.Columns, CLUSTERING_KEY)
|
||||
clusteringColumnCount := componentColumnCountOfType(table.Columns, CLUSTERING_KEY)
|
||||
table.ClusteringColumns = make([]*ColumnMetadata, clusteringColumnCount)
|
||||
|
||||
for _, column := range table.Columns {
|
||||
for _, columnName := range table.OrderedColumns {
|
||||
column := table.Columns[columnName]
|
||||
if column.Kind == PARTITION_KEY {
|
||||
table.PartitionKey[column.ComponentIndex] = column
|
||||
} else if column.Kind == CLUSTERING_KEY {
|
||||
|
@ -320,14 +324,14 @@ func compileV2Metadata(tables []TableMetadata) {
|
|||
}
|
||||
|
||||
// returns the count of coluns with the given "kind" value.
|
||||
func countColumnsOfKind(columns map[string]*ColumnMetadata, kind string) int {
|
||||
count := 0
|
||||
func componentColumnCountOfType(columns map[string]*ColumnMetadata, kind string) int {
|
||||
maxComponentIndex := -1
|
||||
for _, column := range columns {
|
||||
if column.Kind == kind {
|
||||
count++
|
||||
if column.Kind == kind && column.ComponentIndex > maxComponentIndex {
|
||||
maxComponentIndex = column.ComponentIndex
|
||||
}
|
||||
}
|
||||
return count
|
||||
return maxComponentIndex + 1
|
||||
}
|
||||
|
||||
// query only for the keyspace metadata for the specified keyspace from system.schema_keyspace
|
||||
|
|
|
@ -327,6 +327,14 @@ func TestCompileMetadata(t *testing.T) {
|
|||
},
|
||||
}
|
||||
columns = []ColumnMetadata{
|
||||
ColumnMetadata{
|
||||
Keyspace: "V2Keyspace",
|
||||
Table: "Table1",
|
||||
Name: "KEY1",
|
||||
Kind: PARTITION_KEY,
|
||||
ComponentIndex: 0,
|
||||
Validator: "org.apache.cassandra.db.marshal.UTF8Type",
|
||||
},
|
||||
ColumnMetadata{
|
||||
Keyspace: "V2Keyspace",
|
||||
Table: "Table1",
|
||||
|
@ -383,6 +391,11 @@ func TestCompileMetadata(t *testing.T) {
|
|||
},
|
||||
ClusteringColumns: []*ColumnMetadata{},
|
||||
Columns: map[string]*ColumnMetadata{
|
||||
"KEY1": &ColumnMetadata{
|
||||
Name: "KEY1",
|
||||
Type: NativeType{typ: TypeVarchar},
|
||||
Kind: PARTITION_KEY,
|
||||
},
|
||||
"Key1": &ColumnMetadata{
|
||||
Name: "Key1",
|
||||
Type: NativeType{typ: TypeVarchar},
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
// +build all integration
|
||||
|
||||
package gocql
|
||||
|
||||
import (
|
||||
"sync/atomic"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func BenchmarkConnStress(b *testing.B) {
|
||||
const workers = 16
|
||||
|
||||
cluster := createCluster()
|
||||
cluster.NumConns = 1
|
||||
cluster.NumStreams = workers
|
||||
session := createSessionFromCluster(cluster, b)
|
||||
defer session.Close()
|
||||
|
||||
if err := createTable(session, "CREATE TABLE IF NOT EXISTS conn_stress (id int primary key)"); err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
|
||||
var seed uint64
|
||||
writer := func(pb *testing.PB) {
|
||||
seed := atomic.AddUint64(&seed, 1)
|
||||
var i uint64 = 0
|
||||
for pb.Next() {
|
||||
if err := session.Query("insert into conn_stress (id) values (?)", i*seed).Exec(); err != nil {
|
||||
b.Error(err)
|
||||
return
|
||||
}
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
||||
b.SetParallelism(workers)
|
||||
b.RunParallel(writer)
|
||||
|
||||
}
|
|
@ -6,7 +6,7 @@ import (
|
|||
"fmt"
|
||||
"reflect"
|
||||
"sort"
|
||||
"speter.net/go/exp/math/dec/inf"
|
||||
"gopkg.in/inf.v0"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
# This is the official list of Snappy-Go authors for copyright purposes.
|
||||
# This file is distinct from the CONTRIBUTORS files.
|
||||
# See the latter for an explanation.
|
||||
|
||||
# Names should be added to this file as
|
||||
# Name or Organization <email address>
|
||||
# The email address is not required for organizations.
|
||||
|
||||
# Please keep the list sorted.
|
||||
|
||||
Damian Gryski <dgryski@gmail.com>
|
||||
Google Inc.
|
||||
Jan Mercl <0xjnml@gmail.com>
|
||||
Sebastien Binet <seb.binet@gmail.com>
|
|
@ -0,0 +1,36 @@
|
|||
# This is the official list of people who can contribute
|
||||
# (and typically have contributed) code to the Snappy-Go repository.
|
||||
# The AUTHORS file lists the copyright holders; this file
|
||||
# lists people. For example, Google employees are listed here
|
||||
# but not in AUTHORS, because Google holds the copyright.
|
||||
#
|
||||
# The submission process automatically checks to make sure
|
||||
# that people submitting code are listed in this file (by email address).
|
||||
#
|
||||
# Names should be added to this file only after verifying that
|
||||
# the individual or the individual's organization has agreed to
|
||||
# the appropriate Contributor License Agreement, found here:
|
||||
#
|
||||
# http://code.google.com/legal/individual-cla-v1.0.html
|
||||
# http://code.google.com/legal/corporate-cla-v1.0.html
|
||||
#
|
||||
# The agreement for individuals can be filled out on the web.
|
||||
#
|
||||
# When adding J Random Contributor's name to this file,
|
||||
# either J's name or J's organization's name should be
|
||||
# added to the AUTHORS file, depending on whether the
|
||||
# individual or corporate CLA was used.
|
||||
|
||||
# Names should be added to this file like so:
|
||||
# Name <email address>
|
||||
|
||||
# Please keep the list sorted.
|
||||
|
||||
Damian Gryski <dgryski@gmail.com>
|
||||
Jan Mercl <0xjnml@gmail.com>
|
||||
Kai Backman <kaib@golang.org>
|
||||
Marc-Antoine Ruel <maruel@chromium.org>
|
||||
Nigel Tao <nigeltao@golang.org>
|
||||
Rob Pike <r@golang.org>
|
||||
Russ Cox <rsc@golang.org>
|
||||
Sebastien Binet <seb.binet@gmail.com>
|
|
@ -0,0 +1,27 @@
|
|||
Copyright (c) 2011 The Snappy-Go Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -0,0 +1,7 @@
|
|||
The Snappy compression format in the Go programming language.
|
||||
|
||||
To download and install from source:
|
||||
$ go get github.com/golang/snappy
|
||||
|
||||
Unless otherwise noted, the Snappy-Go source files are distributed
|
||||
under the BSD-style license found in the LICENSE file.
|
28
Godeps/_workspace/src/github.com/golang/snappy/snappy/decode.go → Godeps/_workspace/src/github.com/golang/snappy/decode.go
generated
vendored
Normal file → Executable file
28
Godeps/_workspace/src/github.com/golang/snappy/snappy/decode.go → Godeps/_workspace/src/github.com/golang/snappy/decode.go
generated
vendored
Normal file → Executable file
|
@ -13,6 +13,8 @@ import (
|
|||
var (
|
||||
// ErrCorrupt reports that the input is invalid.
|
||||
ErrCorrupt = errors.New("snappy: corrupt input")
|
||||
// ErrTooLarge reports that the uncompressed length is too large.
|
||||
ErrTooLarge = errors.New("snappy: decoded block is too large")
|
||||
// ErrUnsupported reports that the input isn't supported.
|
||||
ErrUnsupported = errors.New("snappy: unsupported input")
|
||||
)
|
||||
|
@ -27,11 +29,13 @@ func DecodedLen(src []byte) (int, error) {
|
|||
// that the length header occupied.
|
||||
func decodedLen(src []byte) (blockLen, headerLen int, err error) {
|
||||
v, n := binary.Uvarint(src)
|
||||
if n == 0 {
|
||||
if n <= 0 || v > 0xffffffff {
|
||||
return 0, 0, ErrCorrupt
|
||||
}
|
||||
if uint64(int(v)) != v {
|
||||
return 0, 0, errors.New("snappy: decoded block is too large")
|
||||
|
||||
const wordSize = 32 << (^uint(0) >> 32 & 1)
|
||||
if wordSize == 32 && v > 0x7fffffff {
|
||||
return 0, 0, ErrTooLarge
|
||||
}
|
||||
return int(v), n, nil
|
||||
}
|
||||
|
@ -56,7 +60,7 @@ func Decode(dst, src []byte) ([]byte, error) {
|
|||
x := uint(src[s] >> 2)
|
||||
switch {
|
||||
case x < 60:
|
||||
s += 1
|
||||
s++
|
||||
case x == 60:
|
||||
s += 2
|
||||
if s > len(src) {
|
||||
|
@ -130,7 +134,7 @@ func Decode(dst, src []byte) ([]byte, error) {
|
|||
|
||||
// NewReader returns a new Reader that decompresses from r, using the framing
|
||||
// format described at
|
||||
// https://code.google.com/p/snappy/source/browse/trunk/framing_format.txt
|
||||
// https://github.com/google/snappy/blob/master/framing_format.txt
|
||||
func NewReader(r io.Reader) *Reader {
|
||||
return &Reader{
|
||||
r: r,
|
||||
|
@ -200,7 +204,7 @@ func (r *Reader) Read(p []byte) (int, error) {
|
|||
}
|
||||
|
||||
// The chunk types are specified at
|
||||
// https://code.google.com/p/snappy/source/browse/trunk/framing_format.txt
|
||||
// https://github.com/google/snappy/blob/master/framing_format.txt
|
||||
switch chunkType {
|
||||
case chunkTypeCompressedData:
|
||||
// Section 4.2. Compressed data (chunk type 0x00).
|
||||
|
@ -280,13 +284,11 @@ func (r *Reader) Read(p []byte) (int, error) {
|
|||
// Section 4.5. Reserved unskippable chunks (chunk types 0x02-0x7f).
|
||||
r.err = ErrUnsupported
|
||||
return 0, r.err
|
||||
|
||||
} else {
|
||||
// Section 4.4 Padding (chunk type 0xfe).
|
||||
// Section 4.6. Reserved skippable chunks (chunk types 0x80-0xfd).
|
||||
if !r.readFull(r.buf[:chunkLen]) {
|
||||
return 0, r.err
|
||||
}
|
||||
}
|
||||
// Section 4.4 Padding (chunk type 0xfe).
|
||||
// Section 4.6. Reserved skippable chunks (chunk types 0x80-0xfd).
|
||||
if !r.readFull(r.buf[:chunkLen]) {
|
||||
return 0, r.err
|
||||
}
|
||||
}
|
||||
}
|
18
Godeps/_workspace/src/github.com/golang/snappy/snappy/encode.go → Godeps/_workspace/src/github.com/golang/snappy/encode.go
generated
vendored
Normal file → Executable file
18
Godeps/_workspace/src/github.com/golang/snappy/snappy/encode.go → Godeps/_workspace/src/github.com/golang/snappy/encode.go
generated
vendored
Normal file → Executable file
|
@ -79,7 +79,7 @@ func emitCopy(dst []byte, offset, length int) int {
|
|||
// slice of dst if dst was large enough to hold the entire encoded block.
|
||||
// Otherwise, a newly allocated slice will be returned.
|
||||
// It is valid to pass a nil dst.
|
||||
func Encode(dst, src []byte) ([]byte, error) {
|
||||
func Encode(dst, src []byte) []byte {
|
||||
if n := MaxEncodedLen(len(src)); len(dst) < n {
|
||||
dst = make([]byte, n)
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ func Encode(dst, src []byte) ([]byte, error) {
|
|||
if len(src) != 0 {
|
||||
d += emitLiteral(dst[d:], src)
|
||||
}
|
||||
return dst[:d], nil
|
||||
return dst[:d]
|
||||
}
|
||||
|
||||
// Initialize the hash table. Its size ranges from 1<<8 to 1<<14 inclusive.
|
||||
|
@ -145,7 +145,7 @@ func Encode(dst, src []byte) ([]byte, error) {
|
|||
if lit != len(src) {
|
||||
d += emitLiteral(dst[d:], src[lit:])
|
||||
}
|
||||
return dst[:d], nil
|
||||
return dst[:d]
|
||||
}
|
||||
|
||||
// MaxEncodedLen returns the maximum length of a snappy block, given its
|
||||
|
@ -176,7 +176,7 @@ func MaxEncodedLen(srcLen int) int {
|
|||
|
||||
// NewWriter returns a new Writer that compresses to w, using the framing
|
||||
// format described at
|
||||
// https://code.google.com/p/snappy/source/browse/trunk/framing_format.txt
|
||||
// https://github.com/google/snappy/blob/master/framing_format.txt
|
||||
func NewWriter(w io.Writer) *Writer {
|
||||
return &Writer{
|
||||
w: w,
|
||||
|
@ -226,11 +226,7 @@ func (w *Writer) Write(p []byte) (n int, errRet error) {
|
|||
// Compress the buffer, discarding the result if the improvement
|
||||
// isn't at least 12.5%.
|
||||
chunkType := uint8(chunkTypeCompressedData)
|
||||
chunkBody, err := Encode(w.enc, uncompressed)
|
||||
if err != nil {
|
||||
w.err = err
|
||||
return n, err
|
||||
}
|
||||
chunkBody := Encode(w.enc, uncompressed)
|
||||
if len(chunkBody) >= len(uncompressed)-len(uncompressed)/8 {
|
||||
chunkType, chunkBody = chunkTypeUncompressedData, uncompressed
|
||||
}
|
||||
|
@ -244,11 +240,11 @@ func (w *Writer) Write(p []byte) (n int, errRet error) {
|
|||
w.buf[5] = uint8(checksum >> 8)
|
||||
w.buf[6] = uint8(checksum >> 16)
|
||||
w.buf[7] = uint8(checksum >> 24)
|
||||
if _, err = w.w.Write(w.buf[:]); err != nil {
|
||||
if _, err := w.w.Write(w.buf[:]); err != nil {
|
||||
w.err = err
|
||||
return n, err
|
||||
}
|
||||
if _, err = w.w.Write(chunkBody); err != nil {
|
||||
if _, err := w.w.Write(chunkBody); err != nil {
|
||||
w.err = err
|
||||
return n, err
|
||||
}
|
8
Godeps/_workspace/src/github.com/golang/snappy/snappy/snappy.go → Godeps/_workspace/src/github.com/golang/snappy/snappy.go
generated
vendored
Normal file → Executable file
8
Godeps/_workspace/src/github.com/golang/snappy/snappy/snappy.go → Godeps/_workspace/src/github.com/golang/snappy/snappy.go
generated
vendored
Normal file → Executable file
|
@ -5,8 +5,8 @@
|
|||
// Package snappy implements the snappy block-based compression format.
|
||||
// It aims for very high speeds and reasonable compression.
|
||||
//
|
||||
// The C++ snappy implementation is at http://code.google.com/p/snappy/
|
||||
package snappy
|
||||
// The C++ snappy implementation is at https://github.com/google/snappy
|
||||
package snappy // import "github.com/golang/snappy"
|
||||
|
||||
import (
|
||||
"hash/crc32"
|
||||
|
@ -46,7 +46,7 @@ const (
|
|||
chunkHeaderSize = 4
|
||||
magicChunk = "\xff\x06\x00\x00" + magicBody
|
||||
magicBody = "sNaPpY"
|
||||
// https://code.google.com/p/snappy/source/browse/trunk/framing_format.txt says
|
||||
// https://github.com/google/snappy/blob/master/framing_format.txt says
|
||||
// that "the uncompressed data in a chunk must be no longer than 65536 bytes".
|
||||
maxUncompressedChunkLen = 65536
|
||||
)
|
||||
|
@ -61,7 +61,7 @@ const (
|
|||
var crcTable = crc32.MakeTable(crc32.Castagnoli)
|
||||
|
||||
// crc implements the checksum specified in section 3 of
|
||||
// https://code.google.com/p/snappy/source/browse/trunk/framing_format.txt
|
||||
// https://github.com/google/snappy/blob/master/framing_format.txt
|
||||
func crc(b []byte) uint32 {
|
||||
c := crc32.Update(0, crcTable, b)
|
||||
return uint32(c>>15|c<<17) + 0xa282ead8
|
39
Godeps/_workspace/src/github.com/golang/snappy/snappy/snappy_test.go → Godeps/_workspace/src/github.com/golang/snappy/snappy_test.go
generated
vendored
Normal file → Executable file
39
Godeps/_workspace/src/github.com/golang/snappy/snappy/snappy_test.go → Godeps/_workspace/src/github.com/golang/snappy/snappy_test.go
generated
vendored
Normal file → Executable file
|
@ -24,11 +24,7 @@ var (
|
|||
)
|
||||
|
||||
func roundtrip(b, ebuf, dbuf []byte) error {
|
||||
e, err := Encode(ebuf, b)
|
||||
if err != nil {
|
||||
return fmt.Errorf("encoding error: %v", err)
|
||||
}
|
||||
d, err := Decode(dbuf, e)
|
||||
d, err := Decode(dbuf, Encode(ebuf, b))
|
||||
if err != nil {
|
||||
return fmt.Errorf("decoding error: %v", err)
|
||||
}
|
||||
|
@ -82,6 +78,26 @@ func TestSmallRegular(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestInvalidVarint(t *testing.T) {
|
||||
data := []byte("\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00")
|
||||
if _, err := DecodedLen(data); err != ErrCorrupt {
|
||||
t.Errorf("DecodedLen: got %v, want ErrCorrupt", err)
|
||||
}
|
||||
if _, err := Decode(nil, data); err != ErrCorrupt {
|
||||
t.Errorf("Decode: got %v, want ErrCorrupt", err)
|
||||
}
|
||||
|
||||
// The encoded varint overflows 32 bits
|
||||
data = []byte("\xff\xff\xff\xff\xff\x00")
|
||||
|
||||
if _, err := DecodedLen(data); err != ErrCorrupt {
|
||||
t.Errorf("DecodedLen: got %v, want ErrCorrupt", err)
|
||||
}
|
||||
if _, err := Decode(nil, data); err != ErrCorrupt {
|
||||
t.Errorf("Decode: got %v, want ErrCorrupt", err)
|
||||
}
|
||||
}
|
||||
|
||||
func cmp(a, b []byte) error {
|
||||
if len(a) != len(b) {
|
||||
return fmt.Errorf("got %d bytes, want %d", len(a), len(b))
|
||||
|
@ -197,10 +213,7 @@ func TestWriterReset(t *testing.T) {
|
|||
}
|
||||
|
||||
func benchDecode(b *testing.B, src []byte) {
|
||||
encoded, err := Encode(nil, src)
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
encoded := Encode(nil, src)
|
||||
// Bandwidth is in amount of uncompressed data.
|
||||
b.SetBytes(int64(len(src)))
|
||||
b.ResetTimer()
|
||||
|
@ -222,7 +235,7 @@ func benchEncode(b *testing.B, src []byte) {
|
|||
func readFile(b testing.TB, filename string) []byte {
|
||||
src, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
b.Fatalf("failed reading %s: %s", filename, err)
|
||||
b.Skipf("skipping benchmark: %v", err)
|
||||
}
|
||||
if len(src) == 0 {
|
||||
b.Fatalf("%s has zero length", filename)
|
||||
|
@ -284,14 +297,14 @@ var testFiles = []struct {
|
|||
// The test data files are present at this canonical URL.
|
||||
const baseURL = "https://raw.githubusercontent.com/google/snappy/master/testdata/"
|
||||
|
||||
func downloadTestdata(basename string) (errRet error) {
|
||||
func downloadTestdata(b *testing.B, basename string) (errRet error) {
|
||||
filename := filepath.Join(*testdata, basename)
|
||||
if stat, err := os.Stat(filename); err == nil && stat.Size() != 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
if !*download {
|
||||
return fmt.Errorf("test data not found; skipping benchmark without the -download flag")
|
||||
b.Skipf("test data not found; skipping benchmark without the -download flag")
|
||||
}
|
||||
// Download the official snappy C++ implementation reference test data
|
||||
// files for benchmarking.
|
||||
|
@ -326,7 +339,7 @@ func downloadTestdata(basename string) (errRet error) {
|
|||
}
|
||||
|
||||
func benchFile(b *testing.B, n int, decode bool) {
|
||||
if err := downloadTestdata(testFiles[n].filename); err != nil {
|
||||
if err := downloadTestdata(b, testFiles[n].filename); err != nil {
|
||||
b.Fatalf("failed to download testdata: %s", err)
|
||||
}
|
||||
data := readFile(b, filepath.Join(*testdata, testFiles[n].filename))
|
|
@ -1,270 +0,0 @@
|
|||
package aws
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/user"
|
||||
"path"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/vaughan0/go-ini"
|
||||
)
|
||||
|
||||
// Credentials are used to authenticate and authorize calls that you make to
|
||||
// AWS.
|
||||
type Credentials struct {
|
||||
AccessKeyID string
|
||||
SecretAccessKey string
|
||||
SecurityToken string
|
||||
}
|
||||
|
||||
// A CredentialsProvider is a provider of credentials.
|
||||
type CredentialsProvider interface {
|
||||
// Credentials returns a set of credentials (or an error if no credentials
|
||||
// could be provided).
|
||||
Credentials() (*Credentials, error)
|
||||
}
|
||||
|
||||
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")
|
||||
)
|
||||
|
||||
// Context encapsulates the context of a client's connection to an AWS service.
|
||||
type Context struct {
|
||||
Service string
|
||||
Region string
|
||||
Credentials CredentialsProvider
|
||||
}
|
||||
|
||||
var currentTime = func() time.Time {
|
||||
return time.Now()
|
||||
}
|
||||
|
||||
// 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 DetectCreds(accessKeyID, secretAccessKey, securityToken string) CredentialsProvider {
|
||||
if accessKeyID != "" && secretAccessKey != "" {
|
||||
return Creds(accessKeyID, secretAccessKey, securityToken)
|
||||
}
|
||||
|
||||
env, err := EnvCreds()
|
||||
if err == nil {
|
||||
return env
|
||||
}
|
||||
|
||||
profile, err := ProfileCreds("", "", 10*time.Minute)
|
||||
if err != nil {
|
||||
return IAMCreds()
|
||||
}
|
||||
|
||||
_, err = profile.Credentials()
|
||||
if err != nil {
|
||||
return IAMCreds()
|
||||
}
|
||||
|
||||
return profile
|
||||
}
|
||||
|
||||
// EnvCreds returns a static provider of AWS credentials from the process's
|
||||
// environment, or an error if none are found.
|
||||
func EnvCreds() (CredentialsProvider, error) {
|
||||
id := os.Getenv("AWS_ACCESS_KEY_ID")
|
||||
if id == "" {
|
||||
id = os.Getenv("AWS_ACCESS_KEY")
|
||||
}
|
||||
|
||||
secret := os.Getenv("AWS_SECRET_ACCESS_KEY")
|
||||
if secret == "" {
|
||||
secret = os.Getenv("AWS_SECRET_KEY")
|
||||
}
|
||||
|
||||
if id == "" {
|
||||
return nil, ErrAccessKeyIDNotFound
|
||||
}
|
||||
|
||||
if secret == "" {
|
||||
return nil, ErrSecretAccessKeyNotFound
|
||||
}
|
||||
|
||||
return Creds(id, secret, os.Getenv("AWS_SESSION_TOKEN")), nil
|
||||
}
|
||||
|
||||
// Creds returns a static provider of credentials.
|
||||
func Creds(accessKeyID, secretAccessKey, securityToken string) CredentialsProvider {
|
||||
return staticCredentialsProvider{
|
||||
creds: Credentials{
|
||||
AccessKeyID: accessKeyID,
|
||||
SecretAccessKey: secretAccessKey,
|
||||
SecurityToken: securityToken,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// IAMCreds returns a provider which pulls credentials from the local EC2
|
||||
// instance's IAM roles.
|
||||
func IAMCreds() CredentialsProvider {
|
||||
return &iamProvider{}
|
||||
}
|
||||
|
||||
// ProfileCreds returns a provider which pulls credentials from the profile
|
||||
// configuration file.
|
||||
func ProfileCreds(filename, profile string, expiry time.Duration) (CredentialsProvider, error) {
|
||||
if filename == "" {
|
||||
u, err := user.Current()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
filename = path.Join(u.HomeDir, ".aws", "credentials")
|
||||
}
|
||||
|
||||
if profile == "" {
|
||||
profile = "default"
|
||||
}
|
||||
|
||||
return &profileProvider{
|
||||
filename: filename,
|
||||
profile: profile,
|
||||
expiry: expiry,
|
||||
}, nil
|
||||
}
|
||||
|
||||
type profileProvider struct {
|
||||
filename string
|
||||
profile string
|
||||
expiry time.Duration
|
||||
|
||||
creds Credentials
|
||||
m sync.Mutex
|
||||
expiration time.Time
|
||||
}
|
||||
|
||||
func (p *profileProvider) Credentials() (*Credentials, error) {
|
||||
p.m.Lock()
|
||||
defer p.m.Unlock()
|
||||
|
||||
if p.expiration.After(currentTime()) {
|
||||
return &p.creds, nil
|
||||
}
|
||||
|
||||
config, err := ini.LoadFile(p.filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
profile := config.Section(p.profile)
|
||||
|
||||
accessKeyID, ok := profile["aws_access_key_id"]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("profile %s in %s did not contain aws_access_key_id", p.profile, p.filename)
|
||||
}
|
||||
|
||||
secretAccessKey, ok := profile["aws_secret_access_key"]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("profile %s in %s did not contain aws_secret_access_key", p.profile, p.filename)
|
||||
}
|
||||
|
||||
securityToken := profile["aws_session_token"]
|
||||
|
||||
p.creds = Credentials{
|
||||
AccessKeyID: accessKeyID,
|
||||
SecretAccessKey: secretAccessKey,
|
||||
SecurityToken: securityToken,
|
||||
}
|
||||
p.expiration = currentTime().Add(p.expiry)
|
||||
|
||||
return &p.creds, nil
|
||||
}
|
||||
|
||||
type iamProvider struct {
|
||||
creds Credentials
|
||||
m sync.Mutex
|
||||
expiration time.Time
|
||||
}
|
||||
|
||||
var metadataCredentialsEndpoint = "http://169.254.169.254/latest/meta-data/iam/security-credentials/"
|
||||
|
||||
// IAMClient is the HTTP client used to query the metadata endpoint for IAM
|
||||
// credentials.
|
||||
var IAMClient = http.Client{
|
||||
Timeout: 1 * time.Second,
|
||||
}
|
||||
|
||||
func (p *iamProvider) Credentials() (*Credentials, error) {
|
||||
p.m.Lock()
|
||||
defer p.m.Unlock()
|
||||
|
||||
if p.expiration.After(currentTime()) {
|
||||
return &p.creds, nil
|
||||
}
|
||||
|
||||
var body struct {
|
||||
Expiration time.Time
|
||||
AccessKeyID string
|
||||
SecretAccessKey string
|
||||
Token string
|
||||
}
|
||||
|
||||
resp, err := IAMClient.Get(metadataCredentialsEndpoint)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("listing IAM credentials")
|
||||
}
|
||||
defer func() {
|
||||
_ = resp.Body.Close()
|
||||
}()
|
||||
|
||||
// Take the first line of the body of the metadata endpoint
|
||||
s := bufio.NewScanner(resp.Body)
|
||||
if !s.Scan() {
|
||||
return nil, fmt.Errorf("unable to find default IAM credentials")
|
||||
} else if s.Err() != nil {
|
||||
return nil, fmt.Errorf("%s listing IAM credentials", s.Err())
|
||||
}
|
||||
|
||||
resp, err = IAMClient.Get(metadataCredentialsEndpoint + s.Text())
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("getting %s IAM credentials", s.Text())
|
||||
}
|
||||
defer func() {
|
||||
_ = resp.Body.Close()
|
||||
}()
|
||||
|
||||
if err := json.NewDecoder(resp.Body).Decode(&body); err != nil {
|
||||
return nil, fmt.Errorf("decoding %s IAM credentials", s.Text())
|
||||
}
|
||||
|
||||
p.creds = Credentials{
|
||||
AccessKeyID: body.AccessKeyID,
|
||||
SecretAccessKey: body.SecretAccessKey,
|
||||
SecurityToken: body.Token,
|
||||
}
|
||||
p.expiration = body.Expiration
|
||||
|
||||
return &p.creds, nil
|
||||
}
|
||||
|
||||
type staticCredentialsProvider struct {
|
||||
creds Credentials
|
||||
}
|
||||
|
||||
func (p staticCredentialsProvider) Credentials() (*Credentials, error) {
|
||||
return &p.creds, nil
|
||||
}
|
|
@ -1,236 +0,0 @@
|
|||
package aws
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestEnvCreds(t *testing.T) {
|
||||
os.Clearenv()
|
||||
os.Setenv("AWS_ACCESS_KEY_ID", "access")
|
||||
os.Setenv("AWS_SECRET_ACCESS_KEY", "secret")
|
||||
os.Setenv("AWS_SESSION_TOKEN", "token")
|
||||
|
||||
prov, err := EnvCreds()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
creds, err := prov.Credentials()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if v, want := creds.AccessKeyID, "access"; v != want {
|
||||
t.Errorf("Access key ID was %v, expected %v", v, want)
|
||||
}
|
||||
|
||||
if v, want := creds.SecretAccessKey, "secret"; v != want {
|
||||
t.Errorf("Secret access key was %v, expected %v", v, want)
|
||||
}
|
||||
|
||||
if v, want := creds.SecurityToken, "token"; v != want {
|
||||
t.Errorf("Security token was %v, expected %v", v, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEnvCredsNoAccessKeyID(t *testing.T) {
|
||||
os.Clearenv()
|
||||
os.Setenv("AWS_SECRET_ACCESS_KEY", "secret")
|
||||
|
||||
prov, err := EnvCreds()
|
||||
if err != ErrAccessKeyIDNotFound {
|
||||
t.Fatalf("ErrAccessKeyIDNotFound expected, but was %#v/%#v", prov, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEnvCredsNoSecretAccessKey(t *testing.T) {
|
||||
os.Clearenv()
|
||||
os.Setenv("AWS_ACCESS_KEY_ID", "access")
|
||||
|
||||
prov, err := EnvCreds()
|
||||
if err != ErrSecretAccessKeyNotFound {
|
||||
t.Fatalf("ErrSecretAccessKeyNotFound expected, but was %#v/%#v", prov, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEnvCredsAlternateNames(t *testing.T) {
|
||||
os.Clearenv()
|
||||
os.Setenv("AWS_ACCESS_KEY", "access")
|
||||
os.Setenv("AWS_SECRET_KEY", "secret")
|
||||
|
||||
prov, err := EnvCreds()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
creds, err := prov.Credentials()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if v, want := creds.AccessKeyID, "access"; v != want {
|
||||
t.Errorf("Access key ID was %v, expected %v", v, want)
|
||||
}
|
||||
|
||||
if v, want := creds.SecretAccessKey, "secret"; v != want {
|
||||
t.Errorf("Secret access key was %v, expected %v", v, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIAMCreds(t *testing.T) {
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.RequestURI == "/" {
|
||||
fmt.Fprintln(w, "/creds")
|
||||
} else {
|
||||
fmt.Fprintln(w, `{
|
||||
"AccessKeyId" : "accessKey",
|
||||
"SecretAccessKey" : "secret",
|
||||
"Token" : "token",
|
||||
"Expiration" : "2014-12-16T01:51:37Z"
|
||||
}`)
|
||||
}
|
||||
}))
|
||||
defer server.Close()
|
||||
|
||||
defer func(s string) {
|
||||
metadataCredentialsEndpoint = s
|
||||
}(metadataCredentialsEndpoint)
|
||||
metadataCredentialsEndpoint = server.URL
|
||||
|
||||
defer func() {
|
||||
currentTime = time.Now
|
||||
}()
|
||||
currentTime = func() time.Time {
|
||||
return time.Date(2014, 12, 15, 21, 26, 0, 0, time.UTC)
|
||||
}
|
||||
|
||||
prov := IAMCreds()
|
||||
creds, err := prov.Credentials()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if v, want := creds.AccessKeyID, "accessKey"; v != want {
|
||||
t.Errorf("AcccessKeyID was %v, but expected %v", v, want)
|
||||
}
|
||||
|
||||
if v, want := creds.SecretAccessKey, "secret"; v != want {
|
||||
t.Errorf("SecretAccessKey was %v, but expected %v", v, want)
|
||||
}
|
||||
|
||||
if v, want := creds.SecurityToken, "token"; v != want {
|
||||
t.Errorf("SecurityToken was %v, but expected %v", v, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestProfileCreds(t *testing.T) {
|
||||
prov, err := ProfileCreds("example.ini", "", 10*time.Minute)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
creds, err := prov.Credentials()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if v, want := creds.AccessKeyID, "accessKey"; v != want {
|
||||
t.Errorf("AcccessKeyID was %v, but expected %v", v, want)
|
||||
}
|
||||
|
||||
if v, want := creds.SecretAccessKey, "secret"; v != want {
|
||||
t.Errorf("SecretAccessKey was %v, but expected %v", v, want)
|
||||
}
|
||||
|
||||
if v, want := creds.SecurityToken, "token"; v != want {
|
||||
t.Errorf("SecurityToken was %v, but expected %v", v, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestProfileCredsWithoutToken(t *testing.T) {
|
||||
prov, err := ProfileCreds("example.ini", "no_token", 10*time.Minute)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
creds, err := prov.Credentials()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if v, want := creds.AccessKeyID, "accessKey"; v != want {
|
||||
t.Errorf("AcccessKeyID was %v, but expected %v", v, want)
|
||||
}
|
||||
|
||||
if v, want := creds.SecretAccessKey, "secret"; v != want {
|
||||
t.Errorf("SecretAccessKey was %v, but expected %v", v, want)
|
||||
}
|
||||
|
||||
if v, want := creds.SecurityToken, ""; v != want {
|
||||
t.Errorf("SecurityToken was %v, but expected %v", v, want)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkProfileCreds(b *testing.B) {
|
||||
prov, err := ProfileCreds("example.ini", "", 10*time.Minute)
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
|
||||
b.ResetTimer()
|
||||
|
||||
b.RunParallel(func(pb *testing.PB) {
|
||||
for pb.Next() {
|
||||
_, err := prov.Credentials()
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func BenchmarkIAMCreds(b *testing.B) {
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.RequestURI == "/" {
|
||||
fmt.Fprintln(w, "/creds")
|
||||
} else {
|
||||
fmt.Fprintln(w, `{
|
||||
"AccessKeyId" : "accessKey",
|
||||
"SecretAccessKey" : "secret",
|
||||
"Token" : "token",
|
||||
"Expiration" : "2014-12-16T01:51:37Z"
|
||||
}`)
|
||||
}
|
||||
}))
|
||||
defer server.Close()
|
||||
|
||||
defer func(s string) {
|
||||
metadataCredentialsEndpoint = s
|
||||
}(metadataCredentialsEndpoint)
|
||||
metadataCredentialsEndpoint = server.URL
|
||||
|
||||
defer func() {
|
||||
currentTime = time.Now
|
||||
}()
|
||||
currentTime = func() time.Time {
|
||||
return time.Date(2014, 12, 15, 21, 26, 0, 0, time.UTC)
|
||||
}
|
||||
|
||||
b.ResetTimer()
|
||||
|
||||
prov := IAMCreds()
|
||||
|
||||
b.RunParallel(func(pb *testing.PB) {
|
||||
for pb.Next() {
|
||||
_, err := prov.Credentials()
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
// Package aws contains support code for the various AWS clients in the
|
||||
// github.com/hashicorp/aws-sdk-go/gen subpackages.
|
||||
package aws
|
|
@ -1,182 +0,0 @@
|
|||
package aws
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// EC2Client is the underlying client for EC2 APIs.
|
||||
type EC2Client struct {
|
||||
Context Context
|
||||
Client *http.Client
|
||||
Endpoint string
|
||||
APIVersion string
|
||||
}
|
||||
|
||||
// Do sends an HTTP request and returns an HTTP response, following policy
|
||||
// (e.g. redirects, cookies, auth) as configured on the client.
|
||||
func (c *EC2Client) Do(op, method, uri string, req, resp interface{}) error {
|
||||
body := url.Values{"Action": {op}, "Version": {c.APIVersion}}
|
||||
if err := c.loadValues(body, req, ""); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
httpReq, err := http.NewRequest(method, c.Endpoint+uri, strings.NewReader(body.Encode()))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
httpReq.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||||
httpReq.Header.Set("User-Agent", "aws-go")
|
||||
if err := c.Context.sign(httpReq); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
httpResp, err := c.Client.Do(httpReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
_ = httpResp.Body.Close()
|
||||
}()
|
||||
|
||||
if httpResp.StatusCode != http.StatusOK {
|
||||
bodyBytes, err := ioutil.ReadAll(httpResp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(bodyBytes) == 0 {
|
||||
return APIError{
|
||||
StatusCode: httpResp.StatusCode,
|
||||
Message: httpResp.Status,
|
||||
}
|
||||
}
|
||||
var ec2Err ec2ErrorResponse
|
||||
if err := xml.Unmarshal(bodyBytes, &ec2Err); err != nil {
|
||||
return err
|
||||
}
|
||||
return ec2Err.Err(httpResp.StatusCode)
|
||||
}
|
||||
|
||||
if resp != nil {
|
||||
return xml.NewDecoder(httpResp.Body).Decode(resp)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ec2ErrorResponse struct {
|
||||
XMLName xml.Name `xml:"Response"`
|
||||
Type string `xml:"Errors>Error>Type"`
|
||||
Code string `xml:"Errors>Error>Code"`
|
||||
Message string `xml:"Errors>Error>Message"`
|
||||
RequestID string `xml:"RequestID"`
|
||||
}
|
||||
|
||||
func (e ec2ErrorResponse) Err(StatusCode int) error {
|
||||
return APIError{
|
||||
StatusCode: StatusCode,
|
||||
Type: e.Type,
|
||||
Code: e.Code,
|
||||
Message: e.Message,
|
||||
RequestID: e.RequestID,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *EC2Client) loadValues(v url.Values, i interface{}, prefix string) error {
|
||||
value := reflect.ValueOf(i)
|
||||
|
||||
// follow any pointers
|
||||
for value.Kind() == reflect.Ptr {
|
||||
value = value.Elem()
|
||||
}
|
||||
if value.Kind() == reflect.Invalid {
|
||||
return nil
|
||||
}
|
||||
if casted, ok := value.Interface().([]byte); ok && prefix != "" {
|
||||
v.Set(prefix, string(casted))
|
||||
return nil
|
||||
}
|
||||
if value.Kind() == reflect.Slice {
|
||||
for i := 0; i < value.Len(); i++ {
|
||||
vPrefix := prefix
|
||||
if vPrefix == "" {
|
||||
vPrefix = strconv.Itoa(i + 1)
|
||||
} else {
|
||||
vPrefix = vPrefix + "." + strconv.Itoa(i+1)
|
||||
}
|
||||
if err := c.loadValues(v, value.Index(i).Interface(), vPrefix); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
return c.loadStruct(v, value, prefix)
|
||||
}
|
||||
|
||||
func (c *EC2Client) loadStruct(v url.Values, value reflect.Value, prefix string) error {
|
||||
if !value.IsValid() {
|
||||
return nil
|
||||
}
|
||||
|
||||
t := value.Type()
|
||||
for i := 0; i < value.NumField(); i++ {
|
||||
value := value.Field(i)
|
||||
name := t.Field(i).Tag.Get("ec2")
|
||||
|
||||
if name == "" {
|
||||
name = t.Field(i).Name
|
||||
}
|
||||
if prefix != "" {
|
||||
name = prefix + "." + name
|
||||
}
|
||||
switch casted := value.Interface().(type) {
|
||||
case StringValue:
|
||||
if casted != nil {
|
||||
v.Set(name, *casted)
|
||||
}
|
||||
case BooleanValue:
|
||||
if casted != nil {
|
||||
v.Set(name, strconv.FormatBool(*casted))
|
||||
}
|
||||
case LongValue:
|
||||
if casted != nil {
|
||||
v.Set(name, strconv.FormatInt(*casted, 10))
|
||||
}
|
||||
case IntegerValue:
|
||||
if casted != nil {
|
||||
v.Set(name, strconv.Itoa(*casted))
|
||||
}
|
||||
case DoubleValue:
|
||||
if casted != nil {
|
||||
v.Set(name, strconv.FormatFloat(*casted, 'f', -1, 64))
|
||||
}
|
||||
case FloatValue:
|
||||
if casted != nil {
|
||||
v.Set(name, strconv.FormatFloat(float64(*casted), 'f', -1, 32))
|
||||
}
|
||||
case []string:
|
||||
if len(casted) != 0 {
|
||||
for i, val := range casted {
|
||||
v.Set(fmt.Sprintf("%s.%d", name, i+1), val)
|
||||
}
|
||||
}
|
||||
case time.Time:
|
||||
if !casted.IsZero() {
|
||||
const ISO8601UTC = "2006-01-02T15:04:05Z"
|
||||
v.Set(name, casted.UTC().Format(ISO8601UTC))
|
||||
}
|
||||
default:
|
||||
if err := c.loadValues(v, value.Interface(), name); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
|
@ -1,227 +0,0 @@
|
|||
package aws_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"reflect"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/aws-sdk-go/aws"
|
||||
)
|
||||
|
||||
func TestEC2Request(t *testing.T) {
|
||||
var m sync.Mutex
|
||||
var httpReq *http.Request
|
||||
var form url.Values
|
||||
|
||||
server := httptest.NewServer(http.HandlerFunc(
|
||||
func(w http.ResponseWriter, r *http.Request) {
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
|
||||
httpReq = r
|
||||
|
||||
if err := r.ParseForm(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
form = r.Form
|
||||
|
||||
fmt.Fprintln(w, `<Thing><IpAddress>woo</IpAddress></Thing>`)
|
||||
},
|
||||
))
|
||||
defer server.Close()
|
||||
|
||||
client := aws.EC2Client{
|
||||
Context: aws.Context{
|
||||
Service: "animals",
|
||||
Region: "us-west-2",
|
||||
Credentials: aws.Creds(
|
||||
"accessKeyID",
|
||||
"secretAccessKey",
|
||||
"securityToken",
|
||||
),
|
||||
},
|
||||
Client: http.DefaultClient,
|
||||
Endpoint: server.URL,
|
||||
APIVersion: "1.1",
|
||||
}
|
||||
|
||||
req := fakeEC2Request{
|
||||
PresentString: aws.String("string"),
|
||||
PresentBoolean: aws.True(),
|
||||
PresentInteger: aws.Integer(1),
|
||||
PresentLong: aws.Long(2),
|
||||
PresentDouble: aws.Double(1.2),
|
||||
PresentFloat: aws.Float(2.3),
|
||||
PresentTime: time.Date(2001, 1, 1, 2, 1, 1, 0, time.FixedZone("UTC+1", 3600)),
|
||||
PresentSlice: []string{"one", "two"},
|
||||
PresentStruct: &EmbeddedStruct{Value: aws.String("v")},
|
||||
PresentStructSlice: []EmbeddedStruct{
|
||||
{Value: aws.String("p")},
|
||||
{Value: aws.String("q")},
|
||||
},
|
||||
}
|
||||
var resp fakeEC2Response
|
||||
if err := client.Do("GetIP", "POST", "/", &req, &resp); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
|
||||
if v, want := httpReq.Method, "POST"; v != want {
|
||||
t.Errorf("Method was %v but expected %v", v, want)
|
||||
}
|
||||
|
||||
if httpReq.Header.Get("Authorization") == "" {
|
||||
t.Error("Authorization header is missing")
|
||||
}
|
||||
|
||||
if v, want := httpReq.Header.Get("Content-Type"), "application/x-www-form-urlencoded"; v != want {
|
||||
t.Errorf("Content-Type was %v but expected %v", v, want)
|
||||
}
|
||||
|
||||
if v, want := httpReq.Header.Get("User-Agent"), "aws-go"; v != want {
|
||||
t.Errorf("User-Agent was %v but expected %v", v, want)
|
||||
}
|
||||
|
||||
if err := httpReq.ParseForm(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
expectedForm := url.Values{
|
||||
"Action": []string{"GetIP"},
|
||||
"Version": []string{"1.1"},
|
||||
"PresentString": []string{"string"},
|
||||
"PresentBoolean": []string{"true"},
|
||||
"PresentInteger": []string{"1"},
|
||||
"PresentLong": []string{"2"},
|
||||
"PresentDouble": []string{"1.2"},
|
||||
"PresentFloat": []string{"2.3"},
|
||||
"PresentTime": []string{"2001-01-01T01:01:01Z"},
|
||||
"PresentSlice.1": []string{"one"},
|
||||
"PresentSlice.2": []string{"two"},
|
||||
"PresentStruct.Value": []string{"v"},
|
||||
"PresentStructSlice.1.Value": []string{"p"},
|
||||
"PresentStructSlice.2.Value": []string{"q"},
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(form, expectedForm) {
|
||||
t.Errorf("Post body was \n%s\n but expected \n%s", form.Encode(), expectedForm.Encode())
|
||||
}
|
||||
|
||||
if want := (fakeEC2Response{IPAddress: "woo"}); want != resp {
|
||||
t.Errorf("Response was %#v, but expected %#v", resp, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEC2RequestError(t *testing.T) {
|
||||
var m sync.Mutex
|
||||
var httpReq *http.Request
|
||||
var form url.Values
|
||||
|
||||
server := httptest.NewServer(http.HandlerFunc(
|
||||
func(w http.ResponseWriter, r *http.Request) {
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
|
||||
httpReq = r
|
||||
|
||||
if err := r.ParseForm(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
form = r.Form
|
||||
|
||||
w.WriteHeader(400)
|
||||
fmt.Fprintln(w, `<Response>
|
||||
<RequestId>woo</RequestId>
|
||||
<Errors>
|
||||
<Error>
|
||||
<Type>Problem</Type>
|
||||
<Code>Uh Oh</Code>
|
||||
<Message>You done did it</Message>
|
||||
</Error>
|
||||
</Errors>
|
||||
</Response>`)
|
||||
},
|
||||
))
|
||||
defer server.Close()
|
||||
|
||||
client := aws.EC2Client{
|
||||
Context: aws.Context{
|
||||
Service: "animals",
|
||||
Region: "us-west-2",
|
||||
Credentials: aws.Creds(
|
||||
"accessKeyID",
|
||||
"secretAccessKey",
|
||||
"securityToken",
|
||||
),
|
||||
},
|
||||
Client: http.DefaultClient,
|
||||
Endpoint: server.URL,
|
||||
APIVersion: "1.1",
|
||||
}
|
||||
|
||||
req := fakeEC2Request{}
|
||||
var resp fakeEC2Response
|
||||
err := client.Do("GetIP", "POST", "/", &req, &resp)
|
||||
if err == nil {
|
||||
t.Fatal("Expected an error but none was returned")
|
||||
}
|
||||
|
||||
if err, ok := err.(aws.APIError); ok {
|
||||
if v, want := err.Type, "Problem"; v != want {
|
||||
t.Errorf("Error type was %v, but expected %v", v, want)
|
||||
}
|
||||
|
||||
if v, want := err.Code, "Uh Oh"; v != want {
|
||||
t.Errorf("Error type was %v, but expected %v", v, want)
|
||||
}
|
||||
|
||||
if v, want := err.Message, "You done did it"; v != want {
|
||||
t.Errorf("Error message was %v, but expected %v", v, want)
|
||||
}
|
||||
} else {
|
||||
t.Errorf("Unknown error returned: %#v", err)
|
||||
}
|
||||
}
|
||||
|
||||
type fakeEC2Request struct {
|
||||
PresentString aws.StringValue `ec2:"PresentString"`
|
||||
MissingString aws.StringValue `ec2:"MissingString"`
|
||||
|
||||
PresentInteger aws.IntegerValue `ec2:"PresentInteger"`
|
||||
MissingInteger aws.IntegerValue `ec2:"MissingInteger"`
|
||||
|
||||
PresentLong aws.LongValue `ec2:"PresentLong"`
|
||||
MissingLong aws.LongValue `ec2:"MissingLong"`
|
||||
|
||||
PresentDouble aws.DoubleValue `ec2:"PresentDouble"`
|
||||
MissingDouble aws.DoubleValue `ec2:"MissingDouble"`
|
||||
|
||||
PresentFloat aws.FloatValue `ec2:"PresentFloat"`
|
||||
MissingFloat aws.FloatValue `ec2:"MissingFloat"`
|
||||
|
||||
PresentTime time.Time `ec2:"PresentTime"`
|
||||
MissingTime time.Time `ec2:"MissingTime"`
|
||||
|
||||
PresentBoolean aws.BooleanValue `ec2:"PresentBoolean"`
|
||||
MissingBoolean aws.BooleanValue `ec2:"MissingBoolean"`
|
||||
|
||||
PresentSlice []string `ec2:"PresentSlice"`
|
||||
MissingSlice []string `ec2:"MissingSlice"`
|
||||
|
||||
PresentStructSlice []EmbeddedStruct `ec2:"PresentStructSlice"`
|
||||
MissingStructSlice []EmbeddedStruct `ec2:"MissingStructSlice"`
|
||||
|
||||
PresentStruct *EmbeddedStruct `ec2:"PresentStruct"`
|
||||
MissingStruct *EmbeddedStruct `ec2:"MissingStruct"`
|
||||
}
|
||||
|
||||
type fakeEC2Response struct {
|
||||
IPAddress string `xml:"IpAddress"`
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package aws
|
||||
|
||||
// An APIError is an error returned by an AWS API.
|
||||
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
|
||||
}
|
||||
|
||||
func (e APIError) Error() string {
|
||||
return e.Message
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
[default]
|
||||
aws_access_key_id = accessKey
|
||||
aws_secret_access_key = secret
|
||||
aws_session_token = token
|
||||
|
||||
[no_token]
|
||||
aws_access_key_id = accessKey
|
||||
aws_secret_access_key = secret
|
|
@ -1,81 +0,0 @@
|
|||
package aws
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// JSONClient is the underlying client for JSON APIs.
|
||||
type JSONClient struct {
|
||||
Context Context
|
||||
Client *http.Client
|
||||
Endpoint string
|
||||
TargetPrefix string
|
||||
JSONVersion string
|
||||
}
|
||||
|
||||
// Do sends an HTTP request and returns an HTTP response, following policy
|
||||
// (e.g. redirects, cookies, auth) as configured on the client.
|
||||
func (c *JSONClient) Do(op, method, uri string, req, resp interface{}) error {
|
||||
b, err := json.Marshal(req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
httpReq, err := http.NewRequest(method, c.Endpoint+uri, bytes.NewReader(b))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
httpReq.Header.Set("User-Agent", "aws-go")
|
||||
httpReq.Header.Set("X-Amz-Target", c.TargetPrefix+"."+op)
|
||||
httpReq.Header.Set("Content-Type", "application/x-amz-json-"+c.JSONVersion)
|
||||
if err := c.Context.sign(httpReq); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
httpResp, err := c.Client.Do(httpReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
_ = httpResp.Body.Close()
|
||||
}()
|
||||
|
||||
if httpResp.StatusCode != http.StatusOK {
|
||||
bodyBytes, err := ioutil.ReadAll(httpResp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(bodyBytes) == 0 {
|
||||
return APIError{
|
||||
StatusCode: httpResp.StatusCode,
|
||||
Message: httpResp.Status,
|
||||
}
|
||||
}
|
||||
var jsonErr jsonErrorResponse
|
||||
if err := json.Unmarshal(bodyBytes, &jsonErr); err != nil {
|
||||
return err
|
||||
}
|
||||
return jsonErr.Err(httpResp.StatusCode)
|
||||
}
|
||||
|
||||
if resp != nil {
|
||||
return json.NewDecoder(httpResp.Body).Decode(resp)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type jsonErrorResponse struct {
|
||||
Type string `json:"__type"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
func (e jsonErrorResponse) Err(StatusCode int) error {
|
||||
return APIError{
|
||||
StatusCode: StatusCode,
|
||||
Type: e.Type,
|
||||
Message: e.Message,
|
||||
}
|
||||
}
|
|
@ -1,143 +0,0 @@
|
|||
package aws_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/aws-sdk-go/aws"
|
||||
)
|
||||
|
||||
func TestJSONRequest(t *testing.T) {
|
||||
var m sync.Mutex
|
||||
var httpReq *http.Request
|
||||
var body []byte
|
||||
|
||||
server := httptest.NewServer(http.HandlerFunc(
|
||||
func(w http.ResponseWriter, r *http.Request) {
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
|
||||
b, err := ioutil.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer r.Body.Close()
|
||||
|
||||
httpReq = r
|
||||
body = b
|
||||
|
||||
fmt.Fprintln(w, `{"TailWagged":true}`)
|
||||
},
|
||||
))
|
||||
defer server.Close()
|
||||
|
||||
client := aws.JSONClient{
|
||||
Context: aws.Context{
|
||||
Service: "animals",
|
||||
Region: "us-west-2",
|
||||
Credentials: aws.Creds(
|
||||
"accessKeyID",
|
||||
"secretAccessKey",
|
||||
"securityToken",
|
||||
),
|
||||
},
|
||||
Client: http.DefaultClient,
|
||||
Endpoint: server.URL,
|
||||
TargetPrefix: "Animals",
|
||||
JSONVersion: "1.1",
|
||||
}
|
||||
|
||||
req := fakeJSONRequest{Name: "Penny"}
|
||||
var resp fakeJSONResponse
|
||||
if err := client.Do("PetTheDog", "POST", "/", req, &resp); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
|
||||
if v, want := httpReq.Method, "POST"; v != want {
|
||||
t.Errorf("Method was %v but expected %v", v, want)
|
||||
}
|
||||
|
||||
if httpReq.Header.Get("Authorization") == "" {
|
||||
t.Error("Authorization header is missing")
|
||||
}
|
||||
|
||||
if v, want := httpReq.Header.Get("Content-Type"), "application/x-amz-json-1.1"; v != want {
|
||||
t.Errorf("Content-Type was %v but expected %v", v, want)
|
||||
}
|
||||
|
||||
if v, want := httpReq.Header.Get("User-Agent"), "aws-go"; v != want {
|
||||
t.Errorf("User-Agent was %v but expected %v", v, want)
|
||||
}
|
||||
|
||||
if v, want := httpReq.Header.Get("X-Amz-Target"), "Animals.PetTheDog"; v != want {
|
||||
t.Errorf("X-Amz-Target was %v but expected %v", v, want)
|
||||
}
|
||||
|
||||
if v, want := string(body), `{"Name":"Penny"}`; v != want {
|
||||
t.Errorf("Body was %v but expected %v", v, want)
|
||||
}
|
||||
|
||||
if v, want := resp, (fakeJSONResponse{TailWagged: true}); v != want {
|
||||
t.Errorf("Response was %#v but expected %#v", v, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestJSONRequestError(t *testing.T) {
|
||||
server := httptest.NewServer(http.HandlerFunc(
|
||||
func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(400)
|
||||
fmt.Fprintln(w, `{"__type":"Problem", "message":"What even"}`)
|
||||
},
|
||||
))
|
||||
defer server.Close()
|
||||
|
||||
client := aws.JSONClient{
|
||||
Context: aws.Context{
|
||||
Service: "animals",
|
||||
Region: "us-west-2",
|
||||
Credentials: aws.Creds(
|
||||
"accessKeyID",
|
||||
"secretAccessKey",
|
||||
"securityToken",
|
||||
),
|
||||
},
|
||||
Client: http.DefaultClient,
|
||||
Endpoint: server.URL,
|
||||
TargetPrefix: "Animals",
|
||||
JSONVersion: "1.1",
|
||||
}
|
||||
|
||||
req := fakeJSONRequest{Name: "Penny"}
|
||||
var resp fakeJSONResponse
|
||||
err := client.Do("PetTheDog", "POST", "/", req, &resp)
|
||||
if err == nil {
|
||||
t.Fatal("Expected an error but none was returned")
|
||||
}
|
||||
|
||||
if err, ok := err.(aws.APIError); ok {
|
||||
if v, want := err.Type, "Problem"; v != want {
|
||||
t.Errorf("Error type was %v, but expected %v", v, want)
|
||||
}
|
||||
|
||||
if v, want := err.Message, "What even"; v != want {
|
||||
t.Errorf("Error message was %v, but expected %v", v, want)
|
||||
}
|
||||
} else {
|
||||
t.Errorf("Unknown error returned: %#v", err)
|
||||
}
|
||||
}
|
||||
|
||||
type fakeJSONRequest struct {
|
||||
Name string
|
||||
}
|
||||
|
||||
type fakeJSONResponse struct {
|
||||
TailWagged bool
|
||||
}
|
|
@ -1,234 +0,0 @@
|
|||
package aws
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// QueryClient is the underlying client for Query APIs.
|
||||
type QueryClient struct {
|
||||
Context Context
|
||||
Client *http.Client
|
||||
Endpoint string
|
||||
APIVersion string
|
||||
}
|
||||
|
||||
// Do sends an HTTP request and returns an HTTP response, following policy
|
||||
// (e.g. redirects, cookies, auth) as configured on the client.
|
||||
func (c *QueryClient) Do(op, method, uri string, req, resp interface{}) error {
|
||||
body := url.Values{"Action": {op}, "Version": {c.APIVersion}}
|
||||
if err := c.loadValues(body, req, ""); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
httpReq, err := http.NewRequest(method, c.Endpoint+uri, strings.NewReader(body.Encode()))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
httpReq.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||||
httpReq.Header.Set("User-Agent", "aws-go")
|
||||
if err := c.Context.sign(httpReq); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
httpResp, err := c.Client.Do(httpReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
_ = httpResp.Body.Close()
|
||||
}()
|
||||
|
||||
if httpResp.StatusCode != http.StatusOK {
|
||||
bodyBytes, err := ioutil.ReadAll(httpResp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(bodyBytes) == 0 {
|
||||
return APIError{
|
||||
StatusCode: httpResp.StatusCode,
|
||||
Message: httpResp.Status,
|
||||
}
|
||||
}
|
||||
var queryErr queryErrorResponse
|
||||
if err := xml.Unmarshal(bodyBytes, &queryErr); err != nil {
|
||||
return err
|
||||
}
|
||||
return queryErr.Err(httpResp.StatusCode)
|
||||
}
|
||||
|
||||
if resp != nil {
|
||||
return xml.NewDecoder(httpResp.Body).Decode(resp)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type queryErrorResponse struct {
|
||||
XMLName xml.Name `xml:"ErrorResponse"`
|
||||
Type string `xml:"Error>Type"`
|
||||
Code string `xml:"Error>Code"`
|
||||
Message string `xml:"Error>Message"`
|
||||
RequestID string `xml:"RequestId"`
|
||||
}
|
||||
|
||||
func (e queryErrorResponse) Err(StatusCode int) error {
|
||||
return APIError{
|
||||
StatusCode: StatusCode,
|
||||
Type: e.Type,
|
||||
Code: e.Code,
|
||||
Message: e.Message,
|
||||
RequestID: e.RequestID,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *QueryClient) loadValues(v url.Values, i interface{}, prefix string) error {
|
||||
value := reflect.ValueOf(i)
|
||||
|
||||
// follow any pointers
|
||||
for value.Kind() == reflect.Ptr {
|
||||
value = value.Elem()
|
||||
}
|
||||
|
||||
// no need to handle zero values
|
||||
if !value.IsValid() {
|
||||
return nil
|
||||
}
|
||||
|
||||
switch value.Kind() {
|
||||
case reflect.Struct:
|
||||
return c.loadStruct(v, value, prefix)
|
||||
case reflect.Slice:
|
||||
for i := 0; i < value.Len(); i++ {
|
||||
slicePrefix := prefix
|
||||
if slicePrefix == "" {
|
||||
slicePrefix = strconv.Itoa(i + 1)
|
||||
} else {
|
||||
slicePrefix = slicePrefix + "." + strconv.Itoa(i+1)
|
||||
}
|
||||
if err := c.loadValues(v, value.Index(i).Interface(), slicePrefix); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
case reflect.Map:
|
||||
sortedKeys := []string{}
|
||||
keysByString := map[string]reflect.Value{}
|
||||
for _, k := range value.MapKeys() {
|
||||
s := fmt.Sprintf("%v", k.Interface())
|
||||
sortedKeys = append(sortedKeys, s)
|
||||
keysByString[s] = k
|
||||
}
|
||||
sort.Strings(sortedKeys)
|
||||
|
||||
for i, sortKey := range sortedKeys {
|
||||
mapKey := keysByString[sortKey]
|
||||
|
||||
var keyName string
|
||||
if prefix == "" {
|
||||
keyName = strconv.Itoa(i+1) + ".Name"
|
||||
} else {
|
||||
keyName = prefix + "." + strconv.Itoa(i+1) + ".Name"
|
||||
}
|
||||
|
||||
if err := c.loadValue(v, mapKey, keyName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mapValue := value.MapIndex(mapKey)
|
||||
|
||||
var valueName string
|
||||
if prefix == "" {
|
||||
valueName = strconv.Itoa(i+1) + ".Value"
|
||||
} else {
|
||||
valueName = prefix + "." + strconv.Itoa(i+1) + ".Value"
|
||||
}
|
||||
|
||||
if err := c.loadValue(v, mapValue, valueName); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
default:
|
||||
panic("unknown request member type: " + value.String())
|
||||
}
|
||||
}
|
||||
|
||||
func (c *QueryClient) loadStruct(v url.Values, value reflect.Value, prefix string) error {
|
||||
if !value.IsValid() {
|
||||
return nil
|
||||
}
|
||||
|
||||
t := value.Type()
|
||||
for i := 0; i < value.NumField(); i++ {
|
||||
value := value.Field(i)
|
||||
name := t.Field(i).Tag.Get("query")
|
||||
if name == "" {
|
||||
name = t.Field(i).Name
|
||||
}
|
||||
if prefix != "" {
|
||||
name = prefix + "." + name
|
||||
}
|
||||
if err := c.loadValue(v, value, name); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *QueryClient) loadValue(v url.Values, value reflect.Value, name string) error {
|
||||
switch casted := value.Interface().(type) {
|
||||
case string:
|
||||
if casted != "" {
|
||||
v.Set(name, casted)
|
||||
}
|
||||
case StringValue:
|
||||
if casted != nil {
|
||||
v.Set(name, *casted)
|
||||
}
|
||||
case BooleanValue:
|
||||
if casted != nil {
|
||||
v.Set(name, strconv.FormatBool(*casted))
|
||||
}
|
||||
case LongValue:
|
||||
if casted != nil {
|
||||
v.Set(name, strconv.FormatInt(*casted, 10))
|
||||
}
|
||||
case IntegerValue:
|
||||
if casted != nil {
|
||||
v.Set(name, strconv.Itoa(*casted))
|
||||
}
|
||||
case DoubleValue:
|
||||
if casted != nil {
|
||||
v.Set(name, strconv.FormatFloat(*casted, 'f', -1, 64))
|
||||
}
|
||||
case FloatValue:
|
||||
if casted != nil {
|
||||
v.Set(name, strconv.FormatFloat(float64(*casted), 'f', -1, 32))
|
||||
}
|
||||
case time.Time:
|
||||
if !casted.IsZero() {
|
||||
const ISO8601UTC = "2006-01-02T15:04:05Z"
|
||||
v.Set(name, casted.UTC().Format(ISO8601UTC))
|
||||
}
|
||||
case []string:
|
||||
if len(casted) != 0 {
|
||||
for i, val := range casted {
|
||||
v.Set(fmt.Sprintf("%s.%d", name, i+1), val)
|
||||
}
|
||||
}
|
||||
default:
|
||||
if err := c.loadValues(v, value.Interface(), name); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
|
@ -1,240 +0,0 @@
|
|||
package aws_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"reflect"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/aws-sdk-go/aws"
|
||||
)
|
||||
|
||||
func TestQueryRequest(t *testing.T) {
|
||||
var m sync.Mutex
|
||||
var httpReq *http.Request
|
||||
var form url.Values
|
||||
|
||||
server := httptest.NewServer(http.HandlerFunc(
|
||||
func(w http.ResponseWriter, r *http.Request) {
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
|
||||
httpReq = r
|
||||
|
||||
if err := r.ParseForm(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
form = r.Form
|
||||
|
||||
fmt.Fprintln(w, `<Thing><IpAddress>woo</IpAddress></Thing>`)
|
||||
},
|
||||
))
|
||||
defer server.Close()
|
||||
|
||||
client := aws.QueryClient{
|
||||
Context: aws.Context{
|
||||
Service: "animals",
|
||||
Region: "us-west-2",
|
||||
Credentials: aws.Creds(
|
||||
"accessKeyID",
|
||||
"secretAccessKey",
|
||||
"securityToken",
|
||||
),
|
||||
},
|
||||
Client: http.DefaultClient,
|
||||
Endpoint: server.URL,
|
||||
APIVersion: "1.1",
|
||||
}
|
||||
|
||||
req := fakeQueryRequest{
|
||||
PresentString: aws.String("string"),
|
||||
PresentBoolean: aws.True(),
|
||||
PresentInteger: aws.Integer(1),
|
||||
PresentLong: aws.Long(2),
|
||||
PresentDouble: aws.Double(1.2),
|
||||
PresentFloat: aws.Float(2.3),
|
||||
PresentTime: time.Date(2001, 1, 1, 2, 1, 1, 0, time.FixedZone("UTC+1", 3600)),
|
||||
PresentSlice: []string{"one", "two"},
|
||||
PresentStruct: &EmbeddedStruct{Value: aws.String("v")},
|
||||
PresentStructSlice: []EmbeddedStruct{
|
||||
{Value: aws.String("p")},
|
||||
{Value: aws.String("q")},
|
||||
},
|
||||
PresentMap: map[string]EmbeddedStruct{
|
||||
"aa": EmbeddedStruct{Value: aws.String("AA")},
|
||||
"bb": EmbeddedStruct{Value: aws.String("BB")},
|
||||
},
|
||||
}
|
||||
var resp fakeQueryResponse
|
||||
if err := client.Do("GetIP", "POST", "/", &req, &resp); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
|
||||
if v, want := httpReq.Method, "POST"; v != want {
|
||||
t.Errorf("Method was %v but expected %v", v, want)
|
||||
}
|
||||
|
||||
if httpReq.Header.Get("Authorization") == "" {
|
||||
t.Error("Authorization header is missing")
|
||||
}
|
||||
|
||||
if v, want := httpReq.Header.Get("Content-Type"), "application/x-www-form-urlencoded"; v != want {
|
||||
t.Errorf("Content-Type was %v but expected %v", v, want)
|
||||
}
|
||||
|
||||
if v, want := httpReq.Header.Get("User-Agent"), "aws-go"; v != want {
|
||||
t.Errorf("User-Agent was %v but expected %v", v, want)
|
||||
}
|
||||
|
||||
if err := httpReq.ParseForm(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
expectedForm := url.Values{
|
||||
"Action": []string{"GetIP"},
|
||||
"Version": []string{"1.1"},
|
||||
"PresentString": []string{"string"},
|
||||
"PresentBoolean": []string{"true"},
|
||||
"PresentInteger": []string{"1"},
|
||||
"PresentLong": []string{"2"},
|
||||
"PresentDouble": []string{"1.2"},
|
||||
"PresentFloat": []string{"2.3"},
|
||||
"PresentTime": []string{"2001-01-01T01:01:01Z"},
|
||||
"PresentSlice.1": []string{"one"},
|
||||
"PresentSlice.2": []string{"two"},
|
||||
"PresentStruct.Value": []string{"v"},
|
||||
"PresentStructSlice.1.Value": []string{"p"},
|
||||
"PresentStructSlice.2.Value": []string{"q"},
|
||||
"PresentMap.1.Name": []string{"aa"},
|
||||
"PresentMap.1.Value.Value": []string{"AA"},
|
||||
"PresentMap.2.Name": []string{"bb"},
|
||||
"PresentMap.2.Value.Value": []string{"BB"},
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(form, expectedForm) {
|
||||
t.Errorf("Post body was \n%s\n but expected \n%s", form.Encode(), expectedForm.Encode())
|
||||
}
|
||||
|
||||
if want := (fakeQueryResponse{IPAddress: "woo"}); want != resp {
|
||||
t.Errorf("Response was %#v, but expected %#v", resp, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestQueryRequestError(t *testing.T) {
|
||||
var m sync.Mutex
|
||||
var httpReq *http.Request
|
||||
var form url.Values
|
||||
|
||||
server := httptest.NewServer(http.HandlerFunc(
|
||||
func(w http.ResponseWriter, r *http.Request) {
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
|
||||
httpReq = r
|
||||
|
||||
if err := r.ParseForm(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
form = r.Form
|
||||
|
||||
w.WriteHeader(400)
|
||||
fmt.Fprintln(w, `<ErrorResponse>
|
||||
<RequestId>woo</RequestId>
|
||||
<Error>
|
||||
<Type>Problem</Type>
|
||||
<Code>Uh Oh</Code>
|
||||
<Message>You done did it</Message>
|
||||
</Error>
|
||||
</ErrorResponse>`)
|
||||
},
|
||||
))
|
||||
defer server.Close()
|
||||
|
||||
client := aws.QueryClient{
|
||||
Context: aws.Context{
|
||||
Service: "animals",
|
||||
Region: "us-west-2",
|
||||
Credentials: aws.Creds(
|
||||
"accessKeyID",
|
||||
"secretAccessKey",
|
||||
"securityToken",
|
||||
),
|
||||
},
|
||||
Client: http.DefaultClient,
|
||||
Endpoint: server.URL,
|
||||
APIVersion: "1.1",
|
||||
}
|
||||
|
||||
req := fakeQueryRequest{}
|
||||
var resp fakeQueryResponse
|
||||
err := client.Do("GetIP", "POST", "/", &req, &resp)
|
||||
if err == nil {
|
||||
t.Fatal("Expected an error but none was returned")
|
||||
}
|
||||
|
||||
if err, ok := err.(aws.APIError); ok {
|
||||
if v, want := err.Type, "Problem"; v != want {
|
||||
t.Errorf("Error type was %v, but expected %v", v, want)
|
||||
}
|
||||
|
||||
if v, want := err.Code, "Uh Oh"; v != want {
|
||||
t.Errorf("Error type was %v, but expected %v", v, want)
|
||||
}
|
||||
|
||||
if v, want := err.Message, "You done did it"; v != want {
|
||||
t.Errorf("Error message was %v, but expected %v", v, want)
|
||||
}
|
||||
} else {
|
||||
t.Errorf("Unknown error returned: %#v", err)
|
||||
}
|
||||
}
|
||||
|
||||
type fakeQueryRequest struct {
|
||||
PresentString aws.StringValue `query:"PresentString"`
|
||||
MissingString aws.StringValue `query:"MissingString"`
|
||||
|
||||
PresentInteger aws.IntegerValue `query:"PresentInteger"`
|
||||
MissingInteger aws.IntegerValue `query:"MissingInteger"`
|
||||
|
||||
PresentLong aws.LongValue `query:"PresentLong"`
|
||||
MissingLong aws.LongValue `query:"MissingLong"`
|
||||
|
||||
PresentDouble aws.DoubleValue `query:"PresentDouble"`
|
||||
MissingDouble aws.DoubleValue `query:"MissingDouble"`
|
||||
|
||||
PresentFloat aws.FloatValue `query:"PresentFloat"`
|
||||
MissingFloat aws.FloatValue `query:"MissingFloat"`
|
||||
|
||||
PresentBoolean aws.BooleanValue `query:"PresentBoolean"`
|
||||
MissingBoolean aws.BooleanValue `query:"MissingBoolean"`
|
||||
|
||||
PresentTime time.Time `query:"PresentTime"`
|
||||
MissingTime time.Time `query:"MissingTime"`
|
||||
|
||||
PresentSlice []string `query:"PresentSlice"`
|
||||
MissingSlice []string `query:"MissingSlice"`
|
||||
|
||||
PresentStructSlice []EmbeddedStruct `query:"PresentStructSlice"`
|
||||
MissingStructSlice []EmbeddedStruct `query:"MissingStructSlice"`
|
||||
|
||||
PresentMap map[string]EmbeddedStruct `query:"PresentMap"`
|
||||
MissingMap map[string]EmbeddedStruct `query:"MissingMap"`
|
||||
|
||||
PresentStruct *EmbeddedStruct `query:"PresentStruct"`
|
||||
MissingStruct *EmbeddedStruct `query:"MissingStruct"`
|
||||
}
|
||||
|
||||
type EmbeddedStruct struct {
|
||||
Value aws.StringValue
|
||||
}
|
||||
|
||||
type fakeQueryResponse struct {
|
||||
IPAddress string `xml:"IpAddress"`
|
||||
}
|
|
@ -1,136 +0,0 @@
|
|||
package aws
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// RestClient is the underlying client for REST-JSON and REST-XML APIs.
|
||||
type RestClient struct {
|
||||
Context Context
|
||||
Client *http.Client
|
||||
Endpoint string
|
||||
APIVersion string
|
||||
}
|
||||
|
||||
// Whether the byte value can be sent without escaping in AWS URLs
|
||||
var noEscape [256]bool
|
||||
|
||||
// Initialise noEscape
|
||||
func init() {
|
||||
for i := range noEscape {
|
||||
// Amazon expects every character except these escaped
|
||||
noEscape[i] = (i >= 'A' && i <= 'Z') ||
|
||||
(i >= 'a' && i <= 'z') ||
|
||||
(i >= '0' && i <= '9') ||
|
||||
i == '-' ||
|
||||
i == '.' ||
|
||||
i == '/' ||
|
||||
i == ':' ||
|
||||
i == '_' ||
|
||||
i == '~'
|
||||
}
|
||||
}
|
||||
|
||||
// EscapePath escapes part of a URL path in Amazon style
|
||||
func EscapePath(path string) string {
|
||||
var buf bytes.Buffer
|
||||
for i := 0; i < len(path); i++ {
|
||||
c := path[i]
|
||||
if noEscape[c] {
|
||||
buf.WriteByte(c)
|
||||
} else {
|
||||
buf.WriteByte('%')
|
||||
buf.WriteString(strings.ToUpper(strconv.FormatUint(uint64(c), 16)))
|
||||
}
|
||||
}
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
// Do sends an HTTP request and returns an HTTP response, following policy
|
||||
// (e.g. redirects, cookies, auth) as configured on the client.
|
||||
func (c *RestClient) Do(req *http.Request) (*http.Response, error) {
|
||||
// Set the form for the URL
|
||||
req.URL.Opaque = EscapePath(req.URL.Path)
|
||||
req.Header.Set("User-Agent", "aws-go")
|
||||
if err := c.Context.sign(req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp, err := c.Client.Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if resp.StatusCode >= 400 {
|
||||
bodyBytes, err := ioutil.ReadAll(resp.Body)
|
||||
defer resp.Body.Close()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(bodyBytes) == 0 {
|
||||
return nil, APIError{
|
||||
StatusCode: resp.StatusCode,
|
||||
Message: resp.Status,
|
||||
}
|
||||
}
|
||||
var restErr restError
|
||||
switch resp.Header.Get("Content-Type") {
|
||||
case "application/json":
|
||||
if err := json.Unmarshal(bodyBytes, &restErr); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, restErr.Err(resp.StatusCode)
|
||||
case "application/xml", "text/xml":
|
||||
// AWS XML error documents can have a couple of different formats.
|
||||
// Try each before returning a decode error.
|
||||
var wrappedErr restErrorResponse
|
||||
if err := xml.Unmarshal(bodyBytes, &wrappedErr); err == nil {
|
||||
return nil, wrappedErr.Error.Err(resp.StatusCode)
|
||||
}
|
||||
if err := xml.Unmarshal(bodyBytes, &restErr); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, restErr.Err(resp.StatusCode)
|
||||
default:
|
||||
return nil, APIError{
|
||||
StatusCode: resp.StatusCode,
|
||||
Message: string(bodyBytes),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
type restErrorResponse struct {
|
||||
XMLName xml.Name `xml:"ErrorResponse",json:"-"`
|
||||
Error restError
|
||||
}
|
||||
|
||||
type restError struct {
|
||||
XMLName xml.Name `xml:"Error",json:"-"`
|
||||
Code string
|
||||
BucketName string
|
||||
Message string
|
||||
RequestID string
|
||||
HostID string
|
||||
}
|
||||
|
||||
func (e restError) Err(StatusCode int) error {
|
||||
return APIError{
|
||||
StatusCode: StatusCode,
|
||||
Code: e.Code,
|
||||
Message: e.Message,
|
||||
RequestID: e.RequestID,
|
||||
HostID: e.HostID,
|
||||
Specifics: map[string]string{
|
||||
"BucketName": e.BucketName,
|
||||
},
|
||||
}
|
||||
}
|
|
@ -1,215 +0,0 @@
|
|||
package aws_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/aws-sdk-go/aws"
|
||||
)
|
||||
|
||||
func TestRestRequest(t *testing.T) {
|
||||
var m sync.Mutex
|
||||
var httpReq *http.Request
|
||||
|
||||
server := httptest.NewServer(http.HandlerFunc(
|
||||
func(w http.ResponseWriter, r *http.Request) {
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
|
||||
httpReq = r
|
||||
|
||||
fmt.Fprintln(w, `woo`)
|
||||
},
|
||||
))
|
||||
defer server.Close()
|
||||
|
||||
client := aws.RestClient{
|
||||
Context: aws.Context{
|
||||
Service: "animals",
|
||||
Region: "us-west-2",
|
||||
Credentials: aws.Creds(
|
||||
"accessKeyID",
|
||||
"secretAccessKey",
|
||||
"securityToken",
|
||||
),
|
||||
},
|
||||
Client: http.DefaultClient,
|
||||
}
|
||||
|
||||
req, err := http.NewRequest("GET", server.URL+"/yay", nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if v, want := string(body), "woo\n"; v != want {
|
||||
t.Errorf("Response entity was %q, but expected %q", v, want)
|
||||
}
|
||||
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
|
||||
if v, want := httpReq.Method, "GET"; v != want {
|
||||
t.Errorf("Method was %v but expected %v", v, want)
|
||||
}
|
||||
|
||||
if httpReq.Header.Get("Authorization") == "" {
|
||||
t.Error("Authorization header is missing")
|
||||
}
|
||||
|
||||
if v, want := httpReq.Header.Get("User-Agent"), "aws-go"; v != want {
|
||||
t.Errorf("User-Agent was %v but expected %v", v, want)
|
||||
}
|
||||
|
||||
if v, want := httpReq.URL.String(), "/yay"; v != want {
|
||||
t.Errorf("URL was %v but expected %v", v, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRestRequestXMLError(t *testing.T) {
|
||||
var m sync.Mutex
|
||||
var httpReq *http.Request
|
||||
|
||||
server := httptest.NewServer(http.HandlerFunc(
|
||||
func(w http.ResponseWriter, r *http.Request) {
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
|
||||
httpReq = r
|
||||
|
||||
w.Header().Set("Content-Type", "application/xml")
|
||||
w.WriteHeader(500)
|
||||
fmt.Fprintln(w, `<Error>
|
||||
<Code>bonus</Code>
|
||||
<BucketName>bingo</BucketName>
|
||||
<Message>the bad thing</Message>
|
||||
<RequestId>woo woo</RequestId>
|
||||
<HostId>woo woo</HostId>
|
||||
</Error>`)
|
||||
},
|
||||
))
|
||||
defer server.Close()
|
||||
|
||||
client := aws.RestClient{
|
||||
Context: aws.Context{
|
||||
Service: "animals",
|
||||
Region: "us-west-2",
|
||||
Credentials: aws.Creds(
|
||||
"accessKeyID",
|
||||
"secretAccessKey",
|
||||
"securityToken",
|
||||
),
|
||||
},
|
||||
Client: http.DefaultClient,
|
||||
}
|
||||
|
||||
req, err := http.NewRequest("GET", server.URL+"/yay", nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
_, err = client.Do(req)
|
||||
if err == nil {
|
||||
t.Fatal("Expected an error but none was returned")
|
||||
}
|
||||
|
||||
if err, ok := err.(aws.APIError); ok {
|
||||
if v, want := err.Code, "bonus"; v != want {
|
||||
t.Errorf("Error code was %v, but expected %v", v, want)
|
||||
}
|
||||
|
||||
if v, want := err.Message, "the bad thing"; v != want {
|
||||
t.Errorf("Error message was %v, but expected %v", v, want)
|
||||
}
|
||||
} else {
|
||||
t.Errorf("Unknown error returned: %#v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRestRequestJSONError(t *testing.T) {
|
||||
var m sync.Mutex
|
||||
var httpReq *http.Request
|
||||
|
||||
server := httptest.NewServer(http.HandlerFunc(
|
||||
func(w http.ResponseWriter, r *http.Request) {
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
|
||||
httpReq = r
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(500)
|
||||
fmt.Fprintln(w, `{"Code":"bonus", "Message":"the bad thing"}`)
|
||||
},
|
||||
))
|
||||
defer server.Close()
|
||||
|
||||
client := aws.RestClient{
|
||||
Context: aws.Context{
|
||||
Service: "animals",
|
||||
Region: "us-west-2",
|
||||
Credentials: aws.Creds(
|
||||
"accessKeyID",
|
||||
"secretAccessKey",
|
||||
"securityToken",
|
||||
),
|
||||
},
|
||||
Client: http.DefaultClient,
|
||||
}
|
||||
|
||||
req, err := http.NewRequest("GET", server.URL+"/yay", nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
_, err = client.Do(req)
|
||||
if err == nil {
|
||||
t.Fatal("Expected an error but none was returned")
|
||||
}
|
||||
|
||||
if err, ok := err.(aws.APIError); ok {
|
||||
if v, want := err.Code, "bonus"; v != want {
|
||||
t.Errorf("Error code was %v, but expected %v", v, want)
|
||||
}
|
||||
|
||||
if v, want := err.Message, "the bad thing"; v != want {
|
||||
t.Errorf("Error message was %v, but expected %v", v, want)
|
||||
}
|
||||
} else {
|
||||
t.Errorf("Unknown error returned: %#v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEscapePath(t *testing.T) {
|
||||
for _, x := range []struct {
|
||||
in string
|
||||
want string
|
||||
}{
|
||||
{"", ""},
|
||||
{"ABCDEFGHIJKLMNOPQRTSUVWXYZ", "ABCDEFGHIJKLMNOPQRTSUVWXYZ"},
|
||||
{"abcdefghijklmnopqrtsuvwxyz", "abcdefghijklmnopqrtsuvwxyz"},
|
||||
{"0123456789", "0123456789"},
|
||||
{"_-~./:", "_-~./:"},
|
||||
{"test? file", "test%3F%20file"},
|
||||
{`hello? sausage/êé/Hello, 世界/ " ' @ < > & ?/z.txt`, "hello%3F%20sausage/%C3%AA%C3%A9/Hello%2C%20%E4%B8%96%E7%95%8C/%20%22%20%27%20%40%20%3C%20%3E%20%26%20%3F/z.txt"},
|
||||
} {
|
||||
got := aws.EscapePath(x.in)
|
||||
if got != x.want {
|
||||
t.Errorf("EscapePath(%q) got %q, want %v", x.in, got, x.want)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
package aws
|
||||
|
||||
import (
|
||||
"math"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
// A StringValue is a string which may or may not be present.
|
||||
type StringValue *string
|
||||
|
||||
// String converts a Go string into a StringValue.
|
||||
func String(v string) StringValue {
|
||||
return &v
|
||||
}
|
||||
|
||||
// A BooleanValue is a boolean which may or may not be present.
|
||||
type BooleanValue *bool
|
||||
|
||||
// Boolean converts a Go bool into a BooleanValue.
|
||||
func Boolean(v bool) BooleanValue {
|
||||
return &v
|
||||
}
|
||||
|
||||
// True is the BooleanValue equivalent of the Go literal true.
|
||||
func True() BooleanValue {
|
||||
return Boolean(true)
|
||||
}
|
||||
|
||||
// False is the BooleanValue equivalent of the Go literal false.
|
||||
func False() BooleanValue {
|
||||
return Boolean(false)
|
||||
}
|
||||
|
||||
// An IntegerValue is an integer which may or may not be present.
|
||||
type IntegerValue *int
|
||||
|
||||
// Integer converts a Go int into an IntegerValue.
|
||||
func Integer(v int) IntegerValue {
|
||||
return &v
|
||||
}
|
||||
|
||||
// A LongValue is a 64-bit integer which may or may not be present.
|
||||
type LongValue *int64
|
||||
|
||||
// Long converts a Go int64 into a LongValue.
|
||||
func Long(v int64) LongValue {
|
||||
return &v
|
||||
}
|
||||
|
||||
// A FloatValue is a 32-bit floating point number which may or may not be
|
||||
// present.
|
||||
type FloatValue *float32
|
||||
|
||||
// Float converts a Go float32 into a FloatValue.
|
||||
func Float(v float32) FloatValue {
|
||||
return &v
|
||||
}
|
||||
|
||||
// A DoubleValue is a 64-bit floating point number which may or may not be
|
||||
// present.
|
||||
type DoubleValue *float64
|
||||
|
||||
// Double converts a Go float64 into a DoubleValue.
|
||||
func Double(v float64) DoubleValue {
|
||||
return &v
|
||||
}
|
||||
|
||||
// A UnixTimestamp is a Unix timestamp represented as fractional seconds since
|
||||
// the Unix epoch.
|
||||
type UnixTimestamp struct {
|
||||
Time time.Time
|
||||
}
|
||||
|
||||
// MarshalJSON marshals the timestamp as a float.
|
||||
func (t UnixTimestamp) MarshalJSON() (text []byte, err error) {
|
||||
n := float64(t.Time.UnixNano()) / 1e9
|
||||
s := strconv.FormatFloat(n, 'f', -1, 64)
|
||||
return []byte(s), nil
|
||||
}
|
||||
|
||||
// UnmarshalJSON unmarshals the timestamp from a float.
|
||||
func (t *UnixTimestamp) UnmarshalJSON(text []byte) error {
|
||||
f, err := strconv.ParseFloat(string(text), 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
sec := math.Floor(f)
|
||||
nsec := (f - sec) * 1e9
|
||||
|
||||
t.Time = time.Unix(int64(sec), int64(nsec)).UTC()
|
||||
return nil
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package aws_test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/aws-sdk-go/aws"
|
||||
)
|
||||
|
||||
func TestUnixTimestampSerialization(t *testing.T) {
|
||||
d := time.Date(2014, 12, 20, 14, 55, 30, 500000000, time.UTC)
|
||||
ts := aws.UnixTimestamp{Time: d}
|
||||
out, err := json.Marshal(ts)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if v, want := string(out), `1419087330.5`; v != want {
|
||||
t.Errorf("Was %q but expected %q", v, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnixTimestampDeserialization(t *testing.T) {
|
||||
var ts aws.UnixTimestamp
|
||||
if err := json.Unmarshal([]byte(`1419087330.5`), &ts); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if v, want := ts.Time.Format(time.RFC3339Nano), "2014-12-20T14:55:30.5Z"; v != want {
|
||||
t.Errorf("Was %s but expected %s", v, want)
|
||||
}
|
||||
}
|
|
@ -1,249 +0,0 @@
|
|||
package aws
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/hmac"
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
authHeaderPrefix = "AWS4-HMAC-SHA256"
|
||||
timeFormat = "20060102T150405Z"
|
||||
shortTimeFormat = "20060102"
|
||||
)
|
||||
|
||||
func (c *Context) sign(r *http.Request) error {
|
||||
creds, err := c.Credentials.Credentials()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
date := r.Header.Get("Date")
|
||||
t := currentTime().UTC()
|
||||
if date != "" {
|
||||
var err error
|
||||
t, err = time.Parse(http.TimeFormat, date)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
s := signer{
|
||||
Request: r,
|
||||
Time: t,
|
||||
Body: r.Body,
|
||||
ServiceName: c.Service,
|
||||
Region: c.Region,
|
||||
AccessKeyID: creds.AccessKeyID,
|
||||
SecretAccessKey: creds.SecretAccessKey,
|
||||
SessionToken: creds.SecurityToken,
|
||||
Debug: 0,
|
||||
}
|
||||
s.sign()
|
||||
return nil
|
||||
}
|
||||
|
||||
type signer struct {
|
||||
Request *http.Request
|
||||
Time time.Time
|
||||
ServiceName string
|
||||
Region string
|
||||
AccessKeyID string
|
||||
SecretAccessKey string
|
||||
SessionToken string
|
||||
Body io.Reader
|
||||
Debug uint
|
||||
|
||||
formattedTime string
|
||||
formattedShortTime string
|
||||
|
||||
signedHeaders string
|
||||
canonicalHeaders string
|
||||
canonicalString string
|
||||
credentialString string
|
||||
stringToSign string
|
||||
signature string
|
||||
authorization string
|
||||
}
|
||||
|
||||
func (v4 *signer) sign() {
|
||||
formatted := v4.Time.UTC().Format(timeFormat)
|
||||
|
||||
// remove the old headers
|
||||
v4.Request.Header.Del("Date")
|
||||
v4.Request.Header.Del("Authorization")
|
||||
|
||||
if v4.SessionToken != "" {
|
||||
v4.Request.Header.Set("X-Amz-Security-Token", v4.SessionToken)
|
||||
}
|
||||
|
||||
v4.build()
|
||||
|
||||
//v4.Debug = true
|
||||
if v4.Debug > 0 {
|
||||
fmt.Printf("---[ CANONICAL STRING ]-----------------------------\n")
|
||||
fmt.Printf("%s\n", v4.canonicalString)
|
||||
fmt.Printf("-----------------------------------------------------\n\n")
|
||||
fmt.Printf("---[ STRING TO SIGN ]--------------------------------\n")
|
||||
fmt.Printf("%s\n", v4.stringToSign)
|
||||
fmt.Printf("-----------------------------------------------------\n")
|
||||
}
|
||||
|
||||
// add the new ones
|
||||
v4.Request.Header.Set("Date", formatted)
|
||||
v4.Request.Header.Set("Authorization", v4.authorization)
|
||||
}
|
||||
|
||||
func (v4 *signer) build() {
|
||||
v4.buildTime()
|
||||
v4.buildCanonicalHeaders()
|
||||
v4.buildCredentialString()
|
||||
v4.buildCanonicalString()
|
||||
v4.buildStringToSign()
|
||||
v4.buildSignature()
|
||||
v4.buildAuthorization()
|
||||
}
|
||||
|
||||
func (v4 *signer) buildTime() {
|
||||
v4.formattedTime = v4.Time.UTC().Format(timeFormat)
|
||||
v4.formattedShortTime = v4.Time.UTC().Format(shortTimeFormat)
|
||||
}
|
||||
|
||||
func (v4 *signer) buildAuthorization() {
|
||||
v4.authorization = strings.Join([]string{
|
||||
authHeaderPrefix + " Credential=" + v4.AccessKeyID + "/" + v4.credentialString,
|
||||
"SignedHeaders=" + v4.signedHeaders,
|
||||
"Signature=" + v4.signature,
|
||||
}, ",")
|
||||
}
|
||||
|
||||
func (v4 *signer) buildCredentialString() {
|
||||
v4.credentialString = strings.Join([]string{
|
||||
v4.formattedShortTime,
|
||||
v4.Region,
|
||||
v4.ServiceName,
|
||||
"aws4_request",
|
||||
}, "/")
|
||||
}
|
||||
|
||||
func (v4 *signer) buildCanonicalHeaders() {
|
||||
headers := make([]string, 0)
|
||||
headers = append(headers, "host")
|
||||
for k, _ := range v4.Request.Header {
|
||||
if http.CanonicalHeaderKey(k) == "Content-Length" {
|
||||
continue // never sign content-length
|
||||
}
|
||||
headers = append(headers, strings.ToLower(k))
|
||||
}
|
||||
sort.Strings(headers)
|
||||
|
||||
headerValues := make([]string, len(headers))
|
||||
for i, k := range headers {
|
||||
if k == "host" {
|
||||
headerValues[i] = "host:" + v4.Request.URL.Host
|
||||
} else {
|
||||
headerValues[i] = k + ":" +
|
||||
strings.Join(v4.Request.Header[http.CanonicalHeaderKey(k)], ",")
|
||||
}
|
||||
}
|
||||
|
||||
v4.signedHeaders = strings.Join(headers, ";")
|
||||
v4.canonicalHeaders = strings.Join(headerValues, "\n")
|
||||
}
|
||||
|
||||
func (v4 *signer) buildCanonicalString() {
|
||||
v4.canonicalString = strings.Join([]string{
|
||||
v4.Request.Method,
|
||||
v4.Request.URL.Path,
|
||||
v4.Request.URL.Query().Encode(),
|
||||
v4.canonicalHeaders + "\n",
|
||||
v4.signedHeaders,
|
||||
v4.bodyDigest(),
|
||||
}, "\n")
|
||||
}
|
||||
|
||||
func (v4 *signer) buildStringToSign() {
|
||||
v4.stringToSign = strings.Join([]string{
|
||||
authHeaderPrefix,
|
||||
v4.formattedTime,
|
||||
v4.credentialString,
|
||||
hexDigest(makeSha256([]byte(v4.canonicalString))),
|
||||
}, "\n")
|
||||
}
|
||||
|
||||
func (v4 *signer) buildSignature() {
|
||||
secret := v4.SecretAccessKey
|
||||
date := makeHmac([]byte("AWS4"+secret), []byte(v4.formattedShortTime))
|
||||
region := makeHmac(date, []byte(v4.Region))
|
||||
service := makeHmac(region, []byte(v4.ServiceName))
|
||||
credentials := makeHmac(service, []byte("aws4_request"))
|
||||
signature := makeHmac(credentials, []byte(v4.stringToSign))
|
||||
v4.signature = hexDigest(signature)
|
||||
}
|
||||
|
||||
func (v4 *signer) bodyDigest() string {
|
||||
hash := v4.Request.Header.Get("X-Amz-Content-Sha256")
|
||||
if hash == "" {
|
||||
if v4.Body == nil {
|
||||
hash = hexDigest(makeSha256([]byte{}))
|
||||
} else {
|
||||
// TODO refactor body to support seeking body payloads
|
||||
b, _ := ioutil.ReadAll(v4.Body)
|
||||
hash = hexDigest(makeSha256(b))
|
||||
v4.Request.Body = ioutil.NopCloser(bytes.NewReader(b))
|
||||
}
|
||||
v4.Request.Header.Add("X-Amz-Content-Sha256", hash)
|
||||
}
|
||||
return hash
|
||||
}
|
||||
|
||||
func makeHmac(key []byte, data []byte) []byte {
|
||||
hash := hmac.New(sha256.New, key)
|
||||
hash.Write(data)
|
||||
return hash.Sum(nil)
|
||||
}
|
||||
|
||||
func makeSha256(data []byte) []byte {
|
||||
hash := sha256.New()
|
||||
hash.Write(data)
|
||||
return hash.Sum(nil)
|
||||
}
|
||||
|
||||
func makeSha256Reader(reader io.Reader) []byte {
|
||||
packet := make([]byte, 4096)
|
||||
hash := sha256.New()
|
||||
|
||||
//reader.Seek(0, 0)
|
||||
for {
|
||||
n, err := reader.Read(packet)
|
||||
if n > 0 {
|
||||
hash.Write(packet[0:n])
|
||||
}
|
||||
if err == io.EOF || n == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
//reader.Seek(0, 0)
|
||||
|
||||
return hash.Sum(nil)
|
||||
}
|
||||
|
||||
func hexDigest(data []byte) string {
|
||||
var buffer bytes.Buffer
|
||||
for i := range data {
|
||||
str := strconv.FormatUint(uint64(data[i]), 16)
|
||||
if len(str) < 2 {
|
||||
buffer.WriteString("0")
|
||||
}
|
||||
buffer.WriteString(str)
|
||||
}
|
||||
return buffer.String()
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
package aws
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func buildSigner(serviceName string, region string, signTime time.Time, body string) signer {
|
||||
endpoint := "https://" + serviceName + "." + region + ".amazonaws.com"
|
||||
reader := strings.NewReader(body)
|
||||
req, _ := http.NewRequest("POST", endpoint, reader)
|
||||
req.Header.Add("X-Amz-Target", "prefix.Operation")
|
||||
req.Header.Add("Content-Type", "application/x-amz-json-1.0")
|
||||
req.Header.Add("Content-Length", string(len(body)))
|
||||
|
||||
return signer{
|
||||
Request: req,
|
||||
Time: signTime,
|
||||
Body: reader,
|
||||
ServiceName: serviceName,
|
||||
Region: region,
|
||||
AccessKeyID: "AKID",
|
||||
SecretAccessKey: "SECRET",
|
||||
SessionToken: "SESSION",
|
||||
}
|
||||
}
|
||||
|
||||
func removeWS(text string) string {
|
||||
text = strings.Replace(text, " ", "", -1)
|
||||
text = strings.Replace(text, "\n", "", -1)
|
||||
text = strings.Replace(text, "\t", "", -1)
|
||||
return text
|
||||
}
|
||||
|
||||
func assertEqual(t *testing.T, expected, given string) {
|
||||
if removeWS(expected) != removeWS(given) {
|
||||
t.Errorf("\nExpected: %s\nGiven: %s", expected, given)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSignRequest(t *testing.T) {
|
||||
signer := buildSigner("dynamodb", "us-east-1", time.Unix(0, 0), "{}")
|
||||
signer.sign()
|
||||
|
||||
expectedDate := "19700101T000000Z"
|
||||
expectedAuth := `
|
||||
AWS4-HMAC-SHA256
|
||||
Credential=AKID/19700101/us-east-1/dynamodb/aws4_request,
|
||||
SignedHeaders=content-type;host;x-amz-security-token;x-amz-target,
|
||||
Signature=4662104789134800e088b6a2bf3a1153ca7d38ecfc07a69bff2859f04900b67f
|
||||
`
|
||||
|
||||
assertEqual(t, expectedAuth, signer.Request.Header.Get("Authorization"))
|
||||
assertEqual(t, expectedDate, signer.Request.Header.Get("Date"))
|
||||
}
|
||||
|
||||
func BenchmarkSignRequest(b *testing.B) {
|
||||
signer := buildSigner("dynamodb", "us-east-1", time.Now(), "{}")
|
||||
for i := 0; i < b.N; i++ {
|
||||
signer.sign()
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue