diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 070c99a0..06baf4b0 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -5,38 +5,6 @@ "./..." ], "Deps": [ - { - "ImportPath": "github.com/awslabs/aws-sdk-go/aws", - "Rev": "528fdccfb1784861a4a24809328f891336449926" - }, - { - "ImportPath": "github.com/awslabs/aws-sdk-go/internal/endpoints", - "Rev": "528fdccfb1784861a4a24809328f891336449926" - }, - { - "ImportPath": "github.com/awslabs/aws-sdk-go/internal/protocol/query", - "Rev": "528fdccfb1784861a4a24809328f891336449926" - }, - { - "ImportPath": "github.com/awslabs/aws-sdk-go/internal/protocol/rest", - "Rev": "528fdccfb1784861a4a24809328f891336449926" - }, - { - "ImportPath": "github.com/awslabs/aws-sdk-go/internal/protocol/restxml", - "Rev": "528fdccfb1784861a4a24809328f891336449926" - }, - { - "ImportPath": "github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil", - "Rev": "528fdccfb1784861a4a24809328f891336449926" - }, - { - "ImportPath": "github.com/awslabs/aws-sdk-go/internal/signer/v4", - "Rev": "528fdccfb1784861a4a24809328f891336449926" - }, - { - "ImportPath": "github.com/awslabs/aws-sdk-go/service/s3", - "Rev": "528fdccfb1784861a4a24809328f891336449926" - }, { "ImportPath": "github.com/cheggaaa/pb", "Rev": "bd14546a551971ae7f460e6d6e527c5b56cd38d7" @@ -73,10 +41,6 @@ { "ImportPath": "github.com/shiena/ansicolor", "Rev": "8368d3b31cf6f2c2464c7a91675342c9a0ac6658" - }, - { - "ImportPath": "github.com/vaughan0/go-ini", - "Rev": "a98ad7ee00ec53921f08832bc06ecf7fd600e6a1" } ] } diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/copy.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/copy.go deleted file mode 100644 index a96fd68b..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/copy.go +++ /dev/null @@ -1,68 +0,0 @@ -package awsutil - -import ( - "io" - "reflect" -) - -// Copy deeply copies a src structure to dst. Useful for copying request and -// response structures. -func Copy(dst, src interface{}) { - rcopy(reflect.ValueOf(dst), reflect.ValueOf(src)) -} - -// CopyOf returns a copy of src while also allocating the memory for dst. -// src must be a pointer type or this operation will fail. -func CopyOf(src interface{}) (dst interface{}) { - dsti := reflect.New(reflect.TypeOf(src).Elem()) - dst = dsti.Interface() - rcopy(dsti, reflect.ValueOf(src)) - return -} - -func rcopy(dst, src reflect.Value) { - if !src.IsValid() { - return - } - - switch src.Kind() { - case reflect.Ptr: - if _, ok := src.Interface().(io.Reader); ok { - if dst.Kind() == reflect.Ptr && dst.Elem().CanSet() { - dst.Elem().Set(src) - } else if dst.CanSet() { - dst.Set(src) - } - } else { - e := src.Type().Elem() - if dst.CanSet() { - dst.Set(reflect.New(e)) - } - if src.Elem().IsValid() { - rcopy(dst.Elem(), src.Elem()) - } - } - case reflect.Struct: - dst.Set(reflect.New(src.Type()).Elem()) - for i := 0; i < src.NumField(); i++ { - rcopy(dst.Field(i), src.Field(i)) - } - case reflect.Slice: - 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)) - } - case reflect.Map: - s := reflect.MakeMap(src.Type()) - dst.Set(s) - for _, k := range src.MapKeys() { - v := src.MapIndex(k) - v2 := reflect.New(v.Type()).Elem() - rcopy(v2, v) - dst.SetMapIndex(k, v2) - } - default: - dst.Set(src) - } -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/copy_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/copy_test.go deleted file mode 100644 index 15b7929e..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/copy_test.go +++ /dev/null @@ -1,130 +0,0 @@ -package awsutil_test - -import ( - "bytes" - "fmt" - "io" - "io/ioutil" - "testing" - - "github.com/awslabs/aws-sdk-go/aws/awsutil" - "github.com/stretchr/testify/assert" -) - -func ExampleCopy() { - type Foo struct { - A int - B []*string - } - - // Create the initial value - str1 := "hello" - str2 := "bye bye" - f1 := &Foo{A: 1, B: []*string{&str1, &str2}} - - // Do the copy - var f2 Foo - awsutil.Copy(&f2, f1) - - // Print the result - fmt.Println(awsutil.StringValue(f2)) - - // Output: - // { - // A: 1, - // B: ["hello","bye bye"] - // } -} - -func TestCopy(t *testing.T) { - type Foo struct { - A int - B []*string - C map[string]*int - } - - // Create the initial value - str1 := "hello" - str2 := "bye bye" - int1 := 1 - int2 := 2 - f1 := &Foo{ - A: 1, - B: []*string{&str1, &str2}, - C: map[string]*int{ - "A": &int1, - "B": &int2, - }, - } - - // Do the copy - var f2 Foo - awsutil.Copy(&f2, f1) - - // Values are equal - assert.Equal(t, f2.A, f1.A) - assert.Equal(t, f2.B, f1.B) - assert.Equal(t, f2.C, f1.C) - - // But pointers are not! - str3 := "nothello" - int3 := 57 - f2.A = 100 - f2.B[0] = &str3 - f2.C["B"] = &int3 - assert.NotEqual(t, f2.A, f1.A) - assert.NotEqual(t, f2.B, f1.B) - assert.NotEqual(t, f2.C, f1.C) -} - -func TestCopyPrimitive(t *testing.T) { - str := "hello" - var s string - awsutil.Copy(&s, &str) - assert.Equal(t, "hello", s) -} - -func TestCopyNil(t *testing.T) { - var s string - awsutil.Copy(&s, nil) - assert.Equal(t, "", s) -} - -func TestCopyReader(t *testing.T) { - var buf io.Reader = bytes.NewReader([]byte("hello world")) - var r io.Reader - awsutil.Copy(&r, buf) - b, err := ioutil.ReadAll(r) - assert.NoError(t, err) - assert.Equal(t, []byte("hello world"), b) - - // empty bytes because this is not a deep copy - b, err = ioutil.ReadAll(buf) - assert.NoError(t, err) - assert.Equal(t, []byte(""), b) -} - -func ExampleCopyOf() { - type Foo struct { - A int - B []*string - } - - // Create the initial value - str1 := "hello" - str2 := "bye bye" - f1 := &Foo{A: 1, B: []*string{&str1, &str2}} - - // Do the copy - v := awsutil.CopyOf(f1) - var f2 *Foo = v.(*Foo) - - // Print the result - fmt.Println(awsutil.StringValue(f2)) - - // Output: - // { - // A: 1, - // B: ["hello","bye bye"] - // } -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/path_value.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/path_value.go deleted file mode 100644 index ce4c5e27..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/path_value.go +++ /dev/null @@ -1,142 +0,0 @@ -package awsutil - -import ( - "reflect" - "regexp" - "strconv" - "strings" -) - -var indexRe = regexp.MustCompile(`(.+)\[(-?\d+)?\]$`) - -func rValuesAtPath(v interface{}, path string, create bool) []reflect.Value { - pathparts := strings.Split(path, "||") - if len(pathparts) > 1 { - for _, pathpart := range pathparts { - vals := rValuesAtPath(v, pathpart, create) - if vals != nil && len(vals) > 0 { - return vals - } - } - return nil - } - - values := []reflect.Value{reflect.Indirect(reflect.ValueOf(v))} - components := strings.Split(path, ".") - for len(values) > 0 && len(components) > 0 { - var index *int64 - var indexStar bool - c := strings.TrimSpace(components[0]) - if c == "" { // no actual component, illegal syntax - return nil - } else if c != "*" && strings.ToLower(c[0:1]) == c[0:1] { - // TODO normalize case for user - return nil // don't support unexported fields - } - - // parse this component - if m := indexRe.FindStringSubmatch(c); m != nil { - c = m[1] - if m[2] == "" { - index = nil - indexStar = true - } else { - i, _ := strconv.ParseInt(m[2], 10, 32) - index = &i - indexStar = false - } - } - - nextvals := []reflect.Value{} - for _, value := range values { - // pull component name out of struct member - if value.Kind() != reflect.Struct { - continue - } - - if c == "*" { // pull all members - for i := 0; i < value.NumField(); i++ { - if f := reflect.Indirect(value.Field(i)); f.IsValid() { - nextvals = append(nextvals, f) - } - } - continue - } - - value = value.FieldByName(c) - if create && value.Kind() == reflect.Ptr && value.IsNil() { - value.Set(reflect.New(value.Type().Elem())) - value = value.Elem() - } else { - value = reflect.Indirect(value) - } - - if value.IsValid() { - nextvals = append(nextvals, value) - } - } - values = nextvals - - if indexStar || index != nil { - nextvals = []reflect.Value{} - for _, value := range values { - value := reflect.Indirect(value) - if value.Kind() != reflect.Slice { - continue - } - - if indexStar { // grab all indices - for i := 0; i < value.Len(); i++ { - idx := reflect.Indirect(value.Index(i)) - if idx.IsValid() { - nextvals = append(nextvals, idx) - } - } - continue - } - - // pull out index - i := int(*index) - if i >= value.Len() { // check out of bounds - if create { - // TODO resize slice - } else { - continue - } - } else if i < 0 { // support negative indexing - i = value.Len() + i - } - value = reflect.Indirect(value.Index(i)) - - if value.IsValid() { - nextvals = append(nextvals, value) - } - } - values = nextvals - } - - components = components[1:] - } - return values -} - -// ValuesAtPath returns a list of objects at the lexical path inside of a structure -func ValuesAtPath(i interface{}, path string) []interface{} { - if rvals := rValuesAtPath(i, path, false); rvals != nil { - vals := make([]interface{}, len(rvals)) - for i, rval := range rvals { - vals[i] = rval.Interface() - } - return vals - } - return nil -} - -// SetValueAtPath sets an object at the lexical path inside of a structure -func SetValueAtPath(i interface{}, path string, v interface{}) { - if rvals := rValuesAtPath(i, path, true); rvals != nil { - for _, rval := range rvals { - rval.Set(reflect.ValueOf(v)) - } - } -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/path_value_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/path_value_test.go deleted file mode 100644 index f7022968..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/path_value_test.go +++ /dev/null @@ -1,60 +0,0 @@ -package awsutil_test - -import ( - "testing" - - "github.com/awslabs/aws-sdk-go/aws/awsutil" - "github.com/stretchr/testify/assert" -) - -type Struct struct { - A []Struct - a []Struct - B *Struct - D *Struct - C string -} - -var data = Struct{ - A: []Struct{{C: "value1"}, {C: "value2"}, {C: "value3"}}, - a: []Struct{{C: "value1"}, {C: "value2"}, {C: "value3"}}, - B: &Struct{B: &Struct{C: "terminal"}, D: &Struct{C: "terminal2"}}, - C: "initial", -} - -func TestValueAtPathSuccess(t *testing.T) { - assert.Equal(t, []interface{}{"initial"}, awsutil.ValuesAtPath(data, "C")) - assert.Equal(t, []interface{}{"value1"}, awsutil.ValuesAtPath(data, "A[0].C")) - assert.Equal(t, []interface{}{"value2"}, awsutil.ValuesAtPath(data, "A[1].C")) - assert.Equal(t, []interface{}{"value3"}, awsutil.ValuesAtPath(data, "A[2].C")) - assert.Equal(t, []interface{}{"value3"}, awsutil.ValuesAtPath(data, "A[-1].C")) - assert.Equal(t, []interface{}{"value1", "value2", "value3"}, awsutil.ValuesAtPath(data, "A[].C")) - assert.Equal(t, []interface{}{"terminal"}, awsutil.ValuesAtPath(data, "B . B . C")) - assert.Equal(t, []interface{}{"terminal", "terminal2"}, awsutil.ValuesAtPath(data, "B.*.C")) - assert.Equal(t, []interface{}{"initial"}, awsutil.ValuesAtPath(data, "A.D.X || C")) -} - -func TestValueAtPathFailure(t *testing.T) { - assert.Equal(t, []interface{}(nil), awsutil.ValuesAtPath(data, "C.x")) - assert.Equal(t, []interface{}(nil), awsutil.ValuesAtPath(data, ".x")) - assert.Equal(t, []interface{}{}, awsutil.ValuesAtPath(data, "X.Y.Z")) - assert.Equal(t, []interface{}{}, awsutil.ValuesAtPath(data, "A[100].C")) - assert.Equal(t, []interface{}{}, awsutil.ValuesAtPath(data, "A[3].C")) - assert.Equal(t, []interface{}{}, awsutil.ValuesAtPath(data, "B.B.C.Z")) - assert.Equal(t, []interface{}(nil), awsutil.ValuesAtPath(data, "a[-1].C")) - assert.Equal(t, []interface{}{}, awsutil.ValuesAtPath(nil, "A.B.C")) -} - -func TestSetValueAtPathSuccess(t *testing.T) { - var s Struct - awsutil.SetValueAtPath(&s, "C", "test1") - awsutil.SetValueAtPath(&s, "B.B.C", "test2") - awsutil.SetValueAtPath(&s, "B.D.C", "test3") - assert.Equal(t, "test1", s.C) - assert.Equal(t, "test2", s.B.B.C) - assert.Equal(t, "test3", s.B.D.C) - - awsutil.SetValueAtPath(&s, "B.*.C", "test0") - assert.Equal(t, "test0", s.B.B.C) - assert.Equal(t, "test0", s.B.D.C) -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/string_value.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/string_value.go deleted file mode 100644 index d24b2a9c..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/awsutil/string_value.go +++ /dev/null @@ -1,97 +0,0 @@ -package awsutil - -import ( - "bytes" - "fmt" - "reflect" - "strings" -) - -func StringValue(i interface{}) string { - var buf bytes.Buffer - stringValue(reflect.ValueOf(i), 0, &buf) - return buf.String() -} - -func stringValue(v reflect.Value, indent int, buf *bytes.Buffer) { - for v.Kind() == reflect.Ptr { - v = v.Elem() - } - - switch v.Kind() { - case reflect.Struct: - strtype := v.Type().String() - if strtype == "time.Time" { - fmt.Fprintf(buf, "%s", v.Interface()) - break - } else if strings.HasPrefix(strtype, "io.") { - buf.WriteString("") - break - } - - buf.WriteString("{\n") - - names := []string{} - for i := 0; i < v.Type().NumField(); i++ { - name := v.Type().Field(i).Name - f := v.Field(i) - if name[0:1] == strings.ToLower(name[0:1]) { - continue // ignore unexported fields - } - if (f.Kind() == reflect.Ptr || f.Kind() == reflect.Slice) && f.IsNil() { - continue // ignore unset fields - } - names = append(names, name) - } - - for i, n := range names { - val := v.FieldByName(n) - buf.WriteString(strings.Repeat(" ", indent+2)) - buf.WriteString(n + ": ") - stringValue(val, indent+2, buf) - - if i < len(names)-1 { - buf.WriteString(",\n") - } - } - - buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") - case reflect.Slice: - nl, id, id2 := "", "", "" - if v.Len() > 3 { - nl, id, id2 = "\n", strings.Repeat(" ", indent), strings.Repeat(" ", indent+2) - } - buf.WriteString("[" + nl) - for i := 0; i < v.Len(); i++ { - buf.WriteString(id2) - stringValue(v.Index(i), indent+2, buf) - - if i < v.Len()-1 { - buf.WriteString("," + nl) - } - } - - buf.WriteString(nl + id + "]") - case reflect.Map: - buf.WriteString("{\n") - - for i, k := range v.MapKeys() { - buf.WriteString(strings.Repeat(" ", indent+2)) - buf.WriteString(k.String() + ": ") - stringValue(v.MapIndex(k), indent+2, buf) - - if i < v.Len()-1 { - buf.WriteString(",\n") - } - } - - buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") - default: - format := "%v" - switch v.Interface().(type) { - case string: - format = "%q" - } - fmt.Fprintf(buf, format, v.Interface()) - } -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/config.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/config.go deleted file mode 100644 index 89051d3f..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/config.go +++ /dev/null @@ -1,117 +0,0 @@ -package aws - -import ( - "io" - "net/http" - "os" -) - -const DEFAULT_RETRIES = -1 - -var DefaultConfig = &Config{ - Credentials: DefaultCreds(), - Endpoint: "", - Region: os.Getenv("AWS_REGION"), - DisableSSL: false, - ManualSend: false, - HTTPClient: http.DefaultClient, - LogLevel: 0, - Logger: os.Stdout, - MaxRetries: DEFAULT_RETRIES, - DisableParamValidation: false, - DisableComputeChecksums: false, - S3ForcePathStyle: false, -} - -type Config struct { - Credentials CredentialsProvider - Endpoint string - Region string - DisableSSL bool - ManualSend bool - HTTPClient *http.Client - LogLevel uint - Logger io.Writer - MaxRetries int - DisableParamValidation bool - DisableComputeChecksums bool - S3ForcePathStyle bool -} - -func (c Config) Merge(newcfg *Config) *Config { - cfg := Config{} - - if newcfg != nil && newcfg.Credentials != nil { - cfg.Credentials = newcfg.Credentials - } else { - cfg.Credentials = c.Credentials - } - - if newcfg != nil && newcfg.Endpoint != "" { - cfg.Endpoint = newcfg.Endpoint - } else { - cfg.Endpoint = c.Endpoint - } - - if newcfg != nil && newcfg.Region != "" { - cfg.Region = newcfg.Region - } else { - cfg.Region = c.Region - } - - if newcfg != nil && newcfg.DisableSSL { - cfg.DisableSSL = newcfg.DisableSSL - } else { - cfg.DisableSSL = c.DisableSSL - } - - if newcfg != nil && newcfg.ManualSend { - cfg.ManualSend = newcfg.ManualSend - } else { - cfg.ManualSend = c.ManualSend - } - - if newcfg != nil && newcfg.HTTPClient != nil { - cfg.HTTPClient = newcfg.HTTPClient - } else { - cfg.HTTPClient = c.HTTPClient - } - - if newcfg != nil && newcfg.LogLevel != 0 { - cfg.LogLevel = newcfg.LogLevel - } else { - cfg.LogLevel = c.LogLevel - } - - if newcfg != nil && newcfg.Logger != nil { - cfg.Logger = newcfg.Logger - } else { - cfg.Logger = c.Logger - } - - if newcfg != nil && newcfg.MaxRetries != DEFAULT_RETRIES { - cfg.MaxRetries = newcfg.MaxRetries - } else { - cfg.MaxRetries = c.MaxRetries - } - - if newcfg != nil && newcfg.DisableParamValidation { - cfg.DisableParamValidation = newcfg.DisableParamValidation - } else { - cfg.DisableParamValidation = c.DisableParamValidation - } - - if newcfg != nil && newcfg.DisableComputeChecksums { - cfg.DisableComputeChecksums = newcfg.DisableComputeChecksums - } else { - cfg.DisableComputeChecksums = c.DisableComputeChecksums - } - - if newcfg != nil && newcfg.S3ForcePathStyle { - cfg.S3ForcePathStyle = newcfg.S3ForcePathStyle - } else { - cfg.S3ForcePathStyle = c.S3ForcePathStyle - } - - return &cfg -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials.go deleted file mode 100644 index 09c98a4f..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials.go +++ /dev/null @@ -1,291 +0,0 @@ -package aws - -import ( - "bufio" - "encoding/json" - "errors" - "fmt" - "net/http" - "os" - "path/filepath" - "sync" - "time" - - "github.com/vaughan0/go-ini" -) - -var currentTime = time.Now - -// Credentials are used to authenticate and authorize calls that you make to -// AWS. -type Credentials struct { - AccessKeyID string - SecretAccessKey string - SessionToken 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") -) - -type DefaultCredentialsProvider struct { -} - -func (p *DefaultCredentialsProvider) Credentials() (*Credentials, error) { - env, err := EnvCreds() - if err == nil { - return env.Credentials() - } - - profile, err := ProfileCreds("", "", 10*time.Minute) - if err == nil { - profileCreds, err := profile.Credentials() - if err == nil { - return profileCreds, nil - } - } - - return IAMCreds().Credentials() -} - -func DefaultCreds() CredentialsProvider { - return &DefaultCredentialsProvider{} -} - -// 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, sessionToken string) CredentialsProvider { - if accessKeyID != "" && secretAccessKey != "" { - return Creds(accessKeyID, secretAccessKey, sessionToken) - } - - 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, sessionToken string) CredentialsProvider { - return staticCredentialsProvider{ - creds: Credentials{ - AccessKeyID: accessKeyID, - SecretAccessKey: secretAccessKey, - SessionToken: sessionToken, - }, - } -} - -// 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 == "" { - homeDir := os.Getenv("HOME") // *nix - if homeDir == "" { // Windows - homeDir = os.Getenv("USERPROFILE") - } - if homeDir == "" { - return nil, errors.New("User home directory not found.") - } - - filename = filepath.Join(homeDir, ".aws", "credentials") - } - - if profile == "" { - profile = os.Getenv("AWS_PROFILE") - } - 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) - } - - sessionToken := profile["aws_session_token"] - - p.creds = Credentials{ - AccessKeyID: accessKeyID, - SecretAccessKey: secretAccessKey, - SessionToken: sessionToken, - } - 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("%s listing IAM credentials", err) - } - 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, - SessionToken: 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 -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials_test.go deleted file mode 100644 index a5f57e06..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/credentials_test.go +++ /dev/null @@ -1,265 +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.SessionToken, "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.SessionToken, "token"; v != want { - t.Errorf("SessionToken was %v, but expected %v", v, want) - } -} - -func TestProfileCreds(t *testing.T) { - os.Clearenv() - 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.SessionToken, "token"; v != want { - t.Errorf("SessionToken was %v, but expected %v", v, want) - } -} - -func TestProfileCredsWithAWS_PROFILE(t *testing.T) { - os.Clearenv() - os.Setenv("AWS_PROFILE", "no_token") - 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.SessionToken, ""; v != want { - t.Errorf("SessionToken was %v, but expected %v", v, want) - } -} - -func TestProfileCredsWithoutToken(t *testing.T) { - os.Clearenv() - 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.SessionToken, ""; v != want { - t.Errorf("SessionToken was %v, but expected %v", v, want) - } -} - -func BenchmarkProfileCreds(b *testing.B) { - os.Clearenv() - 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) - } - } - }) -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/error.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/error.go deleted file mode 100644 index 08453049..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/error.go +++ /dev/null @@ -1,23 +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 - Code string - Message string - RequestID string -} - -func (e APIError) Error() string { - return e.Code + ": " + e.Message -} - -func Error(e error) *APIError { - if err, ok := e.(*APIError); ok { - return err - } else if err, ok := e.(APIError); ok { - return &err - } else { - return nil - } -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/example.ini b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/example.ini deleted file mode 100644 index aa2dc506..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/example.ini +++ /dev/null @@ -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 diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/handler_functions.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/handler_functions.go deleted file mode 100644 index 38e433e4..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/handler_functions.go +++ /dev/null @@ -1,85 +0,0 @@ -package aws - -import ( - "fmt" - "io" - "strconv" - "time" -) - -var sleepDelay = func(delay time.Duration) { - time.Sleep(delay) -} - -type lener interface { - Len() int -} - -func BuildContentLength(r *Request) { - if slength := r.HTTPRequest.Header.Get("Content-Length"); slength != "" { - length, _ := strconv.ParseInt(slength, 10, 64) - r.HTTPRequest.ContentLength = length - return - } - - var length int64 - switch body := r.Body.(type) { - case nil: - length = 0 - case lener: - length = int64(body.Len()) - case io.Seeker: - cur, _ := body.Seek(0, 1) - end, _ := body.Seek(0, 2) - body.Seek(cur, 0) // make sure to seek back to original location - length = end - cur - default: - panic("Cannot get length of body, must provide `ContentLength`") - } - - r.HTTPRequest.ContentLength = length - r.HTTPRequest.Header.Set("Content-Length", fmt.Sprintf("%d", length)) -} - -func UserAgentHandler(r *Request) { - r.HTTPRequest.Header.Set("User-Agent", SDKName+"/"+SDKVersion) -} - -func SendHandler(r *Request) { - r.HTTPResponse, r.Error = r.Service.Config.HTTPClient.Do(r.HTTPRequest) -} - -func ValidateResponseHandler(r *Request) { - if r.HTTPResponse.StatusCode == 0 || r.HTTPResponse.StatusCode >= 400 { - r.Error = &APIError{ - StatusCode: r.HTTPResponse.StatusCode, - Code: "UnknownError", - Message: "unknown error", - } - } - r.Retryable = r.Service.ShouldRetry(r) - r.RetryDelay = r.Service.RetryRules(r) -} - -func AfterRetryHandler(r *Request) { - if r.WillRetry() { - sleepDelay(r.RetryDelay) - - r.RetryCount++ - r.Retryable = false - r.Error = nil - } -} - -var ( - ErrMissingRegion = fmt.Errorf("could not find region configuration.") - ErrMissingEndpoint = fmt.Errorf("`Endpoint' configuration is required for this service.") -) - -func ValidateEndpointHandler(r *Request) { - if r.Service.SigningRegion == "" && r.Service.Config.Region == "" { - r.Error = ErrMissingRegion - } else if r.Service.Endpoint == "" { - r.Error = ErrMissingEndpoint - } -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/handler_functions_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/handler_functions_test.go deleted file mode 100644 index 34d982ea..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/handler_functions_test.go +++ /dev/null @@ -1,33 +0,0 @@ -package aws - -import ( - "os" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestValidateEndpointHandler(t *testing.T) { - os.Clearenv() - svc := NewService(&Config{Region: "us-west-2"}) - svc.Handlers.Clear() - svc.Handlers.Validate.PushBack(ValidateEndpointHandler) - - req := NewRequest(svc, &Operation{Name: "Operation"}, nil, nil) - err := req.Build() - - assert.NoError(t, err) -} - -func TestValidateEndpointHandlerErrorRegion(t *testing.T) { - os.Clearenv() - svc := NewService(nil) - svc.Handlers.Clear() - svc.Handlers.Validate.PushBack(ValidateEndpointHandler) - - req := NewRequest(svc, &Operation{Name: "Operation"}, nil, nil) - err := req.Build() - - assert.Error(t, err) - assert.Equal(t, ErrMissingRegion, err) -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/handlers.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/handlers.go deleted file mode 100644 index 9bdbb011..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/handlers.go +++ /dev/null @@ -1,82 +0,0 @@ -package aws - -type Handlers struct { - Validate HandlerList - Build HandlerList - Sign HandlerList - Send HandlerList - ValidateResponse HandlerList - Unmarshal HandlerList - UnmarshalMeta HandlerList - UnmarshalError HandlerList - Retry HandlerList - AfterRetry HandlerList -} - -func (h *Handlers) copy() Handlers { - return Handlers{ - Validate: h.Validate.copy(), - Build: h.Build.copy(), - Sign: h.Sign.copy(), - Send: h.Send.copy(), - ValidateResponse: h.ValidateResponse.copy(), - Unmarshal: h.Unmarshal.copy(), - UnmarshalError: h.UnmarshalError.copy(), - UnmarshalMeta: h.UnmarshalMeta.copy(), - Retry: h.Retry.copy(), - AfterRetry: h.AfterRetry.copy(), - } -} - -// Clear removes callback functions for all handlers -func (h *Handlers) Clear() { - h.Validate.Clear() - h.Build.Clear() - h.Send.Clear() - h.Sign.Clear() - h.Unmarshal.Clear() - h.UnmarshalMeta.Clear() - h.UnmarshalError.Clear() - h.ValidateResponse.Clear() - h.Retry.Clear() - h.AfterRetry.Clear() -} - -// A handler list manages zero or more handlers in a list. -type HandlerList struct { - list []func(*Request) -} - -// copy creates a copy of the handler list. -func (l *HandlerList) copy() HandlerList { - var n HandlerList - n.list = append([]func(*Request){}, l.list...) - return n -} - -// Clear clears the handler list. -func (l *HandlerList) Clear() { - l.list = []func(*Request){} -} - -// Len returns the number of handlers in the list. -func (l *HandlerList) Len() int { - return len(l.list) -} - -// PushBack pushes handlers f to the back of the handler list. -func (l *HandlerList) PushBack(f ...func(*Request)) { - l.list = append(l.list, f...) -} - -// PushFront pushes handlers f to the front of the handler list. -func (l *HandlerList) PushFront(f ...func(*Request)) { - l.list = append(f, l.list...) -} - -// Run executes all handlers in the list with a given request object. -func (l *HandlerList) Run(r *Request) { - for _, f := range l.list { - f(r) - } -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/handlers_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/handlers_test.go deleted file mode 100644 index 26776f6d..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/handlers_test.go +++ /dev/null @@ -1,31 +0,0 @@ -package aws - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestHandlerList(t *testing.T) { - s := "" - r := &Request{} - l := HandlerList{} - l.PushBack(func(r *Request) { - s += "a" - r.Data = s - }) - l.Run(r) - assert.Equal(t, "a", s) - assert.Equal(t, "a", r.Data) -} - -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.Run(r) - if r.Data != nil { - t.Error("Expected handler to execute") - } -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/param_validator.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/param_validator.go deleted file mode 100644 index e1cb5cea..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/param_validator.go +++ /dev/null @@ -1,80 +0,0 @@ -package aws - -import ( - "fmt" - "reflect" - "strings" -) - -func ValidateParameters(r *Request) { - if r.ParamsFilled() { - v := validator{errors: []string{}} - v.validateAny(reflect.ValueOf(r.Params), "") - - if count := len(v.errors); count > 0 { - format := "%d validation errors:\n- %s" - msg := fmt.Sprintf(format, count, strings.Join(v.errors, "\n- ")) - r.Error = APIError{Code: "InvalidParameter", Message: msg} - } - } -} - -type validator struct { - errors []string -} - -func (v *validator) validateAny(value reflect.Value, path string) { - value = reflect.Indirect(value) - if !value.IsValid() { - return - } - - switch value.Kind() { - case reflect.Struct: - v.validateStruct(value, path) - case reflect.Slice: - for i := 0; i < value.Len(); i++ { - v.validateAny(value.Index(i), path+fmt.Sprintf("[%d]", i)) - } - case reflect.Map: - for _, n := range value.MapKeys() { - v.validateAny(value.MapIndex(n), path+fmt.Sprintf("[%q]", n.String())) - } - } -} - -func (v *validator) validateStruct(value reflect.Value, path string) { - prefix := "." - if path == "" { - prefix = "" - } - - for i := 0; i < value.Type().NumField(); i++ { - f := value.Type().Field(i) - if strings.ToLower(f.Name[0:1]) == f.Name[0:1] { - continue - } - fvalue := value.FieldByName(f.Name) - - notset := false - if f.Tag.Get("required") != "" { - switch fvalue.Kind() { - case reflect.Ptr, reflect.Slice: - if fvalue.IsNil() { - notset = true - } - default: - if !fvalue.IsValid() { - notset = true - } - } - } - - if notset { - msg := "missing required parameter: " + path + prefix + f.Name - v.errors = append(v.errors, msg) - } else { - v.validateAny(fvalue, path+prefix+f.Name) - } - } -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/param_validator_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/param_validator_test.go deleted file mode 100644 index 952f2b28..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/param_validator_test.go +++ /dev/null @@ -1,85 +0,0 @@ -package aws_test - -import ( - "testing" - - "github.com/awslabs/aws-sdk-go/aws" - "github.com/stretchr/testify/assert" -) - -var service = func() *aws.Service { - s := &aws.Service{ - Config: &aws.Config{}, - ServiceName: "mock-service", - APIVersion: "2015-01-01", - } - return s -}() - -type StructShape struct { - RequiredList []*ConditionalStructShape `required:"true"` - RequiredMap *map[string]*ConditionalStructShape `required:"true"` - RequiredBool *bool `required:"true"` - OptionalStruct *ConditionalStructShape - - hiddenParameter *string - - metadataStructureShape -} - -type metadataStructureShape struct { - SDKShapeTraits bool -} - -type ConditionalStructShape struct { - Name *string `required:"true"` - SDKShapeTraits bool -} - -func TestNoErrors(t *testing.T) { - input := &StructShape{ - RequiredList: []*ConditionalStructShape{}, - RequiredMap: &map[string]*ConditionalStructShape{ - "key1": {Name: aws.String("Name")}, - "key2": {Name: aws.String("Name")}, - }, - RequiredBool: aws.Boolean(true), - OptionalStruct: &ConditionalStructShape{Name: aws.String("Name")}, - } - - req := aws.NewRequest(service, &aws.Operation{}, input, nil) - aws.ValidateParameters(req) - assert.NoError(t, req.Error) -} - -func TestMissingRequiredParameters(t *testing.T) { - input := &StructShape{} - req := aws.NewRequest(service, &aws.Operation{}, input, nil) - aws.ValidateParameters(req) - err := aws.Error(req.Error) - - assert.Error(t, err) - assert.Equal(t, "InvalidParameter", err.Code) - assert.Equal(t, "3 validation errors:\n- missing required parameter: RequiredList\n- missing required parameter: RequiredMap\n- missing required parameter: RequiredBool", err.Message) -} - -func TestNestedMissingRequiredParameters(t *testing.T) { - input := &StructShape{ - RequiredList: []*ConditionalStructShape{{}}, - RequiredMap: &map[string]*ConditionalStructShape{ - "key1": {Name: aws.String("Name")}, - "key2": {}, - }, - RequiredBool: aws.Boolean(true), - OptionalStruct: &ConditionalStructShape{}, - } - - req := aws.NewRequest(service, &aws.Operation{}, input, nil) - aws.ValidateParameters(req) - err := aws.Error(req.Error) - - assert.Error(t, err) - assert.Equal(t, "InvalidParameter", err.Code) - assert.Equal(t, "3 validation errors:\n- missing required parameter: RequiredList[0].Name\n- missing required parameter: RequiredMap[\"key2\"].Name\n- missing required parameter: OptionalStruct.Name", err.Message) - -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/request.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/request.go deleted file mode 100644 index b227c0f0..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/request.go +++ /dev/null @@ -1,160 +0,0 @@ -package aws - -import ( - "bytes" - "io" - "io/ioutil" - "net/http" - "net/url" - "reflect" - "time" -) - -type Request struct { - *Service - Handlers Handlers - Time time.Time - ExpireTime time.Duration - Operation *Operation - HTTPRequest *http.Request - HTTPResponse *http.Response - Body io.ReadSeeker - Params interface{} - Error error - Data interface{} - RequestID string - RetryCount uint - Retryable bool - RetryDelay time.Duration - - built bool -} - -type Operation struct { - Name string - HTTPMethod string - HTTPPath string -} - -func NewRequest(service *Service, operation *Operation, params interface{}, data interface{}) *Request { - method := operation.HTTPMethod - if method == "" { - method = "POST" - } - p := operation.HTTPPath - if p == "" { - p = "/" - } - - httpReq, _ := http.NewRequest(method, "", nil) - httpReq.URL, _ = url.Parse(service.Endpoint + p) - - r := &Request{ - Service: service, - Handlers: service.Handlers.copy(), - Time: time.Now(), - ExpireTime: 0, - Operation: operation, - HTTPRequest: httpReq, - Body: nil, - Params: params, - Error: nil, - Data: data, - } - r.SetBufferBody([]byte{}) - - return r -} - -func (r *Request) WillRetry() bool { - return r.Error != nil && r.Retryable && r.RetryCount < r.Service.MaxRetries() -} - -func (r *Request) ParamsFilled() bool { - return r.Params != nil && reflect.ValueOf(r.Params).Elem().IsValid() -} - -func (r *Request) DataFilled() bool { - return r.Data != nil && reflect.ValueOf(r.Data).Elem().IsValid() -} - -func (r *Request) SetBufferBody(buf []byte) { - r.SetReaderBody(bytes.NewReader(buf)) -} - -func (r *Request) SetReaderBody(reader io.ReadSeeker) { - r.HTTPRequest.Body = ioutil.NopCloser(reader) - r.Body = reader -} - -func (r *Request) Presign(expireTime time.Duration) (string, error) { - r.ExpireTime = expireTime - r.Sign() - if r.Error != nil { - return "", r.Error - } else { - return r.HTTPRequest.URL.String(), nil - } -} - -func (r *Request) Build() error { - if !r.built { - r.Error = nil - r.Handlers.Validate.Run(r) - if r.Error != nil { - return r.Error - } - r.Handlers.Build.Run(r) - r.built = true - } - - return r.Error -} - -func (r *Request) Sign() error { - r.Build() - if r.Error != nil { - return r.Error - } - - r.Handlers.Sign.Run(r) - return r.Error -} - -func (r *Request) Send() error { - r.Sign() - if r.Error != nil { - return r.Error - } - - for { - r.Handlers.Send.Run(r) - if r.Error != nil { - return r.Error - } - - r.Handlers.UnmarshalMeta.Run(r) - r.Handlers.ValidateResponse.Run(r) - if r.Error != nil { - r.Handlers.Retry.Run(r) - r.Handlers.AfterRetry.Run(r) - if r.Error != nil { - r.Handlers.UnmarshalError.Run(r) - return r.Error - } - continue - } - - r.Handlers.Unmarshal.Run(r) - if r.Error != nil { - r.Handlers.Retry.Run(r) - r.Handlers.AfterRetry.Run(r) - if r.Error != nil { - return r.Error - } - continue - } - - return nil - } -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/request_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/request_test.go deleted file mode 100644 index 11055036..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/request_test.go +++ /dev/null @@ -1,120 +0,0 @@ -package aws - -import ( - "bytes" - "encoding/json" - "io" - "io/ioutil" - "net/http" - "reflect" - "testing" - "time" - - "github.com/stretchr/testify/assert" -) - -type testData struct { - Data string -} - -func body(str string) io.ReadCloser { - return ioutil.NopCloser(bytes.NewReader([]byte(str))) -} - -func unmarshal(req *Request) { - defer req.HTTPResponse.Body.Close() - if req.Data != nil { - json.NewDecoder(req.HTTPResponse.Body).Decode(req.Data) - } - return -} - -func unmarshalError(req *Request) { - bodyBytes, err := ioutil.ReadAll(req.HTTPResponse.Body) - if err != nil { - req.Error = err - return - } - if len(bodyBytes) == 0 { - req.Error = APIError{ - StatusCode: req.HTTPResponse.StatusCode, - Message: req.HTTPResponse.Status, - } - return - } - var jsonErr jsonErrorResponse - if err := json.Unmarshal(bodyBytes, &jsonErr); err != nil { - req.Error = err - return - } - req.Error = APIError{ - StatusCode: req.HTTPResponse.StatusCode, - Code: jsonErr.Code, - Message: jsonErr.Message, - } -} - -type jsonErrorResponse struct { - Code string `json:"__type"` - Message string `json:"message"` -} - -func TestRequestRecoverRetry(t *testing.T) { - reqNum := 0 - reqs := []http.Response{ - {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)}, - {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)}, - {StatusCode: 200, Body: body(`{"data":"valid"}`)}, - } - - s := NewService(&Config{MaxRetries: 10}) - s.Handlers.Validate.Clear() - s.Handlers.Unmarshal.PushBack(unmarshal) - s.Handlers.UnmarshalError.PushBack(unmarshalError) - s.Handlers.Send.Clear() // mock sending - s.Handlers.Send.PushBack(func(r *Request) { - r.HTTPResponse = &reqs[reqNum] - reqNum++ - }) - out := &testData{} - r := NewRequest(s, &Operation{Name: "Operation"}, nil, out) - err := r.Send() - assert.Nil(t, err) - assert.Equal(t, 2, int(r.RetryCount)) - assert.Equal(t, "valid", out.Data) -} - -func TestRequestExhaustRetries(t *testing.T) { - delays := []time.Duration{} - sleepDelay = func(delay time.Duration) { - delays = append(delays, delay) - } - - reqNum := 0 - reqs := []http.Response{ - {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)}, - {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)}, - {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)}, - {StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)}, - } - - s := NewService(&Config{MaxRetries: -1}) - s.Handlers.Validate.Clear() - s.Handlers.Unmarshal.PushBack(unmarshal) - s.Handlers.UnmarshalError.PushBack(unmarshalError) - s.Handlers.Send.Clear() // mock sending - s.Handlers.Send.PushBack(func(r *Request) { - r.HTTPResponse = &reqs[reqNum] - reqNum++ - }) - r := NewRequest(s, &Operation{Name: "Operation"}, nil, nil) - err := r.Send() - apiErr := Error(err) - assert.NotNil(t, err) - assert.NotNil(t, apiErr) - assert.Equal(t, 500, apiErr.StatusCode) - assert.Equal(t, "UnknownError", apiErr.Code) - assert.Equal(t, "An error occurred.", apiErr.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)) -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/service.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/service.go deleted file mode 100644 index 0411eb53..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/service.go +++ /dev/null @@ -1,143 +0,0 @@ -package aws - -import ( - "fmt" - "math" - "net/http" - "net/http/httputil" - "regexp" - "time" - - "github.com/awslabs/aws-sdk-go/internal/endpoints" -) - -type Service struct { - Config *Config - Handlers Handlers - ManualSend bool - ServiceName string - APIVersion string - Endpoint string - SigningRegion string - JSONVersion string - TargetPrefix string - RetryRules func(*Request) time.Duration - ShouldRetry func(*Request) bool - DefaultMaxRetries uint -} - -var schemeRE = regexp.MustCompile("^([^:]+)://") - -func NewService(config *Config) *Service { - svc := &Service{Config: config} - svc.Initialize() - return svc -} - -func (s *Service) Initialize() { - if s.Config == nil { - s.Config = &Config{} - } - if s.Config.HTTPClient == nil { - s.Config.HTTPClient = http.DefaultClient - } - - if s.RetryRules == nil { - s.RetryRules = retryRules - } - - if s.ShouldRetry == nil { - s.ShouldRetry = shouldRetry - } - - s.DefaultMaxRetries = 3 - s.Handlers.Validate.PushBack(ValidateEndpointHandler) - s.Handlers.Build.PushBack(UserAgentHandler) - s.Handlers.Sign.PushBack(BuildContentLength) - s.Handlers.Send.PushBack(SendHandler) - s.Handlers.AfterRetry.PushBack(AfterRetryHandler) - s.Handlers.ValidateResponse.PushBack(ValidateResponseHandler) - s.AddDebugHandlers() - s.buildEndpoint() - - if !s.Config.DisableParamValidation { - s.Handlers.Validate.PushBack(ValidateParameters) - } -} - -func (s *Service) buildEndpoint() { - if s.Config.Endpoint != "" { - s.Endpoint = s.Config.Endpoint - } else { - s.Endpoint, s.SigningRegion = - endpoints.EndpointForRegion(s.ServiceName, s.Config.Region) - } - - if s.Endpoint != "" && !schemeRE.MatchString(s.Endpoint) { - scheme := "https" - if s.Config.DisableSSL { - scheme = "http" - } - s.Endpoint = scheme + "://" + s.Endpoint - } -} - -func (s *Service) AddDebugHandlers() { - out := s.Config.Logger - if s.Config.LogLevel == 0 { - return - } - - s.Handlers.Sign.PushBack(func(r *Request) { - dumpedBody, _ := httputil.DumpRequest(r.HTTPRequest, true) - - fmt.Fprintf(out, "=> [%s] %s.%s(%+v)\n", r.Time, - r.Service.ServiceName, r.Operation.Name, r.Params) - fmt.Fprintf(out, "---[ REQUEST PRE-SIGN ]------------------------------\n") - fmt.Fprintf(out, "%s\n", string(dumpedBody)) - fmt.Fprintf(out, "-----------------------------------------------------\n") - }) - s.Handlers.Send.PushFront(func(r *Request) { - dumpedBody, _ := httputil.DumpRequestOut(r.HTTPRequest, true) - - 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 { - dumpedBody, _ := httputil.DumpResponse(r.HTTPResponse, true) - fmt.Fprintf(out, "%s\n", string(dumpedBody)) - } else if r.Error != nil { - fmt.Fprintf(out, "%s\n", r.Error) - } - fmt.Fprintf(out, "-----------------------------------------------------\n") - }) -} - -func (s *Service) MaxRetries() uint { - if s.Config.MaxRetries < 0 { - return s.DefaultMaxRetries - } else { - return uint(s.Config.MaxRetries) - } -} - -func retryRules(r *Request) time.Duration { - delay := time.Duration(math.Pow(2, float64(r.RetryCount))) * 30 - return delay * time.Millisecond -} - -func shouldRetry(r *Request) bool { - if r.HTTPResponse.StatusCode >= 500 { - return true - } else if err := Error(r.Error); err != nil { - switch err.Code { - case "ExpiredTokenException": - case "ProvisionedThroughputExceededException", "Throttling": - return true - } - } - return false -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/types.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/types.go deleted file mode 100644 index 5da09114..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/types.go +++ /dev/null @@ -1,63 +0,0 @@ -package aws - -import ( - "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 -} - -func ReadSeekCloser(r io.Reader) ReaderSeekerCloser { - return ReaderSeekerCloser{r} -} - -type ReaderSeekerCloser struct { - r io.Reader -} - -func (r ReaderSeekerCloser) Read(p []byte) (int, error) { - switch t := r.r.(type) { - case io.Reader: - return t.Read(p) - } - return 0, nil -} - -func (r ReaderSeekerCloser) Seek(offset int64, whence int) (int64, error) { - switch t := r.r.(type) { - case io.Seeker: - return t.Seek(offset, whence) - } - return int64(0), nil -} - -func (r ReaderSeekerCloser) Close() error { - switch t := r.r.(type) { - case io.Closer: - return t.Close() - } - return nil -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/version.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/version.go deleted file mode 100644 index f673d470..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/aws/version.go +++ /dev/null @@ -1,5 +0,0 @@ -// Package aws provides core functionality for making requests to AWS services. -package aws - -const SDKName = "aws-sdk-go" -const SDKVersion = "0.5.0" diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/endpoints/endpoints.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/endpoints/endpoints.go deleted file mode 100644 index 59051011..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/endpoints/endpoints.go +++ /dev/null @@ -1,27 +0,0 @@ -package endpoints - -//go:generate go run ../model/cli/gen-endpoints/main.go endpoints.json endpoints_map.go - -import "strings" - -func EndpointForRegion(svcName, region string) (endpoint, signingRegion string) { - derivedKeys := []string{ - region + "/" + svcName, - region + "/*", - "*/" + svcName, - "*/*", - } - - for _, key := range derivedKeys { - if val, ok := endpointsMap.Endpoints[key]; ok { - ep := val.Endpoint - ep = strings.Replace(ep, "{region}", region, -1) - ep = strings.Replace(ep, "{service}", svcName, -1) - - endpoint = ep - signingRegion = val.SigningRegion - return - } - } - return -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/endpoints/endpoints.json b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/endpoints/endpoints.json deleted file mode 100644 index 4c588090..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/endpoints/endpoints.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "version": 2, - "endpoints": { - "*/*": { - "endpoint": "{service}.{region}.amazonaws.com" - }, - "cn-north-1/*": { - "endpoint": "{service}.{region}.amazonaws.com.cn", - "signatureVersion": "v4" - }, - "us-gov-west-1/iam": { - "endpoint": "iam.us-gov.amazonaws.com" - }, - "us-gov-west-1/sts": { - "endpoint": "sts.us-gov-west-1.amazonaws.com" - }, - "us-gov-west-1/s3": { - "endpoint": "s3-{region}.amazonaws.com" - }, - "*/cloudfront": { - "endpoint": "cloudfront.amazonaws.com", - "signingRegion": "us-east-1" - }, - "*/cloudsearchdomain": { - "endpoint": "", - "signingRegion": "us-east-1" - }, - "*/iam": { - "endpoint": "iam.amazonaws.com", - "signingRegion": "us-east-1" - }, - "*/importexport": { - "endpoint": "importexport.amazonaws.com", - "signingRegion": "us-east-1" - }, - "*/route53": { - "endpoint": "route53.amazonaws.com", - "signingRegion": "us-east-1" - }, - "*/sts": { - "endpoint": "sts.amazonaws.com", - "signingRegion": "us-east-1" - }, - "us-east-1/sdb": { - "endpoint": "sdb.amazonaws.com", - "signingRegion": "us-east-1" - }, - "us-east-1/s3": { - "endpoint": "s3.amazonaws.com" - }, - "us-west-1/s3": { - "endpoint": "s3-{region}.amazonaws.com" - }, - "us-west-2/s3": { - "endpoint": "s3-{region}.amazonaws.com" - }, - "eu-west-1/s3": { - "endpoint": "s3-{region}.amazonaws.com" - }, - "ap-southeast-1/s3": { - "endpoint": "s3-{region}.amazonaws.com" - }, - "ap-southeast-2/s3": { - "endpoint": "s3-{region}.amazonaws.com" - }, - "ap-northeast-1/s3": { - "endpoint": "s3-{region}.amazonaws.com" - }, - "sa-east-1/s3": { - "endpoint": "s3-{region}.amazonaws.com" - }, - "eu-central-1/s3": { - "endpoint": "{service}.{region}.amazonaws.com", - "signatureVersion": "v4" - } - } -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/endpoints/endpoints_map.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/endpoints/endpoints_map.go deleted file mode 100644 index 894c1a64..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/endpoints/endpoints_map.go +++ /dev/null @@ -1,89 +0,0 @@ -package endpoints - -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -type endpointStruct struct { - Version int - Endpoints map[string]endpointEntry -} - -type endpointEntry struct { - Endpoint string - SigningRegion string -} - -var endpointsMap = endpointStruct{ - Version: 2, - Endpoints: map[string]endpointEntry{ - "*/*": { - Endpoint: "{service}.{region}.amazonaws.com", - }, - "*/cloudfront": { - Endpoint: "cloudfront.amazonaws.com", - SigningRegion: "us-east-1", - }, - "*/cloudsearchdomain": { - Endpoint: "", - SigningRegion: "us-east-1", - }, - "*/iam": { - Endpoint: "iam.amazonaws.com", - SigningRegion: "us-east-1", - }, - "*/importexport": { - Endpoint: "importexport.amazonaws.com", - SigningRegion: "us-east-1", - }, - "*/route53": { - Endpoint: "route53.amazonaws.com", - SigningRegion: "us-east-1", - }, - "*/sts": { - Endpoint: "sts.amazonaws.com", - SigningRegion: "us-east-1", - }, - "ap-northeast-1/s3": { - Endpoint: "s3-{region}.amazonaws.com", - }, - "ap-southeast-1/s3": { - Endpoint: "s3-{region}.amazonaws.com", - }, - "ap-southeast-2/s3": { - Endpoint: "s3-{region}.amazonaws.com", - }, - "cn-north-1/*": { - Endpoint: "{service}.{region}.amazonaws.com.cn", - }, - "eu-central-1/s3": { - Endpoint: "{service}.{region}.amazonaws.com", - }, - "eu-west-1/s3": { - Endpoint: "s3-{region}.amazonaws.com", - }, - "sa-east-1/s3": { - Endpoint: "s3-{region}.amazonaws.com", - }, - "us-east-1/s3": { - Endpoint: "s3.amazonaws.com", - }, - "us-east-1/sdb": { - Endpoint: "sdb.amazonaws.com", - SigningRegion: "us-east-1", - }, - "us-gov-west-1/iam": { - Endpoint: "iam.us-gov.amazonaws.com", - }, - "us-gov-west-1/s3": { - Endpoint: "s3-{region}.amazonaws.com", - }, - "us-gov-west-1/sts": { - Endpoint: "sts.us-gov-west-1.amazonaws.com", - }, - "us-west-1/s3": { - Endpoint: "s3-{region}.amazonaws.com", - }, - "us-west-2/s3": { - Endpoint: "s3-{region}.amazonaws.com", - }, - }, -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/endpoints/endpoints_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/endpoints/endpoints_test.go deleted file mode 100644 index 8af65879..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/endpoints/endpoints_test.go +++ /dev/null @@ -1,28 +0,0 @@ -package endpoints - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestGlobalEndpoints(t *testing.T) { - region := "mock-region-1" - svcs := []string{"cloudfront", "iam", "importexport", "route53", "sts"} - - for _, name := range svcs { - ep, sr := EndpointForRegion(name, region) - assert.Equal(t, name+".amazonaws.com", ep) - assert.Equal(t, "us-east-1", sr) - } -} - -func TestServicesInCN(t *testing.T) { - region := "cn-north-1" - svcs := []string{"cloudfront", "iam", "importexport", "route53", "sts", "s3"} - - for _, name := range svcs { - ep, _ := EndpointForRegion(name, region) - assert.Equal(t, name+"."+region+".amazonaws.com.cn", ep) - } -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/query/build.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/query/build.go deleted file mode 100644 index 74b72165..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/query/build.go +++ /dev/null @@ -1,30 +0,0 @@ -package query - -//go:generate go run ../../fixtures/protocol/generate.go ../../fixtures/protocol/input/query.json build_test.go - -import ( - "net/url" - - "github.com/awslabs/aws-sdk-go/aws" - "github.com/awslabs/aws-sdk-go/internal/protocol/query/queryutil" -) - -func Build(r *aws.Request) { - body := url.Values{ - "Action": {r.Operation.Name}, - "Version": {r.Service.APIVersion}, - } - if err := queryutil.Parse(body, r.Params, false); err != nil { - r.Error = err - return - } - - 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() - } -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/query/build_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/query/build_test.go deleted file mode 100644 index 48bae0a0..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/query/build_test.go +++ /dev/null @@ -1,1595 +0,0 @@ -package query_test - -import ( - "github.com/awslabs/aws-sdk-go/aws" - "github.com/awslabs/aws-sdk-go/internal/protocol/query" - "github.com/awslabs/aws-sdk-go/internal/signer/v4" - - "bytes" - "encoding/json" - "encoding/xml" - "github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil" - "github.com/awslabs/aws-sdk-go/internal/util" - "github.com/stretchr/testify/assert" - "io" - "io/ioutil" - "net/http" - "net/url" - "testing" - "time" -) - -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 - -// InputService1ProtocolTest is a client for InputService1ProtocolTest. -type InputService1ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService1ProtocolTest client. -func NewInputService1ProtocolTest(config *aws.Config) *InputService1ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - 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(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.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 -} - -// InputService1TestCaseOperation1Request generates a request for the InputService1TestCaseOperation1 operation. -func (c *InputService1ProtocolTest) InputService1TestCaseOperation1Request(input *InputService1TestShapeInputShape) (req *aws.Request, output *InputService1TestShapeInputService1TestCaseOperation1Output) { - - if opInputService1TestCaseOperation1 == nil { - opInputService1TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &InputService1TestShapeInputShape{} - } - - req = c.newRequest(opInputService1TestCaseOperation1, input, output) - output = &InputService1TestShapeInputService1TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService1ProtocolTest) InputService1TestCaseOperation1(input *InputService1TestShapeInputShape) (output *InputService1TestShapeInputService1TestCaseOperation1Output, err error) { - req, out := c.InputService1TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService1TestCaseOperation1 *aws.Operation - -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"` -} - -// InputService2ProtocolTest is a client for InputService2ProtocolTest. -type InputService2ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService2ProtocolTest client. -func NewInputService2ProtocolTest(config *aws.Config) *InputService2ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - 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(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.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 -} - -// InputService2TestCaseOperation1Request generates a request for the InputService2TestCaseOperation1 operation. -func (c *InputService2ProtocolTest) InputService2TestCaseOperation1Request(input *InputService2TestShapeInputShape) (req *aws.Request, output *InputService2TestShapeInputService2TestCaseOperation1Output) { - - if opInputService2TestCaseOperation1 == nil { - opInputService2TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &InputService2TestShapeInputShape{} - } - - req = c.newRequest(opInputService2TestCaseOperation1, input, output) - output = &InputService2TestShapeInputService2TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService2ProtocolTest) InputService2TestCaseOperation1(input *InputService2TestShapeInputShape) (output *InputService2TestShapeInputService2TestCaseOperation1Output, err error) { - req, out := c.InputService2TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService2TestCaseOperation1 *aws.Operation - -type InputService2TestShapeInputService2TestCaseOperation1Output struct { - metadataInputService2TestShapeInputService2TestCaseOperation1Output `json:"-", xml:"-"` -} - -type metadataInputService2TestShapeInputService2TestCaseOperation1Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService2TestShapeInputShape struct { - StructArg *InputService2TestShapeStructType `type:"structure"` - - metadataInputService2TestShapeInputShape `json:"-", xml:"-"` -} - -type metadataInputService2TestShapeInputShape struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService2TestShapeStructType struct { - ScalarArg *string `type:"string"` - - metadataInputService2TestShapeStructType `json:"-", xml:"-"` -} - -type metadataInputService2TestShapeStructType struct { - SDKShapeTraits bool `type:"structure"` -} - -// InputService3ProtocolTest is a client for InputService3ProtocolTest. -type InputService3ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService3ProtocolTest client. -func NewInputService3ProtocolTest(config *aws.Config) *InputService3ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - 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(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.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 -} - -// InputService3TestCaseOperation1Request generates a request for the InputService3TestCaseOperation1 operation. -func (c *InputService3ProtocolTest) InputService3TestCaseOperation1Request(input *InputService3TestShapeInputShape) (req *aws.Request, output *InputService3TestShapeInputService3TestCaseOperation1Output) { - - if opInputService3TestCaseOperation1 == nil { - opInputService3TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &InputService3TestShapeInputShape{} - } - - req = c.newRequest(opInputService3TestCaseOperation1, input, output) - output = &InputService3TestShapeInputService3TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService3ProtocolTest) InputService3TestCaseOperation1(input *InputService3TestShapeInputShape) (output *InputService3TestShapeInputService3TestCaseOperation1Output, err error) { - req, out := c.InputService3TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService3TestCaseOperation1 *aws.Operation - -// InputService3TestCaseOperation2Request generates a request for the InputService3TestCaseOperation2 operation. -func (c *InputService3ProtocolTest) InputService3TestCaseOperation2Request(input *InputService3TestShapeInputShape) (req *aws.Request, output *InputService3TestShapeInputService3TestCaseOperation2Output) { - - if opInputService3TestCaseOperation2 == nil { - opInputService3TestCaseOperation2 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &InputService3TestShapeInputShape{} - } - - req = c.newRequest(opInputService3TestCaseOperation2, input, output) - output = &InputService3TestShapeInputService3TestCaseOperation2Output{} - req.Data = output - return -} - -func (c *InputService3ProtocolTest) InputService3TestCaseOperation2(input *InputService3TestShapeInputShape) (output *InputService3TestShapeInputService3TestCaseOperation2Output, err error) { - req, out := c.InputService3TestCaseOperation2Request(input) - output = out - err = req.Send() - return -} - -var opInputService3TestCaseOperation2 *aws.Operation - -type InputService3TestShapeInputService3TestCaseOperation1Output struct { - metadataInputService3TestShapeInputService3TestCaseOperation1Output `json:"-", xml:"-"` -} - -type metadataInputService3TestShapeInputService3TestCaseOperation1Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService3TestShapeInputService3TestCaseOperation2Output struct { - metadataInputService3TestShapeInputService3TestCaseOperation2Output `json:"-", xml:"-"` -} - -type metadataInputService3TestShapeInputService3TestCaseOperation2Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService3TestShapeInputShape struct { - ListArg []*string `type:"list"` - - metadataInputService3TestShapeInputShape `json:"-", xml:"-"` -} - -type metadataInputService3TestShapeInputShape struct { - SDKShapeTraits bool `type:"structure"` -} - -// InputService4ProtocolTest is a client for InputService4ProtocolTest. -type InputService4ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService4ProtocolTest client. -func NewInputService4ProtocolTest(config *aws.Config) *InputService4ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - 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(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.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 -} - -// InputService4TestCaseOperation1Request generates a request for the InputService4TestCaseOperation1 operation. -func (c *InputService4ProtocolTest) InputService4TestCaseOperation1Request(input *InputService4TestShapeInputShape) (req *aws.Request, output *InputService4TestShapeInputService4TestCaseOperation1Output) { - - if opInputService4TestCaseOperation1 == nil { - opInputService4TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &InputService4TestShapeInputShape{} - } - - req = c.newRequest(opInputService4TestCaseOperation1, input, output) - output = &InputService4TestShapeInputService4TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService4ProtocolTest) InputService4TestCaseOperation1(input *InputService4TestShapeInputShape) (output *InputService4TestShapeInputService4TestCaseOperation1Output, err error) { - req, out := c.InputService4TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService4TestCaseOperation1 *aws.Operation - -// InputService4TestCaseOperation2Request generates a request for the InputService4TestCaseOperation2 operation. -func (c *InputService4ProtocolTest) InputService4TestCaseOperation2Request(input *InputService4TestShapeInputShape) (req *aws.Request, output *InputService4TestShapeInputService4TestCaseOperation2Output) { - - if opInputService4TestCaseOperation2 == nil { - opInputService4TestCaseOperation2 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &InputService4TestShapeInputShape{} - } - - req = c.newRequest(opInputService4TestCaseOperation2, input, output) - output = &InputService4TestShapeInputService4TestCaseOperation2Output{} - req.Data = output - return -} - -func (c *InputService4ProtocolTest) InputService4TestCaseOperation2(input *InputService4TestShapeInputShape) (output *InputService4TestShapeInputService4TestCaseOperation2Output, err error) { - req, out := c.InputService4TestCaseOperation2Request(input) - output = out - err = req.Send() - return -} - -var opInputService4TestCaseOperation2 *aws.Operation - -type InputService4TestShapeInputService4TestCaseOperation1Output struct { - metadataInputService4TestShapeInputService4TestCaseOperation1Output `json:"-", xml:"-"` -} - -type metadataInputService4TestShapeInputService4TestCaseOperation1Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService4TestShapeInputService4TestCaseOperation2Output struct { - metadataInputService4TestShapeInputService4TestCaseOperation2Output `json:"-", xml:"-"` -} - -type metadataInputService4TestShapeInputService4TestCaseOperation2Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService4TestShapeInputShape struct { - ListArg []*string `type:"list" flattened:"true"` - - ScalarArg *string `type:"string"` - - metadataInputService4TestShapeInputShape `json:"-", xml:"-"` -} - -type metadataInputService4TestShapeInputShape struct { - SDKShapeTraits bool `type:"structure"` -} - -// InputService5ProtocolTest is a client for InputService5ProtocolTest. -type InputService5ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService5ProtocolTest client. -func NewInputService5ProtocolTest(config *aws.Config) *InputService5ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - 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(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.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 -} - -// InputService5TestCaseOperation1Request generates a request for the InputService5TestCaseOperation1 operation. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation1Request(input *InputService5TestShapeInputShape) (req *aws.Request, output *InputService5TestShapeInputService5TestCaseOperation1Output) { - - if opInputService5TestCaseOperation1 == nil { - opInputService5TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &InputService5TestShapeInputShape{} - } - - req = c.newRequest(opInputService5TestCaseOperation1, input, output) - output = &InputService5TestShapeInputService5TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService5ProtocolTest) InputService5TestCaseOperation1(input *InputService5TestShapeInputShape) (output *InputService5TestShapeInputService5TestCaseOperation1Output, err error) { - req, out := c.InputService5TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService5TestCaseOperation1 *aws.Operation - -// InputService5TestCaseOperation2Request generates a request for the InputService5TestCaseOperation2 operation. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation2Request(input *InputService5TestShapeInputShape) (req *aws.Request, output *InputService5TestShapeInputService5TestCaseOperation2Output) { - - if opInputService5TestCaseOperation2 == nil { - opInputService5TestCaseOperation2 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &InputService5TestShapeInputShape{} - } - - req = c.newRequest(opInputService5TestCaseOperation2, input, output) - output = &InputService5TestShapeInputService5TestCaseOperation2Output{} - req.Data = output - return -} - -func (c *InputService5ProtocolTest) InputService5TestCaseOperation2(input *InputService5TestShapeInputShape) (output *InputService5TestShapeInputService5TestCaseOperation2Output, err error) { - req, out := c.InputService5TestCaseOperation2Request(input) - output = out - err = req.Send() - return -} - -var opInputService5TestCaseOperation2 *aws.Operation - -type InputService5TestShapeInputService5TestCaseOperation1Output struct { - metadataInputService5TestShapeInputService5TestCaseOperation1Output `json:"-", xml:"-"` -} - -type metadataInputService5TestShapeInputService5TestCaseOperation1Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService5TestShapeInputService5TestCaseOperation2Output struct { - metadataInputService5TestShapeInputService5TestCaseOperation2Output `json:"-", xml:"-"` -} - -type metadataInputService5TestShapeInputService5TestCaseOperation2Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService5TestShapeInputShape struct { - MapArg *map[string]*string `type:"map"` - - metadataInputService5TestShapeInputShape `json:"-", xml:"-"` -} - -type metadataInputService5TestShapeInputShape struct { - SDKShapeTraits bool `type:"structure"` -} - -// InputService6ProtocolTest is a client for InputService6ProtocolTest. -type InputService6ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService6ProtocolTest client. -func NewInputService6ProtocolTest(config *aws.Config) *InputService6ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - 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(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.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 -} - -// InputService6TestCaseOperation1Request generates a request for the InputService6TestCaseOperation1 operation. -func (c *InputService6ProtocolTest) InputService6TestCaseOperation1Request(input *InputService6TestShapeInputShape) (req *aws.Request, output *InputService6TestShapeInputService6TestCaseOperation1Output) { - - if opInputService6TestCaseOperation1 == nil { - opInputService6TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &InputService6TestShapeInputShape{} - } - - req = c.newRequest(opInputService6TestCaseOperation1, input, output) - output = &InputService6TestShapeInputService6TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService6ProtocolTest) InputService6TestCaseOperation1(input *InputService6TestShapeInputShape) (output *InputService6TestShapeInputService6TestCaseOperation1Output, err error) { - req, out := c.InputService6TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService6TestCaseOperation1 *aws.Operation - -type InputService6TestShapeInputService6TestCaseOperation1Output struct { - metadataInputService6TestShapeInputService6TestCaseOperation1Output `json:"-", xml:"-"` -} - -type metadataInputService6TestShapeInputService6TestCaseOperation1Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService6TestShapeInputShape struct { - MapArg *map[string]*string `locationNameKey:"TheKey" locationNameValue:"TheValue" type:"map"` - - metadataInputService6TestShapeInputShape `json:"-", xml:"-"` -} - -type metadataInputService6TestShapeInputShape struct { - SDKShapeTraits bool `type:"structure"` -} - -// InputService7ProtocolTest is a client for InputService7ProtocolTest. -type InputService7ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService7ProtocolTest client. -func NewInputService7ProtocolTest(config *aws.Config) *InputService7ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - 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(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.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 -} - -// InputService7TestCaseOperation1Request generates a request for the InputService7TestCaseOperation1 operation. -func (c *InputService7ProtocolTest) InputService7TestCaseOperation1Request(input *InputService7TestShapeInputShape) (req *aws.Request, output *InputService7TestShapeInputService7TestCaseOperation1Output) { - - if opInputService7TestCaseOperation1 == nil { - opInputService7TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &InputService7TestShapeInputShape{} - } - - req = c.newRequest(opInputService7TestCaseOperation1, input, output) - output = &InputService7TestShapeInputService7TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService7ProtocolTest) InputService7TestCaseOperation1(input *InputService7TestShapeInputShape) (output *InputService7TestShapeInputService7TestCaseOperation1Output, err error) { - req, out := c.InputService7TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService7TestCaseOperation1 *aws.Operation - -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"` -} - -// InputService8ProtocolTest is a client for InputService8ProtocolTest. -type InputService8ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService8ProtocolTest client. -func NewInputService8ProtocolTest(config *aws.Config) *InputService8ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - 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(query.Build) - service.Handlers.Unmarshal.PushBack(query.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(query.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(query.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 -} - -// InputService8TestCaseOperation1Request generates a request for the InputService8TestCaseOperation1 operation. -func (c *InputService8ProtocolTest) InputService8TestCaseOperation1Request(input *InputService8TestShapeInputShape) (req *aws.Request, output *InputService8TestShapeInputService8TestCaseOperation1Output) { - - if opInputService8TestCaseOperation1 == nil { - opInputService8TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &InputService8TestShapeInputShape{} - } - - req = c.newRequest(opInputService8TestCaseOperation1, input, output) - output = &InputService8TestShapeInputService8TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService8ProtocolTest) InputService8TestCaseOperation1(input *InputService8TestShapeInputShape) (output *InputService8TestShapeInputService8TestCaseOperation1Output, err error) { - req, out := c.InputService8TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService8TestCaseOperation1 *aws.Operation - -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"` -} - -// InputService9ProtocolTest is a client for InputService9ProtocolTest. -type InputService9ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService9ProtocolTest client. -func NewInputService9ProtocolTest(config *aws.Config) *InputService9ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "inputservice9protocoltest", - APIVersion: "2014-01-01", - } - 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) - - return &InputService9ProtocolTest{service} -} - -// newRequest creates a new request for a InputService9ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService9ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { - req := aws.NewRequest(c.Service, op, params, data) - - return req -} - -// InputService9TestCaseOperation1Request generates a request for the InputService9TestCaseOperation1 operation. -func (c *InputService9ProtocolTest) InputService9TestCaseOperation1Request(input *InputService9TestShapeInputShape) (req *aws.Request, output *InputService9TestShapeInputService9TestCaseOperation1Output) { - - if opInputService9TestCaseOperation1 == nil { - opInputService9TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &InputService9TestShapeInputShape{} - } - - req = c.newRequest(opInputService9TestCaseOperation1, input, output) - output = &InputService9TestShapeInputService9TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService9ProtocolTest) InputService9TestCaseOperation1(input *InputService9TestShapeInputShape) (output *InputService9TestShapeInputService9TestCaseOperation1Output, err error) { - req, out := c.InputService9TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService9TestCaseOperation1 *aws.Operation - -// InputService9TestCaseOperation2Request generates a request for the InputService9TestCaseOperation2 operation. -func (c *InputService9ProtocolTest) InputService9TestCaseOperation2Request(input *InputService9TestShapeInputShape) (req *aws.Request, output *InputService9TestShapeInputService9TestCaseOperation2Output) { - - if opInputService9TestCaseOperation2 == nil { - opInputService9TestCaseOperation2 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &InputService9TestShapeInputShape{} - } - - req = c.newRequest(opInputService9TestCaseOperation2, input, output) - output = &InputService9TestShapeInputService9TestCaseOperation2Output{} - req.Data = output - return -} - -func (c *InputService9ProtocolTest) InputService9TestCaseOperation2(input *InputService9TestShapeInputShape) (output *InputService9TestShapeInputService9TestCaseOperation2Output, err error) { - req, out := c.InputService9TestCaseOperation2Request(input) - output = out - err = req.Send() - return -} - -var opInputService9TestCaseOperation2 *aws.Operation - -// InputService9TestCaseOperation3Request generates a request for the InputService9TestCaseOperation3 operation. -func (c *InputService9ProtocolTest) InputService9TestCaseOperation3Request(input *InputService9TestShapeInputShape) (req *aws.Request, output *InputService9TestShapeInputService9TestCaseOperation3Output) { - - if opInputService9TestCaseOperation3 == nil { - opInputService9TestCaseOperation3 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &InputService9TestShapeInputShape{} - } - - req = c.newRequest(opInputService9TestCaseOperation3, input, output) - output = &InputService9TestShapeInputService9TestCaseOperation3Output{} - req.Data = output - return -} - -func (c *InputService9ProtocolTest) InputService9TestCaseOperation3(input *InputService9TestShapeInputShape) (output *InputService9TestShapeInputService9TestCaseOperation3Output, err error) { - req, out := c.InputService9TestCaseOperation3Request(input) - output = out - err = req.Send() - return -} - -var opInputService9TestCaseOperation3 *aws.Operation - -// InputService9TestCaseOperation4Request generates a request for the InputService9TestCaseOperation4 operation. -func (c *InputService9ProtocolTest) InputService9TestCaseOperation4Request(input *InputService9TestShapeInputShape) (req *aws.Request, output *InputService9TestShapeInputService9TestCaseOperation4Output) { - - if opInputService9TestCaseOperation4 == nil { - opInputService9TestCaseOperation4 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &InputService9TestShapeInputShape{} - } - - req = c.newRequest(opInputService9TestCaseOperation4, input, output) - output = &InputService9TestShapeInputService9TestCaseOperation4Output{} - req.Data = output - return -} - -func (c *InputService9ProtocolTest) InputService9TestCaseOperation4(input *InputService9TestShapeInputShape) (output *InputService9TestShapeInputService9TestCaseOperation4Output, err error) { - req, out := c.InputService9TestCaseOperation4Request(input) - output = out - err = req.Send() - return -} - -var opInputService9TestCaseOperation4 *aws.Operation - -// InputService9TestCaseOperation5Request generates a request for the InputService9TestCaseOperation5 operation. -func (c *InputService9ProtocolTest) InputService9TestCaseOperation5Request(input *InputService9TestShapeInputShape) (req *aws.Request, output *InputService9TestShapeInputService9TestCaseOperation5Output) { - - if opInputService9TestCaseOperation5 == nil { - opInputService9TestCaseOperation5 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &InputService9TestShapeInputShape{} - } - - req = c.newRequest(opInputService9TestCaseOperation5, input, output) - output = &InputService9TestShapeInputService9TestCaseOperation5Output{} - req.Data = output - return -} - -func (c *InputService9ProtocolTest) InputService9TestCaseOperation5(input *InputService9TestShapeInputShape) (output *InputService9TestShapeInputService9TestCaseOperation5Output, err error) { - req, out := c.InputService9TestCaseOperation5Request(input) - output = out - err = req.Send() - return -} - -var opInputService9TestCaseOperation5 *aws.Operation - -// InputService9TestCaseOperation6Request generates a request for the InputService9TestCaseOperation6 operation. -func (c *InputService9ProtocolTest) InputService9TestCaseOperation6Request(input *InputService9TestShapeInputShape) (req *aws.Request, output *InputService9TestShapeInputService9TestCaseOperation6Output) { - - if opInputService9TestCaseOperation6 == nil { - opInputService9TestCaseOperation6 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &InputService9TestShapeInputShape{} - } - - req = c.newRequest(opInputService9TestCaseOperation6, input, output) - output = &InputService9TestShapeInputService9TestCaseOperation6Output{} - req.Data = output - return -} - -func (c *InputService9ProtocolTest) InputService9TestCaseOperation6(input *InputService9TestShapeInputShape) (output *InputService9TestShapeInputService9TestCaseOperation6Output, err error) { - req, out := c.InputService9TestCaseOperation6Request(input) - output = out - err = req.Send() - return -} - -var opInputService9TestCaseOperation6 *aws.Operation - -type InputService9TestShapeInputService9TestCaseOperation1Output struct { - metadataInputService9TestShapeInputService9TestCaseOperation1Output `json:"-", xml:"-"` -} - -type metadataInputService9TestShapeInputService9TestCaseOperation1Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService9TestShapeInputService9TestCaseOperation2Output struct { - metadataInputService9TestShapeInputService9TestCaseOperation2Output `json:"-", xml:"-"` -} - -type metadataInputService9TestShapeInputService9TestCaseOperation2Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService9TestShapeInputService9TestCaseOperation3Output struct { - metadataInputService9TestShapeInputService9TestCaseOperation3Output `json:"-", xml:"-"` -} - -type metadataInputService9TestShapeInputService9TestCaseOperation3Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService9TestShapeInputService9TestCaseOperation4Output struct { - metadataInputService9TestShapeInputService9TestCaseOperation4Output `json:"-", xml:"-"` -} - -type metadataInputService9TestShapeInputService9TestCaseOperation4Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService9TestShapeInputService9TestCaseOperation5Output struct { - metadataInputService9TestShapeInputService9TestCaseOperation5Output `json:"-", xml:"-"` -} - -type metadataInputService9TestShapeInputService9TestCaseOperation5Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService9TestShapeInputService9TestCaseOperation6Output struct { - metadataInputService9TestShapeInputService9TestCaseOperation6Output `json:"-", xml:"-"` -} - -type metadataInputService9TestShapeInputService9TestCaseOperation6Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService9TestShapeInputService9TestShapeRecursiveStructType struct { - NoRecurse *string `type:"string"` - - RecursiveList []*InputService9TestShapeInputService9TestShapeRecursiveStructType `type:"list"` - - RecursiveMap *map[string]*InputService9TestShapeInputService9TestShapeRecursiveStructType `type:"map"` - - RecursiveStruct *InputService9TestShapeInputService9TestShapeRecursiveStructType `type:"structure"` - - metadataInputService9TestShapeInputService9TestShapeRecursiveStructType `json:"-", xml:"-"` -} - -type metadataInputService9TestShapeInputService9TestShapeRecursiveStructType struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService9TestShapeInputShape struct { - RecursiveStruct *InputService9TestShapeInputService9TestShapeRecursiveStructType `type:"structure"` - - metadataInputService9TestShapeInputShape `json:"-", xml:"-"` -} - -type metadataInputService9TestShapeInputShape 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 - query.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 TestInputService2ProtocolTestNestedStructureMembersCase1(t *testing.T) { - svc := NewInputService2ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService2TestShapeInputShape{ - StructArg: &InputService2TestShapeStructType{ - ScalarArg: aws.String("foo"), - }, - } - req, _ := svc.InputService2TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.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&StructArg.ScalarArg=foo&Version=2014-01-01`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService3ProtocolTestListTypesCase1(t *testing.T) { - svc := NewInputService3ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService3TestShapeInputShape{ - ListArg: []*string{ - aws.String("foo"), - aws.String("bar"), - aws.String("baz"), - }, - } - req, _ := svc.InputService3TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.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.member.1=foo&ListArg.member.2=bar&ListArg.member.3=baz&Version=2014-01-01`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService3ProtocolTestListTypesCase2(t *testing.T) { - svc := NewInputService3ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService3TestShapeInputShape{ - ListArg: []*string{}, - } - req, _ := svc.InputService3TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - query.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=&Version=2014-01-01`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService4ProtocolTestFlattenedListCase1(t *testing.T) { - svc := NewInputService4ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService4TestShapeInputShape{ - ListArg: []*string{ - aws.String("a"), - aws.String("b"), - aws.String("c"), - }, - ScalarArg: aws.String("foo"), - } - req, _ := svc.InputService4TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.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=a&ListArg.2=b&ListArg.3=c&ScalarArg=foo&Version=2014-01-01`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService4ProtocolTestFlattenedListCase2(t *testing.T) { - svc := NewInputService4ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService4TestShapeInputShape{ - ListArg: []*string{}, - ScalarArg: aws.String("foo"), - } - req, _ := svc.InputService4TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - query.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=&ScalarArg=foo&Version=2014-01-01`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService5ProtocolTestSerializeMapTypeCase1(t *testing.T) { - svc := NewInputService5ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService5TestShapeInputShape{ - MapArg: &map[string]*string{ - "key1": aws.String("val1"), - "key2": aws.String("val2"), - }, - } - req, _ := svc.InputService5TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.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&MapArg.entry.1.key=key1&MapArg.entry.1.value=val1&MapArg.entry.2.key=key2&MapArg.entry.2.value=val2&Version=2014-01-01`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService5ProtocolTestSerializeMapTypeCase2(t *testing.T) { - svc := NewInputService5ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService5TestShapeInputShape{ - MapArg: &map[string]*string{}, - } - req, _ := svc.InputService5TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - query.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&MapArg=&Version=2014-01-01`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService6ProtocolTestSerializeMapTypeWithLocationNameCase1(t *testing.T) { - svc := NewInputService6ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService6TestShapeInputShape{ - MapArg: &map[string]*string{ - "key1": aws.String("val1"), - "key2": aws.String("val2"), - }, - } - req, _ := svc.InputService6TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.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&MapArg.entry.1.TheKey=key1&MapArg.entry.1.TheValue=val1&MapArg.entry.2.TheKey=key2&MapArg.entry.2.TheValue=val2&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 - query.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 - query.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 - -} - -func TestInputService9ProtocolTestRecursiveShapesCase1(t *testing.T) { - svc := NewInputService9ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService9TestShapeInputShape{ - RecursiveStruct: &InputService9TestShapeInputService9TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - } - req, _ := svc.InputService9TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - query.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&RecursiveStruct.NoRecurse=foo&Version=2014-01-01`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService9ProtocolTestRecursiveShapesCase2(t *testing.T) { - svc := NewInputService9ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService9TestShapeInputShape{ - RecursiveStruct: &InputService9TestShapeInputService9TestShapeRecursiveStructType{ - RecursiveStruct: &InputService9TestShapeInputService9TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - }, - } - req, _ := svc.InputService9TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - query.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&RecursiveStruct.RecursiveStruct.NoRecurse=foo&Version=2014-01-01`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService9ProtocolTestRecursiveShapesCase3(t *testing.T) { - svc := NewInputService9ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService9TestShapeInputShape{ - RecursiveStruct: &InputService9TestShapeInputService9TestShapeRecursiveStructType{ - RecursiveStruct: &InputService9TestShapeInputService9TestShapeRecursiveStructType{ - RecursiveStruct: &InputService9TestShapeInputService9TestShapeRecursiveStructType{ - RecursiveStruct: &InputService9TestShapeInputService9TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - }, - }, - }, - } - req, _ := svc.InputService9TestCaseOperation3Request(input) - r := req.HTTPRequest - - // build request - query.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&RecursiveStruct.RecursiveStruct.RecursiveStruct.RecursiveStruct.NoRecurse=foo&Version=2014-01-01`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService9ProtocolTestRecursiveShapesCase4(t *testing.T) { - svc := NewInputService9ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService9TestShapeInputShape{ - RecursiveStruct: &InputService9TestShapeInputService9TestShapeRecursiveStructType{ - RecursiveList: []*InputService9TestShapeInputService9TestShapeRecursiveStructType{ - { - NoRecurse: aws.String("foo"), - }, - { - NoRecurse: aws.String("bar"), - }, - }, - }, - } - req, _ := svc.InputService9TestCaseOperation4Request(input) - r := req.HTTPRequest - - // build request - query.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&RecursiveStruct.RecursiveList.member.1.NoRecurse=foo&RecursiveStruct.RecursiveList.member.2.NoRecurse=bar&Version=2014-01-01`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService9ProtocolTestRecursiveShapesCase5(t *testing.T) { - svc := NewInputService9ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService9TestShapeInputShape{ - RecursiveStruct: &InputService9TestShapeInputService9TestShapeRecursiveStructType{ - RecursiveList: []*InputService9TestShapeInputService9TestShapeRecursiveStructType{ - { - NoRecurse: aws.String("foo"), - }, - { - RecursiveStruct: &InputService9TestShapeInputService9TestShapeRecursiveStructType{ - NoRecurse: aws.String("bar"), - }, - }, - }, - }, - } - req, _ := svc.InputService9TestCaseOperation5Request(input) - r := req.HTTPRequest - - // build request - query.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&RecursiveStruct.RecursiveList.member.1.NoRecurse=foo&RecursiveStruct.RecursiveList.member.2.RecursiveStruct.NoRecurse=bar&Version=2014-01-01`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService9ProtocolTestRecursiveShapesCase6(t *testing.T) { - svc := NewInputService9ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService9TestShapeInputShape{ - RecursiveStruct: &InputService9TestShapeInputService9TestShapeRecursiveStructType{ - RecursiveMap: &map[string]*InputService9TestShapeInputService9TestShapeRecursiveStructType{ - "bar": { - NoRecurse: aws.String("bar"), - }, - "foo": { - NoRecurse: aws.String("foo"), - }, - }, - }, - } - req, _ := svc.InputService9TestCaseOperation6Request(input) - r := req.HTTPRequest - - // build request - query.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&RecursiveStruct.RecursiveMap.entry.1.key=bar&RecursiveStruct.RecursiveMap.entry.1.value.NoRecurse=bar&RecursiveStruct.RecursiveMap.entry.2.key=foo&RecursiveStruct.RecursiveMap.entry.2.value.NoRecurse=foo&Version=2014-01-01`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/", r.URL.String()) - - // assert headers - -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/query/queryutil/queryutil.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/query/queryutil/queryutil.go deleted file mode 100644 index 60a13195..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/query/queryutil/queryutil.go +++ /dev/null @@ -1,221 +0,0 @@ -package queryutil - -import ( - "encoding/base64" - "fmt" - "net/url" - "reflect" - "sort" - "strconv" - "strings" - "time" -) - -func Parse(body url.Values, i interface{}, isEC2 bool) error { - q := queryParser{isEC2: isEC2} - return q.parseValue(body, reflect.ValueOf(i), "", "") -} - -func elemOf(value reflect.Value) reflect.Value { - for value.Kind() == reflect.Ptr { - value = value.Elem() - } - return value -} - -type queryParser struct { - isEC2 bool -} - -func (q *queryParser) parseValue(v url.Values, value reflect.Value, prefix string, tag reflect.StructTag) error { - value = elemOf(value) - - // no need to handle zero values - if !value.IsValid() { - return nil - } - - t := tag.Get("type") - if t == "" { - switch value.Kind() { - case reflect.Struct: - t = "structure" - case reflect.Slice: - t = "list" - case reflect.Map: - t = "map" - } - } - - switch t { - case "structure": - return q.parseStruct(v, value, prefix) - case "list": - return q.parseList(v, value, prefix, tag) - case "map": - return q.parseMap(v, value, prefix, tag) - default: - return q.parseScalar(v, value, prefix, tag) - } -} - -func (q *queryParser) parseStruct(v url.Values, value reflect.Value, prefix string) error { - if !value.IsValid() { - return nil - } - - t := value.Type() - for i := 0; i < value.NumField(); i++ { - if c := t.Field(i).Name[0:1]; strings.ToLower(c) == c { - continue // ignore unexported fields - } - - value := elemOf(value.Field(i)) - field := t.Field(i) - var name string - - if q.isEC2 { - name = field.Tag.Get("queryName") - } - if name == "" { - if field.Tag.Get("flattened") != "" && field.Tag.Get("locationNameList") != "" { - name = field.Tag.Get("locationNameList") - } else if locName := field.Tag.Get("locationName"); locName != "" { - name = locName - } - if name != "" && q.isEC2 { - name = strings.ToUpper(name[0:1]) + name[1:] - } - } - if name == "" { - name = field.Name - } - - if prefix != "" { - name = prefix + "." + name - } - - if err := q.parseValue(v, value, name, field.Tag); err != nil { - return err - } - } - return nil -} - -func (q *queryParser) parseList(v url.Values, value reflect.Value, prefix string, tag reflect.StructTag) error { - // If it's empty, generate an empty value - if !value.IsNil() && value.Len() == 0 { - v.Set(prefix, "") - return nil - } - - // check for unflattened list member - if !q.isEC2 && tag.Get("flattened") == "" { - prefix += ".member" - } - - 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 := q.parseValue(v, value.Index(i), slicePrefix, ""); err != nil { - return err - } - } - return nil -} - -func (q *queryParser) parseMap(v url.Values, value reflect.Value, prefix string, tag reflect.StructTag) error { - // If it's empty, generate an empty value - if !value.IsNil() && value.Len() == 0 { - v.Set(prefix, "") - return nil - } - - // check for unflattened list member - if !q.isEC2 && tag.Get("flattened") == "" { - prefix += ".entry" - } - - // sort keys for improved serialization consistency. - // this is not strictly necessary for protocol support. - mapKeyValues := value.MapKeys() - mapKeys := map[string]reflect.Value{} - mapKeyNames := make([]string, len(mapKeyValues)) - for i, mapKey := range mapKeyValues { - name := mapKey.String() - mapKeys[name] = mapKey - mapKeyNames[i] = name - } - sort.Strings(mapKeyNames) - - for i, mapKeyName := range mapKeyNames { - mapKey := mapKeys[mapKeyName] - mapValue := value.MapIndex(mapKey) - - kname := tag.Get("locationNameKey") - if kname == "" { - kname = "key" - } - vname := tag.Get("locationNameValue") - if vname == "" { - vname = "value" - } - - // serialize key - var keyName string - if prefix == "" { - keyName = strconv.Itoa(i+1) + "." + kname - } else { - keyName = prefix + "." + strconv.Itoa(i+1) + "." + kname - } - - if err := q.parseValue(v, mapKey, keyName, ""); err != nil { - return err - } - - // serialize value - var valueName string - if prefix == "" { - valueName = strconv.Itoa(i+1) + "." + vname - } else { - valueName = prefix + "." + strconv.Itoa(i+1) + "." + vname - } - - if err := q.parseValue(v, mapValue, valueName, ""); err != nil { - return err - } - } - - return nil -} - -func (q *queryParser) parseScalar(v url.Values, r reflect.Value, name string, tag reflect.StructTag) error { - switch value := r.Interface().(type) { - case string: - v.Set(name, value) - case []byte: - if !r.IsNil() { - v.Set(name, base64.StdEncoding.EncodeToString(value)) - } - case bool: - v.Set(name, strconv.FormatBool(value)) - case int64: - v.Set(name, strconv.FormatInt(value, 10)) - case int: - v.Set(name, strconv.Itoa(value)) - case float64: - v.Set(name, strconv.FormatFloat(value, 'f', -1, 64)) - case float32: - v.Set(name, strconv.FormatFloat(float64(value), 'f', -1, 32)) - case time.Time: - const ISO8601UTC = "2006-01-02T15:04:05Z" - v.Set(name, value.UTC().Format(ISO8601UTC)) - default: - return fmt.Errorf("unsupported value for param %s: %v (%s)", name, r.Interface(), r.Type().Name()) - } - return nil -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/query/unmarshal.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/query/unmarshal.go deleted file mode 100644 index 92a740dc..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/query/unmarshal.go +++ /dev/null @@ -1,26 +0,0 @@ -package query - -//go:generate go run ../../fixtures/protocol/generate.go ../../fixtures/protocol/output/query.json unmarshal_test.go - -import ( - "encoding/xml" - - "github.com/awslabs/aws-sdk-go/aws" - "github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil" -) - -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, r.Operation.Name+"Result") - if err != nil { - r.Error = err - return - } - } -} - -func UnmarshalMeta(r *aws.Request) { - // TODO implement unmarshaling of request IDs -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/query/unmarshal_error.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/query/unmarshal_error.go deleted file mode 100644 index cf82eef9..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/query/unmarshal_error.go +++ /dev/null @@ -1,31 +0,0 @@ -package query - -import ( - "encoding/xml" - "io" - - "github.com/awslabs/aws-sdk-go/aws" -) - -type xmlErrorResponse struct { - XMLName xml.Name `xml:"ErrorResponse"` - Code string `xml:"Error>Code"` - Message string `xml:"Error>Message"` - RequestID string `xml:"RequestId"` -} - -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 = err - } else { - r.Error = aws.APIError{ - StatusCode: r.HTTPResponse.StatusCode, - Code: resp.Code, - Message: resp.Message, - } - } -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/query/unmarshal_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/query/unmarshal_test.go deleted file mode 100644 index 3fb843f5..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/query/unmarshal_test.go +++ /dev/null @@ -1,1544 +0,0 @@ -package query_test - -import ( - "github.com/awslabs/aws-sdk-go/aws" - "github.com/awslabs/aws-sdk-go/internal/protocol/query" - "github.com/awslabs/aws-sdk-go/internal/signer/v4" - - "bytes" - "encoding/json" - "encoding/xml" - "github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil" - "github.com/awslabs/aws-sdk-go/internal/util" - "github.com/stretchr/testify/assert" - "io" - "io/ioutil" - "net/http" - "net/url" - "testing" - "time" -) - -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 - -// OutputService1ProtocolTest is a client for OutputService1ProtocolTest. -type OutputService1ProtocolTest struct { - *aws.Service -} - -// New returns a new OutputService1ProtocolTest client. -func NewOutputService1ProtocolTest(config *aws.Config) *OutputService1ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "outputservice1protocoltest", - APIVersion: "", - } - 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) - - 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 -} - -// OutputService1TestCaseOperation1Request generates a request for the OutputService1TestCaseOperation1 operation. -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1Request(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (req *aws.Request, output *OutputService1TestShapeOutputShape) { - - if opOutputService1TestCaseOperation1 == nil { - opOutputService1TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &OutputService1TestShapeOutputService1TestCaseOperation1Input{} - } - - req = c.newRequest(opOutputService1TestCaseOperation1, input, output) - output = &OutputService1TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (output *OutputService1TestShapeOutputShape, err error) { - req, out := c.OutputService1TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opOutputService1TestCaseOperation1 *aws.Operation - -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"` - - Timestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"` - - TrueBool *bool `type:"boolean"` - - metadataOutputService1TestShapeOutputShape `json:"-", xml:"-"` -} - -type metadataOutputService1TestShapeOutputShape struct { - SDKShapeTraits bool `type:"structure"` -} - -// OutputService2ProtocolTest is a client for OutputService2ProtocolTest. -type OutputService2ProtocolTest struct { - *aws.Service -} - -// New returns a new OutputService2ProtocolTest client. -func NewOutputService2ProtocolTest(config *aws.Config) *OutputService2ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "outputservice2protocoltest", - APIVersion: "", - } - 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) - - 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 -} - -// OutputService2TestCaseOperation1Request generates a request for the OutputService2TestCaseOperation1 operation. -func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1Request(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (req *aws.Request, output *OutputService2TestShapeOutputShape) { - - if opOutputService2TestCaseOperation1 == nil { - opOutputService2TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &OutputService2TestShapeOutputService2TestCaseOperation1Input{} - } - - req = c.newRequest(opOutputService2TestCaseOperation1, input, output) - output = &OutputService2TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (output *OutputService2TestShapeOutputShape, err error) { - req, out := c.OutputService2TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opOutputService2TestCaseOperation1 *aws.Operation - -type OutputService2TestShapeOutputService2TestCaseOperation1Input struct { - metadataOutputService2TestShapeOutputService2TestCaseOperation1Input `json:"-", xml:"-"` -} - -type metadataOutputService2TestShapeOutputService2TestCaseOperation1Input struct { - SDKShapeTraits bool `type:"structure"` -} - -type OutputService2TestShapeOutputShape struct { - Num *int64 `type:"integer"` - - Str *string `type:"string"` - - metadataOutputService2TestShapeOutputShape `json:"-", xml:"-"` -} - -type metadataOutputService2TestShapeOutputShape struct { - SDKShapeTraits bool `type:"structure"` -} - -// OutputService3ProtocolTest is a client for OutputService3ProtocolTest. -type OutputService3ProtocolTest struct { - *aws.Service -} - -// New returns a new OutputService3ProtocolTest client. -func NewOutputService3ProtocolTest(config *aws.Config) *OutputService3ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "outputservice3protocoltest", - APIVersion: "", - } - 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) - - 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 -} - -// OutputService3TestCaseOperation1Request generates a request for the OutputService3TestCaseOperation1 operation. -func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1Request(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (req *aws.Request, output *OutputService3TestShapeOutputShape) { - - if opOutputService3TestCaseOperation1 == nil { - opOutputService3TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &OutputService3TestShapeOutputService3TestCaseOperation1Input{} - } - - req = c.newRequest(opOutputService3TestCaseOperation1, input, output) - output = &OutputService3TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (output *OutputService3TestShapeOutputShape, err error) { - req, out := c.OutputService3TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opOutputService3TestCaseOperation1 *aws.Operation - -type OutputService3TestShapeOutputService3TestCaseOperation1Input struct { - metadataOutputService3TestShapeOutputService3TestCaseOperation1Input `json:"-", xml:"-"` -} - -type metadataOutputService3TestShapeOutputService3TestCaseOperation1Input struct { - SDKShapeTraits bool `type:"structure"` -} - -type OutputService3TestShapeOutputShape struct { - Blob []byte `type:"blob"` - - metadataOutputService3TestShapeOutputShape `json:"-", xml:"-"` -} - -type metadataOutputService3TestShapeOutputShape struct { - SDKShapeTraits bool `type:"structure"` -} - -// OutputService4ProtocolTest is a client for OutputService4ProtocolTest. -type OutputService4ProtocolTest struct { - *aws.Service -} - -// New returns a new OutputService4ProtocolTest client. -func NewOutputService4ProtocolTest(config *aws.Config) *OutputService4ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "outputservice4protocoltest", - APIVersion: "", - } - 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) - - 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 -} - -// OutputService4TestCaseOperation1Request generates a request for the OutputService4TestCaseOperation1 operation. -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1Request(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (req *aws.Request, output *OutputService4TestShapeOutputShape) { - - if opOutputService4TestCaseOperation1 == nil { - opOutputService4TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &OutputService4TestShapeOutputService4TestCaseOperation1Input{} - } - - req = c.newRequest(opOutputService4TestCaseOperation1, input, output) - output = &OutputService4TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (output *OutputService4TestShapeOutputShape, err error) { - req, out := c.OutputService4TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opOutputService4TestCaseOperation1 *aws.Operation - -type OutputService4TestShapeOutputService4TestCaseOperation1Input struct { - metadataOutputService4TestShapeOutputService4TestCaseOperation1Input `json:"-", xml:"-"` -} - -type metadataOutputService4TestShapeOutputService4TestCaseOperation1Input struct { - SDKShapeTraits bool `type:"structure"` -} - -type OutputService4TestShapeOutputShape struct { - ListMember []*string `type:"list"` - - metadataOutputService4TestShapeOutputShape `json:"-", xml:"-"` -} - -type metadataOutputService4TestShapeOutputShape struct { - SDKShapeTraits bool `type:"structure"` -} - -// OutputService5ProtocolTest is a client for OutputService5ProtocolTest. -type OutputService5ProtocolTest struct { - *aws.Service -} - -// New returns a new OutputService5ProtocolTest client. -func NewOutputService5ProtocolTest(config *aws.Config) *OutputService5ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "outputservice5protocoltest", - APIVersion: "", - } - 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) - - 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 -} - -// OutputService5TestCaseOperation1Request generates a request for the OutputService5TestCaseOperation1 operation. -func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1Request(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (req *aws.Request, output *OutputService5TestShapeOutputShape) { - - if opOutputService5TestCaseOperation1 == nil { - opOutputService5TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &OutputService5TestShapeOutputService5TestCaseOperation1Input{} - } - - req = c.newRequest(opOutputService5TestCaseOperation1, input, output) - output = &OutputService5TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (output *OutputService5TestShapeOutputShape, err error) { - req, out := c.OutputService5TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opOutputService5TestCaseOperation1 *aws.Operation - -type OutputService5TestShapeOutputService5TestCaseOperation1Input struct { - metadataOutputService5TestShapeOutputService5TestCaseOperation1Input `json:"-", xml:"-"` -} - -type metadataOutputService5TestShapeOutputService5TestCaseOperation1Input struct { - SDKShapeTraits bool `type:"structure"` -} - -type OutputService5TestShapeOutputShape struct { - ListMember []*string `locationNameList:"item" type:"list"` - - metadataOutputService5TestShapeOutputShape `json:"-", xml:"-"` -} - -type metadataOutputService5TestShapeOutputShape struct { - SDKShapeTraits bool `type:"structure"` -} - -// OutputService6ProtocolTest is a client for OutputService6ProtocolTest. -type OutputService6ProtocolTest struct { - *aws.Service -} - -// New returns a new OutputService6ProtocolTest client. -func NewOutputService6ProtocolTest(config *aws.Config) *OutputService6ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "outputservice6protocoltest", - APIVersion: "", - } - 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) - - 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 -} - -// OutputService6TestCaseOperation1Request generates a request for the OutputService6TestCaseOperation1 operation. -func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1Request(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (req *aws.Request, output *OutputService6TestShapeOutputShape) { - - if opOutputService6TestCaseOperation1 == nil { - opOutputService6TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &OutputService6TestShapeOutputService6TestCaseOperation1Input{} - } - - req = c.newRequest(opOutputService6TestCaseOperation1, input, output) - output = &OutputService6TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (output *OutputService6TestShapeOutputShape, err error) { - req, out := c.OutputService6TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opOutputService6TestCaseOperation1 *aws.Operation - -type OutputService6TestShapeOutputService6TestCaseOperation1Input struct { - metadataOutputService6TestShapeOutputService6TestCaseOperation1Input `json:"-", xml:"-"` -} - -type metadataOutputService6TestShapeOutputService6TestCaseOperation1Input struct { - SDKShapeTraits bool `type:"structure"` -} - -type OutputService6TestShapeOutputShape struct { - ListMember []*string `type:"list" flattened:"true"` - - metadataOutputService6TestShapeOutputShape `json:"-", xml:"-"` -} - -type metadataOutputService6TestShapeOutputShape struct { - SDKShapeTraits bool `type:"structure"` -} - -// OutputService7ProtocolTest is a client for OutputService7ProtocolTest. -type OutputService7ProtocolTest struct { - *aws.Service -} - -// New returns a new OutputService7ProtocolTest client. -func NewOutputService7ProtocolTest(config *aws.Config) *OutputService7ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "outputservice7protocoltest", - APIVersion: "", - } - 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) - - 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 -} - -// OutputService7TestCaseOperation1Request generates a request for the OutputService7TestCaseOperation1 operation. -func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1Request(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (req *aws.Request, output *OutputService7TestShapeOutputShape) { - - if opOutputService7TestCaseOperation1 == nil { - opOutputService7TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &OutputService7TestShapeOutputService7TestCaseOperation1Input{} - } - - req = c.newRequest(opOutputService7TestCaseOperation1, input, output) - output = &OutputService7TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (output *OutputService7TestShapeOutputShape, err error) { - req, out := c.OutputService7TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opOutputService7TestCaseOperation1 *aws.Operation - -type OutputService7TestShapeOutputService7TestCaseOperation1Input struct { - metadataOutputService7TestShapeOutputService7TestCaseOperation1Input `json:"-", xml:"-"` -} - -type metadataOutputService7TestShapeOutputService7TestCaseOperation1Input struct { - SDKShapeTraits bool `type:"structure"` -} - -type OutputService7TestShapeOutputShape struct { - ListMember []*string `type:"list" flattened:"true"` - - metadataOutputService7TestShapeOutputShape `json:"-", xml:"-"` -} - -type metadataOutputService7TestShapeOutputShape struct { - SDKShapeTraits bool `type:"structure"` -} - -// OutputService8ProtocolTest is a client for OutputService8ProtocolTest. -type OutputService8ProtocolTest struct { - *aws.Service -} - -// New returns a new OutputService8ProtocolTest client. -func NewOutputService8ProtocolTest(config *aws.Config) *OutputService8ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "outputservice8protocoltest", - APIVersion: "", - } - 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) - - 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 -} - -// OutputService8TestCaseOperation1Request generates a request for the OutputService8TestCaseOperation1 operation. -func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1Request(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (req *aws.Request, output *OutputService8TestShapeOutputShape) { - - if opOutputService8TestCaseOperation1 == nil { - opOutputService8TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &OutputService8TestShapeOutputService8TestCaseOperation1Input{} - } - - req = c.newRequest(opOutputService8TestCaseOperation1, input, output) - output = &OutputService8TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (output *OutputService8TestShapeOutputShape, err error) { - req, out := c.OutputService8TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opOutputService8TestCaseOperation1 *aws.Operation - -type OutputService8TestShapeOutputService8TestCaseOperation1Input struct { - metadataOutputService8TestShapeOutputService8TestCaseOperation1Input `json:"-", xml:"-"` -} - -type metadataOutputService8TestShapeOutputService8TestCaseOperation1Input struct { - SDKShapeTraits bool `type:"structure"` -} - -type OutputService8TestShapeOutputShape struct { - List []*OutputService8TestShapeStructureShape `type:"list"` - - metadataOutputService8TestShapeOutputShape `json:"-", xml:"-"` -} - -type metadataOutputService8TestShapeOutputShape struct { - SDKShapeTraits bool `type:"structure"` -} - -type OutputService8TestShapeStructureShape struct { - Bar *string `type:"string"` - - Baz *string `type:"string"` - - Foo *string `type:"string"` - - metadataOutputService8TestShapeStructureShape `json:"-", xml:"-"` -} - -type metadataOutputService8TestShapeStructureShape struct { - SDKShapeTraits bool `type:"structure"` -} - -// OutputService9ProtocolTest is a client for OutputService9ProtocolTest. -type OutputService9ProtocolTest struct { - *aws.Service -} - -// New returns a new OutputService9ProtocolTest client. -func NewOutputService9ProtocolTest(config *aws.Config) *OutputService9ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "outputservice9protocoltest", - APIVersion: "", - } - 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) - - return &OutputService9ProtocolTest{service} -} - -// newRequest creates a new request for a OutputService9ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService9ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { - req := aws.NewRequest(c.Service, op, params, data) - - return req -} - -// OutputService9TestCaseOperation1Request generates a request for the OutputService9TestCaseOperation1 operation. -func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1Request(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (req *aws.Request, output *OutputService9TestShapeOutputShape) { - - if opOutputService9TestCaseOperation1 == nil { - opOutputService9TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &OutputService9TestShapeOutputService9TestCaseOperation1Input{} - } - - req = c.newRequest(opOutputService9TestCaseOperation1, input, output) - output = &OutputService9TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (output *OutputService9TestShapeOutputShape, err error) { - req, out := c.OutputService9TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opOutputService9TestCaseOperation1 *aws.Operation - -type OutputService9TestShapeOutputService9TestCaseOperation1Input struct { - metadataOutputService9TestShapeOutputService9TestCaseOperation1Input `json:"-", xml:"-"` -} - -type metadataOutputService9TestShapeOutputService9TestCaseOperation1Input struct { - SDKShapeTraits bool `type:"structure"` -} - -type OutputService9TestShapeOutputShape struct { - List []*OutputService9TestShapeStructureShape `type:"list" flattened:"true"` - - metadataOutputService9TestShapeOutputShape `json:"-", xml:"-"` -} - -type metadataOutputService9TestShapeOutputShape struct { - SDKShapeTraits bool `type:"structure"` -} - -type OutputService9TestShapeStructureShape struct { - Bar *string `type:"string"` - - Baz *string `type:"string"` - - Foo *string `type:"string"` - - metadataOutputService9TestShapeStructureShape `json:"-", xml:"-"` -} - -type metadataOutputService9TestShapeStructureShape struct { - SDKShapeTraits bool `type:"structure"` -} - -// OutputService10ProtocolTest is a client for OutputService10ProtocolTest. -type OutputService10ProtocolTest struct { - *aws.Service -} - -// New returns a new OutputService10ProtocolTest client. -func NewOutputService10ProtocolTest(config *aws.Config) *OutputService10ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "outputservice10protocoltest", - APIVersion: "", - } - 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) - - return &OutputService10ProtocolTest{service} -} - -// newRequest creates a new request for a OutputService10ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService10ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { - req := aws.NewRequest(c.Service, op, params, data) - - return req -} - -// OutputService10TestCaseOperation1Request generates a request for the OutputService10TestCaseOperation1 operation. -func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1Request(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (req *aws.Request, output *OutputService10TestShapeOutputShape) { - - if opOutputService10TestCaseOperation1 == nil { - opOutputService10TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &OutputService10TestShapeOutputService10TestCaseOperation1Input{} - } - - req = c.newRequest(opOutputService10TestCaseOperation1, input, output) - output = &OutputService10TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (output *OutputService10TestShapeOutputShape, err error) { - req, out := c.OutputService10TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opOutputService10TestCaseOperation1 *aws.Operation - -type OutputService10TestShapeOutputService10TestCaseOperation1Input struct { - metadataOutputService10TestShapeOutputService10TestCaseOperation1Input `json:"-", xml:"-"` -} - -type metadataOutputService10TestShapeOutputService10TestCaseOperation1Input struct { - SDKShapeTraits bool `type:"structure"` -} - -type OutputService10TestShapeOutputShape struct { - List []*string `locationNameList:"NamedList" type:"list" flattened:"true"` - - metadataOutputService10TestShapeOutputShape `json:"-", xml:"-"` -} - -type metadataOutputService10TestShapeOutputShape struct { - SDKShapeTraits bool `type:"structure"` -} - -// OutputService11ProtocolTest is a client for OutputService11ProtocolTest. -type OutputService11ProtocolTest struct { - *aws.Service -} - -// New returns a new OutputService11ProtocolTest client. -func NewOutputService11ProtocolTest(config *aws.Config) *OutputService11ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "outputservice11protocoltest", - APIVersion: "", - } - 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) - - return &OutputService11ProtocolTest{service} -} - -// newRequest creates a new request for a OutputService11ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService11ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { - req := aws.NewRequest(c.Service, op, params, data) - - return req -} - -// OutputService11TestCaseOperation1Request generates a request for the OutputService11TestCaseOperation1 operation. -func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1Request(input *OutputService11TestShapeOutputService11TestCaseOperation1Input) (req *aws.Request, output *OutputService11TestShapeOutputShape) { - - if opOutputService11TestCaseOperation1 == nil { - opOutputService11TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &OutputService11TestShapeOutputService11TestCaseOperation1Input{} - } - - req = c.newRequest(opOutputService11TestCaseOperation1, input, output) - output = &OutputService11TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1(input *OutputService11TestShapeOutputService11TestCaseOperation1Input) (output *OutputService11TestShapeOutputShape, err error) { - req, out := c.OutputService11TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opOutputService11TestCaseOperation1 *aws.Operation - -type OutputService11TestShapeOutputService11TestCaseOperation1Input struct { - metadataOutputService11TestShapeOutputService11TestCaseOperation1Input `json:"-", xml:"-"` -} - -type metadataOutputService11TestShapeOutputService11TestCaseOperation1Input struct { - SDKShapeTraits bool `type:"structure"` -} - -type OutputService11TestShapeOutputShape struct { - Map *map[string]*OutputService11TestShapeStructType `type:"map"` - - metadataOutputService11TestShapeOutputShape `json:"-", xml:"-"` -} - -type metadataOutputService11TestShapeOutputShape struct { - SDKShapeTraits bool `type:"structure"` -} - -type OutputService11TestShapeStructType struct { - Foo *string `locationName:"foo" type:"string"` - - metadataOutputService11TestShapeStructType `json:"-", xml:"-"` -} - -type metadataOutputService11TestShapeStructType struct { - SDKShapeTraits bool `type:"structure"` -} - -// OutputService12ProtocolTest is a client for OutputService12ProtocolTest. -type OutputService12ProtocolTest struct { - *aws.Service -} - -// New returns a new OutputService12ProtocolTest client. -func NewOutputService12ProtocolTest(config *aws.Config) *OutputService12ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "outputservice12protocoltest", - APIVersion: "", - } - 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) - - return &OutputService12ProtocolTest{service} -} - -// newRequest creates a new request for a OutputService12ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService12ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { - req := aws.NewRequest(c.Service, op, params, data) - - return req -} - -// OutputService12TestCaseOperation1Request generates a request for the OutputService12TestCaseOperation1 operation. -func (c *OutputService12ProtocolTest) OutputService12TestCaseOperation1Request(input *OutputService12TestShapeOutputService12TestCaseOperation1Input) (req *aws.Request, output *OutputService12TestShapeOutputShape) { - - if opOutputService12TestCaseOperation1 == nil { - opOutputService12TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &OutputService12TestShapeOutputService12TestCaseOperation1Input{} - } - - req = c.newRequest(opOutputService12TestCaseOperation1, input, output) - output = &OutputService12TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService12ProtocolTest) OutputService12TestCaseOperation1(input *OutputService12TestShapeOutputService12TestCaseOperation1Input) (output *OutputService12TestShapeOutputShape, err error) { - req, out := c.OutputService12TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opOutputService12TestCaseOperation1 *aws.Operation - -type OutputService12TestShapeOutputService12TestCaseOperation1Input struct { - metadataOutputService12TestShapeOutputService12TestCaseOperation1Input `json:"-", xml:"-"` -} - -type metadataOutputService12TestShapeOutputService12TestCaseOperation1Input struct { - SDKShapeTraits bool `type:"structure"` -} - -type OutputService12TestShapeOutputShape struct { - Map *map[string]*string `type:"map" flattened:"true"` - - metadataOutputService12TestShapeOutputShape `json:"-", xml:"-"` -} - -type metadataOutputService12TestShapeOutputShape struct { - SDKShapeTraits bool `type:"structure"` -} - -// OutputService13ProtocolTest is a client for OutputService13ProtocolTest. -type OutputService13ProtocolTest struct { - *aws.Service -} - -// New returns a new OutputService13ProtocolTest client. -func NewOutputService13ProtocolTest(config *aws.Config) *OutputService13ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "outputservice13protocoltest", - APIVersion: "", - } - 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) - - return &OutputService13ProtocolTest{service} -} - -// newRequest creates a new request for a OutputService13ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService13ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { - req := aws.NewRequest(c.Service, op, params, data) - - return req -} - -// OutputService13TestCaseOperation1Request generates a request for the OutputService13TestCaseOperation1 operation. -func (c *OutputService13ProtocolTest) OutputService13TestCaseOperation1Request(input *OutputService13TestShapeOutputService13TestCaseOperation1Input) (req *aws.Request, output *OutputService13TestShapeOutputShape) { - - if opOutputService13TestCaseOperation1 == nil { - opOutputService13TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &OutputService13TestShapeOutputService13TestCaseOperation1Input{} - } - - req = c.newRequest(opOutputService13TestCaseOperation1, input, output) - output = &OutputService13TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService13ProtocolTest) OutputService13TestCaseOperation1(input *OutputService13TestShapeOutputService13TestCaseOperation1Input) (output *OutputService13TestShapeOutputShape, err error) { - req, out := c.OutputService13TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opOutputService13TestCaseOperation1 *aws.Operation - -type OutputService13TestShapeOutputService13TestCaseOperation1Input struct { - metadataOutputService13TestShapeOutputService13TestCaseOperation1Input `json:"-", xml:"-"` -} - -type metadataOutputService13TestShapeOutputService13TestCaseOperation1Input struct { - SDKShapeTraits bool `type:"structure"` -} - -type OutputService13TestShapeOutputShape struct { - Map *map[string]*string `locationName:"Attribute" locationNameKey:"Name" locationNameValue:"Value" type:"map" flattened:"true"` - - metadataOutputService13TestShapeOutputShape `json:"-", xml:"-"` -} - -type metadataOutputService13TestShapeOutputShape struct { - SDKShapeTraits bool `type:"structure"` -} - -// OutputService14ProtocolTest is a client for OutputService14ProtocolTest. -type OutputService14ProtocolTest struct { - *aws.Service -} - -// New returns a new OutputService14ProtocolTest client. -func NewOutputService14ProtocolTest(config *aws.Config) *OutputService14ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "outputservice14protocoltest", - APIVersion: "", - } - 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) - - return &OutputService14ProtocolTest{service} -} - -// newRequest creates a new request for a OutputService14ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService14ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { - req := aws.NewRequest(c.Service, op, params, data) - - return req -} - -// OutputService14TestCaseOperation1Request generates a request for the OutputService14TestCaseOperation1 operation. -func (c *OutputService14ProtocolTest) OutputService14TestCaseOperation1Request(input *OutputService14TestShapeOutputService14TestCaseOperation1Input) (req *aws.Request, output *OutputService14TestShapeOutputShape) { - - if opOutputService14TestCaseOperation1 == nil { - opOutputService14TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &OutputService14TestShapeOutputService14TestCaseOperation1Input{} - } - - req = c.newRequest(opOutputService14TestCaseOperation1, input, output) - output = &OutputService14TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService14ProtocolTest) OutputService14TestCaseOperation1(input *OutputService14TestShapeOutputService14TestCaseOperation1Input) (output *OutputService14TestShapeOutputShape, err error) { - req, out := c.OutputService14TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opOutputService14TestCaseOperation1 *aws.Operation - -type OutputService14TestShapeOutputService14TestCaseOperation1Input struct { - metadataOutputService14TestShapeOutputService14TestCaseOperation1Input `json:"-", xml:"-"` -} - -type metadataOutputService14TestShapeOutputService14TestCaseOperation1Input struct { - SDKShapeTraits bool `type:"structure"` -} - -type OutputService14TestShapeOutputShape struct { - Map *map[string]*string `locationNameKey:"foo" locationNameValue:"bar" type:"map" flattened:"true"` - - metadataOutputService14TestShapeOutputShape `json:"-", xml:"-"` -} - -type metadataOutputService14TestShapeOutputShape struct { - SDKShapeTraits bool `type:"structure"` -} - -// -// Tests begin here -// - -func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { - svc := NewOutputService1ProtocolTest(nil) - - buf := bytes.NewReader([]byte("myname123falsetrue1.21.3200a2015-01-25T08:00:00Zrequest-id")) - req, out := svc.OutputService1TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.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, time.Unix(1.4221728e+09, 0).UTC().String(), out.Timestamp.String()) - assert.Equal(t, true, *out.TrueBool) - -} - -func TestOutputService2ProtocolTestNotAllMembersInResponseCase1(t *testing.T) { - svc := NewOutputService2ProtocolTest(nil) - - buf := bytes.NewReader([]byte("mynamerequest-id")) - req, out := svc.OutputService2TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "myname", *out.Str) - -} - -func TestOutputService3ProtocolTestBlobCase1(t *testing.T) { - svc := NewOutputService3ProtocolTest(nil) - - buf := bytes.NewReader([]byte("dmFsdWU=requestid")) - req, out := svc.OutputService3TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.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 TestOutputService4ProtocolTestListsCase1(t *testing.T) { - svc := NewOutputService4ProtocolTest(nil) - - buf := bytes.NewReader([]byte("abc123requestid")) - req, out := svc.OutputService4TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.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 TestOutputService5ProtocolTestListWithCustomMemberNameCase1(t *testing.T) { - svc := NewOutputService5ProtocolTest(nil) - - buf := bytes.NewReader([]byte("abc123requestid")) - req, out := svc.OutputService5TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.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 TestOutputService6ProtocolTestFlattenedListCase1(t *testing.T) { - svc := NewOutputService6ProtocolTest(nil) - - buf := bytes.NewReader([]byte("abc123requestid")) - req, out := svc.OutputService6TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.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 TestOutputService7ProtocolTestFlattenedSingleElementListCase1(t *testing.T) { - svc := NewOutputService7ProtocolTest(nil) - - buf := bytes.NewReader([]byte("abcrequestid")) - req, out := svc.OutputService7TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.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]) - -} - -func TestOutputService8ProtocolTestListOfStructuresCase1(t *testing.T) { - svc := NewOutputService8ProtocolTest(nil) - - buf := bytes.NewReader([]byte("firstfoofirstbarfirstbazsecondfoosecondbarsecondbazrequestid")) - req, out := svc.OutputService8TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "firstbar", *out.List[0].Bar) - assert.Equal(t, "firstbaz", *out.List[0].Baz) - assert.Equal(t, "firstfoo", *out.List[0].Foo) - assert.Equal(t, "secondbar", *out.List[1].Bar) - assert.Equal(t, "secondbaz", *out.List[1].Baz) - assert.Equal(t, "secondfoo", *out.List[1].Foo) - -} - -func TestOutputService9ProtocolTestFlattenedListOfStructuresCase1(t *testing.T) { - svc := NewOutputService9ProtocolTest(nil) - - buf := bytes.NewReader([]byte("firstfoofirstbarfirstbazsecondfoosecondbarsecondbazrequestid")) - req, out := svc.OutputService9TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "firstbar", *out.List[0].Bar) - assert.Equal(t, "firstbaz", *out.List[0].Baz) - assert.Equal(t, "firstfoo", *out.List[0].Foo) - assert.Equal(t, "secondbar", *out.List[1].Bar) - assert.Equal(t, "secondbaz", *out.List[1].Baz) - assert.Equal(t, "secondfoo", *out.List[1].Foo) - -} - -func TestOutputService10ProtocolTestFlattenedListWithLocationNameCase1(t *testing.T) { - svc := NewOutputService10ProtocolTest(nil) - - buf := bytes.NewReader([]byte("abrequestid")) - req, out := svc.OutputService10TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "a", *out.List[0]) - assert.Equal(t, "b", *out.List[1]) - -} - -func TestOutputService11ProtocolTestNormalMapCase1(t *testing.T) { - svc := NewOutputService11ProtocolTest(nil) - - buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) - req, out := svc.OutputService11TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.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 TestOutputService12ProtocolTestFlattenedMapCase1(t *testing.T) { - svc := NewOutputService12ProtocolTest(nil) - - buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) - req, out := svc.OutputService12TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.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 TestOutputService13ProtocolTestFlattenedMapInShapeDefinitionCase1(t *testing.T) { - svc := NewOutputService13ProtocolTest(nil) - - buf := bytes.NewReader([]byte("quxbarrequestid")) - req, out := svc.OutputService13TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "bar", *(*out.Map)["qux"]) - -} - -func TestOutputService14ProtocolTestNamedMapCase1(t *testing.T) { - svc := NewOutputService14ProtocolTest(nil) - - buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) - req, out := svc.OutputService14TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - query.UnmarshalMeta(req) - query.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"]) - -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/rest/build.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/rest/build.go deleted file mode 100644 index 3ff667d9..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/rest/build.go +++ /dev/null @@ -1,215 +0,0 @@ -package rest - -import ( - "bytes" - "encoding/base64" - "fmt" - "io" - "net/url" - "path" - "reflect" - "strconv" - "strings" - "time" - - "github.com/awslabs/aws-sdk-go/aws" -) - -// RFC822 returns an RFC822 formatted timestamp for AWS protocols -const RFC822 = "Mon, 2 Jan 2006 15:04:05 GMT" - -func Build(r *aws.Request) { - if r.ParamsFilled() { - v := reflect.ValueOf(r.Params).Elem() - buildLocationElements(r, v) - buildBody(r, v) - } -} - -func buildLocationElements(r *aws.Request, v reflect.Value) { - query := r.HTTPRequest.URL.Query() - - for i := 0; i < v.NumField(); i++ { - m := v.Field(i) - if n := v.Type().Field(i).Name; n[0:1] == strings.ToLower(n[0:1]) { - continue - } - - if m.IsValid() { - field := v.Type().Field(i) - name := field.Tag.Get("locationName") - if name == "" { - name = field.Name - } - if m.Kind() == reflect.Ptr { - m = m.Elem() - } - if !m.IsValid() { - continue - } - - switch field.Tag.Get("location") { - case "headers": // header maps - buildHeaderMap(r, m, field.Tag.Get("locationName")) - case "header": - buildHeader(r, m, name) - case "uri": - buildURI(r, m, name) - case "querystring": - buildQueryString(r, m, name, query) - } - } - if r.Error != nil { - return - } - } - - r.HTTPRequest.URL.RawQuery = query.Encode() - updatePath(r.HTTPRequest.URL, r.HTTPRequest.URL.Path) -} - -func buildBody(r *aws.Request, v reflect.Value) { - if field, ok := v.Type().FieldByName("SDKShapeTraits"); ok { - if payloadName := field.Tag.Get("payload"); payloadName != "" { - pfield, _ := v.Type().FieldByName(payloadName) - if ptag := pfield.Tag.Get("type"); ptag != "" && ptag != "structure" { - payload := reflect.Indirect(v.FieldByName(payloadName)) - if payload.IsValid() && payload.Interface() != nil { - switch reader := payload.Interface().(type) { - case io.ReadSeeker: - r.SetReaderBody(reader) - case []byte: - r.SetBufferBody(reader) - case string: - r.SetBufferBody([]byte(reader)) - default: - r.Error = fmt.Errorf("unknown payload type %s", payload.Type()) - } - } - } - } - } -} - -func buildHeader(r *aws.Request, v reflect.Value, name string) { - str, err := convertType(v) - if err != nil { - r.Error = err - } else if str != nil { - r.HTTPRequest.Header.Add(name, *str) - } -} - -func buildHeaderMap(r *aws.Request, v reflect.Value, prefix string) { - for _, key := range v.MapKeys() { - str, err := convertType(v.MapIndex(key)) - - if err != nil { - r.Error = err - } else if str != nil { - r.HTTPRequest.Header.Add(prefix+key.String(), *str) - } - } -} - -func buildURI(r *aws.Request, v reflect.Value, name string) { - value, err := convertType(v) - if err != nil { - r.Error = err - } else if value != nil { - uri := r.HTTPRequest.URL.Path - uri = strings.Replace(uri, "{"+name+"}", escapePath(*value, true), -1) - uri = strings.Replace(uri, "{"+name+"+}", escapePath(*value, false), -1) - r.HTTPRequest.URL.Path = uri - } -} - -func buildQueryString(r *aws.Request, v reflect.Value, name string, query url.Values) { - str, err := convertType(v) - if err != nil { - r.Error = err - } else if str != nil { - query.Set(name, *str) - } -} - -func updatePath(url *url.URL, urlPath string) { - scheme, query := url.Scheme, url.RawQuery - - // clean up path - urlPath = path.Clean(urlPath) - - // get formatted URL minus scheme so we can build this into Opaque - url.Scheme, url.Path, url.RawQuery = "", "", "" - s := url.String() - url.Scheme = scheme - url.RawQuery = query - - // build opaque URI - url.Opaque = s + urlPath -} - -// Whether the byte value can be sent without escaping in AWS URLs -var noEscape [256]bool -var noEscapeInitialized = false - -// initialise noEscape -func initNoEscape() { - 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 == '~' - } -} - -// escapePath escapes part of a URL path in Amazon style -func escapePath(path string, encodeSep bool) string { - if !noEscapeInitialized { - initNoEscape() - noEscapeInitialized = true - } - - var buf bytes.Buffer - for i := 0; i < len(path); i++ { - c := path[i] - if noEscape[c] || (c == '/' && !encodeSep) { - buf.WriteByte(c) - } else { - buf.WriteByte('%') - buf.WriteString(strings.ToUpper(strconv.FormatUint(uint64(c), 16))) - } - } - return buf.String() -} - -func convertType(v reflect.Value) (*string, error) { - v = reflect.Indirect(v) - if !v.IsValid() { - return nil, nil - } - - var str string - switch value := v.Interface().(type) { - case string: - str = value - case []byte: - str = base64.StdEncoding.EncodeToString(value) - case bool: - str = strconv.FormatBool(value) - case int64: - str = strconv.FormatInt(value, 10) - case float64: - str = strconv.FormatFloat(value, 'f', -1, 64) - case time.Time: - str = value.UTC().Format(RFC822) - default: - err := fmt.Errorf("Unsupported value for param %v (%s)", v.Interface(), v.Type()) - return nil, err - } - return &str, nil -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/rest/payload.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/rest/payload.go deleted file mode 100644 index 1e15f66f..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/rest/payload.go +++ /dev/null @@ -1,43 +0,0 @@ -package rest - -import "reflect" - -func PayloadMember(i interface{}) interface{} { - if i == nil { - return nil - } - - v := reflect.ValueOf(i).Elem() - if !v.IsValid() { - return nil - } - if field, ok := v.Type().FieldByName("SDKShapeTraits"); ok { - if payloadName := field.Tag.Get("payload"); payloadName != "" { - field, _ := v.Type().FieldByName(payloadName) - if field.Tag.Get("type") != "structure" { - return nil - } - - payload := v.FieldByName(payloadName) - if payload.IsValid() || (payload.Kind() == reflect.Ptr && !payload.IsNil()) { - return payload.Interface() - } - } - } - return nil -} - -func PayloadType(i interface{}) string { - v := reflect.Indirect(reflect.ValueOf(i)) - if !v.IsValid() { - return "" - } - if field, ok := v.Type().FieldByName("SDKShapeTraits"); ok { - if payloadName := field.Tag.Get("payload"); payloadName != "" { - if member, ok := v.Type().FieldByName(payloadName); ok { - return member.Tag.Get("type") - } - } - } - return "" -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/rest/unmarshal.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/rest/unmarshal.go deleted file mode 100644 index d0e216c1..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/rest/unmarshal.go +++ /dev/null @@ -1,174 +0,0 @@ -package rest - -import ( - "encoding/base64" - "fmt" - "io/ioutil" - "net/http" - "reflect" - "strconv" - "strings" - "time" - - "github.com/awslabs/aws-sdk-go/aws" -) - -func Unmarshal(r *aws.Request) { - if r.DataFilled() { - v := reflect.Indirect(reflect.ValueOf(r.Data)) - unmarshalBody(r, v) - unmarshalLocationElements(r, v) - } -} - -func unmarshalBody(r *aws.Request, v reflect.Value) { - if field, ok := v.Type().FieldByName("SDKShapeTraits"); ok { - if payloadName := field.Tag.Get("payload"); payloadName != "" { - pfield, _ := v.Type().FieldByName(payloadName) - if ptag := pfield.Tag.Get("type"); ptag != "" && ptag != "structure" { - payload := reflect.Indirect(v.FieldByName(payloadName)) - if payload.IsValid() { - switch payload.Interface().(type) { - case []byte: - b, err := ioutil.ReadAll(r.HTTPResponse.Body) - if err != nil { - r.Error = err - } else { - payload.Set(reflect.ValueOf(b)) - } - case string: - b, err := ioutil.ReadAll(r.HTTPResponse.Body) - if err != nil { - r.Error = err - } else { - payload.Set(reflect.ValueOf(string(b))) - } - default: - switch payload.Type().String() { - case "io.ReadSeeker": - payload.Set(reflect.ValueOf(aws.ReadSeekCloser(r.HTTPResponse.Body))) - case "aws.ReadSeekCloser", "io.ReadCloser": - payload.Set(reflect.ValueOf(r.HTTPResponse.Body)) - default: - r.Error = fmt.Errorf("unknown payload type %s", payload.Type()) - } - } - } - } - } - } -} - -func unmarshalLocationElements(r *aws.Request, v reflect.Value) { - for i := 0; i < v.NumField(); i++ { - m, field := v.Field(i), v.Type().Field(i) - if n := field.Name; n[0:1] == strings.ToLower(n[0:1]) { - continue - } - - if m.IsValid() { - name := field.Tag.Get("locationName") - if name == "" { - name = field.Name - } - - switch field.Tag.Get("location") { - case "statusCode": - unmarshalStatusCode(m, r.HTTPResponse.StatusCode) - case "header": - err := unmarshalHeader(m, r.HTTPResponse.Header.Get(name)) - if err != nil { - r.Error = err - break - } - case "headers": - prefix := field.Tag.Get("locationName") - err := unmarshalHeaderMap(m, r.HTTPResponse.Header, prefix) - if err != nil { - r.Error = err - break - } - } - } - if r.Error != nil { - return - } - } -} - -func unmarshalStatusCode(v reflect.Value, statusCode int) { - if !v.IsValid() { - return - } - - switch v.Interface().(type) { - case *int64: - s := int64(statusCode) - v.Set(reflect.ValueOf(&s)) - } -} - -func unmarshalHeaderMap(r reflect.Value, headers http.Header, prefix string) error { - switch r.Interface().(type) { - case *map[string]*string: // we only support string map value types - out := map[string]*string{} - for k, v := range headers { - k = http.CanonicalHeaderKey(k) - if strings.HasPrefix(strings.ToLower(k), strings.ToLower(prefix)) { - out[k[len(prefix):]] = &v[0] - } - } - r.Set(reflect.ValueOf(&out)) - } - return nil -} - -func unmarshalHeader(v reflect.Value, header string) error { - if !v.IsValid() || (header == "" && v.Elem().Kind() != reflect.String) { - return nil - } - - switch v.Interface().(type) { - case *string: - v.Set(reflect.ValueOf(&header)) - case []byte: - b, err := base64.StdEncoding.DecodeString(header) - if err != nil { - return err - } else { - v.Set(reflect.ValueOf(&b)) - } - case *bool: - b, err := strconv.ParseBool(header) - if err != nil { - return err - } else { - v.Set(reflect.ValueOf(&b)) - } - case *int64: - i, err := strconv.ParseInt(header, 10, 64) - if err != nil { - return err - } else { - v.Set(reflect.ValueOf(&i)) - } - case *float64: - f, err := strconv.ParseFloat(header, 64) - if err != nil { - return err - } else { - v.Set(reflect.ValueOf(&f)) - } - case *time.Time: - t, err := time.Parse(RFC822, header) - if err != nil { - return err - } else { - v.Set(reflect.ValueOf(&t)) - } - default: - err := fmt.Errorf("Unsupported value for param %v (%s)", v.Interface(), v.Type()) - return err - } - return nil -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/restxml/build_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/restxml/build_test.go deleted file mode 100644 index 439bbabf..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/restxml/build_test.go +++ /dev/null @@ -1,2864 +0,0 @@ -package restxml_test - -import ( - "github.com/awslabs/aws-sdk-go/aws" - "github.com/awslabs/aws-sdk-go/internal/protocol/restxml" - "github.com/awslabs/aws-sdk-go/internal/signer/v4" - - "bytes" - "encoding/json" - "encoding/xml" - "github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil" - "github.com/awslabs/aws-sdk-go/internal/util" - "github.com/stretchr/testify/assert" - "io" - "io/ioutil" - "net/http" - "net/url" - "testing" - "time" -) - -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 - -// InputService1ProtocolTest is a client for InputService1ProtocolTest. -type InputService1ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService1ProtocolTest client. -func NewInputService1ProtocolTest(config *aws.Config) *InputService1ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - 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(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.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 -} - -// InputService1TestCaseOperation1Request generates a request for the InputService1TestCaseOperation1 operation. -func (c *InputService1ProtocolTest) InputService1TestCaseOperation1Request(input *InputService1TestShapeInputShape) (req *aws.Request, output *InputService1TestShapeInputService1TestCaseOperation1Output) { - - if opInputService1TestCaseOperation1 == nil { - opInputService1TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - } - - if input == nil { - input = &InputService1TestShapeInputShape{} - } - - req = c.newRequest(opInputService1TestCaseOperation1, input, output) - output = &InputService1TestShapeInputService1TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService1ProtocolTest) InputService1TestCaseOperation1(input *InputService1TestShapeInputShape) (output *InputService1TestShapeInputService1TestCaseOperation1Output, err error) { - req, out := c.InputService1TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService1TestCaseOperation1 *aws.Operation - -// InputService1TestCaseOperation2Request generates a request for the InputService1TestCaseOperation2 operation. -func (c *InputService1ProtocolTest) InputService1TestCaseOperation2Request(input *InputService1TestShapeInputShape) (req *aws.Request, output *InputService1TestShapeInputService1TestCaseOperation2Output) { - - if opInputService1TestCaseOperation2 == nil { - opInputService1TestCaseOperation2 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "PUT", - HTTPPath: "/2014-01-01/hostedzone", - } - } - - if input == nil { - input = &InputService1TestShapeInputShape{} - } - - req = c.newRequest(opInputService1TestCaseOperation2, input, output) - output = &InputService1TestShapeInputService1TestCaseOperation2Output{} - req.Data = output - return -} - -func (c *InputService1ProtocolTest) InputService1TestCaseOperation2(input *InputService1TestShapeInputShape) (output *InputService1TestShapeInputService1TestCaseOperation2Output, err error) { - req, out := c.InputService1TestCaseOperation2Request(input) - output = out - err = req.Send() - return -} - -var opInputService1TestCaseOperation2 *aws.Operation - -type InputService1TestShapeInputService1TestCaseOperation1Output struct { - metadataInputService1TestShapeInputService1TestCaseOperation1Output `json:"-", xml:"-"` -} - -type metadataInputService1TestShapeInputService1TestCaseOperation1Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService1TestShapeInputService1TestCaseOperation2Output struct { - metadataInputService1TestShapeInputService1TestCaseOperation2Output `json:"-", xml:"-"` -} - -type metadataInputService1TestShapeInputService1TestCaseOperation2Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService1TestShapeInputShape struct { - Description *string `type:"string"` - - Name *string `type:"string"` - - metadataInputService1TestShapeInputShape `json:"-", xml:"-"` -} - -type metadataInputService1TestShapeInputShape struct { - SDKShapeTraits bool `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` -} - -// InputService2ProtocolTest is a client for InputService2ProtocolTest. -type InputService2ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService2ProtocolTest client. -func NewInputService2ProtocolTest(config *aws.Config) *InputService2ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - 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(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.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 -} - -// InputService2TestCaseOperation1Request generates a request for the InputService2TestCaseOperation1 operation. -func (c *InputService2ProtocolTest) InputService2TestCaseOperation1Request(input *InputService2TestShapeInputShape) (req *aws.Request, output *InputService2TestShapeInputService2TestCaseOperation1Output) { - - if opInputService2TestCaseOperation1 == nil { - opInputService2TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - } - - if input == nil { - input = &InputService2TestShapeInputShape{} - } - - req = c.newRequest(opInputService2TestCaseOperation1, input, output) - output = &InputService2TestShapeInputService2TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService2ProtocolTest) InputService2TestCaseOperation1(input *InputService2TestShapeInputShape) (output *InputService2TestShapeInputService2TestCaseOperation1Output, err error) { - req, out := c.InputService2TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService2TestCaseOperation1 *aws.Operation - -type InputService2TestShapeInputService2TestCaseOperation1Output struct { - metadataInputService2TestShapeInputService2TestCaseOperation1Output `json:"-", xml:"-"` -} - -type metadataInputService2TestShapeInputService2TestCaseOperation1Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService2TestShapeInputShape struct { - First *bool `type:"boolean"` - - Fourth *int64 `type:"integer"` - - Second *bool `type:"boolean"` - - Third *float64 `type:"float"` - - metadataInputService2TestShapeInputShape `json:"-", xml:"-"` -} - -type metadataInputService2TestShapeInputShape struct { - SDKShapeTraits bool `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` -} - -// InputService3ProtocolTest is a client for InputService3ProtocolTest. -type InputService3ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService3ProtocolTest client. -func NewInputService3ProtocolTest(config *aws.Config) *InputService3ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - 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(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.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 -} - -// InputService3TestCaseOperation1Request generates a request for the InputService3TestCaseOperation1 operation. -func (c *InputService3ProtocolTest) InputService3TestCaseOperation1Request(input *InputService3TestShapeInputShape) (req *aws.Request, output *InputService3TestShapeInputService3TestCaseOperation1Output) { - - if opInputService3TestCaseOperation1 == nil { - opInputService3TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - } - - if input == nil { - input = &InputService3TestShapeInputShape{} - } - - req = c.newRequest(opInputService3TestCaseOperation1, input, output) - output = &InputService3TestShapeInputService3TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService3ProtocolTest) InputService3TestCaseOperation1(input *InputService3TestShapeInputShape) (output *InputService3TestShapeInputService3TestCaseOperation1Output, err error) { - req, out := c.InputService3TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService3TestCaseOperation1 *aws.Operation - -type InputService3TestShapeInputService3TestCaseOperation1Output struct { - metadataInputService3TestShapeInputService3TestCaseOperation1Output `json:"-", xml:"-"` -} - -type metadataInputService3TestShapeInputService3TestCaseOperation1Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService3TestShapeInputShape struct { - Description *string `type:"string"` - - SubStructure *InputService3TestShapeSubStructure `type:"structure"` - - metadataInputService3TestShapeInputShape `json:"-", xml:"-"` -} - -type metadataInputService3TestShapeInputShape struct { - SDKShapeTraits bool `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` -} - -type InputService3TestShapeSubStructure struct { - Bar *string `type:"string"` - - Foo *string `type:"string"` - - metadataInputService3TestShapeSubStructure `json:"-", xml:"-"` -} - -type metadataInputService3TestShapeSubStructure struct { - SDKShapeTraits bool `type:"structure"` -} - -// InputService4ProtocolTest is a client for InputService4ProtocolTest. -type InputService4ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService4ProtocolTest client. -func NewInputService4ProtocolTest(config *aws.Config) *InputService4ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - 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(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.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 -} - -// InputService4TestCaseOperation1Request generates a request for the InputService4TestCaseOperation1 operation. -func (c *InputService4ProtocolTest) InputService4TestCaseOperation1Request(input *InputService4TestShapeInputShape) (req *aws.Request, output *InputService4TestShapeInputService4TestCaseOperation1Output) { - - if opInputService4TestCaseOperation1 == nil { - opInputService4TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - } - - if input == nil { - input = &InputService4TestShapeInputShape{} - } - - req = c.newRequest(opInputService4TestCaseOperation1, input, output) - output = &InputService4TestShapeInputService4TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService4ProtocolTest) InputService4TestCaseOperation1(input *InputService4TestShapeInputShape) (output *InputService4TestShapeInputService4TestCaseOperation1Output, err error) { - req, out := c.InputService4TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService4TestCaseOperation1 *aws.Operation - -type InputService4TestShapeInputService4TestCaseOperation1Output struct { - metadataInputService4TestShapeInputService4TestCaseOperation1Output `json:"-", xml:"-"` -} - -type metadataInputService4TestShapeInputService4TestCaseOperation1Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService4TestShapeInputShape struct { - Description *string `type:"string"` - - SubStructure *InputService4TestShapeSubStructure `type:"structure"` - - metadataInputService4TestShapeInputShape `json:"-", xml:"-"` -} - -type metadataInputService4TestShapeInputShape struct { - SDKShapeTraits bool `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` -} - -type InputService4TestShapeSubStructure struct { - Bar *string `type:"string"` - - Foo *string `type:"string"` - - metadataInputService4TestShapeSubStructure `json:"-", xml:"-"` -} - -type metadataInputService4TestShapeSubStructure struct { - SDKShapeTraits bool `type:"structure"` -} - -// InputService5ProtocolTest is a client for InputService5ProtocolTest. -type InputService5ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService5ProtocolTest client. -func NewInputService5ProtocolTest(config *aws.Config) *InputService5ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - 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(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.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 -} - -// InputService5TestCaseOperation1Request generates a request for the InputService5TestCaseOperation1 operation. -func (c *InputService5ProtocolTest) InputService5TestCaseOperation1Request(input *InputService5TestShapeInputShape) (req *aws.Request, output *InputService5TestShapeInputService5TestCaseOperation1Output) { - - if opInputService5TestCaseOperation1 == nil { - opInputService5TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - } - - if input == nil { - input = &InputService5TestShapeInputShape{} - } - - req = c.newRequest(opInputService5TestCaseOperation1, input, output) - output = &InputService5TestShapeInputService5TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService5ProtocolTest) InputService5TestCaseOperation1(input *InputService5TestShapeInputShape) (output *InputService5TestShapeInputService5TestCaseOperation1Output, err error) { - req, out := c.InputService5TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService5TestCaseOperation1 *aws.Operation - -type InputService5TestShapeInputService5TestCaseOperation1Output struct { - metadataInputService5TestShapeInputService5TestCaseOperation1Output `json:"-", xml:"-"` -} - -type metadataInputService5TestShapeInputService5TestCaseOperation1Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService5TestShapeInputShape struct { - ListParam []*string `type:"list"` - - metadataInputService5TestShapeInputShape `json:"-", xml:"-"` -} - -type metadataInputService5TestShapeInputShape struct { - SDKShapeTraits bool `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` -} - -// InputService6ProtocolTest is a client for InputService6ProtocolTest. -type InputService6ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService6ProtocolTest client. -func NewInputService6ProtocolTest(config *aws.Config) *InputService6ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - 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(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.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 -} - -// InputService6TestCaseOperation1Request generates a request for the InputService6TestCaseOperation1 operation. -func (c *InputService6ProtocolTest) InputService6TestCaseOperation1Request(input *InputService6TestShapeInputShape) (req *aws.Request, output *InputService6TestShapeInputService6TestCaseOperation1Output) { - - if opInputService6TestCaseOperation1 == nil { - opInputService6TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - } - - if input == nil { - input = &InputService6TestShapeInputShape{} - } - - req = c.newRequest(opInputService6TestCaseOperation1, input, output) - output = &InputService6TestShapeInputService6TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService6ProtocolTest) InputService6TestCaseOperation1(input *InputService6TestShapeInputShape) (output *InputService6TestShapeInputService6TestCaseOperation1Output, err error) { - req, out := c.InputService6TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService6TestCaseOperation1 *aws.Operation - -type InputService6TestShapeInputService6TestCaseOperation1Output struct { - metadataInputService6TestShapeInputService6TestCaseOperation1Output `json:"-", xml:"-"` -} - -type metadataInputService6TestShapeInputService6TestCaseOperation1Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService6TestShapeInputShape struct { - ListParam []*string `locationName:"AlternateName" locationNameList:"NotMember" type:"list"` - - metadataInputService6TestShapeInputShape `json:"-", xml:"-"` -} - -type metadataInputService6TestShapeInputShape struct { - SDKShapeTraits bool `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` -} - -// InputService7ProtocolTest is a client for InputService7ProtocolTest. -type InputService7ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService7ProtocolTest client. -func NewInputService7ProtocolTest(config *aws.Config) *InputService7ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - 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(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.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 -} - -// InputService7TestCaseOperation1Request generates a request for the InputService7TestCaseOperation1 operation. -func (c *InputService7ProtocolTest) InputService7TestCaseOperation1Request(input *InputService7TestShapeInputShape) (req *aws.Request, output *InputService7TestShapeInputService7TestCaseOperation1Output) { - - if opInputService7TestCaseOperation1 == nil { - opInputService7TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - } - - if input == nil { - input = &InputService7TestShapeInputShape{} - } - - req = c.newRequest(opInputService7TestCaseOperation1, input, output) - output = &InputService7TestShapeInputService7TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService7ProtocolTest) InputService7TestCaseOperation1(input *InputService7TestShapeInputShape) (output *InputService7TestShapeInputService7TestCaseOperation1Output, err error) { - req, out := c.InputService7TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService7TestCaseOperation1 *aws.Operation - -type InputService7TestShapeInputService7TestCaseOperation1Output struct { - metadataInputService7TestShapeInputService7TestCaseOperation1Output `json:"-", xml:"-"` -} - -type metadataInputService7TestShapeInputService7TestCaseOperation1Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService7TestShapeInputShape struct { - ListParam []*string `type:"list" flattened:"true"` - - metadataInputService7TestShapeInputShape `json:"-", xml:"-"` -} - -type metadataInputService7TestShapeInputShape struct { - SDKShapeTraits bool `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` -} - -// InputService8ProtocolTest is a client for InputService8ProtocolTest. -type InputService8ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService8ProtocolTest client. -func NewInputService8ProtocolTest(config *aws.Config) *InputService8ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - 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(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.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 -} - -// InputService8TestCaseOperation1Request generates a request for the InputService8TestCaseOperation1 operation. -func (c *InputService8ProtocolTest) InputService8TestCaseOperation1Request(input *InputService8TestShapeInputShape) (req *aws.Request, output *InputService8TestShapeInputService8TestCaseOperation1Output) { - - if opInputService8TestCaseOperation1 == nil { - opInputService8TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - } - - if input == nil { - input = &InputService8TestShapeInputShape{} - } - - req = c.newRequest(opInputService8TestCaseOperation1, input, output) - output = &InputService8TestShapeInputService8TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService8ProtocolTest) InputService8TestCaseOperation1(input *InputService8TestShapeInputShape) (output *InputService8TestShapeInputService8TestCaseOperation1Output, err error) { - req, out := c.InputService8TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService8TestCaseOperation1 *aws.Operation - -type InputService8TestShapeInputService8TestCaseOperation1Output struct { - metadataInputService8TestShapeInputService8TestCaseOperation1Output `json:"-", xml:"-"` -} - -type metadataInputService8TestShapeInputService8TestCaseOperation1Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService8TestShapeInputShape struct { - ListParam []*string `locationName:"item" type:"list" flattened:"true"` - - metadataInputService8TestShapeInputShape `json:"-", xml:"-"` -} - -type metadataInputService8TestShapeInputShape struct { - SDKShapeTraits bool `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` -} - -// InputService9ProtocolTest is a client for InputService9ProtocolTest. -type InputService9ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService9ProtocolTest client. -func NewInputService9ProtocolTest(config *aws.Config) *InputService9ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "inputservice9protocoltest", - APIVersion: "2014-01-01", - } - service.Initialize() - - // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return &InputService9ProtocolTest{service} -} - -// newRequest creates a new request for a InputService9ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService9ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { - req := aws.NewRequest(c.Service, op, params, data) - - return req -} - -// InputService9TestCaseOperation1Request generates a request for the InputService9TestCaseOperation1 operation. -func (c *InputService9ProtocolTest) InputService9TestCaseOperation1Request(input *InputService9TestShapeInputShape) (req *aws.Request, output *InputService9TestShapeInputService9TestCaseOperation1Output) { - - if opInputService9TestCaseOperation1 == nil { - opInputService9TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - } - - if input == nil { - input = &InputService9TestShapeInputShape{} - } - - req = c.newRequest(opInputService9TestCaseOperation1, input, output) - output = &InputService9TestShapeInputService9TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService9ProtocolTest) InputService9TestCaseOperation1(input *InputService9TestShapeInputShape) (output *InputService9TestShapeInputService9TestCaseOperation1Output, err error) { - req, out := c.InputService9TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService9TestCaseOperation1 *aws.Operation - -type InputService9TestShapeInputService9TestCaseOperation1Output struct { - metadataInputService9TestShapeInputService9TestCaseOperation1Output `json:"-", xml:"-"` -} - -type metadataInputService9TestShapeInputService9TestCaseOperation1Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService9TestShapeInputShape struct { - ListParam []*InputService9TestShapeSingleFieldStruct `locationName:"item" type:"list" flattened:"true"` - - metadataInputService9TestShapeInputShape `json:"-", xml:"-"` -} - -type metadataInputService9TestShapeInputShape struct { - SDKShapeTraits bool `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` -} - -type InputService9TestShapeSingleFieldStruct struct { - Element *string `locationName:"value" type:"string"` - - metadataInputService9TestShapeSingleFieldStruct `json:"-", xml:"-"` -} - -type metadataInputService9TestShapeSingleFieldStruct struct { - SDKShapeTraits bool `type:"structure"` -} - -// InputService10ProtocolTest is a client for InputService10ProtocolTest. -type InputService10ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService10ProtocolTest client. -func NewInputService10ProtocolTest(config *aws.Config) *InputService10ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "inputservice10protocoltest", - APIVersion: "2014-01-01", - } - service.Initialize() - - // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return &InputService10ProtocolTest{service} -} - -// newRequest creates a new request for a InputService10ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService10ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { - req := aws.NewRequest(c.Service, op, params, data) - - return req -} - -// InputService10TestCaseOperation1Request generates a request for the InputService10TestCaseOperation1 operation. -func (c *InputService10ProtocolTest) InputService10TestCaseOperation1Request(input *InputService10TestShapeInputShape) (req *aws.Request, output *InputService10TestShapeInputService10TestCaseOperation1Output) { - - if opInputService10TestCaseOperation1 == nil { - opInputService10TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - } - - if input == nil { - input = &InputService10TestShapeInputShape{} - } - - req = c.newRequest(opInputService10TestCaseOperation1, input, output) - output = &InputService10TestShapeInputService10TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService10ProtocolTest) InputService10TestCaseOperation1(input *InputService10TestShapeInputShape) (output *InputService10TestShapeInputService10TestCaseOperation1Output, err error) { - req, out := c.InputService10TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService10TestCaseOperation1 *aws.Operation - -type InputService10TestShapeInputService10TestCaseOperation1Output struct { - metadataInputService10TestShapeInputService10TestCaseOperation1Output `json:"-", xml:"-"` -} - -type metadataInputService10TestShapeInputService10TestCaseOperation1Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService10TestShapeInputShape struct { - StructureParam *InputService10TestShapeStructureShape `type:"structure"` - - metadataInputService10TestShapeInputShape `json:"-", xml:"-"` -} - -type metadataInputService10TestShapeInputShape struct { - SDKShapeTraits bool `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` -} - -type InputService10TestShapeStructureShape struct { - B []byte `locationName:"b" type:"blob"` - - T *time.Time `locationName:"t" type:"timestamp" timestampFormat:"iso8601"` - - metadataInputService10TestShapeStructureShape `json:"-", xml:"-"` -} - -type metadataInputService10TestShapeStructureShape struct { - SDKShapeTraits bool `type:"structure"` -} - -// InputService11ProtocolTest is a client for InputService11ProtocolTest. -type InputService11ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService11ProtocolTest client. -func NewInputService11ProtocolTest(config *aws.Config) *InputService11ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "inputservice11protocoltest", - APIVersion: "2014-01-01", - } - service.Initialize() - - // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return &InputService11ProtocolTest{service} -} - -// newRequest creates a new request for a InputService11ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService11ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { - req := aws.NewRequest(c.Service, op, params, data) - - return req -} - -// InputService11TestCaseOperation1Request generates a request for the InputService11TestCaseOperation1 operation. -func (c *InputService11ProtocolTest) InputService11TestCaseOperation1Request(input *InputService11TestShapeInputShape) (req *aws.Request, output *InputService11TestShapeInputService11TestCaseOperation1Output) { - - if opInputService11TestCaseOperation1 == nil { - opInputService11TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "POST", - HTTPPath: "/", - } - } - - if input == nil { - input = &InputService11TestShapeInputShape{} - } - - req = c.newRequest(opInputService11TestCaseOperation1, input, output) - output = &InputService11TestShapeInputService11TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService11ProtocolTest) InputService11TestCaseOperation1(input *InputService11TestShapeInputShape) (output *InputService11TestShapeInputService11TestCaseOperation1Output, err error) { - req, out := c.InputService11TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService11TestCaseOperation1 *aws.Operation - -type InputService11TestShapeInputService11TestCaseOperation1Output struct { - metadataInputService11TestShapeInputService11TestCaseOperation1Output `json:"-", xml:"-"` -} - -type metadataInputService11TestShapeInputService11TestCaseOperation1Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService11TestShapeInputShape struct { - Foo *map[string]*string `location:"headers" locationName:"x-foo-" type:"map"` - - metadataInputService11TestShapeInputShape `json:"-", xml:"-"` -} - -type metadataInputService11TestShapeInputShape struct { - SDKShapeTraits bool `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` -} - -// InputService12ProtocolTest is a client for InputService12ProtocolTest. -type InputService12ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService12ProtocolTest client. -func NewInputService12ProtocolTest(config *aws.Config) *InputService12ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "inputservice12protocoltest", - APIVersion: "2014-01-01", - } - service.Initialize() - - // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return &InputService12ProtocolTest{service} -} - -// newRequest creates a new request for a InputService12ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService12ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { - req := aws.NewRequest(c.Service, op, params, data) - - return req -} - -// InputService12TestCaseOperation1Request generates a request for the InputService12TestCaseOperation1 operation. -func (c *InputService12ProtocolTest) InputService12TestCaseOperation1Request(input *InputService12TestShapeInputShape) (req *aws.Request, output *InputService12TestShapeInputService12TestCaseOperation1Output) { - - if opInputService12TestCaseOperation1 == nil { - opInputService12TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "POST", - HTTPPath: "/", - } - } - - if input == nil { - input = &InputService12TestShapeInputShape{} - } - - req = c.newRequest(opInputService12TestCaseOperation1, input, output) - output = &InputService12TestShapeInputService12TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService12ProtocolTest) InputService12TestCaseOperation1(input *InputService12TestShapeInputShape) (output *InputService12TestShapeInputService12TestCaseOperation1Output, err error) { - req, out := c.InputService12TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService12TestCaseOperation1 *aws.Operation - -type InputService12TestShapeInputService12TestCaseOperation1Output struct { - metadataInputService12TestShapeInputService12TestCaseOperation1Output `json:"-", xml:"-"` -} - -type metadataInputService12TestShapeInputService12TestCaseOperation1Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService12TestShapeInputShape struct { - Foo *string `locationName:"foo" type:"string"` - - metadataInputService12TestShapeInputShape `json:"-", xml:"-"` -} - -type metadataInputService12TestShapeInputShape struct { - SDKShapeTraits bool `type:"structure" payload:"Foo"` -} - -// InputService13ProtocolTest is a client for InputService13ProtocolTest. -type InputService13ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService13ProtocolTest client. -func NewInputService13ProtocolTest(config *aws.Config) *InputService13ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "inputservice13protocoltest", - APIVersion: "2014-01-01", - } - service.Initialize() - - // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return &InputService13ProtocolTest{service} -} - -// newRequest creates a new request for a InputService13ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService13ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { - req := aws.NewRequest(c.Service, op, params, data) - - return req -} - -// InputService13TestCaseOperation1Request generates a request for the InputService13TestCaseOperation1 operation. -func (c *InputService13ProtocolTest) InputService13TestCaseOperation1Request(input *InputService13TestShapeInputShape) (req *aws.Request, output *InputService13TestShapeInputService13TestCaseOperation1Output) { - - if opInputService13TestCaseOperation1 == nil { - opInputService13TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "POST", - HTTPPath: "/", - } - } - - if input == nil { - input = &InputService13TestShapeInputShape{} - } - - req = c.newRequest(opInputService13TestCaseOperation1, input, output) - output = &InputService13TestShapeInputService13TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService13ProtocolTest) InputService13TestCaseOperation1(input *InputService13TestShapeInputShape) (output *InputService13TestShapeInputService13TestCaseOperation1Output, err error) { - req, out := c.InputService13TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService13TestCaseOperation1 *aws.Operation - -// InputService13TestCaseOperation2Request generates a request for the InputService13TestCaseOperation2 operation. -func (c *InputService13ProtocolTest) InputService13TestCaseOperation2Request(input *InputService13TestShapeInputShape) (req *aws.Request, output *InputService13TestShapeInputService13TestCaseOperation2Output) { - - if opInputService13TestCaseOperation2 == nil { - opInputService13TestCaseOperation2 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "POST", - HTTPPath: "/", - } - } - - if input == nil { - input = &InputService13TestShapeInputShape{} - } - - req = c.newRequest(opInputService13TestCaseOperation2, input, output) - output = &InputService13TestShapeInputService13TestCaseOperation2Output{} - req.Data = output - return -} - -func (c *InputService13ProtocolTest) InputService13TestCaseOperation2(input *InputService13TestShapeInputShape) (output *InputService13TestShapeInputService13TestCaseOperation2Output, err error) { - req, out := c.InputService13TestCaseOperation2Request(input) - output = out - err = req.Send() - return -} - -var opInputService13TestCaseOperation2 *aws.Operation - -type InputService13TestShapeInputService13TestCaseOperation1Output struct { - metadataInputService13TestShapeInputService13TestCaseOperation1Output `json:"-", xml:"-"` -} - -type metadataInputService13TestShapeInputService13TestCaseOperation1Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService13TestShapeInputService13TestCaseOperation2Output struct { - metadataInputService13TestShapeInputService13TestCaseOperation2Output `json:"-", xml:"-"` -} - -type metadataInputService13TestShapeInputService13TestCaseOperation2Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService13TestShapeInputShape struct { - Foo []byte `locationName:"foo" type:"blob"` - - metadataInputService13TestShapeInputShape `json:"-", xml:"-"` -} - -type metadataInputService13TestShapeInputShape struct { - SDKShapeTraits bool `type:"structure" payload:"Foo"` -} - -// InputService14ProtocolTest is a client for InputService14ProtocolTest. -type InputService14ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService14ProtocolTest client. -func NewInputService14ProtocolTest(config *aws.Config) *InputService14ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "inputservice14protocoltest", - APIVersion: "2014-01-01", - } - service.Initialize() - - // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return &InputService14ProtocolTest{service} -} - -// newRequest creates a new request for a InputService14ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService14ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { - req := aws.NewRequest(c.Service, op, params, data) - - return req -} - -// InputService14TestCaseOperation1Request generates a request for the InputService14TestCaseOperation1 operation. -func (c *InputService14ProtocolTest) InputService14TestCaseOperation1Request(input *InputService14TestShapeInputShape) (req *aws.Request, output *InputService14TestShapeInputService14TestCaseOperation1Output) { - - if opInputService14TestCaseOperation1 == nil { - opInputService14TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "POST", - HTTPPath: "/", - } - } - - if input == nil { - input = &InputService14TestShapeInputShape{} - } - - req = c.newRequest(opInputService14TestCaseOperation1, input, output) - output = &InputService14TestShapeInputService14TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService14ProtocolTest) InputService14TestCaseOperation1(input *InputService14TestShapeInputShape) (output *InputService14TestShapeInputService14TestCaseOperation1Output, err error) { - req, out := c.InputService14TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService14TestCaseOperation1 *aws.Operation - -// InputService14TestCaseOperation2Request generates a request for the InputService14TestCaseOperation2 operation. -func (c *InputService14ProtocolTest) InputService14TestCaseOperation2Request(input *InputService14TestShapeInputShape) (req *aws.Request, output *InputService14TestShapeInputService14TestCaseOperation2Output) { - - if opInputService14TestCaseOperation2 == nil { - opInputService14TestCaseOperation2 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "POST", - HTTPPath: "/", - } - } - - if input == nil { - input = &InputService14TestShapeInputShape{} - } - - req = c.newRequest(opInputService14TestCaseOperation2, input, output) - output = &InputService14TestShapeInputService14TestCaseOperation2Output{} - req.Data = output - return -} - -func (c *InputService14ProtocolTest) InputService14TestCaseOperation2(input *InputService14TestShapeInputShape) (output *InputService14TestShapeInputService14TestCaseOperation2Output, err error) { - req, out := c.InputService14TestCaseOperation2Request(input) - output = out - err = req.Send() - return -} - -var opInputService14TestCaseOperation2 *aws.Operation - -type InputService14TestShapeFooShape struct { - Baz *string `locationName:"baz" type:"string"` - - metadataInputService14TestShapeFooShape `json:"-", xml:"-"` -} - -type metadataInputService14TestShapeFooShape struct { - SDKShapeTraits bool `locationName:"foo" type:"structure"` -} - -type InputService14TestShapeInputService14TestCaseOperation1Output struct { - metadataInputService14TestShapeInputService14TestCaseOperation1Output `json:"-", xml:"-"` -} - -type metadataInputService14TestShapeInputService14TestCaseOperation1Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService14TestShapeInputService14TestCaseOperation2Output struct { - metadataInputService14TestShapeInputService14TestCaseOperation2Output `json:"-", xml:"-"` -} - -type metadataInputService14TestShapeInputService14TestCaseOperation2Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService14TestShapeInputShape struct { - Foo *InputService14TestShapeFooShape `locationName:"foo" type:"structure"` - - metadataInputService14TestShapeInputShape `json:"-", xml:"-"` -} - -type metadataInputService14TestShapeInputShape struct { - SDKShapeTraits bool `type:"structure" payload:"Foo"` -} - -// InputService15ProtocolTest is a client for InputService15ProtocolTest. -type InputService15ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService15ProtocolTest client. -func NewInputService15ProtocolTest(config *aws.Config) *InputService15ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "inputservice15protocoltest", - APIVersion: "2014-01-01", - } - service.Initialize() - - // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return &InputService15ProtocolTest{service} -} - -// newRequest creates a new request for a InputService15ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService15ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { - req := aws.NewRequest(c.Service, op, params, data) - - return req -} - -// InputService15TestCaseOperation1Request generates a request for the InputService15TestCaseOperation1 operation. -func (c *InputService15ProtocolTest) InputService15TestCaseOperation1Request(input *InputService15TestShapeInputShape) (req *aws.Request, output *InputService15TestShapeInputService15TestCaseOperation1Output) { - - if opInputService15TestCaseOperation1 == nil { - opInputService15TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "POST", - HTTPPath: "/", - } - } - - if input == nil { - input = &InputService15TestShapeInputShape{} - } - - req = c.newRequest(opInputService15TestCaseOperation1, input, output) - output = &InputService15TestShapeInputService15TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService15ProtocolTest) InputService15TestCaseOperation1(input *InputService15TestShapeInputShape) (output *InputService15TestShapeInputService15TestCaseOperation1Output, err error) { - req, out := c.InputService15TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService15TestCaseOperation1 *aws.Operation - -type InputService15TestShapeGrant struct { - Grantee *InputService15TestShapeGrantee `type:"structure"` - - metadataInputService15TestShapeGrant `json:"-", xml:"-"` -} - -type metadataInputService15TestShapeGrant struct { - SDKShapeTraits bool `locationName:"Grant" type:"structure"` -} - -type InputService15TestShapeGrantee struct { - EmailAddress *string `type:"string"` - - Type *string `locationName:"xsi:type" type:"string" xmlAttribute:"true"` - - metadataInputService15TestShapeGrantee `json:"-", xml:"-"` -} - -type metadataInputService15TestShapeGrantee struct { - SDKShapeTraits bool `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"` -} - -type InputService15TestShapeInputService15TestCaseOperation1Output struct { - metadataInputService15TestShapeInputService15TestCaseOperation1Output `json:"-", xml:"-"` -} - -type metadataInputService15TestShapeInputService15TestCaseOperation1Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService15TestShapeInputShape struct { - Grant *InputService15TestShapeGrant `locationName:"Grant" type:"structure"` - - metadataInputService15TestShapeInputShape `json:"-", xml:"-"` -} - -type metadataInputService15TestShapeInputShape struct { - SDKShapeTraits bool `type:"structure" payload:"Grant"` -} - -// InputService16ProtocolTest is a client for InputService16ProtocolTest. -type InputService16ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService16ProtocolTest client. -func NewInputService16ProtocolTest(config *aws.Config) *InputService16ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "inputservice16protocoltest", - APIVersion: "2014-01-01", - } - service.Initialize() - - // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return &InputService16ProtocolTest{service} -} - -// newRequest creates a new request for a InputService16ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService16ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { - req := aws.NewRequest(c.Service, op, params, data) - - return req -} - -// InputService16TestCaseOperation1Request generates a request for the InputService16TestCaseOperation1 operation. -func (c *InputService16ProtocolTest) InputService16TestCaseOperation1Request(input *InputService16TestShapeInputShape) (req *aws.Request, output *InputService16TestShapeInputService16TestCaseOperation1Output) { - - if opInputService16TestCaseOperation1 == nil { - opInputService16TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "GET", - HTTPPath: "/{Bucket}/{Key+}", - } - } - - if input == nil { - input = &InputService16TestShapeInputShape{} - } - - req = c.newRequest(opInputService16TestCaseOperation1, input, output) - output = &InputService16TestShapeInputService16TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService16ProtocolTest) InputService16TestCaseOperation1(input *InputService16TestShapeInputShape) (output *InputService16TestShapeInputService16TestCaseOperation1Output, err error) { - req, out := c.InputService16TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService16TestCaseOperation1 *aws.Operation - -type InputService16TestShapeInputService16TestCaseOperation1Output struct { - metadataInputService16TestShapeInputService16TestCaseOperation1Output `json:"-", xml:"-"` -} - -type metadataInputService16TestShapeInputService16TestCaseOperation1Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService16TestShapeInputShape struct { - Bucket *string `location:"uri" type:"string"` - - Key *string `location:"uri" type:"string"` - - metadataInputService16TestShapeInputShape `json:"-", xml:"-"` -} - -type metadataInputService16TestShapeInputShape struct { - SDKShapeTraits bool `type:"structure"` -} - -// InputService17ProtocolTest is a client for InputService17ProtocolTest. -type InputService17ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService17ProtocolTest client. -func NewInputService17ProtocolTest(config *aws.Config) *InputService17ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "inputservice17protocoltest", - APIVersion: "2014-01-01", - } - service.Initialize() - - // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return &InputService17ProtocolTest{service} -} - -// newRequest creates a new request for a InputService17ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService17ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { - req := aws.NewRequest(c.Service, op, params, data) - - return req -} - -// InputService17TestCaseOperation1Request generates a request for the InputService17TestCaseOperation1 operation. -func (c *InputService17ProtocolTest) InputService17TestCaseOperation1Request(input *InputService17TestShapeInputShape) (req *aws.Request, output *InputService17TestShapeInputService17TestCaseOperation1Output) { - - if opInputService17TestCaseOperation1 == nil { - opInputService17TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "POST", - HTTPPath: "/path", - } - } - - if input == nil { - input = &InputService17TestShapeInputShape{} - } - - req = c.newRequest(opInputService17TestCaseOperation1, input, output) - output = &InputService17TestShapeInputService17TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService17ProtocolTest) InputService17TestCaseOperation1(input *InputService17TestShapeInputShape) (output *InputService17TestShapeInputService17TestCaseOperation1Output, err error) { - req, out := c.InputService17TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService17TestCaseOperation1 *aws.Operation - -// InputService17TestCaseOperation2Request generates a request for the InputService17TestCaseOperation2 operation. -func (c *InputService17ProtocolTest) InputService17TestCaseOperation2Request(input *InputService17TestShapeInputShape) (req *aws.Request, output *InputService17TestShapeInputService17TestCaseOperation2Output) { - - if opInputService17TestCaseOperation2 == nil { - opInputService17TestCaseOperation2 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "POST", - HTTPPath: "/path?abc=mno", - } - } - - if input == nil { - input = &InputService17TestShapeInputShape{} - } - - req = c.newRequest(opInputService17TestCaseOperation2, input, output) - output = &InputService17TestShapeInputService17TestCaseOperation2Output{} - req.Data = output - return -} - -func (c *InputService17ProtocolTest) InputService17TestCaseOperation2(input *InputService17TestShapeInputShape) (output *InputService17TestShapeInputService17TestCaseOperation2Output, err error) { - req, out := c.InputService17TestCaseOperation2Request(input) - output = out - err = req.Send() - return -} - -var opInputService17TestCaseOperation2 *aws.Operation - -type InputService17TestShapeInputService17TestCaseOperation1Output struct { - metadataInputService17TestShapeInputService17TestCaseOperation1Output `json:"-", xml:"-"` -} - -type metadataInputService17TestShapeInputService17TestCaseOperation1Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService17TestShapeInputService17TestCaseOperation2Output struct { - metadataInputService17TestShapeInputService17TestCaseOperation2Output `json:"-", xml:"-"` -} - -type metadataInputService17TestShapeInputService17TestCaseOperation2Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService17TestShapeInputShape struct { - Foo *string `location:"querystring" locationName:"param-name" type:"string"` - - metadataInputService17TestShapeInputShape `json:"-", xml:"-"` -} - -type metadataInputService17TestShapeInputShape struct { - SDKShapeTraits bool `type:"structure"` -} - -// InputService18ProtocolTest is a client for InputService18ProtocolTest. -type InputService18ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService18ProtocolTest client. -func NewInputService18ProtocolTest(config *aws.Config) *InputService18ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "inputservice18protocoltest", - APIVersion: "2014-01-01", - } - service.Initialize() - - // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return &InputService18ProtocolTest{service} -} - -// newRequest creates a new request for a InputService18ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService18ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { - req := aws.NewRequest(c.Service, op, params, data) - - return req -} - -// InputService18TestCaseOperation1Request generates a request for the InputService18TestCaseOperation1 operation. -func (c *InputService18ProtocolTest) InputService18TestCaseOperation1Request(input *InputService18TestShapeInputShape) (req *aws.Request, output *InputService18TestShapeInputService18TestCaseOperation1Output) { - - if opInputService18TestCaseOperation1 == nil { - opInputService18TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "POST", - HTTPPath: "/path", - } - } - - if input == nil { - input = &InputService18TestShapeInputShape{} - } - - req = c.newRequest(opInputService18TestCaseOperation1, input, output) - output = &InputService18TestShapeInputService18TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService18ProtocolTest) InputService18TestCaseOperation1(input *InputService18TestShapeInputShape) (output *InputService18TestShapeInputService18TestCaseOperation1Output, err error) { - req, out := c.InputService18TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService18TestCaseOperation1 *aws.Operation - -// InputService18TestCaseOperation2Request generates a request for the InputService18TestCaseOperation2 operation. -func (c *InputService18ProtocolTest) InputService18TestCaseOperation2Request(input *InputService18TestShapeInputShape) (req *aws.Request, output *InputService18TestShapeInputService18TestCaseOperation2Output) { - - if opInputService18TestCaseOperation2 == nil { - opInputService18TestCaseOperation2 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "POST", - HTTPPath: "/path", - } - } - - if input == nil { - input = &InputService18TestShapeInputShape{} - } - - req = c.newRequest(opInputService18TestCaseOperation2, input, output) - output = &InputService18TestShapeInputService18TestCaseOperation2Output{} - req.Data = output - return -} - -func (c *InputService18ProtocolTest) InputService18TestCaseOperation2(input *InputService18TestShapeInputShape) (output *InputService18TestShapeInputService18TestCaseOperation2Output, err error) { - req, out := c.InputService18TestCaseOperation2Request(input) - output = out - err = req.Send() - return -} - -var opInputService18TestCaseOperation2 *aws.Operation - -// InputService18TestCaseOperation3Request generates a request for the InputService18TestCaseOperation3 operation. -func (c *InputService18ProtocolTest) InputService18TestCaseOperation3Request(input *InputService18TestShapeInputShape) (req *aws.Request, output *InputService18TestShapeInputService18TestShapeInputService18TestCaseOperation3Output) { - - if opInputService18TestCaseOperation3 == nil { - opInputService18TestCaseOperation3 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "POST", - HTTPPath: "/path", - } - } - - if input == nil { - input = &InputService18TestShapeInputShape{} - } - - req = c.newRequest(opInputService18TestCaseOperation3, input, output) - output = &InputService18TestShapeInputService18TestShapeInputService18TestCaseOperation3Output{} - req.Data = output - return -} - -func (c *InputService18ProtocolTest) InputService18TestCaseOperation3(input *InputService18TestShapeInputShape) (output *InputService18TestShapeInputService18TestShapeInputService18TestCaseOperation3Output, err error) { - req, out := c.InputService18TestCaseOperation3Request(input) - output = out - err = req.Send() - return -} - -var opInputService18TestCaseOperation3 *aws.Operation - -// InputService18TestCaseOperation4Request generates a request for the InputService18TestCaseOperation4 operation. -func (c *InputService18ProtocolTest) InputService18TestCaseOperation4Request(input *InputService18TestShapeInputShape) (req *aws.Request, output *InputService18TestShapeInputService18TestShapeInputService18TestCaseOperation4Output) { - - if opInputService18TestCaseOperation4 == nil { - opInputService18TestCaseOperation4 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "POST", - HTTPPath: "/path", - } - } - - if input == nil { - input = &InputService18TestShapeInputShape{} - } - - req = c.newRequest(opInputService18TestCaseOperation4, input, output) - output = &InputService18TestShapeInputService18TestShapeInputService18TestCaseOperation4Output{} - req.Data = output - return -} - -func (c *InputService18ProtocolTest) InputService18TestCaseOperation4(input *InputService18TestShapeInputShape) (output *InputService18TestShapeInputService18TestShapeInputService18TestCaseOperation4Output, err error) { - req, out := c.InputService18TestCaseOperation4Request(input) - output = out - err = req.Send() - return -} - -var opInputService18TestCaseOperation4 *aws.Operation - -// InputService18TestCaseOperation5Request generates a request for the InputService18TestCaseOperation5 operation. -func (c *InputService18ProtocolTest) InputService18TestCaseOperation5Request(input *InputService18TestShapeInputShape) (req *aws.Request, output *InputService18TestShapeInputService18TestCaseOperation5Output) { - - if opInputService18TestCaseOperation5 == nil { - opInputService18TestCaseOperation5 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "POST", - HTTPPath: "/path", - } - } - - if input == nil { - input = &InputService18TestShapeInputShape{} - } - - req = c.newRequest(opInputService18TestCaseOperation5, input, output) - output = &InputService18TestShapeInputService18TestCaseOperation5Output{} - req.Data = output - return -} - -func (c *InputService18ProtocolTest) InputService18TestCaseOperation5(input *InputService18TestShapeInputShape) (output *InputService18TestShapeInputService18TestCaseOperation5Output, err error) { - req, out := c.InputService18TestCaseOperation5Request(input) - output = out - err = req.Send() - return -} - -var opInputService18TestCaseOperation5 *aws.Operation - -// InputService18TestCaseOperation6Request generates a request for the InputService18TestCaseOperation6 operation. -func (c *InputService18ProtocolTest) InputService18TestCaseOperation6Request(input *InputService18TestShapeInputShape) (req *aws.Request, output *InputService18TestShapeInputService18TestCaseOperation6Output) { - - if opInputService18TestCaseOperation6 == nil { - opInputService18TestCaseOperation6 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "POST", - HTTPPath: "/path", - } - } - - if input == nil { - input = &InputService18TestShapeInputShape{} - } - - req = c.newRequest(opInputService18TestCaseOperation6, input, output) - output = &InputService18TestShapeInputService18TestCaseOperation6Output{} - req.Data = output - return -} - -func (c *InputService18ProtocolTest) InputService18TestCaseOperation6(input *InputService18TestShapeInputShape) (output *InputService18TestShapeInputService18TestCaseOperation6Output, err error) { - req, out := c.InputService18TestCaseOperation6Request(input) - output = out - err = req.Send() - return -} - -var opInputService18TestCaseOperation6 *aws.Operation - -type InputService18TestShapeInputService18TestCaseOperation1Output struct { - metadataInputService18TestShapeInputService18TestCaseOperation1Output `json:"-", xml:"-"` -} - -type metadataInputService18TestShapeInputService18TestCaseOperation1Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService18TestShapeInputService18TestCaseOperation2Output struct { - metadataInputService18TestShapeInputService18TestCaseOperation2Output `json:"-", xml:"-"` -} - -type metadataInputService18TestShapeInputService18TestCaseOperation2Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService18TestShapeInputService18TestCaseOperation5Output struct { - metadataInputService18TestShapeInputService18TestCaseOperation5Output `json:"-", xml:"-"` -} - -type metadataInputService18TestShapeInputService18TestCaseOperation5Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService18TestShapeInputService18TestCaseOperation6Output struct { - metadataInputService18TestShapeInputService18TestCaseOperation6Output `json:"-", xml:"-"` -} - -type metadataInputService18TestShapeInputService18TestCaseOperation6Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService18TestShapeInputService18TestShapeInputService18TestCaseOperation3Output struct { - metadataInputService18TestShapeInputService18TestShapeInputService18TestCaseOperation3Output `json:"-", xml:"-"` -} - -type metadataInputService18TestShapeInputService18TestShapeInputService18TestCaseOperation3Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService18TestShapeInputService18TestShapeInputService18TestCaseOperation4Output struct { - metadataInputService18TestShapeInputService18TestShapeInputService18TestCaseOperation4Output `json:"-", xml:"-"` -} - -type metadataInputService18TestShapeInputService18TestShapeInputService18TestCaseOperation4Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService18TestShapeInputShape struct { - RecursiveStruct *InputService18TestShapeRecursiveStructType `type:"structure"` - - metadataInputService18TestShapeInputShape `json:"-", xml:"-"` -} - -type metadataInputService18TestShapeInputShape struct { - SDKShapeTraits bool `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` -} - -type InputService18TestShapeRecursiveStructType struct { - NoRecurse *string `type:"string"` - - RecursiveList []*InputService18TestShapeRecursiveStructType `type:"list"` - - RecursiveMap *map[string]*InputService18TestShapeRecursiveStructType `type:"map"` - - RecursiveStruct *InputService18TestShapeRecursiveStructType `type:"structure"` - - metadataInputService18TestShapeRecursiveStructType `json:"-", xml:"-"` -} - -type metadataInputService18TestShapeRecursiveStructType struct { - SDKShapeTraits bool `type:"structure"` -} - -// InputService19ProtocolTest is a client for InputService19ProtocolTest. -type InputService19ProtocolTest struct { - *aws.Service -} - -// New returns a new InputService19ProtocolTest client. -func NewInputService19ProtocolTest(config *aws.Config) *InputService19ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "inputservice19protocoltest", - APIVersion: "2014-01-01", - } - service.Initialize() - - // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return &InputService19ProtocolTest{service} -} - -// newRequest creates a new request for a InputService19ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService19ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { - req := aws.NewRequest(c.Service, op, params, data) - - return req -} - -// InputService19TestCaseOperation1Request generates a request for the InputService19TestCaseOperation1 operation. -func (c *InputService19ProtocolTest) InputService19TestCaseOperation1Request(input *InputService19TestShapeInputShape) (req *aws.Request, output *InputService19TestShapeInputService19TestCaseOperation1Output) { - - if opInputService19TestCaseOperation1 == nil { - opInputService19TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - HTTPMethod: "POST", - HTTPPath: "/path", - } - } - - if input == nil { - input = &InputService19TestShapeInputShape{} - } - - req = c.newRequest(opInputService19TestCaseOperation1, input, output) - output = &InputService19TestShapeInputService19TestCaseOperation1Output{} - req.Data = output - return -} - -func (c *InputService19ProtocolTest) InputService19TestCaseOperation1(input *InputService19TestShapeInputShape) (output *InputService19TestShapeInputService19TestCaseOperation1Output, err error) { - req, out := c.InputService19TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opInputService19TestCaseOperation1 *aws.Operation - -type InputService19TestShapeInputService19TestCaseOperation1Output struct { - metadataInputService19TestShapeInputService19TestCaseOperation1Output `json:"-", xml:"-"` -} - -type metadataInputService19TestShapeInputService19TestCaseOperation1Output struct { - SDKShapeTraits bool `type:"structure"` -} - -type InputService19TestShapeInputShape struct { - TimeArgInHeader *time.Time `location:"header" locationName:"x-amz-timearg" type:"timestamp" timestampFormat:"rfc822"` - - metadataInputService19TestShapeInputShape `json:"-", xml:"-"` -} - -type metadataInputService19TestShapeInputShape struct { - SDKShapeTraits bool `type:"structure"` -} - -// -// Tests begin here -// - -func TestInputService1ProtocolTestBasicXMLSerializationCase1(t *testing.T) { - svc := NewInputService1ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService1TestShapeInputShape{ - Description: aws.String("bar"), - Name: aws.String("foo"), - } - req, _ := svc.InputService1TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - assert.Equal(t, util.Trim(`barfoo`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService1ProtocolTestBasicXMLSerializationCase2(t *testing.T) { - svc := NewInputService1ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService1TestShapeInputShape{ - Description: aws.String("bar"), - Name: aws.String("foo"), - } - req, _ := svc.InputService1TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - assert.Equal(t, util.Trim(`barfoo`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService2ProtocolTestSerializeOtherScalarTypesCase1(t *testing.T) { - svc := NewInputService2ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService2TestShapeInputShape{ - First: aws.Boolean(true), - Fourth: aws.Long(3), - Second: aws.Boolean(false), - Third: aws.Double(1.2), - } - req, _ := svc.InputService2TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - assert.Equal(t, util.Trim(`true3false1.2`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService3ProtocolTestNestedStructuresCase1(t *testing.T) { - svc := NewInputService3ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService3TestShapeInputShape{ - Description: aws.String("baz"), - SubStructure: &InputService3TestShapeSubStructure{ - Bar: aws.String("b"), - Foo: aws.String("a"), - }, - } - req, _ := svc.InputService3TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - assert.Equal(t, util.Trim(`bazba`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService4ProtocolTestNestedStructuresCase1(t *testing.T) { - svc := NewInputService4ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService4TestShapeInputShape{ - Description: aws.String("baz"), - SubStructure: &InputService4TestShapeSubStructure{}, - } - req, _ := svc.InputService4TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - assert.Equal(t, util.Trim(`baz`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService5ProtocolTestNonFlattenedListsCase1(t *testing.T) { - svc := NewInputService5ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService5TestShapeInputShape{ - ListParam: []*string{ - aws.String("one"), - aws.String("two"), - aws.String("three"), - }, - } - req, _ := svc.InputService5TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - assert.Equal(t, util.Trim(`onetwothree`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService6ProtocolTestNonFlattenedListsWithLocationNameCase1(t *testing.T) { - svc := NewInputService6ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService6TestShapeInputShape{ - ListParam: []*string{ - aws.String("one"), - aws.String("two"), - aws.String("three"), - }, - } - req, _ := svc.InputService6TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - assert.Equal(t, util.Trim(`onetwothree`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService7ProtocolTestFlattenedListsCase1(t *testing.T) { - svc := NewInputService7ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService7TestShapeInputShape{ - ListParam: []*string{ - aws.String("one"), - aws.String("two"), - aws.String("three"), - }, - } - req, _ := svc.InputService7TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - assert.Equal(t, util.Trim(`onetwothree`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService8ProtocolTestFlattenedListsWithLocationNameCase1(t *testing.T) { - svc := NewInputService8ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService8TestShapeInputShape{ - ListParam: []*string{ - aws.String("one"), - aws.String("two"), - aws.String("three"), - }, - } - req, _ := svc.InputService8TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - assert.Equal(t, util.Trim(`onetwothree`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService9ProtocolTestListOfStructuresCase1(t *testing.T) { - svc := NewInputService9ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService9TestShapeInputShape{ - ListParam: []*InputService9TestShapeSingleFieldStruct{ - { - Element: aws.String("one"), - }, - { - Element: aws.String("two"), - }, - { - Element: aws.String("three"), - }, - }, - } - req, _ := svc.InputService9TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - assert.Equal(t, util.Trim(`onetwothree`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService10ProtocolTestBlobAndTimestampShapesCase1(t *testing.T) { - svc := NewInputService10ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService10TestShapeInputShape{ - StructureParam: &InputService10TestShapeStructureShape{ - B: []byte("foo"), - T: aws.Time(time.Unix(1422172800, 0)), - }, - } - req, _ := svc.InputService10TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - assert.Equal(t, util.Trim(`Zm9v2015-01-25T08:00:00Z`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService11ProtocolTestHeaderMapsCase1(t *testing.T) { - svc := NewInputService11ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService11TestShapeInputShape{ - Foo: &map[string]*string{ - "a": aws.String("b"), - "c": aws.String("d"), - }, - } - req, _ := svc.InputService11TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert URL - assert.Equal(t, "https://test/", r.URL.String()) - - // assert headers - assert.Equal(t, "b", r.Header.Get("x-foo-a")) - assert.Equal(t, "d", r.Header.Get("x-foo-c")) - -} - -func TestInputService12ProtocolTestStringPayloadCase1(t *testing.T) { - svc := NewInputService12ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService12TestShapeInputShape{ - Foo: aws.String("bar"), - } - req, _ := svc.InputService12TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - assert.Equal(t, util.Trim(`bar`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService13ProtocolTestBlobPayloadCase1(t *testing.T) { - svc := NewInputService13ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService13TestShapeInputShape{ - Foo: []byte("bar"), - } - req, _ := svc.InputService13TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - assert.Equal(t, util.Trim(`bar`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService13ProtocolTestBlobPayloadCase2(t *testing.T) { - svc := NewInputService13ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService13TestShapeInputShape{} - req, _ := svc.InputService13TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert URL - assert.Equal(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService14ProtocolTestStructurePayloadCase1(t *testing.T) { - svc := NewInputService14ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService14TestShapeInputShape{ - Foo: &InputService14TestShapeFooShape{ - Baz: aws.String("bar"), - }, - } - req, _ := svc.InputService14TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - assert.Equal(t, util.Trim(`bar`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService14ProtocolTestStructurePayloadCase2(t *testing.T) { - svc := NewInputService14ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService14TestShapeInputShape{} - req, _ := svc.InputService14TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert URL - assert.Equal(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService15ProtocolTestXMLAttributeCase1(t *testing.T) { - svc := NewInputService15ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService15TestShapeInputShape{ - Grant: &InputService15TestShapeGrant{ - Grantee: &InputService15TestShapeGrantee{ - EmailAddress: aws.String("foo@example.com"), - Type: aws.String("CanonicalUser"), - }, - }, - } - req, _ := svc.InputService15TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - assert.Equal(t, util.Trim(`foo@example.com`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService16ProtocolTestGreedyKeysCase1(t *testing.T) { - svc := NewInputService16ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService16TestShapeInputShape{ - Bucket: aws.String("my/bucket"), - Key: aws.String("testing /123"), - } - req, _ := svc.InputService16TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert URL - assert.Equal(t, "https://test/my%2Fbucket/testing%20/123", r.URL.String()) - - // assert headers - -} - -func TestInputService17ProtocolTestOmitsNullQueryParamsButSerializesEmptyStringsCase1(t *testing.T) { - svc := NewInputService17ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService17TestShapeInputShape{} - req, _ := svc.InputService17TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert URL - assert.Equal(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService17ProtocolTestOmitsNullQueryParamsButSerializesEmptyStringsCase2(t *testing.T) { - svc := NewInputService17ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService17TestShapeInputShape{ - Foo: aws.String(""), - } - req, _ := svc.InputService17TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert URL - assert.Equal(t, "https://test/path?abc=mno¶m-name=", r.URL.String()) - - // assert headers - -} - -func TestInputService18ProtocolTestRecursiveShapesCase1(t *testing.T) { - svc := NewInputService18ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService18TestShapeInputShape{ - RecursiveStruct: &InputService18TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - } - req, _ := svc.InputService18TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - assert.Equal(t, util.Trim(`foo`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService18ProtocolTestRecursiveShapesCase2(t *testing.T) { - svc := NewInputService18ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService18TestShapeInputShape{ - RecursiveStruct: &InputService18TestShapeRecursiveStructType{ - RecursiveStruct: &InputService18TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - }, - } - req, _ := svc.InputService18TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - assert.Equal(t, util.Trim(`foo`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService18ProtocolTestRecursiveShapesCase3(t *testing.T) { - svc := NewInputService18ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService18TestShapeInputShape{ - RecursiveStruct: &InputService18TestShapeRecursiveStructType{ - RecursiveStruct: &InputService18TestShapeRecursiveStructType{ - RecursiveStruct: &InputService18TestShapeRecursiveStructType{ - RecursiveStruct: &InputService18TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - }, - }, - }, - } - req, _ := svc.InputService18TestCaseOperation3Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - assert.Equal(t, util.Trim(`foo`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService18ProtocolTestRecursiveShapesCase4(t *testing.T) { - svc := NewInputService18ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService18TestShapeInputShape{ - RecursiveStruct: &InputService18TestShapeRecursiveStructType{ - RecursiveList: []*InputService18TestShapeRecursiveStructType{ - { - NoRecurse: aws.String("foo"), - }, - { - NoRecurse: aws.String("bar"), - }, - }, - }, - } - req, _ := svc.InputService18TestCaseOperation4Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - assert.Equal(t, util.Trim(`foobar`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService18ProtocolTestRecursiveShapesCase5(t *testing.T) { - svc := NewInputService18ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService18TestShapeInputShape{ - RecursiveStruct: &InputService18TestShapeRecursiveStructType{ - RecursiveList: []*InputService18TestShapeRecursiveStructType{ - { - NoRecurse: aws.String("foo"), - }, - { - RecursiveStruct: &InputService18TestShapeRecursiveStructType{ - NoRecurse: aws.String("bar"), - }, - }, - }, - }, - } - req, _ := svc.InputService18TestCaseOperation5Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - assert.Equal(t, util.Trim(`foobar`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService18ProtocolTestRecursiveShapesCase6(t *testing.T) { - svc := NewInputService18ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService18TestShapeInputShape{ - RecursiveStruct: &InputService18TestShapeRecursiveStructType{ - RecursiveMap: &map[string]*InputService18TestShapeRecursiveStructType{ - "bar": { - NoRecurse: aws.String("bar"), - }, - "foo": { - NoRecurse: aws.String("foo"), - }, - }, - }, - } - req, _ := svc.InputService18TestCaseOperation6Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert body - assert.NotNil(t, r.Body) - body := util.SortXML(r.Body) - assert.Equal(t, util.Trim(`barbarfoofoo`), util.Trim(string(body))) - - // assert URL - assert.Equal(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService19ProtocolTestTimestampInHeaderCase1(t *testing.T) { - svc := NewInputService19ProtocolTest(nil) - svc.Endpoint = "https://test" - - input := &InputService19TestShapeInputShape{ - TimeArgInHeader: aws.Time(time.Unix(1422172800, 0)), - } - req, _ := svc.InputService19TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - assert.NoError(t, req.Error) - - // assert URL - assert.Equal(t, "https://test/path", r.URL.String()) - - // assert headers - assert.Equal(t, "Sun, 25 Jan 2015 08:00:00 GMT", r.Header.Get("x-amz-timearg")) - -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/restxml/restxml.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/restxml/restxml.go deleted file mode 100644 index 9a952ee1..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/restxml/restxml.go +++ /dev/null @@ -1,48 +0,0 @@ -package restxml - -//go:generate go run ../../fixtures/protocol/generate.go ../../fixtures/protocol/input/rest-xml.json build_test.go -//go:generate go run ../../fixtures/protocol/generate.go ../../fixtures/protocol/output/rest-xml.json unmarshal_test.go - -import ( - "bytes" - "encoding/xml" - - "github.com/awslabs/aws-sdk-go/aws" - "github.com/awslabs/aws-sdk-go/internal/protocol/query" - "github.com/awslabs/aws-sdk-go/internal/protocol/rest" - "github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil" -) - -func Build(r *aws.Request) { - rest.Build(r) - - if t := rest.PayloadType(r.Params); t == "structure" || t == "" { - var buf bytes.Buffer - err := xmlutil.BuildXML(r.Params, xml.NewEncoder(&buf)) - if err != nil { - r.Error = err - return - } - r.SetBufferBody(buf.Bytes()) - } -} - -func Unmarshal(r *aws.Request) { - if t := rest.PayloadType(r.Data); t == "structure" || t == "" { - defer r.HTTPResponse.Body.Close() - decoder := xml.NewDecoder(r.HTTPResponse.Body) - err := xmlutil.UnmarshalXML(r.Data, decoder, "") - if err != nil { - r.Error = err - return - } - } -} - -func UnmarshalMeta(r *aws.Request) { - rest.Unmarshal(r) -} - -func UnmarshalError(r *aws.Request) { - query.UnmarshalError(r) -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/restxml/unmarshal_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/restxml/unmarshal_test.go deleted file mode 100644 index d1383a12..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/restxml/unmarshal_test.go +++ /dev/null @@ -1,1320 +0,0 @@ -package restxml_test - -import ( - "github.com/awslabs/aws-sdk-go/aws" - "github.com/awslabs/aws-sdk-go/internal/protocol/restxml" - "github.com/awslabs/aws-sdk-go/internal/signer/v4" - - "bytes" - "encoding/json" - "encoding/xml" - "github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil" - "github.com/awslabs/aws-sdk-go/internal/util" - "github.com/stretchr/testify/assert" - "io" - "io/ioutil" - "net/http" - "net/url" - "testing" - "time" -) - -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 - -// OutputService1ProtocolTest is a client for OutputService1ProtocolTest. -type OutputService1ProtocolTest struct { - *aws.Service -} - -// New returns a new OutputService1ProtocolTest client. -func NewOutputService1ProtocolTest(config *aws.Config) *OutputService1ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "outputservice1protocoltest", - APIVersion: "", - } - service.Initialize() - - // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.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 -} - -// OutputService1TestCaseOperation1Request generates a request for the OutputService1TestCaseOperation1 operation. -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1Request(input *OutputService1TestShapeOutputService1TestShapeOutputService1TestCaseOperation1Input) (req *aws.Request, output *OutputService1TestShapeOutputShape) { - - if opOutputService1TestCaseOperation1 == nil { - opOutputService1TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &OutputService1TestShapeOutputService1TestShapeOutputService1TestCaseOperation1Input{} - } - - req = c.newRequest(opOutputService1TestCaseOperation1, input, output) - output = &OutputService1TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1(input *OutputService1TestShapeOutputService1TestShapeOutputService1TestCaseOperation1Input) (output *OutputService1TestShapeOutputShape, err error) { - req, out := c.OutputService1TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opOutputService1TestCaseOperation1 *aws.Operation - -// OutputService1TestCaseOperation2Request generates a request for the OutputService1TestCaseOperation2 operation. -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation2Request(input *OutputService1TestShapeOutputService1TestCaseOperation2Input) (req *aws.Request, output *OutputService1TestShapeOutputShape) { - - if opOutputService1TestCaseOperation2 == nil { - opOutputService1TestCaseOperation2 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &OutputService1TestShapeOutputService1TestCaseOperation2Input{} - } - - req = c.newRequest(opOutputService1TestCaseOperation2, input, output) - output = &OutputService1TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation2(input *OutputService1TestShapeOutputService1TestCaseOperation2Input) (output *OutputService1TestShapeOutputShape, err error) { - req, out := c.OutputService1TestCaseOperation2Request(input) - output = out - err = req.Send() - return -} - -var opOutputService1TestCaseOperation2 *aws.Operation - -type OutputService1TestShapeOutputService1TestCaseOperation2Input struct { - metadataOutputService1TestShapeOutputService1TestCaseOperation2Input `json:"-", xml:"-"` -} - -type metadataOutputService1TestShapeOutputService1TestCaseOperation2Input struct { - SDKShapeTraits bool `type:"structure"` -} - -type OutputService1TestShapeOutputService1TestShapeOutputService1TestCaseOperation1Input struct { - metadataOutputService1TestShapeOutputService1TestShapeOutputService1TestCaseOperation1Input `json:"-", xml:"-"` -} - -type metadataOutputService1TestShapeOutputService1TestShapeOutputService1TestCaseOperation1Input struct { - SDKShapeTraits bool `type:"structure"` -} - -type OutputService1TestShapeOutputShape struct { - Char *string `type:"character"` - - Double *float64 `type:"double"` - - FalseBool *bool `type:"boolean"` - - Float *float64 `type:"float"` - - ImaHeader *string `location:"header" type:"string"` - - ImaHeaderLocation *string `location:"header" locationName:"X-Foo" type:"string"` - - Long *int64 `type:"long"` - - Num *int64 `locationName:"FooNum" type:"integer"` - - Str *string `type:"string"` - - Timestamp *time.Time `type:"timestamp" timestampFormat:"iso8601"` - - TrueBool *bool `type:"boolean"` - - metadataOutputService1TestShapeOutputShape `json:"-", xml:"-"` -} - -type metadataOutputService1TestShapeOutputShape struct { - SDKShapeTraits bool `type:"structure"` -} - -// OutputService2ProtocolTest is a client for OutputService2ProtocolTest. -type OutputService2ProtocolTest struct { - *aws.Service -} - -// New returns a new OutputService2ProtocolTest client. -func NewOutputService2ProtocolTest(config *aws.Config) *OutputService2ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "outputservice2protocoltest", - APIVersion: "", - } - service.Initialize() - - // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.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 -} - -// OutputService2TestCaseOperation1Request generates a request for the OutputService2TestCaseOperation1 operation. -func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1Request(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (req *aws.Request, output *OutputService2TestShapeOutputShape) { - - if opOutputService2TestCaseOperation1 == nil { - opOutputService2TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &OutputService2TestShapeOutputService2TestCaseOperation1Input{} - } - - req = c.newRequest(opOutputService2TestCaseOperation1, input, output) - output = &OutputService2TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (output *OutputService2TestShapeOutputShape, err error) { - req, out := c.OutputService2TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opOutputService2TestCaseOperation1 *aws.Operation - -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"` -} - -// OutputService3ProtocolTest is a client for OutputService3ProtocolTest. -type OutputService3ProtocolTest struct { - *aws.Service -} - -// New returns a new OutputService3ProtocolTest client. -func NewOutputService3ProtocolTest(config *aws.Config) *OutputService3ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "outputservice3protocoltest", - APIVersion: "", - } - service.Initialize() - - // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.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 -} - -// OutputService3TestCaseOperation1Request generates a request for the OutputService3TestCaseOperation1 operation. -func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1Request(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (req *aws.Request, output *OutputService3TestShapeOutputShape) { - - if opOutputService3TestCaseOperation1 == nil { - opOutputService3TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &OutputService3TestShapeOutputService3TestCaseOperation1Input{} - } - - req = c.newRequest(opOutputService3TestCaseOperation1, input, output) - output = &OutputService3TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (output *OutputService3TestShapeOutputShape, err error) { - req, out := c.OutputService3TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opOutputService3TestCaseOperation1 *aws.Operation - -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"` -} - -// OutputService4ProtocolTest is a client for OutputService4ProtocolTest. -type OutputService4ProtocolTest struct { - *aws.Service -} - -// New returns a new OutputService4ProtocolTest client. -func NewOutputService4ProtocolTest(config *aws.Config) *OutputService4ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "outputservice4protocoltest", - APIVersion: "", - } - service.Initialize() - - // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.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 -} - -// OutputService4TestCaseOperation1Request generates a request for the OutputService4TestCaseOperation1 operation. -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1Request(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (req *aws.Request, output *OutputService4TestShapeOutputShape) { - - if opOutputService4TestCaseOperation1 == nil { - opOutputService4TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &OutputService4TestShapeOutputService4TestCaseOperation1Input{} - } - - req = c.newRequest(opOutputService4TestCaseOperation1, input, output) - output = &OutputService4TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (output *OutputService4TestShapeOutputShape, err error) { - req, out := c.OutputService4TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opOutputService4TestCaseOperation1 *aws.Operation - -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"` -} - -// OutputService5ProtocolTest is a client for OutputService5ProtocolTest. -type OutputService5ProtocolTest struct { - *aws.Service -} - -// New returns a new OutputService5ProtocolTest client. -func NewOutputService5ProtocolTest(config *aws.Config) *OutputService5ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "outputservice5protocoltest", - APIVersion: "", - } - service.Initialize() - - // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.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 -} - -// OutputService5TestCaseOperation1Request generates a request for the OutputService5TestCaseOperation1 operation. -func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1Request(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (req *aws.Request, output *OutputService5TestShapeOutputShape) { - - if opOutputService5TestCaseOperation1 == nil { - opOutputService5TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &OutputService5TestShapeOutputService5TestCaseOperation1Input{} - } - - req = c.newRequest(opOutputService5TestCaseOperation1, input, output) - output = &OutputService5TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (output *OutputService5TestShapeOutputShape, err error) { - req, out := c.OutputService5TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opOutputService5TestCaseOperation1 *aws.Operation - -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"` -} - -// OutputService6ProtocolTest is a client for OutputService6ProtocolTest. -type OutputService6ProtocolTest struct { - *aws.Service -} - -// New returns a new OutputService6ProtocolTest client. -func NewOutputService6ProtocolTest(config *aws.Config) *OutputService6ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "outputservice6protocoltest", - APIVersion: "", - } - service.Initialize() - - // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.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 -} - -// OutputService6TestCaseOperation1Request generates a request for the OutputService6TestCaseOperation1 operation. -func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1Request(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (req *aws.Request, output *OutputService6TestShapeOutputShape) { - - if opOutputService6TestCaseOperation1 == nil { - opOutputService6TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &OutputService6TestShapeOutputService6TestCaseOperation1Input{} - } - - req = c.newRequest(opOutputService6TestCaseOperation1, input, output) - output = &OutputService6TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (output *OutputService6TestShapeOutputShape, err error) { - req, out := c.OutputService6TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opOutputService6TestCaseOperation1 *aws.Operation - -type OutputService6TestShapeOutputService6TestCaseOperation1Input struct { - metadataOutputService6TestShapeOutputService6TestCaseOperation1Input `json:"-", xml:"-"` -} - -type metadataOutputService6TestShapeOutputService6TestCaseOperation1Input struct { - SDKShapeTraits bool `type:"structure"` -} - -type OutputService6TestShapeOutputShape struct { - Map *map[string]*OutputService6TestShapeSingleStructure `type:"map"` - - metadataOutputService6TestShapeOutputShape `json:"-", xml:"-"` -} - -type metadataOutputService6TestShapeOutputShape struct { - SDKShapeTraits bool `type:"structure"` -} - -type OutputService6TestShapeSingleStructure struct { - Foo *string `locationName:"foo" type:"string"` - - metadataOutputService6TestShapeSingleStructure `json:"-", xml:"-"` -} - -type metadataOutputService6TestShapeSingleStructure struct { - SDKShapeTraits bool `type:"structure"` -} - -// OutputService7ProtocolTest is a client for OutputService7ProtocolTest. -type OutputService7ProtocolTest struct { - *aws.Service -} - -// New returns a new OutputService7ProtocolTest client. -func NewOutputService7ProtocolTest(config *aws.Config) *OutputService7ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "outputservice7protocoltest", - APIVersion: "", - } - service.Initialize() - - // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.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 -} - -// OutputService7TestCaseOperation1Request generates a request for the OutputService7TestCaseOperation1 operation. -func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1Request(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (req *aws.Request, output *OutputService7TestShapeOutputShape) { - - if opOutputService7TestCaseOperation1 == nil { - opOutputService7TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &OutputService7TestShapeOutputService7TestCaseOperation1Input{} - } - - req = c.newRequest(opOutputService7TestCaseOperation1, input, output) - output = &OutputService7TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (output *OutputService7TestShapeOutputShape, err error) { - req, out := c.OutputService7TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opOutputService7TestCaseOperation1 *aws.Operation - -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"` -} - -// OutputService8ProtocolTest is a client for OutputService8ProtocolTest. -type OutputService8ProtocolTest struct { - *aws.Service -} - -// New returns a new OutputService8ProtocolTest client. -func NewOutputService8ProtocolTest(config *aws.Config) *OutputService8ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "outputservice8protocoltest", - APIVersion: "", - } - service.Initialize() - - // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.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 -} - -// OutputService8TestCaseOperation1Request generates a request for the OutputService8TestCaseOperation1 operation. -func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1Request(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (req *aws.Request, output *OutputService8TestShapeOutputShape) { - - if opOutputService8TestCaseOperation1 == nil { - opOutputService8TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &OutputService8TestShapeOutputService8TestCaseOperation1Input{} - } - - req = c.newRequest(opOutputService8TestCaseOperation1, input, output) - output = &OutputService8TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (output *OutputService8TestShapeOutputShape, err error) { - req, out := c.OutputService8TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opOutputService8TestCaseOperation1 *aws.Operation - -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"` - - metadataOutputService8TestShapeOutputShape `json:"-", xml:"-"` -} - -type metadataOutputService8TestShapeOutputShape struct { - SDKShapeTraits bool `type:"structure"` -} - -// OutputService9ProtocolTest is a client for OutputService9ProtocolTest. -type OutputService9ProtocolTest struct { - *aws.Service -} - -// New returns a new OutputService9ProtocolTest client. -func NewOutputService9ProtocolTest(config *aws.Config) *OutputService9ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "outputservice9protocoltest", - APIVersion: "", - } - service.Initialize() - - // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return &OutputService9ProtocolTest{service} -} - -// newRequest creates a new request for a OutputService9ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService9ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { - req := aws.NewRequest(c.Service, op, params, data) - - return req -} - -// OutputService9TestCaseOperation1Request generates a request for the OutputService9TestCaseOperation1 operation. -func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1Request(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (req *aws.Request, output *OutputService9TestShapeOutputShape) { - - if opOutputService9TestCaseOperation1 == nil { - opOutputService9TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &OutputService9TestShapeOutputService9TestCaseOperation1Input{} - } - - req = c.newRequest(opOutputService9TestCaseOperation1, input, output) - output = &OutputService9TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (output *OutputService9TestShapeOutputShape, err error) { - req, out := c.OutputService9TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opOutputService9TestCaseOperation1 *aws.Operation - -type OutputService9TestShapeOutputService9TestCaseOperation1Input struct { - metadataOutputService9TestShapeOutputService9TestCaseOperation1Input `json:"-", xml:"-"` -} - -type metadataOutputService9TestShapeOutputService9TestCaseOperation1Input struct { - SDKShapeTraits bool `type:"structure"` -} - -type OutputService9TestShapeOutputShape struct { - Data *OutputService9TestShapeSingleStructure `type:"structure"` - - Header *string `location:"header" locationName:"X-Foo" type:"string"` - - metadataOutputService9TestShapeOutputShape `json:"-", xml:"-"` -} - -type metadataOutputService9TestShapeOutputShape struct { - SDKShapeTraits bool `type:"structure" payload:"Data"` -} - -type OutputService9TestShapeSingleStructure struct { - Foo *string `type:"string"` - - metadataOutputService9TestShapeSingleStructure `json:"-", xml:"-"` -} - -type metadataOutputService9TestShapeSingleStructure struct { - SDKShapeTraits bool `type:"structure"` -} - -// OutputService10ProtocolTest is a client for OutputService10ProtocolTest. -type OutputService10ProtocolTest struct { - *aws.Service -} - -// New returns a new OutputService10ProtocolTest client. -func NewOutputService10ProtocolTest(config *aws.Config) *OutputService10ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "outputservice10protocoltest", - APIVersion: "", - } - service.Initialize() - - // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return &OutputService10ProtocolTest{service} -} - -// newRequest creates a new request for a OutputService10ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService10ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { - req := aws.NewRequest(c.Service, op, params, data) - - return req -} - -// OutputService10TestCaseOperation1Request generates a request for the OutputService10TestCaseOperation1 operation. -func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1Request(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (req *aws.Request, output *OutputService10TestShapeOutputShape) { - - if opOutputService10TestCaseOperation1 == nil { - opOutputService10TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &OutputService10TestShapeOutputService10TestCaseOperation1Input{} - } - - req = c.newRequest(opOutputService10TestCaseOperation1, input, output) - output = &OutputService10TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (output *OutputService10TestShapeOutputShape, err error) { - req, out := c.OutputService10TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opOutputService10TestCaseOperation1 *aws.Operation - -type OutputService10TestShapeOutputService10TestCaseOperation1Input struct { - metadataOutputService10TestShapeOutputService10TestCaseOperation1Input `json:"-", xml:"-"` -} - -type metadataOutputService10TestShapeOutputService10TestCaseOperation1Input struct { - SDKShapeTraits bool `type:"structure"` -} - -type OutputService10TestShapeOutputShape struct { - Stream []byte `type:"blob"` - - metadataOutputService10TestShapeOutputShape `json:"-", xml:"-"` -} - -type metadataOutputService10TestShapeOutputShape struct { - SDKShapeTraits bool `type:"structure" payload:"Stream"` -} - -// OutputService11ProtocolTest is a client for OutputService11ProtocolTest. -type OutputService11ProtocolTest struct { - *aws.Service -} - -// New returns a new OutputService11ProtocolTest client. -func NewOutputService11ProtocolTest(config *aws.Config) *OutputService11ProtocolTest { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "outputservice11protocoltest", - APIVersion: "", - } - service.Initialize() - - // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - return &OutputService11ProtocolTest{service} -} - -// newRequest creates a new request for a OutputService11ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService11ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request { - req := aws.NewRequest(c.Service, op, params, data) - - return req -} - -// OutputService11TestCaseOperation1Request generates a request for the OutputService11TestCaseOperation1 operation. -func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1Request(input *OutputService11TestShapeOutputService11TestCaseOperation1Input) (req *aws.Request, output *OutputService11TestShapeOutputShape) { - - if opOutputService11TestCaseOperation1 == nil { - opOutputService11TestCaseOperation1 = &aws.Operation{ - Name: "OperationName", - } - } - - if input == nil { - input = &OutputService11TestShapeOutputService11TestCaseOperation1Input{} - } - - req = c.newRequest(opOutputService11TestCaseOperation1, input, output) - output = &OutputService11TestShapeOutputShape{} - req.Data = output - return -} - -func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1(input *OutputService11TestShapeOutputService11TestCaseOperation1Input) (output *OutputService11TestShapeOutputShape, err error) { - req, out := c.OutputService11TestCaseOperation1Request(input) - output = out - err = req.Send() - return -} - -var opOutputService11TestCaseOperation1 *aws.Operation - -type OutputService11TestShapeOutputService11TestCaseOperation1Input struct { - metadataOutputService11TestShapeOutputService11TestCaseOperation1Input `json:"-", xml:"-"` -} - -type metadataOutputService11TestShapeOutputService11TestCaseOperation1Input struct { - SDKShapeTraits bool `type:"structure"` -} - -type OutputService11TestShapeOutputShape struct { - Char *string `location:"header" locationName:"x-char" type:"character"` - - Double *float64 `location:"header" locationName:"x-double" type:"double"` - - FalseBool *bool `location:"header" locationName:"x-false-bool" type:"boolean"` - - Float *float64 `location:"header" locationName:"x-float" type:"float"` - - Integer *int64 `location:"header" locationName:"x-int" type:"integer"` - - Long *int64 `location:"header" locationName:"x-long" type:"long"` - - Str *string `location:"header" locationName:"x-str" type:"string"` - - Timestamp *time.Time `location:"header" locationName:"x-timestamp" type:"timestamp" timestampFormat:"iso8601"` - - TrueBool *bool `location:"header" locationName:"x-true-bool" type:"boolean"` - - metadataOutputService11TestShapeOutputShape `json:"-", xml:"-"` -} - -type metadataOutputService11TestShapeOutputShape struct { - SDKShapeTraits bool `type:"structure"` -} - -// -// Tests begin here -// - -func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { - svc := NewOutputService1ProtocolTest(nil) - - buf := bytes.NewReader([]byte("myname123falsetrue1.21.3200a2015-01-25T08:00:00Z")) - req, out := svc.OutputService1TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - req.HTTPResponse.Header.Set("ImaHeader", "test") - req.HTTPResponse.Header.Set("X-Foo", "abc") - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.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, "test", *out.ImaHeader) - assert.Equal(t, "abc", *out.ImaHeaderLocation) - assert.Equal(t, int64(200), *out.Long) - assert.Equal(t, int64(123), *out.Num) - assert.Equal(t, "myname", *out.Str) - assert.Equal(t, time.Unix(1.4221728e+09, 0).UTC().String(), out.Timestamp.String()) - assert.Equal(t, true, *out.TrueBool) - -} - -func TestOutputService1ProtocolTestScalarMembersCase2(t *testing.T) { - svc := NewOutputService1ProtocolTest(nil) - - buf := bytes.NewReader([]byte("123falsetrue1.21.3200a2015-01-25T08:00:00Z")) - req, out := svc.OutputService1TestCaseOperation2Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - req.HTTPResponse.Header.Set("ImaHeader", "test") - req.HTTPResponse.Header.Set("X-Foo", "abc") - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.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, "test", *out.ImaHeader) - assert.Equal(t, "abc", *out.ImaHeaderLocation) - assert.Equal(t, int64(200), *out.Long) - assert.Equal(t, int64(123), *out.Num) - assert.Equal(t, "", *out.Str) - assert.Equal(t, time.Unix(1.4221728e+09, 0).UTC().String(), out.Timestamp.String()) - assert.Equal(t, true, *out.TrueBool) - -} - -func TestOutputService2ProtocolTestBlobCase1(t *testing.T) { - svc := NewOutputService2ProtocolTest(nil) - - buf := bytes.NewReader([]byte("dmFsdWU=")) - req, out := svc.OutputService2TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.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("abc123")) - req, out := svc.OutputService3TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.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("abc123")) - req, out := svc.OutputService4TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.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("abc123")) - req, out := svc.OutputService5TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.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("quxbarbazbam")) - req, out := svc.OutputService6TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.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("quxbarbazbam")) - req, out := svc.OutputService7TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.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("quxbarbazbam")) - req, out := svc.OutputService8TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.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 TestOutputService9ProtocolTestXMLPayloadCase1(t *testing.T) { - svc := NewOutputService9ProtocolTest(nil) - - buf := bytes.NewReader([]byte("abc")) - req, out := svc.OutputService9TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - req.HTTPResponse.Header.Set("X-Foo", "baz") - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "abc", *out.Data.Foo) - assert.Equal(t, "baz", *out.Header) - -} - -func TestOutputService10ProtocolTestStreamingPayloadCase1(t *testing.T) { - svc := NewOutputService10ProtocolTest(nil) - - buf := bytes.NewReader([]byte("abc")) - req, out := svc.OutputService10TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.Unmarshal(req) - assert.NoError(t, req.Error) - - // assert response - assert.NotNil(t, out) // ensure out variable is used - assert.Equal(t, "abc", string(out.Stream)) - -} - -func TestOutputService11ProtocolTestScalarMembersInHeadersCase1(t *testing.T) { - svc := NewOutputService11ProtocolTest(nil) - - buf := bytes.NewReader([]byte("")) - req, out := svc.OutputService11TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - req.HTTPResponse.Header.Set("x-char", "a") - req.HTTPResponse.Header.Set("x-double", "1.5") - req.HTTPResponse.Header.Set("x-false-bool", "false") - req.HTTPResponse.Header.Set("x-float", "1.5") - req.HTTPResponse.Header.Set("x-int", "1") - req.HTTPResponse.Header.Set("x-long", "100") - req.HTTPResponse.Header.Set("x-str", "string") - req.HTTPResponse.Header.Set("x-timestamp", "Sun, 25 Jan 2015 08:00:00 GMT") - req.HTTPResponse.Header.Set("x-true-bool", "true") - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.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.5, *out.Double) - assert.Equal(t, false, *out.FalseBool) - assert.Equal(t, 1.5, *out.Float) - assert.Equal(t, int64(1), *out.Integer) - assert.Equal(t, int64(100), *out.Long) - assert.Equal(t, "string", *out.Str) - assert.Equal(t, time.Unix(1.4221728e+09, 0).UTC().String(), out.Timestamp.String()) - assert.Equal(t, true, *out.TrueBool) - -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil/build.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil/build.go deleted file mode 100644 index cfe05acb..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil/build.go +++ /dev/null @@ -1,263 +0,0 @@ -package xmlutil - -import ( - "encoding/base64" - "encoding/xml" - "fmt" - "reflect" - "sort" - "strconv" - "strings" - "time" -) - -func BuildXML(params interface{}, e *xml.Encoder) error { - b := xmlBuilder{encoder: e, namespaces: map[string]string{}} - root := NewXMLElement(xml.Name{}) - if err := b.buildValue(reflect.ValueOf(params), root, ""); err != nil { - return err - } - for _, c := range root.Children { - for _, v := range c { - return StructToXML(e, v, false) - } - } - return nil -} - -func elemOf(value reflect.Value) reflect.Value { - for value.Kind() == reflect.Ptr { - value = value.Elem() - } - return value -} - -type xmlBuilder struct { - encoder *xml.Encoder - namespaces map[string]string -} - -func (b *xmlBuilder) buildValue(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { - value = elemOf(value) - if !value.IsValid() { // no need to handle zero values - return nil - } else if tag.Get("location") != "" { // don't handle non-body location values - return nil - } - - t := tag.Get("type") - if t == "" { - switch value.Kind() { - case reflect.Struct: - t = "structure" - case reflect.Slice: - t = "list" - case reflect.Map: - t = "map" - } - } - - switch t { - case "structure": - if field, ok := value.Type().FieldByName("SDKShapeTraits"); ok { - tag = tag + reflect.StructTag(" ") + field.Tag - } - return b.buildStruct(value, current, tag) - case "list": - return b.buildList(value, current, tag) - case "map": - return b.buildMap(value, current, tag) - default: - return b.buildScalar(value, current, tag) - } -} - -func (b *xmlBuilder) buildStruct(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { - if !value.IsValid() { - return nil - } - - fieldAdded := false - - // unwrap payloads - if payload := tag.Get("payload"); payload != "" { - field, _ := value.Type().FieldByName(payload) - tag = field.Tag - value = elemOf(value.FieldByName(payload)) - - if !value.IsValid() { - return nil - } - } - - child := NewXMLElement(xml.Name{Local: tag.Get("locationName")}) - - // there is an xmlNamespace associated with this struct - if prefix, uri := tag.Get("xmlPrefix"), tag.Get("xmlURI"); uri != "" { - ns := xml.Attr{ - Name: xml.Name{Local: "xmlns"}, - Value: uri, - } - if prefix != "" { - b.namespaces[prefix] = uri // register the namespace - ns.Name.Local = "xmlns:" + prefix - } - - child.Attr = append(child.Attr, ns) - } - - t := value.Type() - for i := 0; i < value.NumField(); i++ { - if c := t.Field(i).Name[0:1]; strings.ToLower(c) == c { - continue // ignore unexported fields - } - - member := elemOf(value.Field(i)) - field := t.Field(i) - mTag := field.Tag - - if mTag.Get("location") != "" { // skip non-body members - continue - } - - memberName := mTag.Get("locationName") - if memberName == "" { - memberName = field.Name - mTag = reflect.StructTag(string(mTag) + ` locationName:"` + memberName + `"`) - } - if err := b.buildValue(member, child, mTag); err != nil { - return err - } - - fieldAdded = true - } - - if fieldAdded { // only append this child if we have one ore more valid members - current.AddChild(child) - } - - return nil -} - -func (b *xmlBuilder) buildList(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { - if value.IsNil() { // don't build omitted lists - return nil - } - - // check for unflattened list member - flattened := tag.Get("flattened") != "" - - xname := xml.Name{Local: tag.Get("locationName")} - if flattened { - for i := 0; i < value.Len(); i++ { - child := NewXMLElement(xname) - current.AddChild(child) - if err := b.buildValue(value.Index(i), child, ""); err != nil { - return err - } - } - } else { - list := NewXMLElement(xname) - current.AddChild(list) - - for i := 0; i < value.Len(); i++ { - iname := tag.Get("locationNameList") - if iname == "" { - iname = "member" - } - - child := NewXMLElement(xml.Name{Local: iname}) - list.AddChild(child) - if err := b.buildValue(value.Index(i), child, ""); err != nil { - return err - } - } - } - - return nil -} - -func (b *xmlBuilder) buildMap(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { - if value.IsNil() { // don't build omitted maps - return nil - } - - maproot := NewXMLElement(xml.Name{Local: tag.Get("locationName")}) - current.AddChild(maproot) - current = maproot - - kname, vname := "key", "value" - if n := tag.Get("locationNameKey"); n != "" { - kname = n - } - if n := tag.Get("locationNameValue"); n != "" { - vname = n - } - - // sorting is not required for compliance, but it makes testing easier - keys := make([]string, value.Len()) - for i, k := range value.MapKeys() { - keys[i] = k.String() - } - sort.Strings(keys) - - for _, k := range keys { - v := value.MapIndex(reflect.ValueOf(k)) - - mapcur := current - if tag.Get("flattened") == "" { // add "entry" tag to non-flat maps - child := NewXMLElement(xml.Name{Local: "entry"}) - mapcur.AddChild(child) - mapcur = child - } - - kchild := NewXMLElement(xml.Name{Local: kname}) - kchild.Text = k - vchild := NewXMLElement(xml.Name{Local: vname}) - mapcur.AddChild(kchild) - mapcur.AddChild(vchild) - - if err := b.buildValue(v, vchild, ""); err != nil { - return err - } - } - - return nil -} - -func (b *xmlBuilder) buildScalar(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { - var str string - switch converted := value.Interface().(type) { - case string: - str = converted - case []byte: - if !value.IsNil() { - str = base64.StdEncoding.EncodeToString(converted) - } - case bool: - str = strconv.FormatBool(converted) - case int64: - str = strconv.FormatInt(converted, 10) - case int: - str = strconv.Itoa(converted) - case float64: - str = strconv.FormatFloat(converted, 'f', -1, 64) - case float32: - str = strconv.FormatFloat(float64(converted), 'f', -1, 32) - case time.Time: - const ISO8601UTC = "2006-01-02T15:04:05Z" - str = converted.UTC().Format(ISO8601UTC) - default: - return fmt.Errorf("unsupported value for param %s: %v (%s)", - tag.Get("locationName"), value.Interface(), value.Type().Name()) - } - - xname := xml.Name{Local: tag.Get("locationName")} - if tag.Get("xmlAttribute") != "" { // put into current node's attribute list - attr := xml.Attr{Name: xname, Value: str} - current.Attr = append(current.Attr, attr) - } else { // regular text node - current.AddChild(&XMLNode{Name: xname, Text: str}) - } - return nil -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil/unmarshal.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil/unmarshal.go deleted file mode 100644 index 89c64f2c..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil/unmarshal.go +++ /dev/null @@ -1,251 +0,0 @@ -package xmlutil - -import ( - "encoding/base64" - "encoding/xml" - "fmt" - "io" - "reflect" - "strconv" - "strings" - "time" -) - -func UnmarshalXML(v interface{}, d *xml.Decoder, wrapper string) error { - n, _ := XMLToStruct(d, nil) - if n.Children != nil { - for _, root := range n.Children { - for _, c := range root { - if wrappedChild, ok := c.Children[wrapper]; ok { - c = wrappedChild[0] // pull out wrapped element - } - - err := parse(reflect.ValueOf(v), c, "") - if err != nil { - if err == io.EOF { - return nil - } - return err - } - } - } - return nil - } - return nil -} - -func parse(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { - rtype := r.Type() - if rtype.Kind() == reflect.Ptr { - rtype = rtype.Elem() // check kind of actual element type - } - - t := tag.Get("type") - if t == "" { - switch rtype.Kind() { - case reflect.Struct: - t = "structure" - case reflect.Slice: - t = "list" - case reflect.Map: - t = "map" - } - } - - switch t { - case "structure": - if field, ok := rtype.FieldByName("SDKShapeTraits"); ok { - tag = field.Tag - } - return parseStruct(r, node, tag) - case "list": - return parseList(r, node, tag) - case "map": - return parseMap(r, node, tag) - default: - return parseScalar(r, node, tag) - } -} - -func parseStruct(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { - t := r.Type() - if r.Kind() == reflect.Ptr { - if r.IsNil() { // create the structure if it's nil - s := reflect.New(r.Type().Elem()) - r.Set(s) - r = s - } - - r = r.Elem() - t = t.Elem() - } - - // unwrap any payloads - if payload := tag.Get("payload"); payload != "" { - field, _ := t.FieldByName(payload) - return parseStruct(r.FieldByName(payload), node, field.Tag) - } - - for i := 0; i < t.NumField(); i++ { - field := t.Field(i) - if c := field.Name[0:1]; strings.ToLower(c) == c { - continue // ignore unexported fields - } - - // figure out what this field is called - name := field.Name - if field.Tag.Get("flattened") != "" && field.Tag.Get("locationNameList") != "" { - name = field.Tag.Get("locationNameList") - } else if locName := field.Tag.Get("locationName"); locName != "" { - name = locName - } - - // try to find the field by name in elements - elems := node.Children[name] - - if elems == nil { // try to find the field in attributes - for _, a := range node.Attr { - if name == a.Name.Local { - // turn this into a text node for de-serializing - elems = []*XMLNode{{Text: a.Value}} - } - } - } - - member := r.FieldByName(field.Name) - for _, elem := range elems { - err := parse(member, elem, field.Tag) - if err != nil { - return err - } - } - } - return nil -} - -func parseList(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { - t := r.Type() - - if tag.Get("flattened") == "" { // look at all item entries - mname := "member" - if name := tag.Get("locationNameList"); name != "" { - mname = name - } - - if Children, ok := node.Children[mname]; ok { - if r.IsNil() { - r.Set(reflect.MakeSlice(t, len(Children), len(Children))) - } - - for i, c := range Children { - err := parse(r.Index(i), c, "") - if err != nil { - return err - } - } - } - } else { // flattened list means this is a single element - if r.IsNil() { - r.Set(reflect.MakeSlice(t, 0, 0)) - } - - childR := reflect.Zero(t.Elem()) - r.Set(reflect.Append(r, childR)) - err := parse(r.Index(r.Len()-1), node, "") - if err != nil { - return err - } - } - - return nil -} - -func parseMap(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { - t := r.Type() - if r.Kind() == reflect.Ptr { - t = t.Elem() - if r.IsNil() { - r.Set(reflect.New(t)) - r.Elem().Set(reflect.MakeMap(t)) - } - - r = r.Elem() - } - - if tag.Get("flattened") == "" { // look at all child entries - for _, entry := range node.Children["entry"] { - parseMapEntry(r, entry, tag) - } - } else { // this element is itself an entry - parseMapEntry(r, node, tag) - } - - return nil -} - -func parseMapEntry(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { - kname, vname := "key", "value" - if n := tag.Get("locationNameKey"); n != "" { - kname = n - } - if n := tag.Get("locationNameValue"); n != "" { - vname = n - } - - keys, ok := node.Children[kname] - values := node.Children[vname] - if ok { - for i, key := range keys { - keyR := reflect.ValueOf(key.Text) - value := values[i] - valueR := reflect.New(r.Type().Elem()).Elem() - - parse(valueR, value, "") - r.SetMapIndex(keyR, valueR) - } - } - return nil -} - -func parseScalar(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { - switch r.Interface().(type) { - case *string: - r.Set(reflect.ValueOf(&node.Text)) - return nil - case []byte: - b, err := base64.StdEncoding.DecodeString(node.Text) - if err != nil { - return err - } - r.Set(reflect.ValueOf(b)) - case *bool: - v, err := strconv.ParseBool(node.Text) - if err != nil { - return err - } - r.Set(reflect.ValueOf(&v)) - case *int64: - v, err := strconv.ParseInt(node.Text, 10, 64) - if err != nil { - return err - } - r.Set(reflect.ValueOf(&v)) - case *float64: - v, err := strconv.ParseFloat(node.Text, 64) - if err != nil { - return err - } - r.Set(reflect.ValueOf(&v)) - case *time.Time: - const ISO8601UTC = "2006-01-02T15:04:05Z" - t, err := time.Parse(ISO8601UTC, node.Text) - if err != nil { - return err - } else { - r.Set(reflect.ValueOf(&t)) - } - default: - return fmt.Errorf("unsupported value: %v (%s)", r.Interface(), r.Type()) - } - return nil -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil/xml_to_struct.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil/xml_to_struct.go deleted file mode 100644 index 6e92da3e..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/protocol/xml/xmlutil/xml_to_struct.go +++ /dev/null @@ -1,100 +0,0 @@ -package xmlutil - -import ( - "encoding/xml" - "io" - "sort" -) - -type XMLNode struct { - Name xml.Name `json:",omitempty"` - Children map[string][]*XMLNode `json:",omitempty"` - Text string `json:",omitempty"` - Attr []xml.Attr `json:",omitempty"` -} - -func NewXMLElement(name xml.Name) *XMLNode { - return &XMLNode{ - Name: name, - Children: map[string][]*XMLNode{}, - Attr: []xml.Attr{}, - } -} - -func (n *XMLNode) AddChild(child *XMLNode) { - if _, ok := n.Children[child.Name.Local]; !ok { - n.Children[child.Name.Local] = []*XMLNode{} - } - n.Children[child.Name.Local] = append(n.Children[child.Name.Local], child) -} - -func XMLToStruct(d *xml.Decoder, s *xml.StartElement) (*XMLNode, error) { - out := &XMLNode{} - for { - tok, err := d.Token() - if tok == nil || err == io.EOF { - break - } - if err != nil { - return out, err - } - - switch typed := tok.(type) { - case xml.CharData: - out.Text = string(typed.Copy()) - case xml.StartElement: - el := typed.Copy() - out.Attr = el.Attr - if out.Children == nil { - out.Children = map[string][]*XMLNode{} - } - - name := typed.Name.Local - slice := out.Children[name] - if slice == nil { - slice = []*XMLNode{} - } - node, e := XMLToStruct(d, &el) - if e != nil { - return out, e - } - node.Name = typed.Name - slice = append(slice, node) - out.Children[name] = slice - case xml.EndElement: - if s != nil && s.Name.Local == typed.Name.Local { // matching end token - return out, nil - } - } - } - return out, nil -} - -func StructToXML(e *xml.Encoder, node *XMLNode, sorted bool) error { - e.EncodeToken(xml.StartElement{Name: node.Name, Attr: node.Attr}) - - if node.Text != "" { - e.EncodeToken(xml.CharData([]byte(node.Text))) - } else if sorted { - sortedNames := []string{} - for k := range node.Children { - sortedNames = append(sortedNames, k) - } - sort.Strings(sortedNames) - - for _, k := range sortedNames { - for _, v := range node.Children[k] { - StructToXML(e, v, sorted) - } - } - } else { - for _, c := range node.Children { - for _, v := range c { - StructToXML(e, v, sorted) - } - } - } - - e.EncodeToken(xml.EndElement{Name: node.Name}) - return e.Flush() -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/signer/v4/v4.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/signer/v4/v4.go deleted file mode 100644 index 89e677e1..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/signer/v4/v4.go +++ /dev/null @@ -1,301 +0,0 @@ -package v4 - -import ( - "crypto/hmac" - "crypto/sha256" - "encoding/hex" - "fmt" - "io" - "net/http" - "net/url" - "sort" - "strconv" - "strings" - "time" - - "github.com/awslabs/aws-sdk-go/aws" -) - -const ( - authHeaderPrefix = "AWS4-HMAC-SHA256" - timeFormat = "20060102T150405Z" - shortTimeFormat = "20060102" -) - -var ignoredHeaders = map[string]bool{ - "Authorization": true, - "Content-Type": true, - "Content-Length": true, - "User-Agent": true, -} - -type signer struct { - Request *http.Request - Time time.Time - ExpireTime time.Duration - ServiceName string - Region string - AccessKeyID string - SecretAccessKey string - SessionToken string - Query url.Values - Body io.ReadSeeker - Debug uint - Logger io.Writer - - isPresign bool - formattedTime string - formattedShortTime string - - signedHeaders string - canonicalHeaders string - canonicalString string - credentialString string - stringToSign string - signature string - authorization string -} - -// Sign requests with signature version 4. -func Sign(req *aws.Request) { - creds, err := req.Service.Config.Credentials.Credentials() - if err != nil { - req.Error = err - return - } - - region := req.Service.SigningRegion - if region == "" { - region = req.Service.Config.Region - } - - s := signer{ - Request: req.HTTPRequest, - Time: req.Time, - ExpireTime: req.ExpireTime, - Query: req.HTTPRequest.URL.Query(), - Body: req.Body, - ServiceName: req.Service.ServiceName, - Region: region, - AccessKeyID: creds.AccessKeyID, - SecretAccessKey: creds.SecretAccessKey, - SessionToken: creds.SessionToken, - Debug: req.Service.Config.LogLevel, - Logger: req.Service.Config.Logger, - } - s.sign() - return -} - -func (v4 *signer) sign() { - if v4.ExpireTime != 0 { - v4.isPresign = true - } - - if v4.isPresign { - v4.Query.Set("X-Amz-Algorithm", authHeaderPrefix) - if v4.SessionToken != "" { - v4.Query.Set("X-Amz-Security-Token", v4.SessionToken) - } else { - v4.Query.Del("X-Amz-Security-Token") - } - } else if v4.SessionToken != "" { - v4.Request.Header.Set("X-Amz-Security-Token", v4.SessionToken) - } - - v4.build() - - if v4.Debug > 0 { - 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) - fmt.Fprintf(out, "---[ SIGNED URL ]--------------------------------\n") - fmt.Fprintln(out, v4.Request.URL) - fmt.Fprintf(out, "-----------------------------------------------------\n") - } -} - -func (v4 *signer) build() { - v4.buildTime() // no depends - v4.buildCredentialString() // no depends - if v4.isPresign { - v4.buildQuery() // no depends - } - v4.buildCanonicalHeaders() // depends on cred string - v4.buildCanonicalString() // depends on canon headers / signed headers - v4.buildStringToSign() // depends on canon string - v4.buildSignature() // depends on string to sign - - if v4.isPresign { - v4.Request.URL.RawQuery += "&X-Amz-Signature=" + v4.signature - } else { - parts := []string{ - authHeaderPrefix + " Credential=" + v4.AccessKeyID + "/" + v4.credentialString, - "SignedHeaders=" + v4.signedHeaders, - "Signature=" + v4.signature, - } - v4.Request.Header.Set("Authorization", strings.Join(parts, ", ")) - } -} - -func (v4 *signer) buildTime() { - v4.formattedTime = v4.Time.UTC().Format(timeFormat) - v4.formattedShortTime = v4.Time.UTC().Format(shortTimeFormat) - - if v4.isPresign { - duration := int64(v4.ExpireTime / time.Second) - v4.Query.Set("X-Amz-Date", v4.formattedTime) - v4.Query.Set("X-Amz-Expires", strconv.FormatInt(duration, 10)) - } else { - v4.Request.Header.Set("X-Amz-Date", v4.formattedTime) - } -} - -func (v4 *signer) buildCredentialString() { - v4.credentialString = strings.Join([]string{ - v4.formattedShortTime, - v4.Region, - v4.ServiceName, - "aws4_request", - }, "/") - - if v4.isPresign { - v4.Query.Set("X-Amz-Credential", v4.AccessKeyID+"/"+v4.credentialString) - } -} - -func (v4 *signer) buildQuery() { - for k, h := range v4.Request.Header { - if strings.HasPrefix(http.CanonicalHeaderKey(k), "X-Amz-") { - continue // never hoist x-amz-* headers, they must be signed - } - if _, ok := ignoredHeaders[http.CanonicalHeaderKey(k)]; ok { - continue // never hoist ignored headers - } - - v4.Request.Header.Del(k) - v4.Query.Del(k) - for _, v := range h { - v4.Query.Add(k, v) - } - } -} - -func (v4 *signer) buildCanonicalHeaders() { - headers := make([]string, 0) - headers = append(headers, "host") - for k := range v4.Request.Header { - if _, ok := ignoredHeaders[http.CanonicalHeaderKey(k)]; ok { - continue // ignored header - } - headers = append(headers, strings.ToLower(k)) - } - sort.Strings(headers) - - v4.signedHeaders = strings.Join(headers, ";") - - if v4.isPresign { - v4.Query.Set("X-Amz-SignedHeaders", v4.signedHeaders) - } - - 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.canonicalHeaders = strings.Join(headerValues, "\n") -} - -func (v4 *signer) buildCanonicalString() { - v4.Request.URL.RawQuery = v4.Query.Encode() - uri := v4.Request.URL.Opaque - if uri != "" { - uri = "/" + strings.Join(strings.Split(uri, "/")[3:], "/") - } else { - uri = v4.Request.URL.Path - } - if uri == "" { - uri = "/" - } - - v4.canonicalString = strings.Join([]string{ - v4.Request.Method, - uri, - v4.Request.URL.RawQuery, - v4.canonicalHeaders + "\n", - v4.signedHeaders, - v4.bodyDigest(), - }, "\n") -} - -func (v4 *signer) buildStringToSign() { - v4.stringToSign = strings.Join([]string{ - authHeaderPrefix, - v4.formattedTime, - v4.credentialString, - hex.EncodeToString(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 = hex.EncodeToString(signature) -} - -func (v4 *signer) bodyDigest() string { - hash := v4.Request.Header.Get("X-Amz-Content-Sha256") - if hash == "" { - if v4.isPresign && v4.ServiceName == "s3" { - hash = "UNSIGNED-PAYLOAD" - } else if v4.Body == nil { - hash = hex.EncodeToString(makeSha256([]byte{})) - } else { - hash = hex.EncodeToString(makeSha256Reader(v4.Body)) - } - 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.ReadSeeker) []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) -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/signer/v4/v4_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/signer/v4/v4_test.go deleted file mode 100644 index fb15c394..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/internal/signer/v4/v4_test.go +++ /dev/null @@ -1,89 +0,0 @@ -package v4 - -import ( - "net/http" - "strings" - "testing" - "time" - - "github.com/stretchr/testify/assert" -) - -func buildSigner(serviceName string, region string, signTime time.Time, expireTime time.Duration, body string) signer { - endpoint := "https://" + serviceName + "." + region + ".amazonaws.com" - reader := strings.NewReader(body) - req, _ := http.NewRequest("POST", endpoint, reader) - req.URL.Opaque = "//example.org/bucket/key-._~,!@#$%^&*()" - 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))) - req.Header.Add("X-Amz-Meta-Other-Header", "some-value=!@#$%^&* ()") - - return signer{ - Request: req, - Time: signTime, - ExpireTime: expireTime, - Query: req.URL.Query(), - 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 TestPresignRequest(t *testing.T) { - signer := buildSigner("dynamodb", "us-east-1", time.Unix(0, 0), 300*time.Second, "{}") - signer.sign() - - expectedDate := "19700101T000000Z" - expectedHeaders := "host;x-amz-meta-other-header;x-amz-target" - expectedSig := "41c18d68f9191079dfeead4e3f034328f89d86c79f8e9d51dd48bb70eaf623fc" - expectedCred := "AKID/19700101/us-east-1/dynamodb/aws4_request" - - q := signer.Request.URL.Query() - assert.Equal(t, expectedSig, q.Get("X-Amz-Signature")) - assert.Equal(t, expectedCred, q.Get("X-Amz-Credential")) - assert.Equal(t, expectedHeaders, q.Get("X-Amz-SignedHeaders")) - assert.Equal(t, expectedDate, q.Get("X-Amz-Date")) -} - -func TestSignRequest(t *testing.T) { - signer := buildSigner("dynamodb", "us-east-1", time.Unix(0, 0), 0, "{}") - signer.sign() - - expectedDate := "19700101T000000Z" - expectedSig := "AWS4-HMAC-SHA256 Credential=AKID/19700101/us-east-1/dynamodb/aws4_request, SignedHeaders=host;x-amz-date;x-amz-meta-other-header;x-amz-security-token;x-amz-target, Signature=0196959cabd964bd10c05217b40ed151882dd394190438bab0c658dafdbff7a1" - - q := signer.Request.Header - assert.Equal(t, expectedSig, q.Get("Authorization")) - assert.Equal(t, expectedDate, q.Get("X-Amz-Date")) -} - -func BenchmarkPresignRequest(b *testing.B) { - signer := buildSigner("dynamodb", "us-east-1", time.Now(), 300*time.Second, "{}") - for i := 0; i < b.N; i++ { - signer.sign() - } -} - -func BenchmarkSignRequest(b *testing.B) { - signer := buildSigner("dynamodb", "us-east-1", time.Now(), 0, "{}") - for i := 0; i < b.N; i++ { - signer.sign() - } -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/api.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/api.go deleted file mode 100644 index 5fd28d4e..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/api.go +++ /dev/null @@ -1,4917 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. - -// Package s3 provides a client for Amazon Simple Storage Service. -package s3 - -import ( - "io" - "sync" - "time" - - "github.com/awslabs/aws-sdk-go/aws" -) - -var oprw sync.Mutex - -// AbortMultipartUploadRequest generates a request for the AbortMultipartUpload operation. -func (c *S3) AbortMultipartUploadRequest(input *AbortMultipartUploadInput) (req *aws.Request, output *AbortMultipartUploadOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opAbortMultipartUpload == nil { - opAbortMultipartUpload = &aws.Operation{ - Name: "AbortMultipartUpload", - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}/{Key+}", - } - } - - if input == nil { - input = &AbortMultipartUploadInput{} - } - - req = c.newRequest(opAbortMultipartUpload, input, output) - output = &AbortMultipartUploadOutput{} - req.Data = output - return -} - -// Aborts a multipart upload. -// -// To verify that all parts have been removed, so you don't get charged for -// the part storage, you should call the List Parts operation and ensure the -// parts list is empty. -func (c *S3) AbortMultipartUpload(input *AbortMultipartUploadInput) (output *AbortMultipartUploadOutput, err error) { - req, out := c.AbortMultipartUploadRequest(input) - output = out - err = req.Send() - return -} - -var opAbortMultipartUpload *aws.Operation - -// CompleteMultipartUploadRequest generates a request for the CompleteMultipartUpload operation. -func (c *S3) CompleteMultipartUploadRequest(input *CompleteMultipartUploadInput) (req *aws.Request, output *CompleteMultipartUploadOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opCompleteMultipartUpload == nil { - opCompleteMultipartUpload = &aws.Operation{ - Name: "CompleteMultipartUpload", - HTTPMethod: "POST", - HTTPPath: "/{Bucket}/{Key+}", - } - } - - if input == nil { - input = &CompleteMultipartUploadInput{} - } - - req = c.newRequest(opCompleteMultipartUpload, input, output) - output = &CompleteMultipartUploadOutput{} - req.Data = output - return -} - -// Completes a multipart upload by assembling previously uploaded parts. -func (c *S3) CompleteMultipartUpload(input *CompleteMultipartUploadInput) (output *CompleteMultipartUploadOutput, err error) { - req, out := c.CompleteMultipartUploadRequest(input) - output = out - err = req.Send() - return -} - -var opCompleteMultipartUpload *aws.Operation - -// CopyObjectRequest generates a request for the CopyObject operation. -func (c *S3) CopyObjectRequest(input *CopyObjectInput) (req *aws.Request, output *CopyObjectOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opCopyObject == nil { - opCopyObject = &aws.Operation{ - Name: "CopyObject", - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}/{Key+}", - } - } - - if input == nil { - input = &CopyObjectInput{} - } - - req = c.newRequest(opCopyObject, input, output) - output = &CopyObjectOutput{} - req.Data = output - return -} - -// Creates a copy of an object that is already stored in Amazon S3. -func (c *S3) CopyObject(input *CopyObjectInput) (output *CopyObjectOutput, err error) { - req, out := c.CopyObjectRequest(input) - output = out - err = req.Send() - return -} - -var opCopyObject *aws.Operation - -// CreateBucketRequest generates a request for the CreateBucket operation. -func (c *S3) CreateBucketRequest(input *CreateBucketInput) (req *aws.Request, output *CreateBucketOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opCreateBucket == nil { - opCreateBucket = &aws.Operation{ - Name: "CreateBucket", - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}", - } - } - - if input == nil { - input = &CreateBucketInput{} - } - - req = c.newRequest(opCreateBucket, input, output) - output = &CreateBucketOutput{} - req.Data = output - return -} - -// Creates a new bucket. -func (c *S3) CreateBucket(input *CreateBucketInput) (output *CreateBucketOutput, err error) { - req, out := c.CreateBucketRequest(input) - output = out - err = req.Send() - return -} - -var opCreateBucket *aws.Operation - -// CreateMultipartUploadRequest generates a request for the CreateMultipartUpload operation. -func (c *S3) CreateMultipartUploadRequest(input *CreateMultipartUploadInput) (req *aws.Request, output *CreateMultipartUploadOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opCreateMultipartUpload == nil { - opCreateMultipartUpload = &aws.Operation{ - Name: "CreateMultipartUpload", - HTTPMethod: "POST", - HTTPPath: "/{Bucket}/{Key+}?uploads", - } - } - - if input == nil { - input = &CreateMultipartUploadInput{} - } - - req = c.newRequest(opCreateMultipartUpload, input, output) - output = &CreateMultipartUploadOutput{} - req.Data = output - return -} - -// Initiates a multipart upload and returns an upload ID. -// -// Note: After you initiate multipart upload and upload one or more parts, -// you must either complete or abort multipart upload in order to stop getting -// charged for storage of the uploaded parts. Only after you either complete -// or abort multipart upload, Amazon S3 frees up the parts storage and stops -// charging you for the parts storage. -func (c *S3) CreateMultipartUpload(input *CreateMultipartUploadInput) (output *CreateMultipartUploadOutput, err error) { - req, out := c.CreateMultipartUploadRequest(input) - output = out - err = req.Send() - return -} - -var opCreateMultipartUpload *aws.Operation - -// DeleteBucketRequest generates a request for the DeleteBucket operation. -func (c *S3) DeleteBucketRequest(input *DeleteBucketInput) (req *aws.Request, output *DeleteBucketOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opDeleteBucket == nil { - opDeleteBucket = &aws.Operation{ - Name: "DeleteBucket", - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}", - } - } - - if input == nil { - input = &DeleteBucketInput{} - } - - req = c.newRequest(opDeleteBucket, input, output) - output = &DeleteBucketOutput{} - req.Data = output - return -} - -// Deletes the bucket. All objects (including all object versions and Delete -// Markers) in the bucket must be deleted before the bucket itself can be deleted. -func (c *S3) DeleteBucket(input *DeleteBucketInput) (output *DeleteBucketOutput, err error) { - req, out := c.DeleteBucketRequest(input) - output = out - err = req.Send() - return -} - -var opDeleteBucket *aws.Operation - -// DeleteBucketCORSRequest generates a request for the DeleteBucketCORS operation. -func (c *S3) DeleteBucketCORSRequest(input *DeleteBucketCORSInput) (req *aws.Request, output *DeleteBucketCORSOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opDeleteBucketCORS == nil { - opDeleteBucketCORS = &aws.Operation{ - Name: "DeleteBucketCors", - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}?cors", - } - } - - if input == nil { - input = &DeleteBucketCORSInput{} - } - - req = c.newRequest(opDeleteBucketCORS, input, output) - output = &DeleteBucketCORSOutput{} - req.Data = output - return -} - -// Deletes the cors configuration information set for the bucket. -func (c *S3) DeleteBucketCORS(input *DeleteBucketCORSInput) (output *DeleteBucketCORSOutput, err error) { - req, out := c.DeleteBucketCORSRequest(input) - output = out - err = req.Send() - return -} - -var opDeleteBucketCORS *aws.Operation - -// DeleteBucketLifecycleRequest generates a request for the DeleteBucketLifecycle operation. -func (c *S3) DeleteBucketLifecycleRequest(input *DeleteBucketLifecycleInput) (req *aws.Request, output *DeleteBucketLifecycleOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opDeleteBucketLifecycle == nil { - opDeleteBucketLifecycle = &aws.Operation{ - Name: "DeleteBucketLifecycle", - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}?lifecycle", - } - } - - if input == nil { - input = &DeleteBucketLifecycleInput{} - } - - req = c.newRequest(opDeleteBucketLifecycle, input, output) - output = &DeleteBucketLifecycleOutput{} - req.Data = output - return -} - -// Deletes the lifecycle configuration from the bucket. -func (c *S3) DeleteBucketLifecycle(input *DeleteBucketLifecycleInput) (output *DeleteBucketLifecycleOutput, err error) { - req, out := c.DeleteBucketLifecycleRequest(input) - output = out - err = req.Send() - return -} - -var opDeleteBucketLifecycle *aws.Operation - -// DeleteBucketPolicyRequest generates a request for the DeleteBucketPolicy operation. -func (c *S3) DeleteBucketPolicyRequest(input *DeleteBucketPolicyInput) (req *aws.Request, output *DeleteBucketPolicyOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opDeleteBucketPolicy == nil { - opDeleteBucketPolicy = &aws.Operation{ - Name: "DeleteBucketPolicy", - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}?policy", - } - } - - if input == nil { - input = &DeleteBucketPolicyInput{} - } - - req = c.newRequest(opDeleteBucketPolicy, input, output) - output = &DeleteBucketPolicyOutput{} - req.Data = output - return -} - -// Deletes the policy from the bucket. -func (c *S3) DeleteBucketPolicy(input *DeleteBucketPolicyInput) (output *DeleteBucketPolicyOutput, err error) { - req, out := c.DeleteBucketPolicyRequest(input) - output = out - err = req.Send() - return -} - -var opDeleteBucketPolicy *aws.Operation - -// DeleteBucketReplicationRequest generates a request for the DeleteBucketReplication operation. -func (c *S3) DeleteBucketReplicationRequest(input *DeleteBucketReplicationInput) (req *aws.Request, output *DeleteBucketReplicationOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opDeleteBucketReplication == nil { - opDeleteBucketReplication = &aws.Operation{ - Name: "DeleteBucketReplication", - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}?replication", - } - } - - if input == nil { - input = &DeleteBucketReplicationInput{} - } - - req = c.newRequest(opDeleteBucketReplication, input, output) - output = &DeleteBucketReplicationOutput{} - req.Data = output - return -} - -func (c *S3) DeleteBucketReplication(input *DeleteBucketReplicationInput) (output *DeleteBucketReplicationOutput, err error) { - req, out := c.DeleteBucketReplicationRequest(input) - output = out - err = req.Send() - return -} - -var opDeleteBucketReplication *aws.Operation - -// DeleteBucketTaggingRequest generates a request for the DeleteBucketTagging operation. -func (c *S3) DeleteBucketTaggingRequest(input *DeleteBucketTaggingInput) (req *aws.Request, output *DeleteBucketTaggingOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opDeleteBucketTagging == nil { - opDeleteBucketTagging = &aws.Operation{ - Name: "DeleteBucketTagging", - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}?tagging", - } - } - - if input == nil { - input = &DeleteBucketTaggingInput{} - } - - req = c.newRequest(opDeleteBucketTagging, input, output) - output = &DeleteBucketTaggingOutput{} - req.Data = output - return -} - -// Deletes the tags from the bucket. -func (c *S3) DeleteBucketTagging(input *DeleteBucketTaggingInput) (output *DeleteBucketTaggingOutput, err error) { - req, out := c.DeleteBucketTaggingRequest(input) - output = out - err = req.Send() - return -} - -var opDeleteBucketTagging *aws.Operation - -// DeleteBucketWebsiteRequest generates a request for the DeleteBucketWebsite operation. -func (c *S3) DeleteBucketWebsiteRequest(input *DeleteBucketWebsiteInput) (req *aws.Request, output *DeleteBucketWebsiteOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opDeleteBucketWebsite == nil { - opDeleteBucketWebsite = &aws.Operation{ - Name: "DeleteBucketWebsite", - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}?website", - } - } - - if input == nil { - input = &DeleteBucketWebsiteInput{} - } - - req = c.newRequest(opDeleteBucketWebsite, input, output) - output = &DeleteBucketWebsiteOutput{} - req.Data = output - return -} - -// This operation removes the website configuration from the bucket. -func (c *S3) DeleteBucketWebsite(input *DeleteBucketWebsiteInput) (output *DeleteBucketWebsiteOutput, err error) { - req, out := c.DeleteBucketWebsiteRequest(input) - output = out - err = req.Send() - return -} - -var opDeleteBucketWebsite *aws.Operation - -// DeleteObjectRequest generates a request for the DeleteObject operation. -func (c *S3) DeleteObjectRequest(input *DeleteObjectInput) (req *aws.Request, output *DeleteObjectOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opDeleteObject == nil { - opDeleteObject = &aws.Operation{ - Name: "DeleteObject", - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}/{Key+}", - } - } - - if input == nil { - input = &DeleteObjectInput{} - } - - req = c.newRequest(opDeleteObject, input, output) - output = &DeleteObjectOutput{} - req.Data = output - return -} - -// Removes the null version (if there is one) of an object and inserts a delete -// marker, which becomes the latest version of the object. If there isn't a -// null version, Amazon S3 does not remove any objects. -func (c *S3) DeleteObject(input *DeleteObjectInput) (output *DeleteObjectOutput, err error) { - req, out := c.DeleteObjectRequest(input) - output = out - err = req.Send() - return -} - -var opDeleteObject *aws.Operation - -// DeleteObjectsRequest generates a request for the DeleteObjects operation. -func (c *S3) DeleteObjectsRequest(input *DeleteObjectsInput) (req *aws.Request, output *DeleteObjectsOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opDeleteObjects == nil { - opDeleteObjects = &aws.Operation{ - Name: "DeleteObjects", - HTTPMethod: "POST", - HTTPPath: "/{Bucket}?delete", - } - } - - if input == nil { - input = &DeleteObjectsInput{} - } - - req = c.newRequest(opDeleteObjects, input, output) - output = &DeleteObjectsOutput{} - req.Data = output - return -} - -// This operation enables you to delete multiple objects from a bucket using -// a single HTTP request. You may specify up to 1000 keys. -func (c *S3) DeleteObjects(input *DeleteObjectsInput) (output *DeleteObjectsOutput, err error) { - req, out := c.DeleteObjectsRequest(input) - output = out - err = req.Send() - return -} - -var opDeleteObjects *aws.Operation - -// GetBucketACLRequest generates a request for the GetBucketACL operation. -func (c *S3) GetBucketACLRequest(input *GetBucketACLInput) (req *aws.Request, output *GetBucketACLOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opGetBucketACL == nil { - opGetBucketACL = &aws.Operation{ - Name: "GetBucketAcl", - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?acl", - } - } - - if input == nil { - input = &GetBucketACLInput{} - } - - req = c.newRequest(opGetBucketACL, input, output) - output = &GetBucketACLOutput{} - req.Data = output - return -} - -// Gets the access control policy for the bucket. -func (c *S3) GetBucketACL(input *GetBucketACLInput) (output *GetBucketACLOutput, err error) { - req, out := c.GetBucketACLRequest(input) - output = out - err = req.Send() - return -} - -var opGetBucketACL *aws.Operation - -// GetBucketCORSRequest generates a request for the GetBucketCORS operation. -func (c *S3) GetBucketCORSRequest(input *GetBucketCORSInput) (req *aws.Request, output *GetBucketCORSOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opGetBucketCORS == nil { - opGetBucketCORS = &aws.Operation{ - Name: "GetBucketCors", - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?cors", - } - } - - if input == nil { - input = &GetBucketCORSInput{} - } - - req = c.newRequest(opGetBucketCORS, input, output) - output = &GetBucketCORSOutput{} - req.Data = output - return -} - -// Returns the cors configuration for the bucket. -func (c *S3) GetBucketCORS(input *GetBucketCORSInput) (output *GetBucketCORSOutput, err error) { - req, out := c.GetBucketCORSRequest(input) - output = out - err = req.Send() - return -} - -var opGetBucketCORS *aws.Operation - -// GetBucketLifecycleRequest generates a request for the GetBucketLifecycle operation. -func (c *S3) GetBucketLifecycleRequest(input *GetBucketLifecycleInput) (req *aws.Request, output *GetBucketLifecycleOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opGetBucketLifecycle == nil { - opGetBucketLifecycle = &aws.Operation{ - Name: "GetBucketLifecycle", - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?lifecycle", - } - } - - if input == nil { - input = &GetBucketLifecycleInput{} - } - - req = c.newRequest(opGetBucketLifecycle, input, output) - output = &GetBucketLifecycleOutput{} - req.Data = output - return -} - -// Returns the lifecycle configuration information set on the bucket. -func (c *S3) GetBucketLifecycle(input *GetBucketLifecycleInput) (output *GetBucketLifecycleOutput, err error) { - req, out := c.GetBucketLifecycleRequest(input) - output = out - err = req.Send() - return -} - -var opGetBucketLifecycle *aws.Operation - -// GetBucketLocationRequest generates a request for the GetBucketLocation operation. -func (c *S3) GetBucketLocationRequest(input *GetBucketLocationInput) (req *aws.Request, output *GetBucketLocationOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opGetBucketLocation == nil { - opGetBucketLocation = &aws.Operation{ - Name: "GetBucketLocation", - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?location", - } - } - - if input == nil { - input = &GetBucketLocationInput{} - } - - req = c.newRequest(opGetBucketLocation, input, output) - output = &GetBucketLocationOutput{} - req.Data = output - return -} - -// Returns the region the bucket resides in. -func (c *S3) GetBucketLocation(input *GetBucketLocationInput) (output *GetBucketLocationOutput, err error) { - req, out := c.GetBucketLocationRequest(input) - output = out - err = req.Send() - return -} - -var opGetBucketLocation *aws.Operation - -// GetBucketLoggingRequest generates a request for the GetBucketLogging operation. -func (c *S3) GetBucketLoggingRequest(input *GetBucketLoggingInput) (req *aws.Request, output *GetBucketLoggingOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opGetBucketLogging == nil { - opGetBucketLogging = &aws.Operation{ - Name: "GetBucketLogging", - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?logging", - } - } - - if input == nil { - input = &GetBucketLoggingInput{} - } - - req = c.newRequest(opGetBucketLogging, input, output) - output = &GetBucketLoggingOutput{} - req.Data = output - return -} - -// Returns the logging status of a bucket and the permissions users have to -// view and modify that status. To use GET, you must be the bucket owner. -func (c *S3) GetBucketLogging(input *GetBucketLoggingInput) (output *GetBucketLoggingOutput, err error) { - req, out := c.GetBucketLoggingRequest(input) - output = out - err = req.Send() - return -} - -var opGetBucketLogging *aws.Operation - -// GetBucketNotificationRequest generates a request for the GetBucketNotification operation. -func (c *S3) GetBucketNotificationRequest(input *GetBucketNotificationInput) (req *aws.Request, output *GetBucketNotificationOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opGetBucketNotification == nil { - opGetBucketNotification = &aws.Operation{ - Name: "GetBucketNotification", - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?notification", - } - } - - if input == nil { - input = &GetBucketNotificationInput{} - } - - req = c.newRequest(opGetBucketNotification, input, output) - output = &GetBucketNotificationOutput{} - req.Data = output - return -} - -// Return the notification configuration of a bucket. -func (c *S3) GetBucketNotification(input *GetBucketNotificationInput) (output *GetBucketNotificationOutput, err error) { - req, out := c.GetBucketNotificationRequest(input) - output = out - err = req.Send() - return -} - -var opGetBucketNotification *aws.Operation - -// GetBucketPolicyRequest generates a request for the GetBucketPolicy operation. -func (c *S3) GetBucketPolicyRequest(input *GetBucketPolicyInput) (req *aws.Request, output *GetBucketPolicyOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opGetBucketPolicy == nil { - opGetBucketPolicy = &aws.Operation{ - Name: "GetBucketPolicy", - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?policy", - } - } - - if input == nil { - input = &GetBucketPolicyInput{} - } - - req = c.newRequest(opGetBucketPolicy, input, output) - output = &GetBucketPolicyOutput{} - req.Data = output - return -} - -// Returns the policy of a specified bucket. -func (c *S3) GetBucketPolicy(input *GetBucketPolicyInput) (output *GetBucketPolicyOutput, err error) { - req, out := c.GetBucketPolicyRequest(input) - output = out - err = req.Send() - return -} - -var opGetBucketPolicy *aws.Operation - -// GetBucketReplicationRequest generates a request for the GetBucketReplication operation. -func (c *S3) GetBucketReplicationRequest(input *GetBucketReplicationInput) (req *aws.Request, output *GetBucketReplicationOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opGetBucketReplication == nil { - opGetBucketReplication = &aws.Operation{ - Name: "GetBucketReplication", - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?replication", - } - } - - if input == nil { - input = &GetBucketReplicationInput{} - } - - req = c.newRequest(opGetBucketReplication, input, output) - output = &GetBucketReplicationOutput{} - req.Data = output - return -} - -func (c *S3) GetBucketReplication(input *GetBucketReplicationInput) (output *GetBucketReplicationOutput, err error) { - req, out := c.GetBucketReplicationRequest(input) - output = out - err = req.Send() - return -} - -var opGetBucketReplication *aws.Operation - -// GetBucketRequestPaymentRequest generates a request for the GetBucketRequestPayment operation. -func (c *S3) GetBucketRequestPaymentRequest(input *GetBucketRequestPaymentInput) (req *aws.Request, output *GetBucketRequestPaymentOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opGetBucketRequestPayment == nil { - opGetBucketRequestPayment = &aws.Operation{ - Name: "GetBucketRequestPayment", - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?requestPayment", - } - } - - if input == nil { - input = &GetBucketRequestPaymentInput{} - } - - req = c.newRequest(opGetBucketRequestPayment, input, output) - output = &GetBucketRequestPaymentOutput{} - req.Data = output - return -} - -// Returns the request payment configuration of a bucket. -func (c *S3) GetBucketRequestPayment(input *GetBucketRequestPaymentInput) (output *GetBucketRequestPaymentOutput, err error) { - req, out := c.GetBucketRequestPaymentRequest(input) - output = out - err = req.Send() - return -} - -var opGetBucketRequestPayment *aws.Operation - -// GetBucketTaggingRequest generates a request for the GetBucketTagging operation. -func (c *S3) GetBucketTaggingRequest(input *GetBucketTaggingInput) (req *aws.Request, output *GetBucketTaggingOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opGetBucketTagging == nil { - opGetBucketTagging = &aws.Operation{ - Name: "GetBucketTagging", - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?tagging", - } - } - - if input == nil { - input = &GetBucketTaggingInput{} - } - - req = c.newRequest(opGetBucketTagging, input, output) - output = &GetBucketTaggingOutput{} - req.Data = output - return -} - -// Returns the tag set associated with the bucket. -func (c *S3) GetBucketTagging(input *GetBucketTaggingInput) (output *GetBucketTaggingOutput, err error) { - req, out := c.GetBucketTaggingRequest(input) - output = out - err = req.Send() - return -} - -var opGetBucketTagging *aws.Operation - -// GetBucketVersioningRequest generates a request for the GetBucketVersioning operation. -func (c *S3) GetBucketVersioningRequest(input *GetBucketVersioningInput) (req *aws.Request, output *GetBucketVersioningOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opGetBucketVersioning == nil { - opGetBucketVersioning = &aws.Operation{ - Name: "GetBucketVersioning", - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?versioning", - } - } - - if input == nil { - input = &GetBucketVersioningInput{} - } - - req = c.newRequest(opGetBucketVersioning, input, output) - output = &GetBucketVersioningOutput{} - req.Data = output - return -} - -// Returns the versioning state of a bucket. -func (c *S3) GetBucketVersioning(input *GetBucketVersioningInput) (output *GetBucketVersioningOutput, err error) { - req, out := c.GetBucketVersioningRequest(input) - output = out - err = req.Send() - return -} - -var opGetBucketVersioning *aws.Operation - -// GetBucketWebsiteRequest generates a request for the GetBucketWebsite operation. -func (c *S3) GetBucketWebsiteRequest(input *GetBucketWebsiteInput) (req *aws.Request, output *GetBucketWebsiteOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opGetBucketWebsite == nil { - opGetBucketWebsite = &aws.Operation{ - Name: "GetBucketWebsite", - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?website", - } - } - - if input == nil { - input = &GetBucketWebsiteInput{} - } - - req = c.newRequest(opGetBucketWebsite, input, output) - output = &GetBucketWebsiteOutput{} - req.Data = output - return -} - -// Returns the website configuration for a bucket. -func (c *S3) GetBucketWebsite(input *GetBucketWebsiteInput) (output *GetBucketWebsiteOutput, err error) { - req, out := c.GetBucketWebsiteRequest(input) - output = out - err = req.Send() - return -} - -var opGetBucketWebsite *aws.Operation - -// GetObjectRequest generates a request for the GetObject operation. -func (c *S3) GetObjectRequest(input *GetObjectInput) (req *aws.Request, output *GetObjectOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opGetObject == nil { - opGetObject = &aws.Operation{ - Name: "GetObject", - HTTPMethod: "GET", - HTTPPath: "/{Bucket}/{Key+}", - } - } - - if input == nil { - input = &GetObjectInput{} - } - - req = c.newRequest(opGetObject, input, output) - output = &GetObjectOutput{} - req.Data = output - return -} - -// Retrieves objects from Amazon S3. -func (c *S3) GetObject(input *GetObjectInput) (output *GetObjectOutput, err error) { - req, out := c.GetObjectRequest(input) - output = out - err = req.Send() - return -} - -var opGetObject *aws.Operation - -// GetObjectACLRequest generates a request for the GetObjectACL operation. -func (c *S3) GetObjectACLRequest(input *GetObjectACLInput) (req *aws.Request, output *GetObjectACLOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opGetObjectACL == nil { - opGetObjectACL = &aws.Operation{ - Name: "GetObjectAcl", - HTTPMethod: "GET", - HTTPPath: "/{Bucket}/{Key+}?acl", - } - } - - if input == nil { - input = &GetObjectACLInput{} - } - - req = c.newRequest(opGetObjectACL, input, output) - output = &GetObjectACLOutput{} - req.Data = output - return -} - -// Returns the access control list (ACL) of an object. -func (c *S3) GetObjectACL(input *GetObjectACLInput) (output *GetObjectACLOutput, err error) { - req, out := c.GetObjectACLRequest(input) - output = out - err = req.Send() - return -} - -var opGetObjectACL *aws.Operation - -// GetObjectTorrentRequest generates a request for the GetObjectTorrent operation. -func (c *S3) GetObjectTorrentRequest(input *GetObjectTorrentInput) (req *aws.Request, output *GetObjectTorrentOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opGetObjectTorrent == nil { - opGetObjectTorrent = &aws.Operation{ - Name: "GetObjectTorrent", - HTTPMethod: "GET", - HTTPPath: "/{Bucket}/{Key+}?torrent", - } - } - - if input == nil { - input = &GetObjectTorrentInput{} - } - - req = c.newRequest(opGetObjectTorrent, input, output) - output = &GetObjectTorrentOutput{} - req.Data = output - return -} - -// Return torrent files from a bucket. -func (c *S3) GetObjectTorrent(input *GetObjectTorrentInput) (output *GetObjectTorrentOutput, err error) { - req, out := c.GetObjectTorrentRequest(input) - output = out - err = req.Send() - return -} - -var opGetObjectTorrent *aws.Operation - -// HeadBucketRequest generates a request for the HeadBucket operation. -func (c *S3) HeadBucketRequest(input *HeadBucketInput) (req *aws.Request, output *HeadBucketOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opHeadBucket == nil { - opHeadBucket = &aws.Operation{ - Name: "HeadBucket", - HTTPMethod: "HEAD", - HTTPPath: "/{Bucket}", - } - } - - if input == nil { - input = &HeadBucketInput{} - } - - req = c.newRequest(opHeadBucket, input, output) - output = &HeadBucketOutput{} - req.Data = output - return -} - -// This operation is useful to determine if a bucket exists and you have permission -// to access it. -func (c *S3) HeadBucket(input *HeadBucketInput) (output *HeadBucketOutput, err error) { - req, out := c.HeadBucketRequest(input) - output = out - err = req.Send() - return -} - -var opHeadBucket *aws.Operation - -// HeadObjectRequest generates a request for the HeadObject operation. -func (c *S3) HeadObjectRequest(input *HeadObjectInput) (req *aws.Request, output *HeadObjectOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opHeadObject == nil { - opHeadObject = &aws.Operation{ - Name: "HeadObject", - HTTPMethod: "HEAD", - HTTPPath: "/{Bucket}/{Key+}", - } - } - - if input == nil { - input = &HeadObjectInput{} - } - - req = c.newRequest(opHeadObject, input, output) - output = &HeadObjectOutput{} - req.Data = output - return -} - -// The HEAD operation retrieves metadata from an object without returning the -// object itself. This operation is useful if you're only interested in an object's -// metadata. To use HEAD, you must have READ access to the object. -func (c *S3) HeadObject(input *HeadObjectInput) (output *HeadObjectOutput, err error) { - req, out := c.HeadObjectRequest(input) - output = out - err = req.Send() - return -} - -var opHeadObject *aws.Operation - -// ListBucketsRequest generates a request for the ListBuckets operation. -func (c *S3) ListBucketsRequest(input *ListBucketsInput) (req *aws.Request, output *ListBucketsOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opListBuckets == nil { - opListBuckets = &aws.Operation{ - Name: "ListBuckets", - HTTPMethod: "GET", - HTTPPath: "/", - } - } - - if input == nil { - input = &ListBucketsInput{} - } - - req = c.newRequest(opListBuckets, input, output) - output = &ListBucketsOutput{} - req.Data = output - return -} - -// Returns a list of all buckets owned by the authenticated sender of the request. -func (c *S3) ListBuckets(input *ListBucketsInput) (output *ListBucketsOutput, err error) { - req, out := c.ListBucketsRequest(input) - output = out - err = req.Send() - return -} - -var opListBuckets *aws.Operation - -// ListMultipartUploadsRequest generates a request for the ListMultipartUploads operation. -func (c *S3) ListMultipartUploadsRequest(input *ListMultipartUploadsInput) (req *aws.Request, output *ListMultipartUploadsOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opListMultipartUploads == nil { - opListMultipartUploads = &aws.Operation{ - Name: "ListMultipartUploads", - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?uploads", - } - } - - if input == nil { - input = &ListMultipartUploadsInput{} - } - - req = c.newRequest(opListMultipartUploads, input, output) - output = &ListMultipartUploadsOutput{} - req.Data = output - return -} - -// This operation lists in-progress multipart uploads. -func (c *S3) ListMultipartUploads(input *ListMultipartUploadsInput) (output *ListMultipartUploadsOutput, err error) { - req, out := c.ListMultipartUploadsRequest(input) - output = out - err = req.Send() - return -} - -var opListMultipartUploads *aws.Operation - -// ListObjectVersionsRequest generates a request for the ListObjectVersions operation. -func (c *S3) ListObjectVersionsRequest(input *ListObjectVersionsInput) (req *aws.Request, output *ListObjectVersionsOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opListObjectVersions == nil { - opListObjectVersions = &aws.Operation{ - Name: "ListObjectVersions", - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?versions", - } - } - - if input == nil { - input = &ListObjectVersionsInput{} - } - - req = c.newRequest(opListObjectVersions, input, output) - output = &ListObjectVersionsOutput{} - req.Data = output - return -} - -// Returns metadata about all of the versions of objects in a bucket. -func (c *S3) ListObjectVersions(input *ListObjectVersionsInput) (output *ListObjectVersionsOutput, err error) { - req, out := c.ListObjectVersionsRequest(input) - output = out - err = req.Send() - return -} - -var opListObjectVersions *aws.Operation - -// ListObjectsRequest generates a request for the ListObjects operation. -func (c *S3) ListObjectsRequest(input *ListObjectsInput) (req *aws.Request, output *ListObjectsOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opListObjects == nil { - opListObjects = &aws.Operation{ - Name: "ListObjects", - HTTPMethod: "GET", - HTTPPath: "/{Bucket}", - } - } - - if input == nil { - input = &ListObjectsInput{} - } - - req = c.newRequest(opListObjects, input, output) - output = &ListObjectsOutput{} - req.Data = output - return -} - -// Returns some or all (up to 1000) of the objects in a bucket. You can use -// the request parameters as selection criteria to return a subset of the objects -// in a bucket. -func (c *S3) ListObjects(input *ListObjectsInput) (output *ListObjectsOutput, err error) { - req, out := c.ListObjectsRequest(input) - output = out - err = req.Send() - return -} - -var opListObjects *aws.Operation - -// ListPartsRequest generates a request for the ListParts operation. -func (c *S3) ListPartsRequest(input *ListPartsInput) (req *aws.Request, output *ListPartsOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opListParts == nil { - opListParts = &aws.Operation{ - Name: "ListParts", - HTTPMethod: "GET", - HTTPPath: "/{Bucket}/{Key+}", - } - } - - if input == nil { - input = &ListPartsInput{} - } - - req = c.newRequest(opListParts, input, output) - output = &ListPartsOutput{} - req.Data = output - return -} - -// Lists the parts that have been uploaded for a specific multipart upload. -func (c *S3) ListParts(input *ListPartsInput) (output *ListPartsOutput, err error) { - req, out := c.ListPartsRequest(input) - output = out - err = req.Send() - return -} - -var opListParts *aws.Operation - -// PutBucketACLRequest generates a request for the PutBucketACL operation. -func (c *S3) PutBucketACLRequest(input *PutBucketACLInput) (req *aws.Request, output *PutBucketACLOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opPutBucketACL == nil { - opPutBucketACL = &aws.Operation{ - Name: "PutBucketAcl", - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?acl", - } - } - - if input == nil { - input = &PutBucketACLInput{} - } - - req = c.newRequest(opPutBucketACL, input, output) - output = &PutBucketACLOutput{} - req.Data = output - return -} - -// Sets the permissions on a bucket using access control lists (ACL). -func (c *S3) PutBucketACL(input *PutBucketACLInput) (output *PutBucketACLOutput, err error) { - req, out := c.PutBucketACLRequest(input) - output = out - err = req.Send() - return -} - -var opPutBucketACL *aws.Operation - -// PutBucketCORSRequest generates a request for the PutBucketCORS operation. -func (c *S3) PutBucketCORSRequest(input *PutBucketCORSInput) (req *aws.Request, output *PutBucketCORSOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opPutBucketCORS == nil { - opPutBucketCORS = &aws.Operation{ - Name: "PutBucketCors", - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?cors", - } - } - - if input == nil { - input = &PutBucketCORSInput{} - } - - req = c.newRequest(opPutBucketCORS, input, output) - output = &PutBucketCORSOutput{} - req.Data = output - return -} - -// Sets the cors configuration for a bucket. -func (c *S3) PutBucketCORS(input *PutBucketCORSInput) (output *PutBucketCORSOutput, err error) { - req, out := c.PutBucketCORSRequest(input) - output = out - err = req.Send() - return -} - -var opPutBucketCORS *aws.Operation - -// PutBucketLifecycleRequest generates a request for the PutBucketLifecycle operation. -func (c *S3) PutBucketLifecycleRequest(input *PutBucketLifecycleInput) (req *aws.Request, output *PutBucketLifecycleOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opPutBucketLifecycle == nil { - opPutBucketLifecycle = &aws.Operation{ - Name: "PutBucketLifecycle", - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?lifecycle", - } - } - - if input == nil { - input = &PutBucketLifecycleInput{} - } - - req = c.newRequest(opPutBucketLifecycle, input, output) - output = &PutBucketLifecycleOutput{} - req.Data = output - return -} - -// Sets lifecycle configuration for your bucket. If a lifecycle configuration -// exists, it replaces it. -func (c *S3) PutBucketLifecycle(input *PutBucketLifecycleInput) (output *PutBucketLifecycleOutput, err error) { - req, out := c.PutBucketLifecycleRequest(input) - output = out - err = req.Send() - return -} - -var opPutBucketLifecycle *aws.Operation - -// PutBucketLoggingRequest generates a request for the PutBucketLogging operation. -func (c *S3) PutBucketLoggingRequest(input *PutBucketLoggingInput) (req *aws.Request, output *PutBucketLoggingOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opPutBucketLogging == nil { - opPutBucketLogging = &aws.Operation{ - Name: "PutBucketLogging", - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?logging", - } - } - - if input == nil { - input = &PutBucketLoggingInput{} - } - - req = c.newRequest(opPutBucketLogging, input, output) - output = &PutBucketLoggingOutput{} - req.Data = output - return -} - -// Set the logging parameters for a bucket and to specify permissions for who -// can view and modify the logging parameters. To set the logging status of -// a bucket, you must be the bucket owner. -func (c *S3) PutBucketLogging(input *PutBucketLoggingInput) (output *PutBucketLoggingOutput, err error) { - req, out := c.PutBucketLoggingRequest(input) - output = out - err = req.Send() - return -} - -var opPutBucketLogging *aws.Operation - -// PutBucketNotificationRequest generates a request for the PutBucketNotification operation. -func (c *S3) PutBucketNotificationRequest(input *PutBucketNotificationInput) (req *aws.Request, output *PutBucketNotificationOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opPutBucketNotification == nil { - opPutBucketNotification = &aws.Operation{ - Name: "PutBucketNotification", - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?notification", - } - } - - if input == nil { - input = &PutBucketNotificationInput{} - } - - req = c.newRequest(opPutBucketNotification, input, output) - output = &PutBucketNotificationOutput{} - req.Data = output - return -} - -// Enables notifications of specified events for a bucket. -func (c *S3) PutBucketNotification(input *PutBucketNotificationInput) (output *PutBucketNotificationOutput, err error) { - req, out := c.PutBucketNotificationRequest(input) - output = out - err = req.Send() - return -} - -var opPutBucketNotification *aws.Operation - -// PutBucketPolicyRequest generates a request for the PutBucketPolicy operation. -func (c *S3) PutBucketPolicyRequest(input *PutBucketPolicyInput) (req *aws.Request, output *PutBucketPolicyOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opPutBucketPolicy == nil { - opPutBucketPolicy = &aws.Operation{ - Name: "PutBucketPolicy", - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?policy", - } - } - - if input == nil { - input = &PutBucketPolicyInput{} - } - - req = c.newRequest(opPutBucketPolicy, input, output) - output = &PutBucketPolicyOutput{} - req.Data = output - return -} - -// Replaces a policy on a bucket. If the bucket already has a policy, the one -// in this request completely replaces it. -func (c *S3) PutBucketPolicy(input *PutBucketPolicyInput) (output *PutBucketPolicyOutput, err error) { - req, out := c.PutBucketPolicyRequest(input) - output = out - err = req.Send() - return -} - -var opPutBucketPolicy *aws.Operation - -// PutBucketReplicationRequest generates a request for the PutBucketReplication operation. -func (c *S3) PutBucketReplicationRequest(input *PutBucketReplicationInput) (req *aws.Request, output *PutBucketReplicationOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opPutBucketReplication == nil { - opPutBucketReplication = &aws.Operation{ - Name: "PutBucketReplication", - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?replication", - } - } - - if input == nil { - input = &PutBucketReplicationInput{} - } - - req = c.newRequest(opPutBucketReplication, input, output) - output = &PutBucketReplicationOutput{} - req.Data = output - return -} - -// Creates a new replication configuration (or replaces an existing one, if -// present). -func (c *S3) PutBucketReplication(input *PutBucketReplicationInput) (output *PutBucketReplicationOutput, err error) { - req, out := c.PutBucketReplicationRequest(input) - output = out - err = req.Send() - return -} - -var opPutBucketReplication *aws.Operation - -// PutBucketRequestPaymentRequest generates a request for the PutBucketRequestPayment operation. -func (c *S3) PutBucketRequestPaymentRequest(input *PutBucketRequestPaymentInput) (req *aws.Request, output *PutBucketRequestPaymentOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opPutBucketRequestPayment == nil { - opPutBucketRequestPayment = &aws.Operation{ - Name: "PutBucketRequestPayment", - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?requestPayment", - } - } - - if input == nil { - input = &PutBucketRequestPaymentInput{} - } - - req = c.newRequest(opPutBucketRequestPayment, input, output) - output = &PutBucketRequestPaymentOutput{} - req.Data = output - return -} - -// Sets the request payment configuration for a bucket. By default, the bucket -// owner pays for downloads from the bucket. This configuration parameter enables -// the bucket owner (only) to specify that the person requesting the download -// will be charged for the download. Documentation on requester pays buckets -// can be found at http://docs.aws.amazon.com/AmazonS3/latest/dev/RequesterPaysBuckets.html -func (c *S3) PutBucketRequestPayment(input *PutBucketRequestPaymentInput) (output *PutBucketRequestPaymentOutput, err error) { - req, out := c.PutBucketRequestPaymentRequest(input) - output = out - err = req.Send() - return -} - -var opPutBucketRequestPayment *aws.Operation - -// PutBucketTaggingRequest generates a request for the PutBucketTagging operation. -func (c *S3) PutBucketTaggingRequest(input *PutBucketTaggingInput) (req *aws.Request, output *PutBucketTaggingOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opPutBucketTagging == nil { - opPutBucketTagging = &aws.Operation{ - Name: "PutBucketTagging", - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?tagging", - } - } - - if input == nil { - input = &PutBucketTaggingInput{} - } - - req = c.newRequest(opPutBucketTagging, input, output) - output = &PutBucketTaggingOutput{} - req.Data = output - return -} - -// Sets the tags for a bucket. -func (c *S3) PutBucketTagging(input *PutBucketTaggingInput) (output *PutBucketTaggingOutput, err error) { - req, out := c.PutBucketTaggingRequest(input) - output = out - err = req.Send() - return -} - -var opPutBucketTagging *aws.Operation - -// PutBucketVersioningRequest generates a request for the PutBucketVersioning operation. -func (c *S3) PutBucketVersioningRequest(input *PutBucketVersioningInput) (req *aws.Request, output *PutBucketVersioningOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opPutBucketVersioning == nil { - opPutBucketVersioning = &aws.Operation{ - Name: "PutBucketVersioning", - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?versioning", - } - } - - if input == nil { - input = &PutBucketVersioningInput{} - } - - req = c.newRequest(opPutBucketVersioning, input, output) - output = &PutBucketVersioningOutput{} - req.Data = output - return -} - -// Sets the versioning state of an existing bucket. To set the versioning state, -// you must be the bucket owner. -func (c *S3) PutBucketVersioning(input *PutBucketVersioningInput) (output *PutBucketVersioningOutput, err error) { - req, out := c.PutBucketVersioningRequest(input) - output = out - err = req.Send() - return -} - -var opPutBucketVersioning *aws.Operation - -// PutBucketWebsiteRequest generates a request for the PutBucketWebsite operation. -func (c *S3) PutBucketWebsiteRequest(input *PutBucketWebsiteInput) (req *aws.Request, output *PutBucketWebsiteOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opPutBucketWebsite == nil { - opPutBucketWebsite = &aws.Operation{ - Name: "PutBucketWebsite", - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?website", - } - } - - if input == nil { - input = &PutBucketWebsiteInput{} - } - - req = c.newRequest(opPutBucketWebsite, input, output) - output = &PutBucketWebsiteOutput{} - req.Data = output - return -} - -// Set the website configuration for a bucket. -func (c *S3) PutBucketWebsite(input *PutBucketWebsiteInput) (output *PutBucketWebsiteOutput, err error) { - req, out := c.PutBucketWebsiteRequest(input) - output = out - err = req.Send() - return -} - -var opPutBucketWebsite *aws.Operation - -// PutObjectRequest generates a request for the PutObject operation. -func (c *S3) PutObjectRequest(input *PutObjectInput) (req *aws.Request, output *PutObjectOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opPutObject == nil { - opPutObject = &aws.Operation{ - Name: "PutObject", - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}/{Key+}", - } - } - - if input == nil { - input = &PutObjectInput{} - } - - req = c.newRequest(opPutObject, input, output) - output = &PutObjectOutput{} - req.Data = output - return -} - -// Adds an object to a bucket. -func (c *S3) PutObject(input *PutObjectInput) (output *PutObjectOutput, err error) { - req, out := c.PutObjectRequest(input) - output = out - err = req.Send() - return -} - -var opPutObject *aws.Operation - -// PutObjectACLRequest generates a request for the PutObjectACL operation. -func (c *S3) PutObjectACLRequest(input *PutObjectACLInput) (req *aws.Request, output *PutObjectACLOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opPutObjectACL == nil { - opPutObjectACL = &aws.Operation{ - Name: "PutObjectAcl", - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}/{Key+}?acl", - } - } - - if input == nil { - input = &PutObjectACLInput{} - } - - req = c.newRequest(opPutObjectACL, input, output) - output = &PutObjectACLOutput{} - req.Data = output - return -} - -// uses the acl subresource to set the access control list (ACL) permissions -// for an object that already exists in a bucket -func (c *S3) PutObjectACL(input *PutObjectACLInput) (output *PutObjectACLOutput, err error) { - req, out := c.PutObjectACLRequest(input) - output = out - err = req.Send() - return -} - -var opPutObjectACL *aws.Operation - -// RestoreObjectRequest generates a request for the RestoreObject operation. -func (c *S3) RestoreObjectRequest(input *RestoreObjectInput) (req *aws.Request, output *RestoreObjectOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opRestoreObject == nil { - opRestoreObject = &aws.Operation{ - Name: "RestoreObject", - HTTPMethod: "POST", - HTTPPath: "/{Bucket}/{Key+}?restore", - } - } - - if input == nil { - input = &RestoreObjectInput{} - } - - req = c.newRequest(opRestoreObject, input, output) - output = &RestoreObjectOutput{} - req.Data = output - return -} - -// Restores an archived copy of an object back into Amazon S3 -func (c *S3) RestoreObject(input *RestoreObjectInput) (output *RestoreObjectOutput, err error) { - req, out := c.RestoreObjectRequest(input) - output = out - err = req.Send() - return -} - -var opRestoreObject *aws.Operation - -// UploadPartRequest generates a request for the UploadPart operation. -func (c *S3) UploadPartRequest(input *UploadPartInput) (req *aws.Request, output *UploadPartOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opUploadPart == nil { - opUploadPart = &aws.Operation{ - Name: "UploadPart", - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}/{Key+}", - } - } - - if input == nil { - input = &UploadPartInput{} - } - - req = c.newRequest(opUploadPart, input, output) - output = &UploadPartOutput{} - req.Data = output - return -} - -// Uploads a part in a multipart upload. -// -// Note: After you initiate multipart upload and upload one or more parts, -// you must either complete or abort multipart upload in order to stop getting -// charged for storage of the uploaded parts. Only after you either complete -// or abort multipart upload, Amazon S3 frees up the parts storage and stops -// charging you for the parts storage. -func (c *S3) UploadPart(input *UploadPartInput) (output *UploadPartOutput, err error) { - req, out := c.UploadPartRequest(input) - output = out - err = req.Send() - return -} - -var opUploadPart *aws.Operation - -// UploadPartCopyRequest generates a request for the UploadPartCopy operation. -func (c *S3) UploadPartCopyRequest(input *UploadPartCopyInput) (req *aws.Request, output *UploadPartCopyOutput) { - oprw.Lock() - defer oprw.Unlock() - - if opUploadPartCopy == nil { - opUploadPartCopy = &aws.Operation{ - Name: "UploadPartCopy", - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}/{Key+}", - } - } - - if input == nil { - input = &UploadPartCopyInput{} - } - - req = c.newRequest(opUploadPartCopy, input, output) - output = &UploadPartCopyOutput{} - req.Data = output - return -} - -// Uploads a part by copying data from an existing object as data source. -func (c *S3) UploadPartCopy(input *UploadPartCopyInput) (output *UploadPartCopyOutput, err error) { - req, out := c.UploadPartCopyRequest(input) - output = out - err = req.Send() - return -} - -var opUploadPartCopy *aws.Operation - -type AbortMultipartUploadInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - Key *string `location:"uri" locationName:"Key" type:"string" required:"true"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string"` - - UploadID *string `location:"querystring" locationName:"uploadId" type:"string" required:"true"` - - metadataAbortMultipartUploadInput `json:"-", xml:"-"` -} - -type metadataAbortMultipartUploadInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type AbortMultipartUploadOutput struct { - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string"` - - metadataAbortMultipartUploadOutput `json:"-", xml:"-"` -} - -type metadataAbortMultipartUploadOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type AccessControlPolicy struct { - // A list of grants. - Grants []*Grant `locationName:"AccessControlList" locationNameList:"Grant" type:"list"` - - Owner *Owner `type:"structure"` - - metadataAccessControlPolicy `json:"-", xml:"-"` -} - -type metadataAccessControlPolicy struct { - SDKShapeTraits bool `type:"structure"` -} - -type Bucket struct { - // Date the bucket was created. - CreationDate *time.Time `type:"timestamp" timestampFormat:"iso8601"` - - // The name of the bucket. - Name *string `type:"string"` - - metadataBucket `json:"-", xml:"-"` -} - -type metadataBucket struct { - SDKShapeTraits bool `type:"structure"` -} - -type BucketLoggingStatus struct { - LoggingEnabled *LoggingEnabled `type:"structure"` - - metadataBucketLoggingStatus `json:"-", xml:"-"` -} - -type metadataBucketLoggingStatus struct { - SDKShapeTraits bool `type:"structure"` -} - -type CORSConfiguration struct { - CORSRules []*CORSRule `locationName:"CORSRule" type:"list" flattened:"true"` - - metadataCORSConfiguration `json:"-", xml:"-"` -} - -type metadataCORSConfiguration struct { - SDKShapeTraits bool `type:"structure"` -} - -type CORSRule struct { - // Specifies which headers are allowed in a pre-flight OPTIONS request. - AllowedHeaders []*string `locationName:"AllowedHeader" type:"list" flattened:"true"` - - // Identifies HTTP methods that the domain/origin specified in the rule is allowed - // to execute. - AllowedMethods []*string `locationName:"AllowedMethod" type:"list" flattened:"true"` - - // One or more origins you want customers to be able to access the bucket from. - AllowedOrigins []*string `locationName:"AllowedOrigin" type:"list" flattened:"true"` - - // One or more headers in the response that you want customers to be able to - // access from their applications (for example, from a JavaScript XMLHttpRequest - // object). - ExposeHeaders []*string `locationName:"ExposeHeader" type:"list" flattened:"true"` - - // The time in seconds that your browser is to cache the preflight response - // for the specified resource. - MaxAgeSeconds *int64 `type:"integer"` - - metadataCORSRule `json:"-", xml:"-"` -} - -type metadataCORSRule struct { - SDKShapeTraits bool `type:"structure"` -} - -type CloudFunctionConfiguration struct { - CloudFunction *string `type:"string"` - - Event *string `type:"string"` - - Events []*string `locationName:"Event" type:"list" flattened:"true"` - - ID *string `locationName:"Id" type:"string"` - - InvocationRole *string `type:"string"` - - metadataCloudFunctionConfiguration `json:"-", xml:"-"` -} - -type metadataCloudFunctionConfiguration struct { - SDKShapeTraits bool `type:"structure"` -} - -type CommonPrefix struct { - Prefix *string `type:"string"` - - metadataCommonPrefix `json:"-", xml:"-"` -} - -type metadataCommonPrefix struct { - SDKShapeTraits bool `type:"structure"` -} - -type CompleteMultipartUploadInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - Key *string `location:"uri" locationName:"Key" type:"string" required:"true"` - - MultipartUpload *CompletedMultipartUpload `locationName:"CompleteMultipartUpload" type:"structure"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string"` - - UploadID *string `location:"querystring" locationName:"uploadId" type:"string" required:"true"` - - metadataCompleteMultipartUploadInput `json:"-", xml:"-"` -} - -type metadataCompleteMultipartUploadInput struct { - SDKShapeTraits bool `type:"structure" payload:"MultipartUpload"` -} - -type CompleteMultipartUploadOutput struct { - Bucket *string `type:"string"` - - // Entity tag of the object. - ETag *string `type:"string"` - - // If the object expiration is configured, this will contain the expiration - // date (expiry-date) and rule ID (rule-id). The value of rule-id is URL encoded. - Expiration *string `location:"header" locationName:"x-amz-expiration" type:"string"` - - Key *string `type:"string"` - - Location *string `type:"string"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string"` - - // If present, specifies the ID of the AWS Key Management Service (KMS) master - // encryption key that was used for the object. - SSEKMSKeyID *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` - - // The Server-side encryption algorithm used when storing this object in S3 - // (e.g., AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string"` - - // Version of the object. - VersionID *string `location:"header" locationName:"x-amz-version-id" type:"string"` - - metadataCompleteMultipartUploadOutput `json:"-", xml:"-"` -} - -type metadataCompleteMultipartUploadOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type CompletedMultipartUpload struct { - Parts []*CompletedPart `locationName:"Part" type:"list" flattened:"true"` - - metadataCompletedMultipartUpload `json:"-", xml:"-"` -} - -type metadataCompletedMultipartUpload struct { - SDKShapeTraits bool `type:"structure"` -} - -type CompletedPart struct { - // Entity tag returned when the part was uploaded. - ETag *string `type:"string"` - - // Part number that identifies the part. - PartNumber *int64 `type:"integer"` - - metadataCompletedPart `json:"-", xml:"-"` -} - -type metadataCompletedPart struct { - SDKShapeTraits bool `type:"structure"` -} - -type Condition struct { - // The HTTP error code when the redirect is applied. In the event of an error, - // if the error code equals this value, then the specified redirect is applied. - // Required when parent element Condition is specified and sibling KeyPrefixEquals - // is not specified. If both are specified, then both must be true for the redirect - // to be applied. - HTTPErrorCodeReturnedEquals *string `locationName:"HttpErrorCodeReturnedEquals" type:"string"` - - // The object key name prefix when the redirect is applied. For example, to - // redirect requests for ExamplePage.html, the key prefix will be ExamplePage.html. - // To redirect request for all pages with the prefix docs/, the key prefix will - // be /docs, which identifies all objects in the docs/ folder. Required when - // the parent element Condition is specified and sibling HttpErrorCodeReturnedEquals - // is not specified. If both conditions are specified, both must be true for - // the redirect to be applied. - KeyPrefixEquals *string `type:"string"` - - metadataCondition `json:"-", xml:"-"` -} - -type metadataCondition struct { - SDKShapeTraits bool `type:"structure"` -} - -type CopyObjectInput struct { - // The canned ACL to apply to the object. - ACL *string `location:"header" locationName:"x-amz-acl" type:"string"` - - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Specifies caching behavior along the request/reply chain. - CacheControl *string `location:"header" locationName:"Cache-Control" type:"string"` - - // Specifies presentational information for the object. - ContentDisposition *string `location:"header" locationName:"Content-Disposition" type:"string"` - - // Specifies what content encodings have been applied to the object and thus - // what decoding mechanisms must be applied to obtain the media-type referenced - // by the Content-Type header field. - ContentEncoding *string `location:"header" locationName:"Content-Encoding" type:"string"` - - // The language the content is in. - ContentLanguage *string `location:"header" locationName:"Content-Language" type:"string"` - - // A standard MIME type describing the format of the object data. - ContentType *string `location:"header" locationName:"Content-Type" type:"string"` - - // The name of the source bucket and key name of the source object, separated - // by a slash (/). Must be URL-encoded. - CopySource *string `location:"header" locationName:"x-amz-copy-source" type:"string" required:"true"` - - // Copies the object if its entity tag (ETag) matches the specified tag. - CopySourceIfMatch *string `location:"header" locationName:"x-amz-copy-source-if-match" type:"string"` - - // Copies the object if it has been modified since the specified time. - CopySourceIfModifiedSince *time.Time `location:"header" locationName:"x-amz-copy-source-if-modified-since" type:"timestamp" timestampFormat:"rfc822"` - - // Copies the object if its entity tag (ETag) is different than the specified - // ETag. - CopySourceIfNoneMatch *string `location:"header" locationName:"x-amz-copy-source-if-none-match" type:"string"` - - // Copies the object if it hasn't been modified since the specified time. - CopySourceIfUnmodifiedSince *time.Time `location:"header" locationName:"x-amz-copy-source-if-unmodified-since" type:"timestamp" timestampFormat:"rfc822"` - - // Specifies the algorithm to use when decrypting the source object (e.g., AES256). - CopySourceSSECustomerAlgorithm *string `location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-algorithm" type:"string"` - - // Specifies the customer-provided encryption key for Amazon S3 to use to decrypt - // the source object. The encryption key provided in this header must be one - // that was used when the source object was created. - CopySourceSSECustomerKey *string `location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-key" type:"string"` - - // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. - // Amazon S3 uses this header for a message integrity check to ensure the encryption - // key was transmitted without error. - CopySourceSSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-key-MD5" type:"string"` - - // The date and time at which the object is no longer cacheable. - Expires *time.Time `location:"header" locationName:"Expires" type:"timestamp" timestampFormat:"rfc822"` - - // Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object. - GrantFullControl *string `location:"header" locationName:"x-amz-grant-full-control" type:"string"` - - // Allows grantee to read the object data and its metadata. - GrantRead *string `location:"header" locationName:"x-amz-grant-read" type:"string"` - - // Allows grantee to read the object ACL. - GrantReadACP *string `location:"header" locationName:"x-amz-grant-read-acp" type:"string"` - - // Allows grantee to write the ACL for the applicable object. - GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` - - Key *string `location:"uri" locationName:"Key" type:"string" required:"true"` - - // A map of metadata to store with the object in S3. - Metadata *map[string]*string `location:"headers" locationName:"x-amz-meta-" type:"map"` - - // Specifies whether the metadata is copied from the source object or replaced - // with metadata provided in the request. - MetadataDirective *string `location:"header" locationName:"x-amz-metadata-directive" type:"string"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string"` - - // Specifies the algorithm to use to when encrypting the object (e.g., AES256, - // aws:kms). - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting - // data. This value is used to store the object and then it is discarded; Amazon - // does not store the encryption key. The key must be appropriate for use with - // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm - // header. - SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string"` - - // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. - // Amazon S3 uses this header for a message integrity check to ensure the encryption - // key was transmitted without error. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // Specifies the AWS KMS key ID to use for object encryption. All GET and PUT - // requests for an object protected by AWS KMS will fail if not made via SSL - // or using SigV4. Documentation on configuring any of the officially supported - // AWS SDKs and CLI can be found at http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version - SSEKMSKeyID *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` - - // The Server-side encryption algorithm used when storing this object in S3 - // (e.g., AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string"` - - // The type of storage to use for the object. Defaults to 'STANDARD'. - StorageClass *string `location:"header" locationName:"x-amz-storage-class" type:"string"` - - // If the bucket is configured as a website, redirects requests for this object - // to another object in the same bucket or to an external URL. Amazon S3 stores - // the value of this header in the object metadata. - WebsiteRedirectLocation *string `location:"header" locationName:"x-amz-website-redirect-location" type:"string"` - - metadataCopyObjectInput `json:"-", xml:"-"` -} - -type metadataCopyObjectInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type CopyObjectOutput struct { - CopyObjectResult *CopyObjectResult `type:"structure"` - - CopySourceVersionID *string `location:"header" locationName:"x-amz-copy-source-version-id" type:"string"` - - // If the object expiration is configured, the response includes this header. - Expiration *string `location:"header" locationName:"x-amz-expiration" type:"string"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header confirming the encryption algorithm - // used. - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header to provide round trip message integrity - // verification of the customer-provided encryption key. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // If present, specifies the ID of the AWS Key Management Service (KMS) master - // encryption key that was used for the object. - SSEKMSKeyID *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` - - // The Server-side encryption algorithm used when storing this object in S3 - // (e.g., AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string"` - - metadataCopyObjectOutput `json:"-", xml:"-"` -} - -type metadataCopyObjectOutput struct { - SDKShapeTraits bool `type:"structure" payload:"CopyObjectResult"` -} - -type CopyObjectResult struct { - ETag *string `type:"string"` - - LastModified *time.Time `type:"timestamp" timestampFormat:"iso8601"` - - metadataCopyObjectResult `json:"-", xml:"-"` -} - -type metadataCopyObjectResult struct { - SDKShapeTraits bool `type:"structure"` -} - -type CopyPartResult struct { - // Entity tag of the object. - ETag *string `type:"string"` - - // Date and time at which the object was uploaded. - LastModified *time.Time `type:"timestamp" timestampFormat:"iso8601"` - - metadataCopyPartResult `json:"-", xml:"-"` -} - -type metadataCopyPartResult struct { - SDKShapeTraits bool `type:"structure"` -} - -type CreateBucketConfiguration struct { - // Specifies the region where the bucket will be created. - LocationConstraint *string `type:"string"` - - metadataCreateBucketConfiguration `json:"-", xml:"-"` -} - -type metadataCreateBucketConfiguration struct { - SDKShapeTraits bool `type:"structure"` -} - -type CreateBucketInput struct { - // The canned ACL to apply to the bucket. - ACL *string `location:"header" locationName:"x-amz-acl" type:"string"` - - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - CreateBucketConfiguration *CreateBucketConfiguration `locationName:"CreateBucketConfiguration" type:"structure"` - - // Allows grantee the read, write, read ACP, and write ACP permissions on the - // bucket. - GrantFullControl *string `location:"header" locationName:"x-amz-grant-full-control" type:"string"` - - // Allows grantee to list the objects in the bucket. - GrantRead *string `location:"header" locationName:"x-amz-grant-read" type:"string"` - - // Allows grantee to read the bucket ACL. - GrantReadACP *string `location:"header" locationName:"x-amz-grant-read-acp" type:"string"` - - // Allows grantee to create, overwrite, and delete any object in the bucket. - GrantWrite *string `location:"header" locationName:"x-amz-grant-write" type:"string"` - - // Allows grantee to write the ACL for the applicable bucket. - GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` - - metadataCreateBucketInput `json:"-", xml:"-"` -} - -type metadataCreateBucketInput struct { - SDKShapeTraits bool `type:"structure" payload:"CreateBucketConfiguration"` -} - -type CreateBucketOutput struct { - Location *string `location:"header" locationName:"Location" type:"string"` - - metadataCreateBucketOutput `json:"-", xml:"-"` -} - -type metadataCreateBucketOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type CreateMultipartUploadInput struct { - // The canned ACL to apply to the object. - ACL *string `location:"header" locationName:"x-amz-acl" type:"string"` - - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Specifies caching behavior along the request/reply chain. - CacheControl *string `location:"header" locationName:"Cache-Control" type:"string"` - - // Specifies presentational information for the object. - ContentDisposition *string `location:"header" locationName:"Content-Disposition" type:"string"` - - // Specifies what content encodings have been applied to the object and thus - // what decoding mechanisms must be applied to obtain the media-type referenced - // by the Content-Type header field. - ContentEncoding *string `location:"header" locationName:"Content-Encoding" type:"string"` - - // The language the content is in. - ContentLanguage *string `location:"header" locationName:"Content-Language" type:"string"` - - // A standard MIME type describing the format of the object data. - ContentType *string `location:"header" locationName:"Content-Type" type:"string"` - - // The date and time at which the object is no longer cacheable. - Expires *time.Time `location:"header" locationName:"Expires" type:"timestamp" timestampFormat:"rfc822"` - - // Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object. - GrantFullControl *string `location:"header" locationName:"x-amz-grant-full-control" type:"string"` - - // Allows grantee to read the object data and its metadata. - GrantRead *string `location:"header" locationName:"x-amz-grant-read" type:"string"` - - // Allows grantee to read the object ACL. - GrantReadACP *string `location:"header" locationName:"x-amz-grant-read-acp" type:"string"` - - // Allows grantee to write the ACL for the applicable object. - GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` - - Key *string `location:"uri" locationName:"Key" type:"string" required:"true"` - - // A map of metadata to store with the object in S3. - Metadata *map[string]*string `location:"headers" locationName:"x-amz-meta-" type:"map"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string"` - - // Specifies the algorithm to use to when encrypting the object (e.g., AES256, - // aws:kms). - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting - // data. This value is used to store the object and then it is discarded; Amazon - // does not store the encryption key. The key must be appropriate for use with - // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm - // header. - SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string"` - - // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. - // Amazon S3 uses this header for a message integrity check to ensure the encryption - // key was transmitted without error. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // Specifies the AWS KMS key ID to use for object encryption. All GET and PUT - // requests for an object protected by AWS KMS will fail if not made via SSL - // or using SigV4. Documentation on configuring any of the officially supported - // AWS SDKs and CLI can be found at http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version - SSEKMSKeyID *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` - - // The Server-side encryption algorithm used when storing this object in S3 - // (e.g., AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string"` - - // The type of storage to use for the object. Defaults to 'STANDARD'. - StorageClass *string `location:"header" locationName:"x-amz-storage-class" type:"string"` - - // If the bucket is configured as a website, redirects requests for this object - // to another object in the same bucket or to an external URL. Amazon S3 stores - // the value of this header in the object metadata. - WebsiteRedirectLocation *string `location:"header" locationName:"x-amz-website-redirect-location" type:"string"` - - metadataCreateMultipartUploadInput `json:"-", xml:"-"` -} - -type metadataCreateMultipartUploadInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type CreateMultipartUploadOutput struct { - // Name of the bucket to which the multipart upload was initiated. - Bucket *string `locationName:"Bucket" type:"string"` - - // Object key for which the multipart upload was initiated. - Key *string `type:"string"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header confirming the encryption algorithm - // used. - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header to provide round trip message integrity - // verification of the customer-provided encryption key. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // If present, specifies the ID of the AWS Key Management Service (KMS) master - // encryption key that was used for the object. - SSEKMSKeyID *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` - - // The Server-side encryption algorithm used when storing this object in S3 - // (e.g., AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string"` - - // ID for the initiated multipart upload. - UploadID *string `locationName:"UploadId" type:"string"` - - metadataCreateMultipartUploadOutput `json:"-", xml:"-"` -} - -type metadataCreateMultipartUploadOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type Delete struct { - Objects []*ObjectIdentifier `locationName:"Object" type:"list" flattened:"true" required:"true"` - - // Element to enable quiet mode for the request. When you add this element, - // you must set its value to true. - Quiet *bool `type:"boolean"` - - metadataDelete `json:"-", xml:"-"` -} - -type metadataDelete struct { - SDKShapeTraits bool `type:"structure"` -} - -type DeleteBucketCORSInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - metadataDeleteBucketCORSInput `json:"-", xml:"-"` -} - -type metadataDeleteBucketCORSInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type DeleteBucketCORSOutput struct { - metadataDeleteBucketCORSOutput `json:"-", xml:"-"` -} - -type metadataDeleteBucketCORSOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type DeleteBucketInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - metadataDeleteBucketInput `json:"-", xml:"-"` -} - -type metadataDeleteBucketInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type DeleteBucketLifecycleInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - metadataDeleteBucketLifecycleInput `json:"-", xml:"-"` -} - -type metadataDeleteBucketLifecycleInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type DeleteBucketLifecycleOutput struct { - metadataDeleteBucketLifecycleOutput `json:"-", xml:"-"` -} - -type metadataDeleteBucketLifecycleOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type DeleteBucketOutput struct { - metadataDeleteBucketOutput `json:"-", xml:"-"` -} - -type metadataDeleteBucketOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type DeleteBucketPolicyInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - metadataDeleteBucketPolicyInput `json:"-", xml:"-"` -} - -type metadataDeleteBucketPolicyInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type DeleteBucketPolicyOutput struct { - metadataDeleteBucketPolicyOutput `json:"-", xml:"-"` -} - -type metadataDeleteBucketPolicyOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type DeleteBucketReplicationInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - metadataDeleteBucketReplicationInput `json:"-", xml:"-"` -} - -type metadataDeleteBucketReplicationInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type DeleteBucketReplicationOutput struct { - metadataDeleteBucketReplicationOutput `json:"-", xml:"-"` -} - -type metadataDeleteBucketReplicationOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type DeleteBucketTaggingInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - metadataDeleteBucketTaggingInput `json:"-", xml:"-"` -} - -type metadataDeleteBucketTaggingInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type DeleteBucketTaggingOutput struct { - metadataDeleteBucketTaggingOutput `json:"-", xml:"-"` -} - -type metadataDeleteBucketTaggingOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type DeleteBucketWebsiteInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - metadataDeleteBucketWebsiteInput `json:"-", xml:"-"` -} - -type metadataDeleteBucketWebsiteInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type DeleteBucketWebsiteOutput struct { - metadataDeleteBucketWebsiteOutput `json:"-", xml:"-"` -} - -type metadataDeleteBucketWebsiteOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type DeleteMarkerEntry struct { - // Specifies whether the object is (true) or is not (false) the latest version - // of an object. - IsLatest *bool `type:"boolean"` - - // The object key. - Key *string `type:"string"` - - // Date and time the object was last modified. - LastModified *time.Time `type:"timestamp" timestampFormat:"iso8601"` - - Owner *Owner `type:"structure"` - - // Version ID of an object. - VersionID *string `locationName:"VersionId" type:"string"` - - metadataDeleteMarkerEntry `json:"-", xml:"-"` -} - -type metadataDeleteMarkerEntry struct { - SDKShapeTraits bool `type:"structure"` -} - -type DeleteObjectInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - Key *string `location:"uri" locationName:"Key" type:"string" required:"true"` - - // The concatenation of the authentication device's serial number, a space, - // and the value that is displayed on your authentication device. - MFA *string `location:"header" locationName:"x-amz-mfa" type:"string"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string"` - - // VersionId used to reference a specific version of the object. - VersionID *string `location:"querystring" locationName:"versionId" type:"string"` - - metadataDeleteObjectInput `json:"-", xml:"-"` -} - -type metadataDeleteObjectInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type DeleteObjectOutput struct { - // Specifies whether the versioned object that was permanently deleted was (true) - // or was not (false) a delete marker. - DeleteMarker *bool `location:"header" locationName:"x-amz-delete-marker" type:"boolean"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string"` - - // Returns the version ID of the delete marker created as a result of the DELETE - // operation. - VersionID *string `location:"header" locationName:"x-amz-version-id" type:"string"` - - metadataDeleteObjectOutput `json:"-", xml:"-"` -} - -type metadataDeleteObjectOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type DeleteObjectsInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - Delete *Delete `locationName:"Delete" type:"structure" required:"true"` - - // The concatenation of the authentication device's serial number, a space, - // and the value that is displayed on your authentication device. - MFA *string `location:"header" locationName:"x-amz-mfa" type:"string"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string"` - - metadataDeleteObjectsInput `json:"-", xml:"-"` -} - -type metadataDeleteObjectsInput struct { - SDKShapeTraits bool `type:"structure" payload:"Delete"` -} - -type DeleteObjectsOutput struct { - Deleted []*DeletedObject `type:"list" flattened:"true"` - - Errors []*Error `locationName:"Error" type:"list" flattened:"true"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string"` - - metadataDeleteObjectsOutput `json:"-", xml:"-"` -} - -type metadataDeleteObjectsOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type DeletedObject struct { - DeleteMarker *bool `type:"boolean"` - - DeleteMarkerVersionID *string `locationName:"DeleteMarkerVersionId" type:"string"` - - Key *string `type:"string"` - - VersionID *string `locationName:"VersionId" type:"string"` - - metadataDeletedObject `json:"-", xml:"-"` -} - -type metadataDeletedObject struct { - SDKShapeTraits bool `type:"structure"` -} - -type Destination struct { - // Amazon resource name (ARN) of the bucket where you want Amazon S3 to store - // replicas of the object identified by the rule. - Bucket *string `type:"string" required:"true"` - - metadataDestination `json:"-", xml:"-"` -} - -type metadataDestination struct { - SDKShapeTraits bool `type:"structure"` -} - -type Error struct { - Code *string `type:"string"` - - Key *string `type:"string"` - - Message *string `type:"string"` - - VersionID *string `locationName:"VersionId" type:"string"` - - metadataError `json:"-", xml:"-"` -} - -type metadataError struct { - SDKShapeTraits bool `type:"structure"` -} - -type ErrorDocument struct { - // The object key name to use when a 4XX class error occurs. - Key *string `type:"string" required:"true"` - - metadataErrorDocument `json:"-", xml:"-"` -} - -type metadataErrorDocument struct { - SDKShapeTraits bool `type:"structure"` -} - -type GetBucketACLInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - metadataGetBucketACLInput `json:"-", xml:"-"` -} - -type metadataGetBucketACLInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type GetBucketACLOutput struct { - // A list of grants. - Grants []*Grant `locationName:"AccessControlList" locationNameList:"Grant" type:"list"` - - Owner *Owner `type:"structure"` - - metadataGetBucketACLOutput `json:"-", xml:"-"` -} - -type metadataGetBucketACLOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type GetBucketCORSInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - metadataGetBucketCORSInput `json:"-", xml:"-"` -} - -type metadataGetBucketCORSInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type GetBucketCORSOutput struct { - CORSRules []*CORSRule `locationName:"CORSRule" type:"list" flattened:"true"` - - metadataGetBucketCORSOutput `json:"-", xml:"-"` -} - -type metadataGetBucketCORSOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type GetBucketLifecycleInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - metadataGetBucketLifecycleInput `json:"-", xml:"-"` -} - -type metadataGetBucketLifecycleInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type GetBucketLifecycleOutput struct { - Rules []*LifecycleRule `locationName:"Rule" type:"list" flattened:"true"` - - metadataGetBucketLifecycleOutput `json:"-", xml:"-"` -} - -type metadataGetBucketLifecycleOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type GetBucketLocationInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - metadataGetBucketLocationInput `json:"-", xml:"-"` -} - -type metadataGetBucketLocationInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type GetBucketLocationOutput struct { - LocationConstraint *string `type:"string"` - - metadataGetBucketLocationOutput `json:"-", xml:"-"` -} - -type metadataGetBucketLocationOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type GetBucketLoggingInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - metadataGetBucketLoggingInput `json:"-", xml:"-"` -} - -type metadataGetBucketLoggingInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type GetBucketLoggingOutput struct { - LoggingEnabled *LoggingEnabled `type:"structure"` - - metadataGetBucketLoggingOutput `json:"-", xml:"-"` -} - -type metadataGetBucketLoggingOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type GetBucketNotificationInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - metadataGetBucketNotificationInput `json:"-", xml:"-"` -} - -type metadataGetBucketNotificationInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type GetBucketNotificationOutput struct { - CloudFunctionConfiguration *CloudFunctionConfiguration `type:"structure"` - - QueueConfiguration *QueueConfiguration `type:"structure"` - - TopicConfiguration *TopicConfiguration `type:"structure"` - - metadataGetBucketNotificationOutput `json:"-", xml:"-"` -} - -type metadataGetBucketNotificationOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type GetBucketPolicyInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - metadataGetBucketPolicyInput `json:"-", xml:"-"` -} - -type metadataGetBucketPolicyInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type GetBucketPolicyOutput struct { - // The bucket policy as a JSON document. - Policy *string `type:"string"` - - metadataGetBucketPolicyOutput `json:"-", xml:"-"` -} - -type metadataGetBucketPolicyOutput struct { - SDKShapeTraits bool `type:"structure" payload:"Policy"` -} - -type GetBucketReplicationInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - metadataGetBucketReplicationInput `json:"-", xml:"-"` -} - -type metadataGetBucketReplicationInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type GetBucketReplicationOutput struct { - // Container for replication rules. You can add as many as 1,000 rules. Total - // replication configuration size can be up to 2 MB. - ReplicationConfiguration *ReplicationConfiguration `type:"structure"` - - metadataGetBucketReplicationOutput `json:"-", xml:"-"` -} - -type metadataGetBucketReplicationOutput struct { - SDKShapeTraits bool `type:"structure" payload:"ReplicationConfiguration"` -} - -type GetBucketRequestPaymentInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - metadataGetBucketRequestPaymentInput `json:"-", xml:"-"` -} - -type metadataGetBucketRequestPaymentInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type GetBucketRequestPaymentOutput struct { - // Specifies who pays for the download and request fees. - Payer *string `type:"string"` - - metadataGetBucketRequestPaymentOutput `json:"-", xml:"-"` -} - -type metadataGetBucketRequestPaymentOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type GetBucketTaggingInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - metadataGetBucketTaggingInput `json:"-", xml:"-"` -} - -type metadataGetBucketTaggingInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type GetBucketTaggingOutput struct { - TagSet []*Tag `locationNameList:"Tag" type:"list" required:"true"` - - metadataGetBucketTaggingOutput `json:"-", xml:"-"` -} - -type metadataGetBucketTaggingOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type GetBucketVersioningInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - metadataGetBucketVersioningInput `json:"-", xml:"-"` -} - -type metadataGetBucketVersioningInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type GetBucketVersioningOutput struct { - // Specifies whether MFA delete is enabled in the bucket versioning configuration. - // This element is only returned if the bucket has been configured with MFA - // delete. If the bucket has never been so configured, this element is not returned. - MFADelete *string `locationName:"MfaDelete" type:"string"` - - // The versioning state of the bucket. - Status *string `type:"string"` - - metadataGetBucketVersioningOutput `json:"-", xml:"-"` -} - -type metadataGetBucketVersioningOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type GetBucketWebsiteInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - metadataGetBucketWebsiteInput `json:"-", xml:"-"` -} - -type metadataGetBucketWebsiteInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type GetBucketWebsiteOutput struct { - ErrorDocument *ErrorDocument `type:"structure"` - - IndexDocument *IndexDocument `type:"structure"` - - RedirectAllRequestsTo *RedirectAllRequestsTo `type:"structure"` - - RoutingRules []*RoutingRule `locationNameList:"RoutingRule" type:"list"` - - metadataGetBucketWebsiteOutput `json:"-", xml:"-"` -} - -type metadataGetBucketWebsiteOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type GetObjectACLInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - Key *string `location:"uri" locationName:"Key" type:"string" required:"true"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string"` - - // VersionId used to reference a specific version of the object. - VersionID *string `location:"querystring" locationName:"versionId" type:"string"` - - metadataGetObjectACLInput `json:"-", xml:"-"` -} - -type metadataGetObjectACLInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type GetObjectACLOutput struct { - // A list of grants. - Grants []*Grant `locationName:"AccessControlList" locationNameList:"Grant" type:"list"` - - Owner *Owner `type:"structure"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string"` - - metadataGetObjectACLOutput `json:"-", xml:"-"` -} - -type metadataGetObjectACLOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type GetObjectInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Return the object only if its entity tag (ETag) is the same as the one specified, - // otherwise return a 412 (precondition failed). - IfMatch *string `location:"header" locationName:"If-Match" type:"string"` - - // Return the object only if it has been modified since the specified time, - // otherwise return a 304 (not modified). - IfModifiedSince *time.Time `location:"header" locationName:"If-Modified-Since" type:"timestamp" timestampFormat:"rfc822"` - - // Return the object only if its entity tag (ETag) is different from the one - // specified, otherwise return a 304 (not modified). - IfNoneMatch *string `location:"header" locationName:"If-None-Match" type:"string"` - - // Return the object only if it has not been modified since the specified time, - // otherwise return a 412 (precondition failed). - IfUnmodifiedSince *time.Time `location:"header" locationName:"If-Unmodified-Since" type:"timestamp" timestampFormat:"rfc822"` - - Key *string `location:"uri" locationName:"Key" type:"string" required:"true"` - - // Downloads the specified range bytes of an object. For more information about - // the HTTP Range header, go to http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35. - Range *string `location:"header" locationName:"Range" type:"string"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string"` - - // Sets the Cache-Control header of the response. - ResponseCacheControl *string `location:"querystring" locationName:"response-cache-control" type:"string"` - - // Sets the Content-Disposition header of the response - ResponseContentDisposition *string `location:"querystring" locationName:"response-content-disposition" type:"string"` - - // Sets the Content-Encoding header of the response. - ResponseContentEncoding *string `location:"querystring" locationName:"response-content-encoding" type:"string"` - - // Sets the Content-Language header of the response. - ResponseContentLanguage *string `location:"querystring" locationName:"response-content-language" type:"string"` - - // Sets the Content-Type header of the response. - ResponseContentType *string `location:"querystring" locationName:"response-content-type" type:"string"` - - // Sets the Expires header of the response. - ResponseExpires *time.Time `location:"querystring" locationName:"response-expires" type:"timestamp" timestampFormat:"iso8601"` - - // Specifies the algorithm to use to when encrypting the object (e.g., AES256, - // aws:kms). - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting - // data. This value is used to store the object and then it is discarded; Amazon - // does not store the encryption key. The key must be appropriate for use with - // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm - // header. - SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string"` - - // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. - // Amazon S3 uses this header for a message integrity check to ensure the encryption - // key was transmitted without error. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // VersionId used to reference a specific version of the object. - VersionID *string `location:"querystring" locationName:"versionId" type:"string"` - - metadataGetObjectInput `json:"-", xml:"-"` -} - -type metadataGetObjectInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type GetObjectOutput struct { - AcceptRanges *string `location:"header" locationName:"accept-ranges" type:"string"` - - // Object data. - Body io.ReadCloser `type:"blob"` - - // Specifies caching behavior along the request/reply chain. - CacheControl *string `location:"header" locationName:"Cache-Control" type:"string"` - - // Specifies presentational information for the object. - ContentDisposition *string `location:"header" locationName:"Content-Disposition" type:"string"` - - // Specifies what content encodings have been applied to the object and thus - // what decoding mechanisms must be applied to obtain the media-type referenced - // by the Content-Type header field. - ContentEncoding *string `location:"header" locationName:"Content-Encoding" type:"string"` - - // The language the content is in. - ContentLanguage *string `location:"header" locationName:"Content-Language" type:"string"` - - // Size of the body in bytes. - ContentLength *int64 `location:"header" locationName:"Content-Length" type:"integer"` - - // A standard MIME type describing the format of the object data. - ContentType *string `location:"header" locationName:"Content-Type" type:"string"` - - // Specifies whether the object retrieved was (true) or was not (false) a Delete - // Marker. If false, this response header does not appear in the response. - DeleteMarker *bool `location:"header" locationName:"x-amz-delete-marker" type:"boolean"` - - // An ETag is an opaque identifier assigned by a web server to a specific version - // of a resource found at a URL - ETag *string `location:"header" locationName:"ETag" type:"string"` - - // If the object expiration is configured (see PUT Bucket lifecycle), the response - // includes this header. It includes the expiry-date and rule-id key value pairs - // providing object expiration information. The value of the rule-id is URL - // encoded. - Expiration *string `location:"header" locationName:"x-amz-expiration" type:"string"` - - // The date and time at which the object is no longer cacheable. - Expires *time.Time `location:"header" locationName:"Expires" type:"timestamp" timestampFormat:"rfc822"` - - // Last modified date of the object - LastModified *time.Time `location:"header" locationName:"Last-Modified" type:"timestamp" timestampFormat:"rfc822"` - - // A map of metadata to store with the object in S3. - Metadata *map[string]*string `location:"headers" locationName:"x-amz-meta-" type:"map"` - - // This is set to the number of metadata entries not returned in x-amz-meta - // headers. This can happen if you create metadata using an API like SOAP that - // supports more flexible metadata than the REST API. For example, using SOAP, - // you can create metadata whose values are not legal HTTP headers. - MissingMeta *int64 `location:"header" locationName:"x-amz-missing-meta" type:"integer"` - - ReplicationStatus *string `location:"header" locationName:"x-amz-replication-status" type:"string"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string"` - - // Provides information about object restoration operation and expiration time - // of the restored object copy. - Restore *string `location:"header" locationName:"x-amz-restore" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header confirming the encryption algorithm - // used. - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header to provide round trip message integrity - // verification of the customer-provided encryption key. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // If present, specifies the ID of the AWS Key Management Service (KMS) master - // encryption key that was used for the object. - SSEKMSKeyID *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` - - // The Server-side encryption algorithm used when storing this object in S3 - // (e.g., AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string"` - - // Version of the object. - VersionID *string `location:"header" locationName:"x-amz-version-id" type:"string"` - - // If the bucket is configured as a website, redirects requests for this object - // to another object in the same bucket or to an external URL. Amazon S3 stores - // the value of this header in the object metadata. - WebsiteRedirectLocation *string `location:"header" locationName:"x-amz-website-redirect-location" type:"string"` - - metadataGetObjectOutput `json:"-", xml:"-"` -} - -type metadataGetObjectOutput struct { - SDKShapeTraits bool `type:"structure" payload:"Body"` -} - -type GetObjectTorrentInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - Key *string `location:"uri" locationName:"Key" type:"string" required:"true"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string"` - - metadataGetObjectTorrentInput `json:"-", xml:"-"` -} - -type metadataGetObjectTorrentInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type GetObjectTorrentOutput struct { - Body io.ReadCloser `type:"blob"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string"` - - metadataGetObjectTorrentOutput `json:"-", xml:"-"` -} - -type metadataGetObjectTorrentOutput struct { - SDKShapeTraits bool `type:"structure" payload:"Body"` -} - -type Grant struct { - Grantee *Grantee `type:"structure"` - - // Specifies the permission given to the grantee. - Permission *string `type:"string"` - - metadataGrant `json:"-", xml:"-"` -} - -type metadataGrant struct { - SDKShapeTraits bool `type:"structure"` -} - -type Grantee struct { - // Screen name of the grantee. - DisplayName *string `type:"string"` - - // Email address of the grantee. - EmailAddress *string `type:"string"` - - // The canonical user ID of the grantee. - ID *string `type:"string"` - - // Type of grantee - Type *string `locationName:"xsi:type" type:"string" required:"true"` - - // URI of the grantee group. - URI *string `type:"string"` - - metadataGrantee `json:"-", xml:"-"` -} - -type metadataGrantee struct { - SDKShapeTraits bool `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"` -} - -type HeadBucketInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - metadataHeadBucketInput `json:"-", xml:"-"` -} - -type metadataHeadBucketInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type HeadBucketOutput struct { - metadataHeadBucketOutput `json:"-", xml:"-"` -} - -type metadataHeadBucketOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type HeadObjectInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Return the object only if its entity tag (ETag) is the same as the one specified, - // otherwise return a 412 (precondition failed). - IfMatch *string `location:"header" locationName:"If-Match" type:"string"` - - // Return the object only if it has been modified since the specified time, - // otherwise return a 304 (not modified). - IfModifiedSince *time.Time `location:"header" locationName:"If-Modified-Since" type:"timestamp" timestampFormat:"rfc822"` - - // Return the object only if its entity tag (ETag) is different from the one - // specified, otherwise return a 304 (not modified). - IfNoneMatch *string `location:"header" locationName:"If-None-Match" type:"string"` - - // Return the object only if it has not been modified since the specified time, - // otherwise return a 412 (precondition failed). - IfUnmodifiedSince *time.Time `location:"header" locationName:"If-Unmodified-Since" type:"timestamp" timestampFormat:"rfc822"` - - Key *string `location:"uri" locationName:"Key" type:"string" required:"true"` - - // Downloads the specified range bytes of an object. For more information about - // the HTTP Range header, go to http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35. - Range *string `location:"header" locationName:"Range" type:"string"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string"` - - // Specifies the algorithm to use to when encrypting the object (e.g., AES256, - // aws:kms). - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting - // data. This value is used to store the object and then it is discarded; Amazon - // does not store the encryption key. The key must be appropriate for use with - // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm - // header. - SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string"` - - // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. - // Amazon S3 uses this header for a message integrity check to ensure the encryption - // key was transmitted without error. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // VersionId used to reference a specific version of the object. - VersionID *string `location:"querystring" locationName:"versionId" type:"string"` - - metadataHeadObjectInput `json:"-", xml:"-"` -} - -type metadataHeadObjectInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type HeadObjectOutput struct { - AcceptRanges *string `location:"header" locationName:"accept-ranges" type:"string"` - - // Specifies caching behavior along the request/reply chain. - CacheControl *string `location:"header" locationName:"Cache-Control" type:"string"` - - // Specifies presentational information for the object. - ContentDisposition *string `location:"header" locationName:"Content-Disposition" type:"string"` - - // Specifies what content encodings have been applied to the object and thus - // what decoding mechanisms must be applied to obtain the media-type referenced - // by the Content-Type header field. - ContentEncoding *string `location:"header" locationName:"Content-Encoding" type:"string"` - - // The language the content is in. - ContentLanguage *string `location:"header" locationName:"Content-Language" type:"string"` - - // Size of the body in bytes. - ContentLength *int64 `location:"header" locationName:"Content-Length" type:"integer"` - - // A standard MIME type describing the format of the object data. - ContentType *string `location:"header" locationName:"Content-Type" type:"string"` - - // Specifies whether the object retrieved was (true) or was not (false) a Delete - // Marker. If false, this response header does not appear in the response. - DeleteMarker *bool `location:"header" locationName:"x-amz-delete-marker" type:"boolean"` - - // An ETag is an opaque identifier assigned by a web server to a specific version - // of a resource found at a URL - ETag *string `location:"header" locationName:"ETag" type:"string"` - - // If the object expiration is configured (see PUT Bucket lifecycle), the response - // includes this header. It includes the expiry-date and rule-id key value pairs - // providing object expiration information. The value of the rule-id is URL - // encoded. - Expiration *string `location:"header" locationName:"x-amz-expiration" type:"string"` - - // The date and time at which the object is no longer cacheable. - Expires *time.Time `location:"header" locationName:"Expires" type:"timestamp" timestampFormat:"rfc822"` - - // Last modified date of the object - LastModified *time.Time `location:"header" locationName:"Last-Modified" type:"timestamp" timestampFormat:"rfc822"` - - // A map of metadata to store with the object in S3. - Metadata *map[string]*string `location:"headers" locationName:"x-amz-meta-" type:"map"` - - // This is set to the number of metadata entries not returned in x-amz-meta - // headers. This can happen if you create metadata using an API like SOAP that - // supports more flexible metadata than the REST API. For example, using SOAP, - // you can create metadata whose values are not legal HTTP headers. - MissingMeta *int64 `location:"header" locationName:"x-amz-missing-meta" type:"integer"` - - ReplicationStatus *string `location:"header" locationName:"x-amz-replication-status" type:"string"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string"` - - // Provides information about object restoration operation and expiration time - // of the restored object copy. - Restore *string `location:"header" locationName:"x-amz-restore" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header confirming the encryption algorithm - // used. - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header to provide round trip message integrity - // verification of the customer-provided encryption key. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // If present, specifies the ID of the AWS Key Management Service (KMS) master - // encryption key that was used for the object. - SSEKMSKeyID *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` - - // The Server-side encryption algorithm used when storing this object in S3 - // (e.g., AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string"` - - // Version of the object. - VersionID *string `location:"header" locationName:"x-amz-version-id" type:"string"` - - // If the bucket is configured as a website, redirects requests for this object - // to another object in the same bucket or to an external URL. Amazon S3 stores - // the value of this header in the object metadata. - WebsiteRedirectLocation *string `location:"header" locationName:"x-amz-website-redirect-location" type:"string"` - - metadataHeadObjectOutput `json:"-", xml:"-"` -} - -type metadataHeadObjectOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type IndexDocument struct { - // A suffix that is appended to a request that is for a directory on the website - // endpoint (e.g. if the suffix is index.html and you make a request to samplebucket/images/ - // the data that is returned will be for the object with the key name images/index.html) - // The suffix must not be empty and must not include a slash character. - Suffix *string `type:"string" required:"true"` - - metadataIndexDocument `json:"-", xml:"-"` -} - -type metadataIndexDocument struct { - SDKShapeTraits bool `type:"structure"` -} - -type Initiator struct { - // Name of the Principal. - DisplayName *string `type:"string"` - - // If the principal is an AWS account, it provides the Canonical User ID. If - // the principal is an IAM User, it provides a user ARN value. - ID *string `type:"string"` - - metadataInitiator `json:"-", xml:"-"` -} - -type metadataInitiator struct { - SDKShapeTraits bool `type:"structure"` -} - -type LifecycleConfiguration struct { - Rules []*LifecycleRule `locationName:"Rule" type:"list" flattened:"true" required:"true"` - - metadataLifecycleConfiguration `json:"-", xml:"-"` -} - -type metadataLifecycleConfiguration struct { - SDKShapeTraits bool `type:"structure"` -} - -type LifecycleExpiration struct { - // Indicates at what date the object is to be moved or deleted. Should be in - // GMT ISO 8601 Format. - Date *time.Time `type:"timestamp" timestampFormat:"iso8601"` - - // Indicates the lifetime, in days, of the objects that are subject to the rule. - // The value must be a non-zero positive integer. - Days *int64 `type:"integer"` - - metadataLifecycleExpiration `json:"-", xml:"-"` -} - -type metadataLifecycleExpiration struct { - SDKShapeTraits bool `type:"structure"` -} - -type LifecycleRule struct { - Expiration *LifecycleExpiration `type:"structure"` - - // Unique identifier for the rule. The value cannot be longer than 255 characters. - ID *string `type:"string"` - - // Specifies when noncurrent object versions expire. Upon expiration, Amazon - // S3 permanently deletes the noncurrent object versions. You set this lifecycle - // configuration action on a bucket that has versioning enabled (or suspended) - // to request that Amazon S3 delete noncurrent object versions at a specific - // period in the object's lifetime. - NoncurrentVersionExpiration *NoncurrentVersionExpiration `type:"structure"` - - // Container for the transition rule that describes when noncurrent objects - // transition to the GLACIER storage class. If your bucket is versioning-enabled - // (or versioning is suspended), you can set this action to request that Amazon - // S3 transition noncurrent object versions to the GLACIER storage class at - // a specific period in the object's lifetime. - NoncurrentVersionTransition *NoncurrentVersionTransition `type:"structure"` - - // Prefix identifying one or more objects to which the rule applies. - Prefix *string `type:"string" required:"true"` - - // If 'Enabled', the rule is currently being applied. If 'Disabled', the rule - // is not currently being applied. - Status *string `type:"string" required:"true"` - - Transition *Transition `type:"structure"` - - metadataLifecycleRule `json:"-", xml:"-"` -} - -type metadataLifecycleRule struct { - SDKShapeTraits bool `type:"structure"` -} - -type ListBucketsInput struct { - metadataListBucketsInput `json:"-", xml:"-"` -} - -type metadataListBucketsInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type ListBucketsOutput struct { - Buckets []*Bucket `locationNameList:"Bucket" type:"list"` - - Owner *Owner `type:"structure"` - - metadataListBucketsOutput `json:"-", xml:"-"` -} - -type metadataListBucketsOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type ListMultipartUploadsInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Character you use to group keys. - Delimiter *string `location:"querystring" locationName:"delimiter" type:"string"` - - // Requests Amazon S3 to encode the object keys in the response and specifies - // the encoding method to use. An object key may contain any Unicode character; - // however, XML 1.0 parser cannot parse some characters, such as characters - // with an ASCII value from 0 to 10. For characters that are not supported in - // XML 1.0, you can add this parameter to request that Amazon S3 encode the - // keys in the response. - EncodingType *string `location:"querystring" locationName:"encoding-type" type:"string"` - - // Together with upload-id-marker, this parameter specifies the multipart upload - // after which listing should begin. - KeyMarker *string `location:"querystring" locationName:"key-marker" type:"string"` - - // Sets the maximum number of multipart uploads, from 1 to 1,000, to return - // in the response body. 1,000 is the maximum number of uploads that can be - // returned in a response. - MaxUploads *int64 `location:"querystring" locationName:"max-uploads" type:"integer"` - - // Lists in-progress uploads only for those keys that begin with the specified - // prefix. - Prefix *string `location:"querystring" locationName:"prefix" type:"string"` - - // Together with key-marker, specifies the multipart upload after which listing - // should begin. If key-marker is not specified, the upload-id-marker parameter - // is ignored. - UploadIDMarker *string `location:"querystring" locationName:"upload-id-marker" type:"string"` - - metadataListMultipartUploadsInput `json:"-", xml:"-"` -} - -type metadataListMultipartUploadsInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type ListMultipartUploadsOutput struct { - // Name of the bucket to which the multipart upload was initiated. - Bucket *string `type:"string"` - - CommonPrefixes []*CommonPrefix `type:"list" flattened:"true"` - - Delimiter *string `type:"string"` - - // Encoding type used by Amazon S3 to encode object keys in the response. - EncodingType *string `type:"string"` - - // Indicates whether the returned list of multipart uploads is truncated. A - // value of true indicates that the list was truncated. The list can be truncated - // if the number of multipart uploads exceeds the limit allowed or specified - // by max uploads. - IsTruncated *bool `type:"boolean"` - - // The key at or after which the listing began. - KeyMarker *string `type:"string"` - - // Maximum number of multipart uploads that could have been included in the - // response. - MaxUploads *int64 `type:"integer"` - - // When a list is truncated, this element specifies the value that should be - // used for the key-marker request parameter in a subsequent request. - NextKeyMarker *string `type:"string"` - - // When a list is truncated, this element specifies the value that should be - // used for the upload-id-marker request parameter in a subsequent request. - NextUploadIDMarker *string `locationName:"NextUploadIdMarker" type:"string"` - - // When a prefix is provided in the request, this field contains the specified - // prefix. The result contains only keys starting with the specified prefix. - Prefix *string `type:"string"` - - // Upload ID after which listing began. - UploadIDMarker *string `locationName:"UploadIdMarker" type:"string"` - - Uploads []*MultipartUpload `locationName:"Upload" type:"list" flattened:"true"` - - metadataListMultipartUploadsOutput `json:"-", xml:"-"` -} - -type metadataListMultipartUploadsOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type ListObjectVersionsInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // A delimiter is a character you use to group keys. - Delimiter *string `location:"querystring" locationName:"delimiter" type:"string"` - - // Requests Amazon S3 to encode the object keys in the response and specifies - // the encoding method to use. An object key may contain any Unicode character; - // however, XML 1.0 parser cannot parse some characters, such as characters - // with an ASCII value from 0 to 10. For characters that are not supported in - // XML 1.0, you can add this parameter to request that Amazon S3 encode the - // keys in the response. - EncodingType *string `location:"querystring" locationName:"encoding-type" type:"string"` - - // Specifies the key to start with when listing objects in a bucket. - KeyMarker *string `location:"querystring" locationName:"key-marker" type:"string"` - - // Sets the maximum number of keys returned in the response. The response might - // contain fewer keys but will never contain more. - MaxKeys *int64 `location:"querystring" locationName:"max-keys" type:"integer"` - - // Limits the response to keys that begin with the specified prefix. - Prefix *string `location:"querystring" locationName:"prefix" type:"string"` - - // Specifies the object version you want to start listing from. - VersionIDMarker *string `location:"querystring" locationName:"version-id-marker" type:"string"` - - metadataListObjectVersionsInput `json:"-", xml:"-"` -} - -type metadataListObjectVersionsInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type ListObjectVersionsOutput struct { - CommonPrefixes []*CommonPrefix `type:"list" flattened:"true"` - - DeleteMarkers []*DeleteMarkerEntry `locationName:"DeleteMarker" type:"list" flattened:"true"` - - Delimiter *string `type:"string"` - - // Encoding type used by Amazon S3 to encode object keys in the response. - EncodingType *string `type:"string"` - - // A flag that indicates whether or not Amazon S3 returned all of the results - // that satisfied the search criteria. If your results were truncated, you can - // make a follow-up paginated request using the NextKeyMarker and NextVersionIdMarker - // response parameters as a starting place in another request to return the - // rest of the results. - IsTruncated *bool `type:"boolean"` - - // Marks the last Key returned in a truncated response. - KeyMarker *string `type:"string"` - - MaxKeys *int64 `type:"integer"` - - Name *string `type:"string"` - - // Use this value for the key marker request parameter in a subsequent request. - NextKeyMarker *string `type:"string"` - - // Use this value for the next version id marker parameter in a subsequent request. - NextVersionIDMarker *string `locationName:"NextVersionIdMarker" type:"string"` - - Prefix *string `type:"string"` - - VersionIDMarker *string `locationName:"VersionIdMarker" type:"string"` - - Versions []*ObjectVersion `locationName:"Version" type:"list" flattened:"true"` - - metadataListObjectVersionsOutput `json:"-", xml:"-"` -} - -type metadataListObjectVersionsOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type ListObjectsInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // A delimiter is a character you use to group keys. - Delimiter *string `location:"querystring" locationName:"delimiter" type:"string"` - - // Requests Amazon S3 to encode the object keys in the response and specifies - // the encoding method to use. An object key may contain any Unicode character; - // however, XML 1.0 parser cannot parse some characters, such as characters - // with an ASCII value from 0 to 10. For characters that are not supported in - // XML 1.0, you can add this parameter to request that Amazon S3 encode the - // keys in the response. - EncodingType *string `location:"querystring" locationName:"encoding-type" type:"string"` - - // Specifies the key to start with when listing objects in a bucket. - Marker *string `location:"querystring" locationName:"marker" type:"string"` - - // Sets the maximum number of keys returned in the response. The response might - // contain fewer keys but will never contain more. - MaxKeys *int64 `location:"querystring" locationName:"max-keys" type:"integer"` - - // Limits the response to keys that begin with the specified prefix. - Prefix *string `location:"querystring" locationName:"prefix" type:"string"` - - metadataListObjectsInput `json:"-", xml:"-"` -} - -type metadataListObjectsInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type ListObjectsOutput struct { - CommonPrefixes []*CommonPrefix `type:"list" flattened:"true"` - - Contents []*Object `type:"list" flattened:"true"` - - Delimiter *string `type:"string"` - - // Encoding type used by Amazon S3 to encode object keys in the response. - EncodingType *string `type:"string"` - - // A flag that indicates whether or not Amazon S3 returned all of the results - // that satisfied the search criteria. - IsTruncated *bool `type:"boolean"` - - Marker *string `type:"string"` - - MaxKeys *int64 `type:"integer"` - - Name *string `type:"string"` - - // When response is truncated (the IsTruncated element value in the response - // is true), you can use the key name in this field as marker in the subsequent - // request to get next set of objects. Amazon S3 lists objects in alphabetical - // order Note: This element is returned only if you have delimiter request parameter - // specified. If response does not include the NextMaker and it is truncated, - // you can use the value of the last Key in the response as the marker in the - // subsequent request to get the next set of object keys. - NextMarker *string `type:"string"` - - Prefix *string `type:"string"` - - metadataListObjectsOutput `json:"-", xml:"-"` -} - -type metadataListObjectsOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type ListPartsInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - Key *string `location:"uri" locationName:"Key" type:"string" required:"true"` - - // Sets the maximum number of parts to return. - MaxParts *int64 `location:"querystring" locationName:"max-parts" type:"integer"` - - // Specifies the part after which listing should begin. Only parts with higher - // part numbers will be listed. - PartNumberMarker *int64 `location:"querystring" locationName:"part-number-marker" type:"integer"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string"` - - // Upload ID identifying the multipart upload whose parts are being listed. - UploadID *string `location:"querystring" locationName:"uploadId" type:"string" required:"true"` - - metadataListPartsInput `json:"-", xml:"-"` -} - -type metadataListPartsInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type ListPartsOutput struct { - // Name of the bucket to which the multipart upload was initiated. - Bucket *string `type:"string"` - - // Identifies who initiated the multipart upload. - Initiator *Initiator `type:"structure"` - - // Indicates whether the returned list of parts is truncated. - IsTruncated *bool `type:"boolean"` - - // Object key for which the multipart upload was initiated. - Key *string `type:"string"` - - // Maximum number of parts that were allowed in the response. - MaxParts *int64 `type:"integer"` - - // When a list is truncated, this element specifies the last part in the list, - // as well as the value to use for the part-number-marker request parameter - // in a subsequent request. - NextPartNumberMarker *int64 `type:"integer"` - - Owner *Owner `type:"structure"` - - // Part number after which listing begins. - PartNumberMarker *int64 `type:"integer"` - - Parts []*Part `locationName:"Part" type:"list" flattened:"true"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string"` - - // The class of storage used to store the object. - StorageClass *string `type:"string"` - - // Upload ID identifying the multipart upload whose parts are being listed. - UploadID *string `locationName:"UploadId" type:"string"` - - metadataListPartsOutput `json:"-", xml:"-"` -} - -type metadataListPartsOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type LoggingEnabled struct { - // Specifies the bucket where you want Amazon S3 to store server access logs. - // You can have your logs delivered to any bucket that you own, including the - // same bucket that is being logged. You can also configure multiple buckets - // to deliver their logs to the same target bucket. In this case you should - // choose a different TargetPrefix for each source bucket so that the delivered - // log files can be distinguished by key. - TargetBucket *string `type:"string"` - - TargetGrants []*TargetGrant `locationNameList:"Grant" type:"list"` - - // This element lets you specify a prefix for the keys that the log files will - // be stored under. - TargetPrefix *string `type:"string"` - - metadataLoggingEnabled `json:"-", xml:"-"` -} - -type metadataLoggingEnabled struct { - SDKShapeTraits bool `type:"structure"` -} - -type MultipartUpload struct { - // Date and time at which the multipart upload was initiated. - Initiated *time.Time `type:"timestamp" timestampFormat:"iso8601"` - - // Identifies who initiated the multipart upload. - Initiator *Initiator `type:"structure"` - - // Key of the object for which the multipart upload was initiated. - Key *string `type:"string"` - - Owner *Owner `type:"structure"` - - // The class of storage used to store the object. - StorageClass *string `type:"string"` - - // Upload ID that identifies the multipart upload. - UploadID *string `locationName:"UploadId" type:"string"` - - metadataMultipartUpload `json:"-", xml:"-"` -} - -type metadataMultipartUpload struct { - SDKShapeTraits bool `type:"structure"` -} - -// Specifies when noncurrent object versions expire. Upon expiration, Amazon -// S3 permanently deletes the noncurrent object versions. You set this lifecycle -// configuration action on a bucket that has versioning enabled (or suspended) -// to request that Amazon S3 delete noncurrent object versions at a specific -// period in the object's lifetime. -type NoncurrentVersionExpiration struct { - // Specifies the number of days an object is noncurrent before Amazon S3 can - // perform the associated action. For information about the noncurrent days - // calculations, see How Amazon S3 Calculates When an Object Became Noncurrent - // (/AmazonS3/latest/dev/s3-access-control.html) in the Amazon Simple Storage - // Service Developer Guide. - NoncurrentDays *int64 `type:"integer"` - - metadataNoncurrentVersionExpiration `json:"-", xml:"-"` -} - -type metadataNoncurrentVersionExpiration struct { - SDKShapeTraits bool `type:"structure"` -} - -// Container for the transition rule that describes when noncurrent objects -// transition to the GLACIER storage class. If your bucket is versioning-enabled -// (or versioning is suspended), you can set this action to request that Amazon -// S3 transition noncurrent object versions to the GLACIER storage class at -// a specific period in the object's lifetime. -type NoncurrentVersionTransition struct { - // Specifies the number of days an object is noncurrent before Amazon S3 can - // perform the associated action. For information about the noncurrent days - // calculations, see How Amazon S3 Calculates When an Object Became Noncurrent - // (/AmazonS3/latest/dev/s3-access-control.html) in the Amazon Simple Storage - // Service Developer Guide. - NoncurrentDays *int64 `type:"integer"` - - // The class of storage used to store the object. - StorageClass *string `type:"string"` - - metadataNoncurrentVersionTransition `json:"-", xml:"-"` -} - -type metadataNoncurrentVersionTransition struct { - SDKShapeTraits bool `type:"structure"` -} - -type NotificationConfiguration struct { - CloudFunctionConfiguration *CloudFunctionConfiguration `type:"structure"` - - QueueConfiguration *QueueConfiguration `type:"structure"` - - TopicConfiguration *TopicConfiguration `type:"structure"` - - metadataNotificationConfiguration `json:"-", xml:"-"` -} - -type metadataNotificationConfiguration struct { - SDKShapeTraits bool `type:"structure"` -} - -type Object struct { - ETag *string `type:"string"` - - Key *string `type:"string"` - - LastModified *time.Time `type:"timestamp" timestampFormat:"iso8601"` - - Owner *Owner `type:"structure"` - - Size *int64 `type:"integer"` - - // The class of storage used to store the object. - StorageClass *string `type:"string"` - - metadataObject `json:"-", xml:"-"` -} - -type metadataObject struct { - SDKShapeTraits bool `type:"structure"` -} - -type ObjectIdentifier struct { - // Key name of the object to delete. - Key *string `type:"string" required:"true"` - - // VersionId for the specific version of the object to delete. - VersionID *string `locationName:"VersionId" type:"string"` - - metadataObjectIdentifier `json:"-", xml:"-"` -} - -type metadataObjectIdentifier struct { - SDKShapeTraits bool `type:"structure"` -} - -type ObjectVersion struct { - ETag *string `type:"string"` - - // Specifies whether the object is (true) or is not (false) the latest version - // of an object. - IsLatest *bool `type:"boolean"` - - // The object key. - Key *string `type:"string"` - - // Date and time the object was last modified. - LastModified *time.Time `type:"timestamp" timestampFormat:"iso8601"` - - Owner *Owner `type:"structure"` - - // Size in bytes of the object. - Size *int64 `type:"integer"` - - // The class of storage used to store the object. - StorageClass *string `type:"string"` - - // Version ID of an object. - VersionID *string `locationName:"VersionId" type:"string"` - - metadataObjectVersion `json:"-", xml:"-"` -} - -type metadataObjectVersion struct { - SDKShapeTraits bool `type:"structure"` -} - -type Owner struct { - DisplayName *string `type:"string"` - - ID *string `type:"string"` - - metadataOwner `json:"-", xml:"-"` -} - -type metadataOwner struct { - SDKShapeTraits bool `type:"structure"` -} - -type Part struct { - // Entity tag returned when the part was uploaded. - ETag *string `type:"string"` - - // Date and time at which the part was uploaded. - LastModified *time.Time `type:"timestamp" timestampFormat:"iso8601"` - - // Part number identifying the part. - PartNumber *int64 `type:"integer"` - - // Size of the uploaded part data. - Size *int64 `type:"integer"` - - metadataPart `json:"-", xml:"-"` -} - -type metadataPart struct { - SDKShapeTraits bool `type:"structure"` -} - -type PutBucketACLInput struct { - // The canned ACL to apply to the bucket. - ACL *string `location:"header" locationName:"x-amz-acl" type:"string"` - - AccessControlPolicy *AccessControlPolicy `locationName:"AccessControlPolicy" type:"structure"` - - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Allows grantee the read, write, read ACP, and write ACP permissions on the - // bucket. - GrantFullControl *string `location:"header" locationName:"x-amz-grant-full-control" type:"string"` - - // Allows grantee to list the objects in the bucket. - GrantRead *string `location:"header" locationName:"x-amz-grant-read" type:"string"` - - // Allows grantee to read the bucket ACL. - GrantReadACP *string `location:"header" locationName:"x-amz-grant-read-acp" type:"string"` - - // Allows grantee to create, overwrite, and delete any object in the bucket. - GrantWrite *string `location:"header" locationName:"x-amz-grant-write" type:"string"` - - // Allows grantee to write the ACL for the applicable bucket. - GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` - - metadataPutBucketACLInput `json:"-", xml:"-"` -} - -type metadataPutBucketACLInput struct { - SDKShapeTraits bool `type:"structure" payload:"AccessControlPolicy"` -} - -type PutBucketACLOutput struct { - metadataPutBucketACLOutput `json:"-", xml:"-"` -} - -type metadataPutBucketACLOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type PutBucketCORSInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - CORSConfiguration *CORSConfiguration `locationName:"CORSConfiguration" type:"structure"` - - metadataPutBucketCORSInput `json:"-", xml:"-"` -} - -type metadataPutBucketCORSInput struct { - SDKShapeTraits bool `type:"structure" payload:"CORSConfiguration"` -} - -type PutBucketCORSOutput struct { - metadataPutBucketCORSOutput `json:"-", xml:"-"` -} - -type metadataPutBucketCORSOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type PutBucketLifecycleInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - LifecycleConfiguration *LifecycleConfiguration `locationName:"LifecycleConfiguration" type:"structure"` - - metadataPutBucketLifecycleInput `json:"-", xml:"-"` -} - -type metadataPutBucketLifecycleInput struct { - SDKShapeTraits bool `type:"structure" payload:"LifecycleConfiguration"` -} - -type PutBucketLifecycleOutput struct { - metadataPutBucketLifecycleOutput `json:"-", xml:"-"` -} - -type metadataPutBucketLifecycleOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type PutBucketLoggingInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - BucketLoggingStatus *BucketLoggingStatus `locationName:"BucketLoggingStatus" type:"structure" required:"true"` - - metadataPutBucketLoggingInput `json:"-", xml:"-"` -} - -type metadataPutBucketLoggingInput struct { - SDKShapeTraits bool `type:"structure" payload:"BucketLoggingStatus"` -} - -type PutBucketLoggingOutput struct { - metadataPutBucketLoggingOutput `json:"-", xml:"-"` -} - -type metadataPutBucketLoggingOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type PutBucketNotificationInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - NotificationConfiguration *NotificationConfiguration `locationName:"NotificationConfiguration" type:"structure" required:"true"` - - metadataPutBucketNotificationInput `json:"-", xml:"-"` -} - -type metadataPutBucketNotificationInput struct { - SDKShapeTraits bool `type:"structure" payload:"NotificationConfiguration"` -} - -type PutBucketNotificationOutput struct { - metadataPutBucketNotificationOutput `json:"-", xml:"-"` -} - -type metadataPutBucketNotificationOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type PutBucketPolicyInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The bucket policy as a JSON document. - Policy *string `type:"string" required:"true"` - - metadataPutBucketPolicyInput `json:"-", xml:"-"` -} - -type metadataPutBucketPolicyInput struct { - SDKShapeTraits bool `type:"structure" payload:"Policy"` -} - -type PutBucketPolicyOutput struct { - metadataPutBucketPolicyOutput `json:"-", xml:"-"` -} - -type metadataPutBucketPolicyOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type PutBucketReplicationInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Container for replication rules. You can add as many as 1,000 rules. Total - // replication configuration size can be up to 2 MB. - ReplicationConfiguration *ReplicationConfiguration `locationName:"ReplicationConfiguration" type:"structure" required:"true"` - - metadataPutBucketReplicationInput `json:"-", xml:"-"` -} - -type metadataPutBucketReplicationInput struct { - SDKShapeTraits bool `type:"structure" payload:"ReplicationConfiguration"` -} - -type PutBucketReplicationOutput struct { - metadataPutBucketReplicationOutput `json:"-", xml:"-"` -} - -type metadataPutBucketReplicationOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type PutBucketRequestPaymentInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - RequestPaymentConfiguration *RequestPaymentConfiguration `locationName:"RequestPaymentConfiguration" type:"structure" required:"true"` - - metadataPutBucketRequestPaymentInput `json:"-", xml:"-"` -} - -type metadataPutBucketRequestPaymentInput struct { - SDKShapeTraits bool `type:"structure" payload:"RequestPaymentConfiguration"` -} - -type PutBucketRequestPaymentOutput struct { - metadataPutBucketRequestPaymentOutput `json:"-", xml:"-"` -} - -type metadataPutBucketRequestPaymentOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type PutBucketTaggingInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - Tagging *Tagging `locationName:"Tagging" type:"structure" required:"true"` - - metadataPutBucketTaggingInput `json:"-", xml:"-"` -} - -type metadataPutBucketTaggingInput struct { - SDKShapeTraits bool `type:"structure" payload:"Tagging"` -} - -type PutBucketTaggingOutput struct { - metadataPutBucketTaggingOutput `json:"-", xml:"-"` -} - -type metadataPutBucketTaggingOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type PutBucketVersioningInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The concatenation of the authentication device's serial number, a space, - // and the value that is displayed on your authentication device. - MFA *string `location:"header" locationName:"x-amz-mfa" type:"string"` - - VersioningConfiguration *VersioningConfiguration `locationName:"VersioningConfiguration" type:"structure" required:"true"` - - metadataPutBucketVersioningInput `json:"-", xml:"-"` -} - -type metadataPutBucketVersioningInput struct { - SDKShapeTraits bool `type:"structure" payload:"VersioningConfiguration"` -} - -type PutBucketVersioningOutput struct { - metadataPutBucketVersioningOutput `json:"-", xml:"-"` -} - -type metadataPutBucketVersioningOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type PutBucketWebsiteInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - WebsiteConfiguration *WebsiteConfiguration `locationName:"WebsiteConfiguration" type:"structure" required:"true"` - - metadataPutBucketWebsiteInput `json:"-", xml:"-"` -} - -type metadataPutBucketWebsiteInput struct { - SDKShapeTraits bool `type:"structure" payload:"WebsiteConfiguration"` -} - -type PutBucketWebsiteOutput struct { - metadataPutBucketWebsiteOutput `json:"-", xml:"-"` -} - -type metadataPutBucketWebsiteOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type PutObjectACLInput struct { - // The canned ACL to apply to the object. - ACL *string `location:"header" locationName:"x-amz-acl" type:"string"` - - AccessControlPolicy *AccessControlPolicy `locationName:"AccessControlPolicy" type:"structure"` - - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Allows grantee the read, write, read ACP, and write ACP permissions on the - // bucket. - GrantFullControl *string `location:"header" locationName:"x-amz-grant-full-control" type:"string"` - - // Allows grantee to list the objects in the bucket. - GrantRead *string `location:"header" locationName:"x-amz-grant-read" type:"string"` - - // Allows grantee to read the bucket ACL. - GrantReadACP *string `location:"header" locationName:"x-amz-grant-read-acp" type:"string"` - - // Allows grantee to create, overwrite, and delete any object in the bucket. - GrantWrite *string `location:"header" locationName:"x-amz-grant-write" type:"string"` - - // Allows grantee to write the ACL for the applicable bucket. - GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` - - Key *string `location:"uri" locationName:"Key" type:"string" required:"true"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string"` - - metadataPutObjectACLInput `json:"-", xml:"-"` -} - -type metadataPutObjectACLInput struct { - SDKShapeTraits bool `type:"structure" payload:"AccessControlPolicy"` -} - -type PutObjectACLOutput struct { - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string"` - - metadataPutObjectACLOutput `json:"-", xml:"-"` -} - -type metadataPutObjectACLOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type PutObjectInput struct { - // The canned ACL to apply to the object. - ACL *string `location:"header" locationName:"x-amz-acl" type:"string"` - - // Object data. - Body io.ReadSeeker `type:"blob"` - - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Specifies caching behavior along the request/reply chain. - CacheControl *string `location:"header" locationName:"Cache-Control" type:"string"` - - // Specifies presentational information for the object. - ContentDisposition *string `location:"header" locationName:"Content-Disposition" type:"string"` - - // Specifies what content encodings have been applied to the object and thus - // what decoding mechanisms must be applied to obtain the media-type referenced - // by the Content-Type header field. - ContentEncoding *string `location:"header" locationName:"Content-Encoding" type:"string"` - - // The language the content is in. - ContentLanguage *string `location:"header" locationName:"Content-Language" type:"string"` - - // Size of the body in bytes. This parameter is useful when the size of the - // body cannot be determined automatically. - ContentLength *int64 `location:"header" locationName:"Content-Length" type:"integer"` - - // A standard MIME type describing the format of the object data. - ContentType *string `location:"header" locationName:"Content-Type" type:"string"` - - // The date and time at which the object is no longer cacheable. - Expires *time.Time `location:"header" locationName:"Expires" type:"timestamp" timestampFormat:"rfc822"` - - // Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object. - GrantFullControl *string `location:"header" locationName:"x-amz-grant-full-control" type:"string"` - - // Allows grantee to read the object data and its metadata. - GrantRead *string `location:"header" locationName:"x-amz-grant-read" type:"string"` - - // Allows grantee to read the object ACL. - GrantReadACP *string `location:"header" locationName:"x-amz-grant-read-acp" type:"string"` - - // Allows grantee to write the ACL for the applicable object. - GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` - - Key *string `location:"uri" locationName:"Key" type:"string" required:"true"` - - // A map of metadata to store with the object in S3. - Metadata *map[string]*string `location:"headers" locationName:"x-amz-meta-" type:"map"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string"` - - // Specifies the algorithm to use to when encrypting the object (e.g., AES256, - // aws:kms). - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting - // data. This value is used to store the object and then it is discarded; Amazon - // does not store the encryption key. The key must be appropriate for use with - // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm - // header. - SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string"` - - // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. - // Amazon S3 uses this header for a message integrity check to ensure the encryption - // key was transmitted without error. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // Specifies the AWS KMS key ID to use for object encryption. All GET and PUT - // requests for an object protected by AWS KMS will fail if not made via SSL - // or using SigV4. Documentation on configuring any of the officially supported - // AWS SDKs and CLI can be found at http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version - SSEKMSKeyID *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` - - // The Server-side encryption algorithm used when storing this object in S3 - // (e.g., AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string"` - - // The type of storage to use for the object. Defaults to 'STANDARD'. - StorageClass *string `location:"header" locationName:"x-amz-storage-class" type:"string"` - - // If the bucket is configured as a website, redirects requests for this object - // to another object in the same bucket or to an external URL. Amazon S3 stores - // the value of this header in the object metadata. - WebsiteRedirectLocation *string `location:"header" locationName:"x-amz-website-redirect-location" type:"string"` - - metadataPutObjectInput `json:"-", xml:"-"` -} - -type metadataPutObjectInput struct { - SDKShapeTraits bool `type:"structure" payload:"Body"` -} - -type PutObjectOutput struct { - // Entity tag for the uploaded object. - ETag *string `location:"header" locationName:"ETag" type:"string"` - - // If the object expiration is configured, this will contain the expiration - // date (expiry-date) and rule ID (rule-id). The value of rule-id is URL encoded. - Expiration *string `location:"header" locationName:"x-amz-expiration" type:"string"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header confirming the encryption algorithm - // used. - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header to provide round trip message integrity - // verification of the customer-provided encryption key. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // If present, specifies the ID of the AWS Key Management Service (KMS) master - // encryption key that was used for the object. - SSEKMSKeyID *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` - - // The Server-side encryption algorithm used when storing this object in S3 - // (e.g., AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string"` - - // Version of the object. - VersionID *string `location:"header" locationName:"x-amz-version-id" type:"string"` - - metadataPutObjectOutput `json:"-", xml:"-"` -} - -type metadataPutObjectOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type QueueConfiguration struct { - Event *string `type:"string"` - - Events []*string `locationName:"Event" type:"list" flattened:"true"` - - ID *string `locationName:"Id" type:"string"` - - Queue *string `type:"string"` - - metadataQueueConfiguration `json:"-", xml:"-"` -} - -type metadataQueueConfiguration struct { - SDKShapeTraits bool `type:"structure"` -} - -type Redirect struct { - // The HTTP redirect code to use on the response. Not required if one of the - // siblings is present. - HTTPRedirectCode *string `locationName:"HttpRedirectCode" type:"string"` - - // The host name to use in the redirect request. - HostName *string `type:"string"` - - // Protocol to use (http, https) when redirecting requests. The default is the - // protocol that is used in the original request. - Protocol *string `type:"string"` - - // The object key prefix to use in the redirect request. For example, to redirect - // requests for all pages with prefix docs/ (objects in the docs/ folder) to - // documents/, you can set a condition block with KeyPrefixEquals set to docs/ - // and in the Redirect set ReplaceKeyPrefixWith to /documents. Not required - // if one of the siblings is present. Can be present only if ReplaceKeyWith - // is not provided. - ReplaceKeyPrefixWith *string `type:"string"` - - // The specific object key to use in the redirect request. For example, redirect - // request to error.html. Not required if one of the sibling is present. Can - // be present only if ReplaceKeyPrefixWith is not provided. - ReplaceKeyWith *string `type:"string"` - - metadataRedirect `json:"-", xml:"-"` -} - -type metadataRedirect struct { - SDKShapeTraits bool `type:"structure"` -} - -type RedirectAllRequestsTo struct { - // Name of the host where requests will be redirected. - HostName *string `type:"string" required:"true"` - - // Protocol to use (http, https) when redirecting requests. The default is the - // protocol that is used in the original request. - Protocol *string `type:"string"` - - metadataRedirectAllRequestsTo `json:"-", xml:"-"` -} - -type metadataRedirectAllRequestsTo struct { - SDKShapeTraits bool `type:"structure"` -} - -// Container for replication rules. You can add as many as 1,000 rules. Total -// replication configuration size can be up to 2 MB. -type ReplicationConfiguration struct { - // Amazon Resource Name (ARN) of an IAM role for Amazon S3 to assume when replicating - // the objects. - Role *string `type:"string" required:"true"` - - // Container for information about a particular replication rule. Replication - // configuration must have at least one rule and can contain up to 1,000 rules. - Rules []*ReplicationRule `locationName:"Rule" type:"list" flattened:"true" required:"true"` - - metadataReplicationConfiguration `json:"-", xml:"-"` -} - -type metadataReplicationConfiguration struct { - SDKShapeTraits bool `type:"structure"` -} - -type ReplicationRule struct { - Destination *Destination `type:"structure" required:"true"` - - // Unique identifier for the rule. The value cannot be longer than 255 characters. - ID *string `type:"string"` - - // Object keyname prefix identifying one or more objects to which the rule applies. - // Maximum prefix length can be up to 1,024 characters. Overlapping prefixes - // are not supported. - Prefix *string `type:"string" required:"true"` - - // The rule is ignored if status is not Enabled. - Status *string `type:"string" required:"true"` - - metadataReplicationRule `json:"-", xml:"-"` -} - -type metadataReplicationRule struct { - SDKShapeTraits bool `type:"structure"` -} - -type RequestPaymentConfiguration struct { - // Specifies who pays for the download and request fees. - Payer *string `type:"string" required:"true"` - - metadataRequestPaymentConfiguration `json:"-", xml:"-"` -} - -type metadataRequestPaymentConfiguration struct { - SDKShapeTraits bool `type:"structure"` -} - -type RestoreObjectInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - Key *string `location:"uri" locationName:"Key" type:"string" required:"true"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string"` - - RestoreRequest *RestoreRequest `locationName:"RestoreRequest" type:"structure"` - - VersionID *string `location:"querystring" locationName:"versionId" type:"string"` - - metadataRestoreObjectInput `json:"-", xml:"-"` -} - -type metadataRestoreObjectInput struct { - SDKShapeTraits bool `type:"structure" payload:"RestoreRequest"` -} - -type RestoreObjectOutput struct { - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string"` - - metadataRestoreObjectOutput `json:"-", xml:"-"` -} - -type metadataRestoreObjectOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type RestoreRequest struct { - // Lifetime of the active copy in days - Days *int64 `type:"integer" required:"true"` - - metadataRestoreRequest `json:"-", xml:"-"` -} - -type metadataRestoreRequest struct { - SDKShapeTraits bool `type:"structure"` -} - -type RoutingRule struct { - // A container for describing a condition that must be met for the specified - // redirect to apply. For example, 1. If request is for pages in the /docs folder, - // redirect to the /documents folder. 2. If request results in HTTP error 4xx, - // redirect request to another host where you might process the error. - Condition *Condition `type:"structure"` - - // Container for redirect information. You can redirect requests to another - // host, to another page, or with another protocol. In the event of an error, - // you can can specify a different error code to return. - Redirect *Redirect `type:"structure" required:"true"` - - metadataRoutingRule `json:"-", xml:"-"` -} - -type metadataRoutingRule struct { - SDKShapeTraits bool `type:"structure"` -} - -type Tag struct { - // Name of the tag. - Key *string `type:"string" required:"true"` - - // Value of the tag. - Value *string `type:"string" required:"true"` - - metadataTag `json:"-", xml:"-"` -} - -type metadataTag struct { - SDKShapeTraits bool `type:"structure"` -} - -type Tagging struct { - TagSet []*Tag `locationNameList:"Tag" type:"list" required:"true"` - - metadataTagging `json:"-", xml:"-"` -} - -type metadataTagging struct { - SDKShapeTraits bool `type:"structure"` -} - -type TargetGrant struct { - Grantee *Grantee `type:"structure"` - - // Logging permissions assigned to the Grantee for the bucket. - Permission *string `type:"string"` - - metadataTargetGrant `json:"-", xml:"-"` -} - -type metadataTargetGrant struct { - SDKShapeTraits bool `type:"structure"` -} - -type TopicConfiguration struct { - // Bucket event for which to send notifications. - Event *string `type:"string"` - - Events []*string `locationName:"Event" type:"list" flattened:"true"` - - ID *string `locationName:"Id" type:"string"` - - // Amazon SNS topic to which Amazon S3 will publish a message to report the - // specified events for the bucket. - Topic *string `type:"string"` - - metadataTopicConfiguration `json:"-", xml:"-"` -} - -type metadataTopicConfiguration struct { - SDKShapeTraits bool `type:"structure"` -} - -type Transition struct { - // Indicates at what date the object is to be moved or deleted. Should be in - // GMT ISO 8601 Format. - Date *time.Time `type:"timestamp" timestampFormat:"iso8601"` - - // Indicates the lifetime, in days, of the objects that are subject to the rule. - // The value must be a non-zero positive integer. - Days *int64 `type:"integer"` - - // The class of storage used to store the object. - StorageClass *string `type:"string"` - - metadataTransition `json:"-", xml:"-"` -} - -type metadataTransition struct { - SDKShapeTraits bool `type:"structure"` -} - -type UploadPartCopyInput struct { - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The name of the source bucket and key name of the source object, separated - // by a slash (/). Must be URL-encoded. - CopySource *string `location:"header" locationName:"x-amz-copy-source" type:"string" required:"true"` - - // Copies the object if its entity tag (ETag) matches the specified tag. - CopySourceIfMatch *string `location:"header" locationName:"x-amz-copy-source-if-match" type:"string"` - - // Copies the object if it has been modified since the specified time. - CopySourceIfModifiedSince *time.Time `location:"header" locationName:"x-amz-copy-source-if-modified-since" type:"timestamp" timestampFormat:"rfc822"` - - // Copies the object if its entity tag (ETag) is different than the specified - // ETag. - CopySourceIfNoneMatch *string `location:"header" locationName:"x-amz-copy-source-if-none-match" type:"string"` - - // Copies the object if it hasn't been modified since the specified time. - CopySourceIfUnmodifiedSince *time.Time `location:"header" locationName:"x-amz-copy-source-if-unmodified-since" type:"timestamp" timestampFormat:"rfc822"` - - // The range of bytes to copy from the source object. The range value must use - // the form bytes=first-last, where the first and last are the zero-based byte - // offsets to copy. For example, bytes=0-9 indicates that you want to copy the - // first ten bytes of the source. You can copy a range only if the source object - // is greater than 5 GB. - CopySourceRange *string `location:"header" locationName:"x-amz-copy-source-range" type:"string"` - - // Specifies the algorithm to use when decrypting the source object (e.g., AES256). - CopySourceSSECustomerAlgorithm *string `location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-algorithm" type:"string"` - - // Specifies the customer-provided encryption key for Amazon S3 to use to decrypt - // the source object. The encryption key provided in this header must be one - // that was used when the source object was created. - CopySourceSSECustomerKey *string `location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-key" type:"string"` - - // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. - // Amazon S3 uses this header for a message integrity check to ensure the encryption - // key was transmitted without error. - CopySourceSSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-key-MD5" type:"string"` - - Key *string `location:"uri" locationName:"Key" type:"string" required:"true"` - - // Part number of part being copied. - PartNumber *int64 `location:"querystring" locationName:"partNumber" type:"integer" required:"true"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string"` - - // Specifies the algorithm to use to when encrypting the object (e.g., AES256, - // aws:kms). - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting - // data. This value is used to store the object and then it is discarded; Amazon - // does not store the encryption key. The key must be appropriate for use with - // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm - // header. This must be the same encryption key specified in the initiate multipart - // upload request. - SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string"` - - // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. - // Amazon S3 uses this header for a message integrity check to ensure the encryption - // key was transmitted without error. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // Upload ID identifying the multipart upload whose part is being copied. - UploadID *string `location:"querystring" locationName:"uploadId" type:"string" required:"true"` - - metadataUploadPartCopyInput `json:"-", xml:"-"` -} - -type metadataUploadPartCopyInput struct { - SDKShapeTraits bool `type:"structure"` -} - -type UploadPartCopyOutput struct { - CopyPartResult *CopyPartResult `type:"structure"` - - // The version of the source object that was copied, if you have enabled versioning - // on the source bucket. - CopySourceVersionID *string `location:"header" locationName:"x-amz-copy-source-version-id" type:"string"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header confirming the encryption algorithm - // used. - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header to provide round trip message integrity - // verification of the customer-provided encryption key. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // If present, specifies the ID of the AWS Key Management Service (KMS) master - // encryption key that was used for the object. - SSEKMSKeyID *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` - - // The Server-side encryption algorithm used when storing this object in S3 - // (e.g., AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string"` - - metadataUploadPartCopyOutput `json:"-", xml:"-"` -} - -type metadataUploadPartCopyOutput struct { - SDKShapeTraits bool `type:"structure" payload:"CopyPartResult"` -} - -type UploadPartInput struct { - Body io.ReadSeeker `type:"blob"` - - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Size of the body in bytes. This parameter is useful when the size of the - // body cannot be determined automatically. - ContentLength *int64 `location:"header" locationName:"Content-Length" type:"integer"` - - Key *string `location:"uri" locationName:"Key" type:"string" required:"true"` - - // Part number of part being uploaded. - PartNumber *int64 `location:"querystring" locationName:"partNumber" type:"integer" required:"true"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string"` - - // Specifies the algorithm to use to when encrypting the object (e.g., AES256, - // aws:kms). - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting - // data. This value is used to store the object and then it is discarded; Amazon - // does not store the encryption key. The key must be appropriate for use with - // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm - // header. This must be the same encryption key specified in the initiate multipart - // upload request. - SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string"` - - // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. - // Amazon S3 uses this header for a message integrity check to ensure the encryption - // key was transmitted without error. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // Upload ID identifying the multipart upload whose part is being uploaded. - UploadID *string `location:"querystring" locationName:"uploadId" type:"string" required:"true"` - - metadataUploadPartInput `json:"-", xml:"-"` -} - -type metadataUploadPartInput struct { - SDKShapeTraits bool `type:"structure" payload:"Body"` -} - -type UploadPartOutput struct { - // Entity tag for the uploaded object. - ETag *string `location:"header" locationName:"ETag" type:"string"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header confirming the encryption algorithm - // used. - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header to provide round trip message integrity - // verification of the customer-provided encryption key. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // If present, specifies the ID of the AWS Key Management Service (KMS) master - // encryption key that was used for the object. - SSEKMSKeyID *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` - - // The Server-side encryption algorithm used when storing this object in S3 - // (e.g., AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string"` - - metadataUploadPartOutput `json:"-", xml:"-"` -} - -type metadataUploadPartOutput struct { - SDKShapeTraits bool `type:"structure"` -} - -type VersioningConfiguration struct { - // Specifies whether MFA delete is enabled in the bucket versioning configuration. - // This element is only returned if the bucket has been configured with MFA - // delete. If the bucket has never been so configured, this element is not returned. - MFADelete *string `locationName:"MfaDelete" type:"string"` - - // The versioning state of the bucket. - Status *string `type:"string"` - - metadataVersioningConfiguration `json:"-", xml:"-"` -} - -type metadataVersioningConfiguration struct { - SDKShapeTraits bool `type:"structure"` -} - -type WebsiteConfiguration struct { - ErrorDocument *ErrorDocument `type:"structure"` - - IndexDocument *IndexDocument `type:"structure"` - - RedirectAllRequestsTo *RedirectAllRequestsTo `type:"structure"` - - RoutingRules []*RoutingRule `locationNameList:"RoutingRule" type:"list"` - - metadataWebsiteConfiguration `json:"-", xml:"-"` -} - -type metadataWebsiteConfiguration struct { - SDKShapeTraits bool `type:"structure"` -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/bucket_location.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/bucket_location.go deleted file mode 100644 index cbed183d..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/bucket_location.go +++ /dev/null @@ -1,41 +0,0 @@ -package s3 - -import ( - "io/ioutil" - "regexp" - - "github.com/awslabs/aws-sdk-go/aws" - "github.com/awslabs/aws-sdk-go/aws/awsutil" -) - -var reBucketLocation = regexp.MustCompile(`>([^<>]+)<\/Location`) - -func buildGetBucketLocation(r *aws.Request) { - if r.DataFilled() { - out := r.Data.(*GetBucketLocationOutput) - b, err := ioutil.ReadAll(r.HTTPResponse.Body) - if err != nil { - r.Error = err - return - } - - match := reBucketLocation.FindSubmatch(b) - if len(match) > 1 { - loc := string(match[1]) - out.LocationConstraint = &loc - } - } -} - -func populateLocationConstraint(r *aws.Request) { - if r.ParamsFilled() && 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, - } - } - } -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/bucket_location_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/bucket_location_test.go deleted file mode 100644 index e5932e0b..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/bucket_location_test.go +++ /dev/null @@ -1,73 +0,0 @@ -package s3_test - -import ( - "bytes" - "io/ioutil" - "net/http" - "testing" - - "github.com/awslabs/aws-sdk-go/aws" - "github.com/awslabs/aws-sdk-go/aws/awsutil" - "github.com/awslabs/aws-sdk-go/service/s3" - "github.com/stretchr/testify/assert" -) - -var s3LocationTests = []struct { - body string - loc string -}{ - {``, ``}, - {`EU`, `EU`}, -} - -func TestGetBucketLocation(t *testing.T) { - for _, test := range s3LocationTests { - s := s3.New(baseConfig) - s.Handlers.Send.Clear() - s.Handlers.Send.PushBack(func(r *aws.Request) { - reader := ioutil.NopCloser(bytes.NewReader([]byte(test.body))) - r.HTTPResponse = &http.Response{StatusCode: 200, Body: reader} - }) - - resp, err := s.GetBucketLocation(&s3.GetBucketLocationInput{Bucket: aws.String("bucket")}) - assert.NoError(t, err) - if test.loc == "" { - assert.Nil(t, resp.LocationConstraint) - } else { - assert.Equal(t, test.loc, *resp.LocationConstraint) - } - } -} - -func TestPopulateLocationConstraint(t *testing.T) { - s := s3.New(baseConfig) - in := &s3.CreateBucketInput{ - Bucket: aws.String("bucket"), - } - req, _ := s.CreateBucketRequest(in) - err := req.Build() - assert.NoError(t, err) - assert.Equal(t, "mock-region", awsutil.ValuesAtPath(req.Params, "CreateBucketConfiguration.LocationConstraint")[0]) - assert.Nil(t, in.CreateBucketConfiguration) // don't modify original params -} - -func TestNoPopulateLocationConstraintIfProvided(t *testing.T) { - s := s3.New(baseConfig) - req, _ := s.CreateBucketRequest(&s3.CreateBucketInput{ - Bucket: aws.String("bucket"), - CreateBucketConfiguration: &s3.CreateBucketConfiguration{}, - }) - err := req.Build() - assert.NoError(t, err) - assert.Equal(t, 0, len(awsutil.ValuesAtPath(req.Params, "CreateBucketConfiguration.LocationConstraint"))) -} - -func TestNoPopulateLocationConstraintIfClassic(t *testing.T) { - s := s3.New(baseConfig.Merge(&aws.Config{Region: "us-east-1"})) - req, _ := s.CreateBucketRequest(&s3.CreateBucketInput{ - Bucket: aws.String("bucket"), - }) - err := req.Build() - assert.NoError(t, err) - assert.Equal(t, 0, len(awsutil.ValuesAtPath(req.Params, "CreateBucketConfiguration.LocationConstraint"))) -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/content_md5.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/content_md5.go deleted file mode 100644 index bb47ff61..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/content_md5.go +++ /dev/null @@ -1,36 +0,0 @@ -package s3 - -import ( - "crypto/md5" - "encoding/base64" - "fmt" - "io" - - "github.com/awslabs/aws-sdk-go/aws" -) - -// contentMD5 computes and sets the HTTP Content-MD5 header for requests that -// require it. -func contentMD5(r *aws.Request) { - h := md5.New() - - // hash the body. seek back to the first position after reading to reset - // the body for transmission. copy errors may be assumed to be from the - // body. - _, err := io.Copy(h, r.Body) - if err != nil { - r.Error = fmt.Errorf("content-md5: read: %v", err) - return - } - _, err = r.Body.Seek(0, 0) - if err != nil { - r.Error = fmt.Errorf("content-md5: seek: %v", err) - return - } - - // encode the md5 checksum in base64 and set the request header. - sum := h.Sum(nil) - sum64 := make([]byte, base64.StdEncoding.EncodedLen(len(sum))) - base64.StdEncoding.Encode(sum64, sum) - r.HTTPRequest.Header.Set("Content-MD5", string(sum64)) -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/customizations.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/customizations.go deleted file mode 100644 index b23c207d..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/customizations.go +++ /dev/null @@ -1,32 +0,0 @@ -package s3 - -import "github.com/awslabs/aws-sdk-go/aws" - -func init() { - initService = func(s *aws.Service) { - // Support building custom host-style bucket endpoints - s.Handlers.Build.PushFront(updateHostWithBucket) - - // Require SSL when using SSE keys - s.Handlers.Validate.PushBack(validateSSERequiresSSL) - s.Handlers.Build.PushBack(computeSSEKeys) - - // S3 uses custom error unmarshaling logic - s.Handlers.UnmarshalError.Clear() - s.Handlers.UnmarshalError.PushBack(unmarshalError) - } - - initRequest = func(r *aws.Request) { - switch r.Operation { - case opPutBucketCORS, opPutBucketLifecycle, opPutBucketTagging, opDeleteObjects: - // These S3 operations require Content-MD5 to be set - r.Handlers.Build.PushBack(contentMD5) - case opGetBucketLocation: - // GetBucketLocation has custom parsing logic - r.Handlers.Unmarshal.PushFront(buildGetBucketLocation) - case opCreateBucket: - // Auto-populate LocationConstraint with current region - r.Handlers.Validate.PushFront(populateLocationConstraint) - } - } -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/customizations_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/customizations_test.go deleted file mode 100644 index f9675870..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/customizations_test.go +++ /dev/null @@ -1,78 +0,0 @@ -package s3_test - -import ( - "crypto/md5" - "encoding/base64" - "io/ioutil" - "testing" - - "github.com/awslabs/aws-sdk-go/aws" - "github.com/awslabs/aws-sdk-go/service/s3" - "github.com/stretchr/testify/assert" -) - -func assertMD5(t *testing.T, req *aws.Request) { - err := req.Build() - assert.NoError(t, err) - - b, _ := ioutil.ReadAll(req.HTTPRequest.Body) - out := md5.Sum(b) - assert.NotEmpty(t, b) - assert.Equal(t, base64.StdEncoding.EncodeToString(out[:]), req.HTTPRequest.Header.Get("Content-MD5")) -} - -func TestMD5InPutBucketCORS(t *testing.T) { - svc := s3.New(baseConfig) - req, _ := svc.PutBucketCORSRequest(&s3.PutBucketCORSInput{ - Bucket: aws.String("bucketname"), - CORSConfiguration: &s3.CORSConfiguration{ - CORSRules: []*s3.CORSRule{ - {AllowedMethods: []*string{aws.String("GET")}}, - }, - }, - }) - assertMD5(t, req) -} - -func TestMD5InPutBucketLifecycle(t *testing.T) { - svc := s3.New(baseConfig) - req, _ := svc.PutBucketLifecycleRequest(&s3.PutBucketLifecycleInput{ - Bucket: aws.String("bucketname"), - LifecycleConfiguration: &s3.LifecycleConfiguration{ - Rules: []*s3.LifecycleRule{ - { - ID: aws.String("ID"), - Prefix: aws.String("Prefix"), - Status: aws.String("Enabled"), - }, - }, - }, - }) - assertMD5(t, req) -} - -func TestMD5InPutBucketTagging(t *testing.T) { - svc := s3.New(baseConfig) - req, _ := svc.PutBucketTaggingRequest(&s3.PutBucketTaggingInput{ - Bucket: aws.String("bucketname"), - Tagging: &s3.Tagging{ - TagSet: []*s3.Tag{ - {Key: aws.String("KEY"), Value: aws.String("VALUE")}, - }, - }, - }) - assertMD5(t, req) -} - -func TestMD5InDeleteObjects(t *testing.T) { - svc := s3.New(baseConfig) - req, _ := svc.DeleteObjectsRequest(&s3.DeleteObjectsInput{ - Bucket: aws.String("bucketname"), - Delete: &s3.Delete{ - Objects: []*s3.ObjectIdentifier{ - {Key: aws.String("key")}, - }, - }, - }) - assertMD5(t, req) -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/examples_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/examples_test.go deleted file mode 100644 index 3471b6b2..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/examples_test.go +++ /dev/null @@ -1,1472 +0,0 @@ -package s3_test - -import ( - "bytes" - "fmt" - "time" - - "github.com/awslabs/aws-sdk-go/aws" - "github.com/awslabs/aws-sdk-go/aws/awsutil" - "github.com/awslabs/aws-sdk-go/service/s3" -) - -var _ time.Duration -var _ bytes.Buffer - -func ExampleS3_AbortMultipartUpload() { - svc := s3.New(nil) - - params := &s3.AbortMultipartUploadInput{ - Bucket: aws.String("BucketName"), // Required - Key: aws.String("ObjectKey"), // Required - UploadID: aws.String("MultipartUploadId"), // Required - RequestPayer: aws.String("RequestPayer"), - } - resp, err := svc.AbortMultipartUpload(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_CompleteMultipartUpload() { - svc := s3.New(nil) - - params := &s3.CompleteMultipartUploadInput{ - Bucket: aws.String("BucketName"), // Required - Key: aws.String("ObjectKey"), // Required - UploadID: aws.String("MultipartUploadId"), // Required - MultipartUpload: &s3.CompletedMultipartUpload{ - Parts: []*s3.CompletedPart{ - { // Required - ETag: aws.String("ETag"), - PartNumber: aws.Long(1), - }, - // More values... - }, - }, - RequestPayer: aws.String("RequestPayer"), - } - resp, err := svc.CompleteMultipartUpload(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_CopyObject() { - svc := s3.New(nil) - - params := &s3.CopyObjectInput{ - Bucket: aws.String("BucketName"), // Required - CopySource: aws.String("CopySource"), // Required - Key: aws.String("ObjectKey"), // Required - ACL: aws.String("ObjectCannedACL"), - CacheControl: aws.String("CacheControl"), - ContentDisposition: aws.String("ContentDisposition"), - ContentEncoding: aws.String("ContentEncoding"), - ContentLanguage: aws.String("ContentLanguage"), - ContentType: aws.String("ContentType"), - CopySourceIfMatch: aws.String("CopySourceIfMatch"), - CopySourceIfModifiedSince: aws.Time(time.Now()), - CopySourceIfNoneMatch: aws.String("CopySourceIfNoneMatch"), - CopySourceIfUnmodifiedSince: aws.Time(time.Now()), - CopySourceSSECustomerAlgorithm: aws.String("CopySourceSSECustomerAlgorithm"), - CopySourceSSECustomerKey: aws.String("CopySourceSSECustomerKey"), - CopySourceSSECustomerKeyMD5: aws.String("CopySourceSSECustomerKeyMD5"), - Expires: aws.Time(time.Now()), - GrantFullControl: aws.String("GrantFullControl"), - GrantRead: aws.String("GrantRead"), - GrantReadACP: aws.String("GrantReadACP"), - GrantWriteACP: aws.String("GrantWriteACP"), - Metadata: &map[string]*string{ - "Key": aws.String("MetadataValue"), // Required - // More values... - }, - MetadataDirective: aws.String("MetadataDirective"), - RequestPayer: aws.String("RequestPayer"), - SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"), - SSECustomerKey: aws.String("SSECustomerKey"), - SSECustomerKeyMD5: aws.String("SSECustomerKeyMD5"), - SSEKMSKeyID: aws.String("SSEKMSKeyId"), - ServerSideEncryption: aws.String("ServerSideEncryption"), - StorageClass: aws.String("StorageClass"), - WebsiteRedirectLocation: aws.String("WebsiteRedirectLocation"), - } - resp, err := svc.CopyObject(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_CreateBucket() { - svc := s3.New(nil) - - params := &s3.CreateBucketInput{ - Bucket: aws.String("BucketName"), // Required - ACL: aws.String("BucketCannedACL"), - CreateBucketConfiguration: &s3.CreateBucketConfiguration{ - LocationConstraint: aws.String("BucketLocationConstraint"), - }, - GrantFullControl: aws.String("GrantFullControl"), - GrantRead: aws.String("GrantRead"), - GrantReadACP: aws.String("GrantReadACP"), - GrantWrite: aws.String("GrantWrite"), - GrantWriteACP: aws.String("GrantWriteACP"), - } - resp, err := svc.CreateBucket(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_CreateMultipartUpload() { - svc := s3.New(nil) - - params := &s3.CreateMultipartUploadInput{ - Bucket: aws.String("BucketName"), // Required - Key: aws.String("ObjectKey"), // Required - ACL: aws.String("ObjectCannedACL"), - CacheControl: aws.String("CacheControl"), - ContentDisposition: aws.String("ContentDisposition"), - ContentEncoding: aws.String("ContentEncoding"), - ContentLanguage: aws.String("ContentLanguage"), - ContentType: aws.String("ContentType"), - Expires: aws.Time(time.Now()), - GrantFullControl: aws.String("GrantFullControl"), - GrantRead: aws.String("GrantRead"), - GrantReadACP: aws.String("GrantReadACP"), - GrantWriteACP: aws.String("GrantWriteACP"), - Metadata: &map[string]*string{ - "Key": aws.String("MetadataValue"), // Required - // More values... - }, - RequestPayer: aws.String("RequestPayer"), - SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"), - SSECustomerKey: aws.String("SSECustomerKey"), - SSECustomerKeyMD5: aws.String("SSECustomerKeyMD5"), - SSEKMSKeyID: aws.String("SSEKMSKeyId"), - ServerSideEncryption: aws.String("ServerSideEncryption"), - StorageClass: aws.String("StorageClass"), - WebsiteRedirectLocation: aws.String("WebsiteRedirectLocation"), - } - resp, err := svc.CreateMultipartUpload(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_DeleteBucket() { - svc := s3.New(nil) - - params := &s3.DeleteBucketInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.DeleteBucket(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_DeleteBucketCORS() { - svc := s3.New(nil) - - params := &s3.DeleteBucketCORSInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.DeleteBucketCORS(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_DeleteBucketLifecycle() { - svc := s3.New(nil) - - params := &s3.DeleteBucketLifecycleInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.DeleteBucketLifecycle(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_DeleteBucketPolicy() { - svc := s3.New(nil) - - params := &s3.DeleteBucketPolicyInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.DeleteBucketPolicy(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_DeleteBucketReplication() { - svc := s3.New(nil) - - params := &s3.DeleteBucketReplicationInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.DeleteBucketReplication(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_DeleteBucketTagging() { - svc := s3.New(nil) - - params := &s3.DeleteBucketTaggingInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.DeleteBucketTagging(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_DeleteBucketWebsite() { - svc := s3.New(nil) - - params := &s3.DeleteBucketWebsiteInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.DeleteBucketWebsite(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_DeleteObject() { - svc := s3.New(nil) - - params := &s3.DeleteObjectInput{ - Bucket: aws.String("BucketName"), // Required - Key: aws.String("ObjectKey"), // Required - MFA: aws.String("MFA"), - RequestPayer: aws.String("RequestPayer"), - VersionID: aws.String("ObjectVersionId"), - } - resp, err := svc.DeleteObject(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_DeleteObjects() { - svc := s3.New(nil) - - params := &s3.DeleteObjectsInput{ - Bucket: aws.String("BucketName"), // Required - Delete: &s3.Delete{ // Required - Objects: []*s3.ObjectIdentifier{ // Required - { // Required - Key: aws.String("ObjectKey"), // Required - VersionID: aws.String("ObjectVersionId"), - }, - // More values... - }, - Quiet: aws.Boolean(true), - }, - MFA: aws.String("MFA"), - RequestPayer: aws.String("RequestPayer"), - } - resp, err := svc.DeleteObjects(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_GetBucketACL() { - svc := s3.New(nil) - - params := &s3.GetBucketACLInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.GetBucketACL(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_GetBucketCORS() { - svc := s3.New(nil) - - params := &s3.GetBucketCORSInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.GetBucketCORS(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_GetBucketLifecycle() { - svc := s3.New(nil) - - params := &s3.GetBucketLifecycleInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.GetBucketLifecycle(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_GetBucketLocation() { - svc := s3.New(nil) - - params := &s3.GetBucketLocationInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.GetBucketLocation(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_GetBucketLogging() { - svc := s3.New(nil) - - params := &s3.GetBucketLoggingInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.GetBucketLogging(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_GetBucketNotification() { - svc := s3.New(nil) - - params := &s3.GetBucketNotificationInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.GetBucketNotification(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_GetBucketPolicy() { - svc := s3.New(nil) - - params := &s3.GetBucketPolicyInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.GetBucketPolicy(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_GetBucketReplication() { - svc := s3.New(nil) - - params := &s3.GetBucketReplicationInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.GetBucketReplication(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_GetBucketRequestPayment() { - svc := s3.New(nil) - - params := &s3.GetBucketRequestPaymentInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.GetBucketRequestPayment(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_GetBucketTagging() { - svc := s3.New(nil) - - params := &s3.GetBucketTaggingInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.GetBucketTagging(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_GetBucketVersioning() { - svc := s3.New(nil) - - params := &s3.GetBucketVersioningInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.GetBucketVersioning(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_GetBucketWebsite() { - svc := s3.New(nil) - - params := &s3.GetBucketWebsiteInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.GetBucketWebsite(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_GetObject() { - svc := s3.New(nil) - - params := &s3.GetObjectInput{ - Bucket: aws.String("BucketName"), // Required - Key: aws.String("ObjectKey"), // Required - IfMatch: aws.String("IfMatch"), - IfModifiedSince: aws.Time(time.Now()), - IfNoneMatch: aws.String("IfNoneMatch"), - IfUnmodifiedSince: aws.Time(time.Now()), - Range: aws.String("Range"), - RequestPayer: aws.String("RequestPayer"), - ResponseCacheControl: aws.String("ResponseCacheControl"), - ResponseContentDisposition: aws.String("ResponseContentDisposition"), - ResponseContentEncoding: aws.String("ResponseContentEncoding"), - ResponseContentLanguage: aws.String("ResponseContentLanguage"), - ResponseContentType: aws.String("ResponseContentType"), - ResponseExpires: aws.Time(time.Now()), - SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"), - SSECustomerKey: aws.String("SSECustomerKey"), - SSECustomerKeyMD5: aws.String("SSECustomerKeyMD5"), - VersionID: aws.String("ObjectVersionId"), - } - resp, err := svc.GetObject(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_GetObjectACL() { - svc := s3.New(nil) - - params := &s3.GetObjectACLInput{ - Bucket: aws.String("BucketName"), // Required - Key: aws.String("ObjectKey"), // Required - RequestPayer: aws.String("RequestPayer"), - VersionID: aws.String("ObjectVersionId"), - } - resp, err := svc.GetObjectACL(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_GetObjectTorrent() { - svc := s3.New(nil) - - params := &s3.GetObjectTorrentInput{ - Bucket: aws.String("BucketName"), // Required - Key: aws.String("ObjectKey"), // Required - RequestPayer: aws.String("RequestPayer"), - } - resp, err := svc.GetObjectTorrent(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_HeadBucket() { - svc := s3.New(nil) - - params := &s3.HeadBucketInput{ - Bucket: aws.String("BucketName"), // Required - } - resp, err := svc.HeadBucket(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_HeadObject() { - svc := s3.New(nil) - - params := &s3.HeadObjectInput{ - Bucket: aws.String("BucketName"), // Required - Key: aws.String("ObjectKey"), // Required - IfMatch: aws.String("IfMatch"), - IfModifiedSince: aws.Time(time.Now()), - IfNoneMatch: aws.String("IfNoneMatch"), - IfUnmodifiedSince: aws.Time(time.Now()), - Range: aws.String("Range"), - RequestPayer: aws.String("RequestPayer"), - SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"), - SSECustomerKey: aws.String("SSECustomerKey"), - SSECustomerKeyMD5: aws.String("SSECustomerKeyMD5"), - VersionID: aws.String("ObjectVersionId"), - } - resp, err := svc.HeadObject(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_ListBuckets() { - svc := s3.New(nil) - - var params *s3.ListBucketsInput - resp, err := svc.ListBuckets(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_ListMultipartUploads() { - svc := s3.New(nil) - - params := &s3.ListMultipartUploadsInput{ - Bucket: aws.String("BucketName"), // Required - Delimiter: aws.String("Delimiter"), - EncodingType: aws.String("EncodingType"), - KeyMarker: aws.String("KeyMarker"), - MaxUploads: aws.Long(1), - Prefix: aws.String("Prefix"), - UploadIDMarker: aws.String("UploadIdMarker"), - } - resp, err := svc.ListMultipartUploads(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_ListObjectVersions() { - svc := s3.New(nil) - - params := &s3.ListObjectVersionsInput{ - Bucket: aws.String("BucketName"), // Required - Delimiter: aws.String("Delimiter"), - EncodingType: aws.String("EncodingType"), - KeyMarker: aws.String("KeyMarker"), - MaxKeys: aws.Long(1), - Prefix: aws.String("Prefix"), - VersionIDMarker: aws.String("VersionIdMarker"), - } - resp, err := svc.ListObjectVersions(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_ListObjects() { - svc := s3.New(nil) - - params := &s3.ListObjectsInput{ - Bucket: aws.String("BucketName"), // Required - Delimiter: aws.String("Delimiter"), - EncodingType: aws.String("EncodingType"), - Marker: aws.String("Marker"), - MaxKeys: aws.Long(1), - Prefix: aws.String("Prefix"), - } - resp, err := svc.ListObjects(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_ListParts() { - svc := s3.New(nil) - - params := &s3.ListPartsInput{ - Bucket: aws.String("BucketName"), // Required - Key: aws.String("ObjectKey"), // Required - UploadID: aws.String("MultipartUploadId"), // Required - MaxParts: aws.Long(1), - PartNumberMarker: aws.Long(1), - RequestPayer: aws.String("RequestPayer"), - } - resp, err := svc.ListParts(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_PutBucketACL() { - svc := s3.New(nil) - - params := &s3.PutBucketACLInput{ - Bucket: aws.String("BucketName"), // Required - ACL: aws.String("BucketCannedACL"), - AccessControlPolicy: &s3.AccessControlPolicy{ - Grants: []*s3.Grant{ - { // Required - Grantee: &s3.Grantee{ - Type: aws.String("Type"), // Required - DisplayName: aws.String("DisplayName"), - EmailAddress: aws.String("EmailAddress"), - ID: aws.String("ID"), - URI: aws.String("URI"), - }, - Permission: aws.String("Permission"), - }, - // More values... - }, - Owner: &s3.Owner{ - DisplayName: aws.String("DisplayName"), - ID: aws.String("ID"), - }, - }, - GrantFullControl: aws.String("GrantFullControl"), - GrantRead: aws.String("GrantRead"), - GrantReadACP: aws.String("GrantReadACP"), - GrantWrite: aws.String("GrantWrite"), - GrantWriteACP: aws.String("GrantWriteACP"), - } - resp, err := svc.PutBucketACL(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_PutBucketCORS() { - svc := s3.New(nil) - - params := &s3.PutBucketCORSInput{ - Bucket: aws.String("BucketName"), // Required - CORSConfiguration: &s3.CORSConfiguration{ - CORSRules: []*s3.CORSRule{ - { // Required - AllowedHeaders: []*string{ - aws.String("AllowedHeader"), // Required - // More values... - }, - AllowedMethods: []*string{ - aws.String("AllowedMethod"), // Required - // More values... - }, - AllowedOrigins: []*string{ - aws.String("AllowedOrigin"), // Required - // More values... - }, - ExposeHeaders: []*string{ - aws.String("ExposeHeader"), // Required - // More values... - }, - MaxAgeSeconds: aws.Long(1), - }, - // More values... - }, - }, - } - resp, err := svc.PutBucketCORS(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_PutBucketLifecycle() { - svc := s3.New(nil) - - params := &s3.PutBucketLifecycleInput{ - Bucket: aws.String("BucketName"), // Required - LifecycleConfiguration: &s3.LifecycleConfiguration{ - Rules: []*s3.LifecycleRule{ // Required - { // Required - Prefix: aws.String("Prefix"), // Required - Status: aws.String("ExpirationStatus"), // Required - Expiration: &s3.LifecycleExpiration{ - Date: aws.Time(time.Now()), - Days: aws.Long(1), - }, - ID: aws.String("ID"), - NoncurrentVersionExpiration: &s3.NoncurrentVersionExpiration{ - NoncurrentDays: aws.Long(1), - }, - NoncurrentVersionTransition: &s3.NoncurrentVersionTransition{ - NoncurrentDays: aws.Long(1), - StorageClass: aws.String("TransitionStorageClass"), - }, - Transition: &s3.Transition{ - Date: aws.Time(time.Now()), - Days: aws.Long(1), - StorageClass: aws.String("TransitionStorageClass"), - }, - }, - // More values... - }, - }, - } - resp, err := svc.PutBucketLifecycle(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_PutBucketLogging() { - svc := s3.New(nil) - - params := &s3.PutBucketLoggingInput{ - Bucket: aws.String("BucketName"), // Required - BucketLoggingStatus: &s3.BucketLoggingStatus{ // Required - LoggingEnabled: &s3.LoggingEnabled{ - TargetBucket: aws.String("TargetBucket"), - TargetGrants: []*s3.TargetGrant{ - { // Required - Grantee: &s3.Grantee{ - Type: aws.String("Type"), // Required - DisplayName: aws.String("DisplayName"), - EmailAddress: aws.String("EmailAddress"), - ID: aws.String("ID"), - URI: aws.String("URI"), - }, - Permission: aws.String("BucketLogsPermission"), - }, - // More values... - }, - TargetPrefix: aws.String("TargetPrefix"), - }, - }, - } - resp, err := svc.PutBucketLogging(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_PutBucketNotification() { - svc := s3.New(nil) - - params := &s3.PutBucketNotificationInput{ - Bucket: aws.String("BucketName"), // Required - NotificationConfiguration: &s3.NotificationConfiguration{ // Required - CloudFunctionConfiguration: &s3.CloudFunctionConfiguration{ - CloudFunction: aws.String("CloudFunction"), - Event: aws.String("Event"), - Events: []*string{ - aws.String("Event"), // Required - // More values... - }, - ID: aws.String("NotificationId"), - InvocationRole: aws.String("CloudFunctionInvocationRole"), - }, - QueueConfiguration: &s3.QueueConfiguration{ - Event: aws.String("Event"), - Events: []*string{ - aws.String("Event"), // Required - // More values... - }, - ID: aws.String("NotificationId"), - Queue: aws.String("Queue"), - }, - TopicConfiguration: &s3.TopicConfiguration{ - Event: aws.String("Event"), - Events: []*string{ - aws.String("Event"), // Required - // More values... - }, - ID: aws.String("NotificationId"), - Topic: aws.String("Topic"), - }, - }, - } - resp, err := svc.PutBucketNotification(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_PutBucketPolicy() { - svc := s3.New(nil) - - params := &s3.PutBucketPolicyInput{ - Bucket: aws.String("BucketName"), // Required - Policy: aws.String("Policy"), // Required - } - resp, err := svc.PutBucketPolicy(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_PutBucketReplication() { - svc := s3.New(nil) - - params := &s3.PutBucketReplicationInput{ - Bucket: aws.String("BucketName"), // Required - ReplicationConfiguration: &s3.ReplicationConfiguration{ // Required - Role: aws.String("Role"), // Required - Rules: []*s3.ReplicationRule{ // Required - { // Required - Destination: &s3.Destination{ // Required - Bucket: aws.String("BucketName"), // Required - }, - Prefix: aws.String("Prefix"), // Required - Status: aws.String("ReplicationRuleStatus"), // Required - ID: aws.String("ID"), - }, - // More values... - }, - }, - } - resp, err := svc.PutBucketReplication(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_PutBucketRequestPayment() { - svc := s3.New(nil) - - params := &s3.PutBucketRequestPaymentInput{ - Bucket: aws.String("BucketName"), // Required - RequestPaymentConfiguration: &s3.RequestPaymentConfiguration{ // Required - Payer: aws.String("Payer"), // Required - }, - } - resp, err := svc.PutBucketRequestPayment(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_PutBucketTagging() { - svc := s3.New(nil) - - params := &s3.PutBucketTaggingInput{ - Bucket: aws.String("BucketName"), // Required - Tagging: &s3.Tagging{ // Required - TagSet: []*s3.Tag{ // Required - { // Required - Key: aws.String("ObjectKey"), // Required - Value: aws.String("Value"), // Required - }, - // More values... - }, - }, - } - resp, err := svc.PutBucketTagging(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_PutBucketVersioning() { - svc := s3.New(nil) - - params := &s3.PutBucketVersioningInput{ - Bucket: aws.String("BucketName"), // Required - VersioningConfiguration: &s3.VersioningConfiguration{ // Required - MFADelete: aws.String("MFADelete"), - Status: aws.String("BucketVersioningStatus"), - }, - MFA: aws.String("MFA"), - } - resp, err := svc.PutBucketVersioning(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_PutBucketWebsite() { - svc := s3.New(nil) - - params := &s3.PutBucketWebsiteInput{ - Bucket: aws.String("BucketName"), // Required - WebsiteConfiguration: &s3.WebsiteConfiguration{ // Required - ErrorDocument: &s3.ErrorDocument{ - Key: aws.String("ObjectKey"), // Required - }, - IndexDocument: &s3.IndexDocument{ - Suffix: aws.String("Suffix"), // Required - }, - RedirectAllRequestsTo: &s3.RedirectAllRequestsTo{ - HostName: aws.String("HostName"), // Required - Protocol: aws.String("Protocol"), - }, - RoutingRules: []*s3.RoutingRule{ - { // Required - Redirect: &s3.Redirect{ // Required - HTTPRedirectCode: aws.String("HttpRedirectCode"), - HostName: aws.String("HostName"), - Protocol: aws.String("Protocol"), - ReplaceKeyPrefixWith: aws.String("ReplaceKeyPrefixWith"), - ReplaceKeyWith: aws.String("ReplaceKeyWith"), - }, - Condition: &s3.Condition{ - HTTPErrorCodeReturnedEquals: aws.String("HttpErrorCodeReturnedEquals"), - KeyPrefixEquals: aws.String("KeyPrefixEquals"), - }, - }, - // More values... - }, - }, - } - resp, err := svc.PutBucketWebsite(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_PutObject() { - svc := s3.New(nil) - - params := &s3.PutObjectInput{ - Bucket: aws.String("BucketName"), // Required - Key: aws.String("ObjectKey"), // Required - ACL: aws.String("ObjectCannedACL"), - Body: bytes.NewReader([]byte("PAYLOAD")), - CacheControl: aws.String("CacheControl"), - ContentDisposition: aws.String("ContentDisposition"), - ContentEncoding: aws.String("ContentEncoding"), - ContentLanguage: aws.String("ContentLanguage"), - ContentLength: aws.Long(1), - ContentType: aws.String("ContentType"), - Expires: aws.Time(time.Now()), - GrantFullControl: aws.String("GrantFullControl"), - GrantRead: aws.String("GrantRead"), - GrantReadACP: aws.String("GrantReadACP"), - GrantWriteACP: aws.String("GrantWriteACP"), - Metadata: &map[string]*string{ - "Key": aws.String("MetadataValue"), // Required - // More values... - }, - RequestPayer: aws.String("RequestPayer"), - SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"), - SSECustomerKey: aws.String("SSECustomerKey"), - SSECustomerKeyMD5: aws.String("SSECustomerKeyMD5"), - SSEKMSKeyID: aws.String("SSEKMSKeyId"), - ServerSideEncryption: aws.String("ServerSideEncryption"), - StorageClass: aws.String("StorageClass"), - WebsiteRedirectLocation: aws.String("WebsiteRedirectLocation"), - } - resp, err := svc.PutObject(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_PutObjectACL() { - svc := s3.New(nil) - - params := &s3.PutObjectACLInput{ - Bucket: aws.String("BucketName"), // Required - Key: aws.String("ObjectKey"), // Required - ACL: aws.String("ObjectCannedACL"), - AccessControlPolicy: &s3.AccessControlPolicy{ - Grants: []*s3.Grant{ - { // Required - Grantee: &s3.Grantee{ - Type: aws.String("Type"), // Required - DisplayName: aws.String("DisplayName"), - EmailAddress: aws.String("EmailAddress"), - ID: aws.String("ID"), - URI: aws.String("URI"), - }, - Permission: aws.String("Permission"), - }, - // More values... - }, - Owner: &s3.Owner{ - DisplayName: aws.String("DisplayName"), - ID: aws.String("ID"), - }, - }, - GrantFullControl: aws.String("GrantFullControl"), - GrantRead: aws.String("GrantRead"), - GrantReadACP: aws.String("GrantReadACP"), - GrantWrite: aws.String("GrantWrite"), - GrantWriteACP: aws.String("GrantWriteACP"), - RequestPayer: aws.String("RequestPayer"), - } - resp, err := svc.PutObjectACL(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_RestoreObject() { - svc := s3.New(nil) - - params := &s3.RestoreObjectInput{ - Bucket: aws.String("BucketName"), // Required - Key: aws.String("ObjectKey"), // Required - RequestPayer: aws.String("RequestPayer"), - RestoreRequest: &s3.RestoreRequest{ - Days: aws.Long(1), // Required - }, - VersionID: aws.String("ObjectVersionId"), - } - resp, err := svc.RestoreObject(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_UploadPart() { - svc := s3.New(nil) - - params := &s3.UploadPartInput{ - Bucket: aws.String("BucketName"), // Required - Key: aws.String("ObjectKey"), // Required - PartNumber: aws.Long(1), // Required - UploadID: aws.String("MultipartUploadId"), // Required - Body: bytes.NewReader([]byte("PAYLOAD")), - ContentLength: aws.Long(1), - RequestPayer: aws.String("RequestPayer"), - SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"), - SSECustomerKey: aws.String("SSECustomerKey"), - SSECustomerKeyMD5: aws.String("SSECustomerKeyMD5"), - } - resp, err := svc.UploadPart(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} - -func ExampleS3_UploadPartCopy() { - svc := s3.New(nil) - - params := &s3.UploadPartCopyInput{ - Bucket: aws.String("BucketName"), // Required - CopySource: aws.String("CopySource"), // Required - Key: aws.String("ObjectKey"), // Required - PartNumber: aws.Long(1), // Required - UploadID: aws.String("MultipartUploadId"), // Required - CopySourceIfMatch: aws.String("CopySourceIfMatch"), - CopySourceIfModifiedSince: aws.Time(time.Now()), - CopySourceIfNoneMatch: aws.String("CopySourceIfNoneMatch"), - CopySourceIfUnmodifiedSince: aws.Time(time.Now()), - CopySourceRange: aws.String("CopySourceRange"), - CopySourceSSECustomerAlgorithm: aws.String("CopySourceSSECustomerAlgorithm"), - CopySourceSSECustomerKey: aws.String("CopySourceSSECustomerKey"), - CopySourceSSECustomerKeyMD5: aws.String("CopySourceSSECustomerKeyMD5"), - RequestPayer: aws.String("RequestPayer"), - SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"), - SSECustomerKey: aws.String("SSECustomerKey"), - SSECustomerKeyMD5: aws.String("SSECustomerKeyMD5"), - } - resp, err := svc.UploadPartCopy(params) - - if awserr := aws.Error(err); awserr != nil { - // A service error occurred. - fmt.Println("Error:", awserr.Code, awserr.Message) - } else if err != nil { - // A non-service error occurred. - panic(err) - } - - // Pretty-print the response data. - fmt.Println(awsutil.StringValue(resp)) -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/host_style_bucket.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/host_style_bucket.go deleted file mode 100644 index e3d6a43f..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/host_style_bucket.go +++ /dev/null @@ -1,53 +0,0 @@ -package s3 - -import ( - "regexp" - "strings" - - "github.com/awslabs/aws-sdk-go/aws" - "github.com/awslabs/aws-sdk-go/aws/awsutil" -) - -var reDomain = regexp.MustCompile(`^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$`) -var reIPAddress = regexp.MustCompile(`^(\d+\.){3}\d+$`) - -// dnsCompatibleBucketName returns true if the bucket name is DNS compatible. -// Buckets created outside of the classic region MUST be DNS compatible. -func dnsCompatibleBucketName(bucket string) bool { - return reDomain.MatchString(bucket) && - !reIPAddress.MatchString(bucket) && - !strings.Contains(bucket, "..") -} - -// hostStyleBucketName returns true if the request should put the bucket in -// 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 { - return false - } - - // Bucket might be DNS compatible but dots in the hostname will fail - // certificate validation, so do not use host-style. - if r.HTTPRequest.URL.Scheme == "https" && strings.Contains(bucket, ".") { - return false - } - - // Use host-style if the bucket is DNS compatible - return dnsCompatibleBucketName(bucket) -} - -func updateHostWithBucket(r *aws.Request) { - b := awsutil.ValuesAtPath(r.Params, "Bucket") - if len(b) == 0 { - return - } - - if bucket := b[0].(string); bucket != "" && hostStyleBucketName(r, bucket) { - r.HTTPRequest.URL.Host = bucket + "." + r.HTTPRequest.URL.Host - r.HTTPRequest.URL.Path = strings.Replace(r.HTTPRequest.URL.Path, "/{Bucket}", "", -1) - if r.HTTPRequest.URL.Path == "" { - r.HTTPRequest.URL.Path = "/" - } - } -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/host_style_bucket_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/host_style_bucket_test.go deleted file mode 100644 index 898b47da..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/host_style_bucket_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package s3_test - -import ( - "testing" - - "github.com/awslabs/aws-sdk-go/aws" - "github.com/awslabs/aws-sdk-go/service/s3" - "github.com/stretchr/testify/assert" -) - -type s3BucketTest struct { - bucket string - url string -} - -var ( - baseConfig = &aws.Config{ - Credentials: aws.DetectCreds("AKID", "SECRET", ""), - Region: "mock-region", - } - - sslTests = []s3BucketTest{ - {"abc", "https://abc.s3.mock-region.amazonaws.com/"}, - {"a$b$c", "https://s3.mock-region.amazonaws.com/a%24b%24c"}, - {"a.b.c", "https://s3.mock-region.amazonaws.com/a.b.c"}, - {"a..bc", "https://s3.mock-region.amazonaws.com/a..bc"}, - } - - nosslTests = []s3BucketTest{ - {"a.b.c", "http://a.b.c.s3.mock-region.amazonaws.com/"}, - {"a..bc", "http://s3.mock-region.amazonaws.com/a..bc"}, - } - - forcepathTests = []s3BucketTest{ - {"abc", "https://s3.mock-region.amazonaws.com/abc"}, - {"a$b$c", "https://s3.mock-region.amazonaws.com/a%24b%24c"}, - {"a.b.c", "https://s3.mock-region.amazonaws.com/a.b.c"}, - {"a..bc", "https://s3.mock-region.amazonaws.com/a..bc"}, - } -) - -func runTests(t *testing.T, svc *s3.S3, tests []s3BucketTest) { - for _, test := range tests { - req, _ := svc.ListObjectsRequest(&s3.ListObjectsInput{Bucket: &test.bucket}) - req.Build() - assert.Equal(t, test.url, req.HTTPRequest.URL.String()) - } -} - -func TestHostStyleBucketBuild(t *testing.T) { - s := s3.New(baseConfig) - runTests(t, s, sslTests) -} - -func TestHostStyleBucketBuildNoSSL(t *testing.T) { - s := s3.New(baseConfig.Merge(&aws.Config{DisableSSL: true})) - runTests(t, s, nosslTests) -} - -func TestPathStyleBucketBuild(t *testing.T) { - s := s3.New(baseConfig.Merge(&aws.Config{S3ForcePathStyle: true})) - runTests(t, s, forcepathTests) -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/integration_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/integration_test.go deleted file mode 100644 index 4a8aa341..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/integration_test.go +++ /dev/null @@ -1,107 +0,0 @@ -// +build integration - -package s3_test - -import ( - "bytes" - "fmt" - "io/ioutil" - "net/http" - "os" - "testing" - "time" - - "github.com/awslabs/aws-sdk-go/aws" - "github.com/awslabs/aws-sdk-go/service/s3" - "github.com/stretchr/testify/assert" -) - -var bucketName *string -var svc *s3.S3 - -func TestMain(m *testing.M) { - setup() - defer teardown() // only called if we panic - result := m.Run() - teardown() - os.Exit(result) -} - -// Create a bucket for testing -func setup() { - svc = s3.New(nil) - bucketName = aws.String( - fmt.Sprintf("aws-sdk-go-integration-%d", time.Now().Unix())) - - for i := 0; i < 10; i++ { - _, err := svc.CreateBucket(&s3.CreateBucketInput{Bucket: bucketName}) - if err == nil { - break - } - time.Sleep(1 * time.Second) - } -} - -// Delete the bucket -func teardown() { - resp, _ := svc.ListObjects(&s3.ListObjectsInput{Bucket: bucketName}) - for _, o := range resp.Contents { - svc.DeleteObject(&s3.DeleteObjectInput{Bucket: bucketName, Key: o.Key}) - } - svc.DeleteBucket(&s3.DeleteBucketInput{Bucket: bucketName}) -} - -func TestWriteToObject(t *testing.T) { - _, err := svc.PutObject(&s3.PutObjectInput{ - Bucket: bucketName, - Key: aws.String("key name"), - Body: bytes.NewReader([]byte("hello world")), - }) - assert.NoError(t, err) - - resp, err := svc.GetObject(&s3.GetObjectInput{ - Bucket: bucketName, - Key: aws.String("key name"), - }) - assert.NoError(t, err) - - b, _ := ioutil.ReadAll(resp.Body) - assert.Equal(t, []byte("hello world"), b) -} - -func TestPresignedGetPut(t *testing.T) { - putreq, _ := svc.PutObjectRequest(&s3.PutObjectInput{ - Bucket: bucketName, - Key: aws.String("presigned-key"), - }) - - // Presign a PUT request - puturl, err := putreq.Presign(300 * time.Second) - assert.NoError(t, err) - - // PUT to the presigned URL with a body - buf := bytes.NewReader([]byte("hello world")) - puthttpreq, err := http.NewRequest("PUT", puturl, buf) - assert.NoError(t, err) - - putresp, err := http.DefaultClient.Do(puthttpreq) - assert.NoError(t, err) - assert.Equal(t, 200, putresp.StatusCode) - - // Presign a GET on the same URL - getreq, _ := svc.GetObjectRequest(&s3.GetObjectInput{ - Bucket: bucketName, - Key: aws.String("presigned-key"), - }) - - geturl, err := getreq.Presign(300 * time.Second) - assert.NoError(t, err) - - // Get the body - getresp, err := http.Get(geturl) - assert.NoError(t, err) - - defer getresp.Body.Close() - b, err := ioutil.ReadAll(getresp.Body) - assert.Equal(t, "hello world", string(b)) -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/s3iface/interface.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/s3iface/interface.go deleted file mode 100644 index 0f400f18..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/s3iface/interface.go +++ /dev/null @@ -1,111 +0,0 @@ -package s3iface - -import ( - "github.com/awslabs/aws-sdk-go/service/s3" -) - -type S3API interface { - AbortMultipartUpload(*s3.AbortMultipartUploadInput) (*s3.AbortMultipartUploadOutput, error) - - CompleteMultipartUpload(*s3.CompleteMultipartUploadInput) (*s3.CompleteMultipartUploadOutput, error) - - CopyObject(*s3.CopyObjectInput) (*s3.CopyObjectOutput, error) - - CreateBucket(*s3.CreateBucketInput) (*s3.CreateBucketOutput, error) - - CreateMultipartUpload(*s3.CreateMultipartUploadInput) (*s3.CreateMultipartUploadOutput, error) - - DeleteBucket(*s3.DeleteBucketInput) (*s3.DeleteBucketOutput, error) - - DeleteBucketCORS(*s3.DeleteBucketCORSInput) (*s3.DeleteBucketCORSOutput, error) - - DeleteBucketLifecycle(*s3.DeleteBucketLifecycleInput) (*s3.DeleteBucketLifecycleOutput, error) - - DeleteBucketPolicy(*s3.DeleteBucketPolicyInput) (*s3.DeleteBucketPolicyOutput, error) - - DeleteBucketReplication(*s3.DeleteBucketReplicationInput) (*s3.DeleteBucketReplicationOutput, error) - - DeleteBucketTagging(*s3.DeleteBucketTaggingInput) (*s3.DeleteBucketTaggingOutput, error) - - DeleteBucketWebsite(*s3.DeleteBucketWebsiteInput) (*s3.DeleteBucketWebsiteOutput, error) - - DeleteObject(*s3.DeleteObjectInput) (*s3.DeleteObjectOutput, error) - - DeleteObjects(*s3.DeleteObjectsInput) (*s3.DeleteObjectsOutput, error) - - GetBucketACL(*s3.GetBucketACLInput) (*s3.GetBucketACLOutput, error) - - GetBucketCORS(*s3.GetBucketCORSInput) (*s3.GetBucketCORSOutput, error) - - GetBucketLifecycle(*s3.GetBucketLifecycleInput) (*s3.GetBucketLifecycleOutput, error) - - GetBucketLocation(*s3.GetBucketLocationInput) (*s3.GetBucketLocationOutput, error) - - GetBucketLogging(*s3.GetBucketLoggingInput) (*s3.GetBucketLoggingOutput, error) - - GetBucketNotification(*s3.GetBucketNotificationInput) (*s3.GetBucketNotificationOutput, error) - - GetBucketPolicy(*s3.GetBucketPolicyInput) (*s3.GetBucketPolicyOutput, error) - - GetBucketReplication(*s3.GetBucketReplicationInput) (*s3.GetBucketReplicationOutput, error) - - GetBucketRequestPayment(*s3.GetBucketRequestPaymentInput) (*s3.GetBucketRequestPaymentOutput, error) - - GetBucketTagging(*s3.GetBucketTaggingInput) (*s3.GetBucketTaggingOutput, error) - - GetBucketVersioning(*s3.GetBucketVersioningInput) (*s3.GetBucketVersioningOutput, error) - - GetBucketWebsite(*s3.GetBucketWebsiteInput) (*s3.GetBucketWebsiteOutput, error) - - GetObject(*s3.GetObjectInput) (*s3.GetObjectOutput, error) - - GetObjectACL(*s3.GetObjectACLInput) (*s3.GetObjectACLOutput, error) - - GetObjectTorrent(*s3.GetObjectTorrentInput) (*s3.GetObjectTorrentOutput, error) - - HeadBucket(*s3.HeadBucketInput) (*s3.HeadBucketOutput, error) - - HeadObject(*s3.HeadObjectInput) (*s3.HeadObjectOutput, error) - - ListBuckets(*s3.ListBucketsInput) (*s3.ListBucketsOutput, error) - - ListMultipartUploads(*s3.ListMultipartUploadsInput) (*s3.ListMultipartUploadsOutput, error) - - ListObjectVersions(*s3.ListObjectVersionsInput) (*s3.ListObjectVersionsOutput, error) - - ListObjects(*s3.ListObjectsInput) (*s3.ListObjectsOutput, error) - - ListParts(*s3.ListPartsInput) (*s3.ListPartsOutput, error) - - PutBucketACL(*s3.PutBucketACLInput) (*s3.PutBucketACLOutput, error) - - PutBucketCORS(*s3.PutBucketCORSInput) (*s3.PutBucketCORSOutput, error) - - PutBucketLifecycle(*s3.PutBucketLifecycleInput) (*s3.PutBucketLifecycleOutput, error) - - PutBucketLogging(*s3.PutBucketLoggingInput) (*s3.PutBucketLoggingOutput, error) - - PutBucketNotification(*s3.PutBucketNotificationInput) (*s3.PutBucketNotificationOutput, error) - - PutBucketPolicy(*s3.PutBucketPolicyInput) (*s3.PutBucketPolicyOutput, error) - - PutBucketReplication(*s3.PutBucketReplicationInput) (*s3.PutBucketReplicationOutput, error) - - PutBucketRequestPayment(*s3.PutBucketRequestPaymentInput) (*s3.PutBucketRequestPaymentOutput, error) - - PutBucketTagging(*s3.PutBucketTaggingInput) (*s3.PutBucketTaggingOutput, error) - - PutBucketVersioning(*s3.PutBucketVersioningInput) (*s3.PutBucketVersioningOutput, error) - - PutBucketWebsite(*s3.PutBucketWebsiteInput) (*s3.PutBucketWebsiteOutput, error) - - PutObject(*s3.PutObjectInput) (*s3.PutObjectOutput, error) - - PutObjectACL(*s3.PutObjectACLInput) (*s3.PutObjectACLOutput, error) - - RestoreObject(*s3.RestoreObjectInput) (*s3.RestoreObjectOutput, error) - - UploadPart(*s3.UploadPartInput) (*s3.UploadPartOutput, error) - - UploadPartCopy(*s3.UploadPartCopyInput) (*s3.UploadPartCopyOutput, error) -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/service.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/service.go deleted file mode 100644 index cc85d4a5..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/service.go +++ /dev/null @@ -1,59 +0,0 @@ -package s3 - -import ( - "github.com/awslabs/aws-sdk-go/aws" - "github.com/awslabs/aws-sdk-go/internal/protocol/restxml" - "github.com/awslabs/aws-sdk-go/internal/signer/v4" -) - -// S3 is a client for Amazon S3. -type S3 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 S3 client. -func New(config *aws.Config) *S3 { - if config == nil { - config = &aws.Config{} - } - - service := &aws.Service{ - Config: aws.DefaultConfig.Merge(config), - ServiceName: "s3", - APIVersion: "2006-03-01", - } - service.Initialize() - - // Handlers - service.Handlers.Sign.PushBack(v4.Sign) - service.Handlers.Build.PushBack(restxml.Build) - service.Handlers.Unmarshal.PushBack(restxml.Unmarshal) - service.Handlers.UnmarshalMeta.PushBack(restxml.UnmarshalMeta) - service.Handlers.UnmarshalError.PushBack(restxml.UnmarshalError) - - // Run custom service initialization if present - if initService != nil { - initService(service) - } - - return &S3{service} -} - -// newRequest creates a new request for a S3 operation and runs any -// custom request initialization. -func (c *S3) 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 -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/sse.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/sse.go deleted file mode 100644 index 8977e3b8..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/sse.go +++ /dev/null @@ -1,46 +0,0 @@ -package s3 - -import ( - "crypto/md5" - "encoding/base64" - - "github.com/awslabs/aws-sdk-go/aws" - "github.com/awslabs/aws-sdk-go/aws/awsutil" -) - -var errSSERequiresSSL = aws.APIError{ - Code: "ConfigError", - Message: "cannot send SSE keys over HTTP.", -} - -func validateSSERequiresSSL(r *aws.Request) { - if r.HTTPRequest.URL.Scheme != "https" { - p := awsutil.ValuesAtPath(r.Params, "SSECustomerKey||CopySourceSSECustomerKey") - if len(p) > 0 { - r.Error = errSSERequiresSSL - } - } -} - -func computeSSEKeys(r *aws.Request) { - headers := []string{ - "x-amz-server-side-encryption-customer-key", - "x-amz-copy-source-server-side-encryption-customer-key", - } - - for _, h := range headers { - md5h := h + "-md5" - if key := r.HTTPRequest.Header.Get(h); key != "" { - // Base64-encode the value - b64v := base64.StdEncoding.EncodeToString([]byte(key)) - r.HTTPRequest.Header.Set(h, b64v) - - // Add MD5 if it wasn't computed - if r.HTTPRequest.Header.Get(md5h) == "" { - sum := md5.Sum([]byte(key)) - b64sum := base64.StdEncoding.EncodeToString(sum[:]) - r.HTTPRequest.Header.Set(md5h, b64sum) - } - } - } -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/sse_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/sse_test.go deleted file mode 100644 index f0e7b2b1..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/sse_test.go +++ /dev/null @@ -1,79 +0,0 @@ -package s3_test - -import ( - "testing" - - "github.com/awslabs/aws-sdk-go/aws" - "github.com/awslabs/aws-sdk-go/service/s3" - "github.com/stretchr/testify/assert" -) - -func TestSSECustomerKeyOverHTTPError(t *testing.T) { - s := s3.New(baseConfig.Merge(&aws.Config{DisableSSL: true})) - req, _ := s.CopyObjectRequest(&s3.CopyObjectInput{ - Bucket: aws.String("bucket"), - CopySource: aws.String("bucket/source"), - Key: aws.String("dest"), - SSECustomerKey: aws.String("key"), - }) - err := req.Build() - - assert.Error(t, err) - aerr := aws.Error(err) - assert.Equal(t, "ConfigError", aerr.Code) - assert.Contains(t, aerr.Message, "cannot send SSE keys over HTTP") -} - -func TestCopySourceSSECustomerKeyOverHTTPError(t *testing.T) { - s := s3.New(baseConfig.Merge(&aws.Config{DisableSSL: true})) - req, _ := s.CopyObjectRequest(&s3.CopyObjectInput{ - Bucket: aws.String("bucket"), - CopySource: aws.String("bucket/source"), - Key: aws.String("dest"), - CopySourceSSECustomerKey: aws.String("key"), - }) - err := req.Build() - - assert.Error(t, err) - aerr := aws.Error(err) - assert.Equal(t, "ConfigError", aerr.Code) - assert.Contains(t, aerr.Message, "cannot send SSE keys over HTTP") -} - -func TestComputeSSEKeys(t *testing.T) { - s := s3.New(baseConfig) - req, _ := s.CopyObjectRequest(&s3.CopyObjectInput{ - Bucket: aws.String("bucket"), - CopySource: aws.String("bucket/source"), - Key: aws.String("dest"), - SSECustomerKey: aws.String("key"), - CopySourceSSECustomerKey: aws.String("key"), - }) - err := req.Build() - - assert.NoError(t, err) - assert.Equal(t, "a2V5", req.HTTPRequest.Header.Get("x-amz-server-side-encryption-customer-key")) - assert.Equal(t, "a2V5", req.HTTPRequest.Header.Get("x-amz-copy-source-server-side-encryption-customer-key")) - assert.Equal(t, "PG4LipwVIkqCKLmpjKFTHQ==", req.HTTPRequest.Header.Get("x-amz-server-side-encryption-customer-key-md5")) - assert.Equal(t, "PG4LipwVIkqCKLmpjKFTHQ==", req.HTTPRequest.Header.Get("x-amz-copy-source-server-side-encryption-customer-key-md5")) -} - -func TestComputeSSEKeysShortcircuit(t *testing.T) { - s := s3.New(baseConfig) - req, _ := s.CopyObjectRequest(&s3.CopyObjectInput{ - Bucket: aws.String("bucket"), - CopySource: aws.String("bucket/source"), - Key: aws.String("dest"), - SSECustomerKey: aws.String("key"), - CopySourceSSECustomerKey: aws.String("key"), - SSECustomerKeyMD5: aws.String("MD5"), - CopySourceSSECustomerKeyMD5: aws.String("MD5"), - }) - err := req.Build() - - assert.NoError(t, err) - assert.Equal(t, "a2V5", req.HTTPRequest.Header.Get("x-amz-server-side-encryption-customer-key")) - assert.Equal(t, "a2V5", req.HTTPRequest.Header.Get("x-amz-copy-source-server-side-encryption-customer-key")) - assert.Equal(t, "MD5", req.HTTPRequest.Header.Get("x-amz-server-side-encryption-customer-key-md5")) - assert.Equal(t, "MD5", req.HTTPRequest.Header.Get("x-amz-copy-source-server-side-encryption-customer-key-md5")) -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/unmarshal_error.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/unmarshal_error.go deleted file mode 100644 index 9f3f1c72..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/unmarshal_error.go +++ /dev/null @@ -1,41 +0,0 @@ -package s3 - -import ( - "encoding/xml" - "io" - "strings" - - "github.com/awslabs/aws-sdk-go/aws" -) - -type xmlErrorResponse struct { - XMLName xml.Name `xml:"Error"` - Code string `xml:"Code"` - Message string `xml:"Message"` -} - -func unmarshalError(r *aws.Request) { - defer r.HTTPResponse.Body.Close() - - if r.HTTPResponse.ContentLength == int64(0) { - // No body, use status code to generate an APIError - r.Error = aws.APIError{ - StatusCode: r.HTTPResponse.StatusCode, - Code: strings.Replace(r.HTTPResponse.Status, " ", "", -1), - Message: r.HTTPResponse.Status, - } - return - } - - resp := &xmlErrorResponse{} - err := xml.NewDecoder(r.HTTPResponse.Body).Decode(resp) - if err != nil && err != io.EOF { - r.Error = err - } else { - r.Error = aws.APIError{ - StatusCode: r.HTTPResponse.StatusCode, - Code: resp.Code, - Message: resp.Message, - } - } -} diff --git a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/unmarshal_error_test.go b/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/unmarshal_error_test.go deleted file mode 100644 index 2e60a3c1..00000000 --- a/Godeps/_workspace/src/github.com/awslabs/aws-sdk-go/service/s3/unmarshal_error_test.go +++ /dev/null @@ -1,49 +0,0 @@ -package s3_test - -import ( - "bytes" - "io/ioutil" - "net/http" - "testing" - - "github.com/awslabs/aws-sdk-go/aws" - "github.com/awslabs/aws-sdk-go/service/s3" - "github.com/stretchr/testify/assert" -) - -var s3StatusCodeErrorTests = []struct { - scode int - status string - body string - code string - message string -}{ - {403, "Forbidden", "", "Forbidden", "Forbidden"}, - {400, "Bad Request", "", "BadRequest", "Bad Request"}, - {404, "Not Found", "", "NotFound", "Not Found"}, - {500, "Internal Error", "", "InternalError", "Internal Error"}, -} - -func TestStatusCodeError(t *testing.T) { - for _, test := range s3StatusCodeErrorTests { - s := s3.New(baseConfig) - s.Handlers.Send.Clear() - s.Handlers.Send.PushBack(func(r *aws.Request) { - body := ioutil.NopCloser(bytes.NewReader([]byte(test.body))) - r.HTTPResponse = &http.Response{ - ContentLength: int64(len(test.body)), - StatusCode: test.scode, - Status: test.status, - Body: body, - } - }) - _, err := s.PutBucketACL(&s3.PutBucketACLInput{ - Bucket: aws.String("bucket"), ACL: aws.String("public-read"), - }) - - assert.Error(t, err) - aerr := aws.Error(err) - assert.Equal(t, test.code, aerr.Code) - assert.Equal(t, test.message, aerr.Message) - } -} diff --git a/Godeps/_workspace/src/github.com/vaughan0/go-ini/LICENSE b/Godeps/_workspace/src/github.com/vaughan0/go-ini/LICENSE deleted file mode 100644 index 968b4538..00000000 --- a/Godeps/_workspace/src/github.com/vaughan0/go-ini/LICENSE +++ /dev/null @@ -1,14 +0,0 @@ -Copyright (c) 2013 Vaughan Newton - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the -Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Godeps/_workspace/src/github.com/vaughan0/go-ini/README.md b/Godeps/_workspace/src/github.com/vaughan0/go-ini/README.md deleted file mode 100644 index d5cd4e74..00000000 --- a/Godeps/_workspace/src/github.com/vaughan0/go-ini/README.md +++ /dev/null @@ -1,70 +0,0 @@ -go-ini -====== - -INI parsing library for Go (golang). - -View the API documentation [here](http://godoc.org/github.com/vaughan0/go-ini). - -Usage ------ - -Parse an INI file: - -```go -import "github.com/vaughan0/go-ini" - -file, err := ini.LoadFile("myfile.ini") -``` - -Get data from the parsed file: - -```go -name, ok := file.Get("person", "name") -if !ok { - panic("'name' variable missing from 'person' section") -} -``` - -Iterate through values in a section: - -```go -for key, value := range file["mysection"] { - fmt.Printf("%s => %s\n", key, value) -} -``` - -Iterate through sections in a file: - -```go -for name, section := range file { - fmt.Printf("Section name: %s\n", name) -} -``` - -File Format ------------ - -INI files are parsed by go-ini line-by-line. Each line may be one of the following: - - * A section definition: [section-name] - * A property: key = value - * A comment: #blahblah _or_ ;blahblah - * Blank. The line will be ignored. - -Properties defined before any section headers are placed in the default section, which has -the empty string as it's key. - -Example: - -```ini -# I am a comment -; So am I! - -[apples] -colour = red or green -shape = applish - -[oranges] -shape = square -colour = blue -``` diff --git a/Godeps/_workspace/src/github.com/vaughan0/go-ini/ini.go b/Godeps/_workspace/src/github.com/vaughan0/go-ini/ini.go deleted file mode 100644 index 81aeb32f..00000000 --- a/Godeps/_workspace/src/github.com/vaughan0/go-ini/ini.go +++ /dev/null @@ -1,123 +0,0 @@ -// Package ini provides functions for parsing INI configuration files. -package ini - -import ( - "bufio" - "fmt" - "io" - "os" - "regexp" - "strings" -) - -var ( - sectionRegex = regexp.MustCompile(`^\[(.*)\]$`) - assignRegex = regexp.MustCompile(`^([^=]+)=(.*)$`) -) - -// ErrSyntax is returned when there is a syntax error in an INI file. -type ErrSyntax struct { - Line int - Source string // The contents of the erroneous line, without leading or trailing whitespace -} - -func (e ErrSyntax) Error() string { - return fmt.Sprintf("invalid INI syntax on line %d: %s", e.Line, e.Source) -} - -// A File represents a parsed INI file. -type File map[string]Section - -// A Section represents a single section of an INI file. -type Section map[string]string - -// Returns a named Section. A Section will be created if one does not already exist for the given name. -func (f File) Section(name string) Section { - section := f[name] - if section == nil { - section = make(Section) - f[name] = section - } - return section -} - -// Looks up a value for a key in a section and returns that value, along with a boolean result similar to a map lookup. -func (f File) Get(section, key string) (value string, ok bool) { - if s := f[section]; s != nil { - value, ok = s[key] - } - return -} - -// Loads INI data from a reader and stores the data in the File. -func (f File) Load(in io.Reader) (err error) { - bufin, ok := in.(*bufio.Reader) - if !ok { - bufin = bufio.NewReader(in) - } - return parseFile(bufin, f) -} - -// Loads INI data from a named file and stores the data in the File. -func (f File) LoadFile(file string) (err error) { - in, err := os.Open(file) - if err != nil { - return - } - defer in.Close() - return f.Load(in) -} - -func parseFile(in *bufio.Reader, file File) (err error) { - section := "" - lineNum := 0 - for done := false; !done; { - var line string - if line, err = in.ReadString('\n'); err != nil { - if err == io.EOF { - done = true - } else { - return - } - } - lineNum++ - line = strings.TrimSpace(line) - if len(line) == 0 { - // Skip blank lines - continue - } - if line[0] == ';' || line[0] == '#' { - // Skip comments - continue - } - - if groups := assignRegex.FindStringSubmatch(line); groups != nil { - key, val := groups[1], groups[2] - key, val = strings.TrimSpace(key), strings.TrimSpace(val) - file.Section(section)[key] = val - } else if groups := sectionRegex.FindStringSubmatch(line); groups != nil { - name := strings.TrimSpace(groups[1]) - section = name - // Create the section if it does not exist - file.Section(section) - } else { - return ErrSyntax{lineNum, line} - } - - } - return nil -} - -// Loads and returns a File from a reader. -func Load(in io.Reader) (File, error) { - file := make(File) - err := file.Load(in) - return file, err -} - -// Loads and returns an INI File from a file on disk. -func LoadFile(filename string) (File, error) { - file := make(File) - err := file.LoadFile(filename) - return file, err -} diff --git a/Godeps/_workspace/src/github.com/vaughan0/go-ini/ini_linux_test.go b/Godeps/_workspace/src/github.com/vaughan0/go-ini/ini_linux_test.go deleted file mode 100644 index 38a6f000..00000000 --- a/Godeps/_workspace/src/github.com/vaughan0/go-ini/ini_linux_test.go +++ /dev/null @@ -1,43 +0,0 @@ -package ini - -import ( - "reflect" - "syscall" - "testing" -) - -func TestLoadFile(t *testing.T) { - originalOpenFiles := numFilesOpen(t) - - file, err := LoadFile("test.ini") - if err != nil { - t.Fatal(err) - } - - if originalOpenFiles != numFilesOpen(t) { - t.Error("test.ini not closed") - } - - if !reflect.DeepEqual(file, File{"default": {"stuff": "things"}}) { - t.Error("file not read correctly") - } -} - -func numFilesOpen(t *testing.T) (num uint64) { - var rlimit syscall.Rlimit - err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rlimit) - if err != nil { - t.Fatal(err) - } - maxFds := int(rlimit.Cur) - - var stat syscall.Stat_t - for i := 0; i < maxFds; i++ { - if syscall.Fstat(i, &stat) == nil { - num++ - } else { - return - } - } - return -} diff --git a/Godeps/_workspace/src/github.com/vaughan0/go-ini/ini_test.go b/Godeps/_workspace/src/github.com/vaughan0/go-ini/ini_test.go deleted file mode 100644 index 06a4d05e..00000000 --- a/Godeps/_workspace/src/github.com/vaughan0/go-ini/ini_test.go +++ /dev/null @@ -1,89 +0,0 @@ -package ini - -import ( - "reflect" - "strings" - "testing" -) - -func TestLoad(t *testing.T) { - src := ` - # Comments are ignored - - herp = derp - - [foo] - hello=world - whitespace should = not matter - ; sneaky semicolon-style comment - multiple = equals = signs - - [bar] - this = that` - - file, err := Load(strings.NewReader(src)) - if err != nil { - t.Fatal(err) - } - check := func(section, key, expect string) { - if value, _ := file.Get(section, key); value != expect { - t.Errorf("Get(%q, %q): expected %q, got %q", section, key, expect, value) - } - } - - check("", "herp", "derp") - check("foo", "hello", "world") - check("foo", "whitespace should", "not matter") - check("foo", "multiple", "equals = signs") - check("bar", "this", "that") -} - -func TestSyntaxError(t *testing.T) { - src := ` - # Line 2 - [foo] - bar = baz - # Here's an error on line 6: - wut? - herp = derp` - _, err := Load(strings.NewReader(src)) - t.Logf("%T: %v", err, err) - if err == nil { - t.Fatal("expected an error, got nil") - } - syntaxErr, ok := err.(ErrSyntax) - if !ok { - t.Fatal("expected an error of type ErrSyntax") - } - if syntaxErr.Line != 6 { - t.Fatal("incorrect line number") - } - if syntaxErr.Source != "wut?" { - t.Fatal("incorrect source") - } -} - -func TestDefinedSectionBehaviour(t *testing.T) { - check := func(src string, expect File) { - file, err := Load(strings.NewReader(src)) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(file, expect) { - t.Errorf("expected %v, got %v", expect, file) - } - } - // No sections for an empty file - check("", File{}) - // Default section only if there are actually values for it - check("foo=bar", File{"": {"foo": "bar"}}) - // User-defined sections should always be present, even if empty - check("[a]\n[b]\nfoo=bar", File{ - "a": {}, - "b": {"foo": "bar"}, - }) - check("foo=bar\n[a]\nthis=that", File{ - "": {"foo": "bar"}, - "a": {"this": "that"}, - }) -} diff --git a/Godeps/_workspace/src/github.com/vaughan0/go-ini/test.ini b/Godeps/_workspace/src/github.com/vaughan0/go-ini/test.ini deleted file mode 100644 index d13c999e..00000000 --- a/Godeps/_workspace/src/github.com/vaughan0/go-ini/test.ini +++ /dev/null @@ -1,2 +0,0 @@ -[default] -stuff = things diff --git a/pkg/client/client.go b/pkg/client/client.go index 07b35aa4..0da6d0ab 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -26,7 +26,7 @@ import ( // Client - client interface type Client interface { - MultipartUpload + // MultipartUpload - TODO // Common operations Stat() (content *Content, err error) @@ -44,13 +44,13 @@ type Client interface { } // MultipartUpload - multi part upload interface -type MultipartUpload interface { - InitiateMultiPartUpload() (objectID string, err error) - UploadPart(uploadID string, body io.ReadSeeker, contentLength, partNumber int64) (md5hex string, err error) - CompleteMultiPartUpload(uploadID string) (location, md5hex string, err error) - AbortMultiPartUpload(uploadID string) error - ListParts(uploadID string) (contents *PartContents, err error) -} +//type MultipartUpload interface { +// InitiateMultiPartUpload() (objectID string, err error) +// UploadPart(uploadID string, body io.ReadSeeker, contentLength, partNumber int64) (md5hex string, err error) +// CompleteMultiPartUpload(uploadID string) (location, md5hex string, err error) +// AbortMultiPartUpload(uploadID string) error +// ListParts(uploadID string) (contents *PartContents, err error) +//} // Part - part xml response type Part struct { diff --git a/pkg/client/fs/fs_multipart_put.go b/pkg/client/fs/fs_multipart_put.go deleted file mode 100644 index c72bd765..00000000 --- a/pkg/client/fs/fs_multipart_put.go +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Minio Client (C) 2015 Minio, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this fs except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package fs - -import ( - "io" - - "github.com/minio-io/mc/pkg/client" - "github.com/minio-io/minio/pkg/iodine" -) - -// Multipart object upload handlers - -// InitiateMultiPartUpload - -func (c *fsClient) InitiateMultiPartUpload() (objectID string, err error) { - return "", iodine.New(client.APINotImplemented{API: "InitiateMultiPartUpload"}, nil) -} - -// UploadPart - -func (c *fsClient) UploadPart(uploadID string, body io.ReadSeeker, contentLength, partNumber int64) (md5hex string, err error) { - return "", iodine.New(client.APINotImplemented{API: "UploadPart"}, nil) -} - -// CompleteMultiPartUpload - -func (c *fsClient) CompleteMultiPartUpload(uploadID string) (location, md5hex string, err error) { - return "", "", iodine.New(client.APINotImplemented{API: "CompleteMultiPartUpload"}, nil) -} - -// AbortMultiPartUpload - -func (c *fsClient) AbortMultiPartUpload(uploadID string) error { - return iodine.New(client.APINotImplemented{API: "AbortMultiPartUpload"}, nil) -} - -// ListParts - -func (c *fsClient) ListParts(uploadID string) (contents *client.PartContents, err error) { - return nil, iodine.New(client.APINotImplemented{API: "ListParts"}, nil) -} diff --git a/pkg/client/s3/bucket.go b/pkg/client/s3/bucket.go index 78fcf104..6c3c45df 100644 --- a/pkg/client/s3/bucket.go +++ b/pkg/client/s3/bucket.go @@ -70,7 +70,7 @@ func (c *s3Client) PutBucket() error { } if res != nil { if res.StatusCode != http.StatusOK { - return iodine.New(NewError(res), nil) + return iodine.New(ResponseToError(res), nil) } } defer res.Body.Close() @@ -114,7 +114,7 @@ func (c *s3Client) PutBucketACL(acl string) error { } if res != nil { if res.StatusCode != http.StatusOK { - return iodine.New(NewError(res), nil) + return iodine.New(ResponseToError(res), nil) } } defer res.Body.Close() diff --git a/pkg/client/s3/bucket_object_metadata.go b/pkg/client/s3/bucket_object_metadata.go index 65c8be8a..4653437e 100644 --- a/pkg/client/s3/bucket_object_metadata.go +++ b/pkg/client/s3/bucket_object_metadata.go @@ -63,7 +63,7 @@ func (c *s3Client) getBucketMetadata(bucket string) (content *client.Content, er case http.StatusMovedPermanently: return content, nil default: - return nil, iodine.New(NewError(res), nil) + return nil, iodine.New(ResponseToError(res), nil) } } @@ -109,6 +109,6 @@ func (c *s3Client) getObjectMetadata(bucket, object string) (content *client.Con content.FileType = 0 return content, nil default: - return nil, iodine.New(NewError(res), nil) + return nil, iodine.New(ResponseToError(res), nil) } } diff --git a/pkg/client/s3/bucket_routines.go b/pkg/client/s3/bucket_routines.go index 5a37dd54..e57484c3 100644 --- a/pkg/client/s3/bucket_routines.go +++ b/pkg/client/s3/bucket_routines.go @@ -146,7 +146,7 @@ func (c *s3Client) decodeBucketResults(queryURL string) (*listBucketResults, err } defer res.Body.Close() if res.StatusCode != http.StatusOK { - return nil, iodine.New(NewError(res), nil) + return nil, iodine.New(ResponseToError(res), nil) } var logbuf bytes.Buffer err = xml.NewDecoder(io.TeeReader(res.Body, &logbuf)).Decode(bres) @@ -271,8 +271,7 @@ func (c *s3Client) listBuckets() ([]*client.Content, error) { } if res != nil { if res.StatusCode != http.StatusOK { - err = NewError(res) - return nil, iodine.New(err, nil) + return nil, iodine.New(ResponseToError(res), nil) } } defer res.Body.Close() diff --git a/pkg/client/s3/client_test.go b/pkg/client/s3/client_test.go index 1ca0d4bd..459e1016 100644 --- a/pkg/client/s3/client_test.go +++ b/pkg/client/s3/client_test.go @@ -95,7 +95,7 @@ func (s *MySuite) TestError(c *C) { res := "\nAccessDeniedAccess Denied/mybucket/myphoto.jpgF19772218238A85AGuWkjyviSiGHizehqpmsD1ndz5NClSP19DOT+s2mv7gXGQ8/X1lhbDGiIJEXpGFD" response := new(http.Response) response.Body = ioutil.NopCloser(strings.NewReader(res)) - err := NewError(response) + err := ResponseToError(response) c.Assert(err, Not(IsNil)) c.Assert(err.Error(), Equals, "Access Denied") } diff --git a/pkg/client/s3/common.go b/pkg/client/s3/common.go index 4cb43c86..c2b254ed 100644 --- a/pkg/client/s3/common.go +++ b/pkg/client/s3/common.go @@ -17,12 +17,9 @@ package s3 import ( - "io/ioutil" "net/http" "net/url" - "github.com/awslabs/aws-sdk-go/aws" - "github.com/awslabs/aws-sdk-go/service/s3" "github.com/minio-io/mc/pkg/client" ) @@ -41,15 +38,10 @@ func New(config *Config) client.Client { } else { transport = http.DefaultTransport } - awsConf := aws.DefaultConfig - awsConf.Credentials = aws.Creds(config.AccessKeyID, config.SecretAccessKey, "") - awsConf.HTTPClient = &http.Client{Transport: transport} - awsConf.Logger = ioutil.Discard s3c := &s3Client{ &Meta{ Config: config, Transport: transport, - S3: s3.New(awsConf), }, u, } return s3c diff --git a/pkg/client/s3/definitions.go b/pkg/client/s3/definitions.go index e697b87f..09c552b5 100644 --- a/pkg/client/s3/definitions.go +++ b/pkg/client/s3/definitions.go @@ -1,11 +1,25 @@ +/* + * Minio Client (C) 2015 Minio, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package s3 import ( "net/http" "net/url" "time" - - "github.com/awslabs/aws-sdk-go/service/s3" ) // @@ -35,7 +49,6 @@ type listBucketResults struct { // Meta holds Amazon S3 client credentials and flags. type Meta struct { *Config - *s3.S3 Transport http.RoundTripper // or nil for the default behavior } diff --git a/pkg/client/s3/object_get.go b/pkg/client/s3/object_get.go index ceba0ab1..2d4a17fe 100644 --- a/pkg/client/s3/object_get.go +++ b/pkg/client/s3/object_get.go @@ -71,7 +71,7 @@ func (c *s3Client) Get() (body io.ReadCloser, size int64, md5 string, err error) } if res.StatusCode != http.StatusOK { - return nil, 0, "", iodine.New(NewError(res), nil) + return nil, 0, "", iodine.New(ResponseToError(res), nil) } md5sum := strings.Trim(res.Header.Get("ETag"), "\"") // trim off the erroneous double quotes return res.Body, res.ContentLength, md5sum, nil @@ -99,6 +99,6 @@ func (c *s3Client) GetPartial(offset, length int64) (body io.ReadCloser, size in case http.StatusOK, http.StatusPartialContent: return res.Body, res.ContentLength, res.Header.Get("ETag"), nil default: - return nil, 0, "", iodine.New(NewError(res), nil) + return nil, 0, "", iodine.New(ResponseToError(res), nil) } } diff --git a/pkg/client/s3/object_multipart_put.go b/pkg/client/s3/object_multipart_put.go deleted file mode 100644 index 380eb54a..00000000 --- a/pkg/client/s3/object_multipart_put.go +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Minio Client (C) 2015 Minio, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this fs except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package s3 - -import ( - "io" - - "github.com/awslabs/aws-sdk-go/service/s3" - "github.com/minio-io/mc/pkg/client" - "github.com/minio-io/minio/pkg/iodine" -) - -// Multipart object upload handlers - -// InitiateMultiPartUpload - start multipart upload session -func (c *s3Client) InitiateMultiPartUpload() (uploadID string, err error) { - bucket, object := c.url2BucketAndObject() - - multiparthUploadInput := new(s3.CreateMultipartUploadInput) - multiparthUploadInput.Bucket = &bucket - multiparthUploadInput.Key = &object - multiparthUploadOutput, err := c.S3.CreateMultipartUpload(multiparthUploadInput) - if err != nil { - return "", iodine.New(err, nil) - } - return *multiparthUploadOutput.UploadID, nil -} - -// UploadPart - start uploading individual parts -func (c *s3Client) UploadPart(uploadID string, body io.ReadSeeker, contentLength, partNumber int64) (md5hex string, err error) { - bucket, object := c.url2BucketAndObject() - - uploadPartInput := new(s3.UploadPartInput) - uploadPartInput.Bucket = &bucket - uploadPartInput.Key = &object - uploadPartInput.Body = body - uploadPartInput.PartNumber = &partNumber - uploadPartInput.UploadID = &uploadID - uploadPartOutput, err := c.S3.UploadPart(uploadPartInput) - if err != nil { - return "", iodine.New(err, nil) - } - return *uploadPartOutput.ETag, nil -} - -// CompleteMultiPartUpload -func (c *s3Client) CompleteMultiPartUpload(uploadID string) (location, md5hex string, err error) { - bucket, object := c.url2BucketAndObject() - - completeMultiPartUploadInput := new(s3.CompleteMultipartUploadInput) - completeMultiPartUploadInput.Bucket = &bucket - completeMultiPartUploadInput.Key = &object - completeMultiPartUploadInput.UploadID = &uploadID - - completeMultiPartUploadOutput, err := c.S3.CompleteMultipartUpload(completeMultiPartUploadInput) - if err != nil { - return "", "", iodine.New(err, nil) - } - return *completeMultiPartUploadOutput.Location, *completeMultiPartUploadOutput.ETag, nil -} - -// AbortMultiPartUpload -func (c *s3Client) AbortMultiPartUpload(uploadID string) error { - bucket, object := c.url2BucketAndObject() - abortMultiPartUploadInput := new(s3.AbortMultipartUploadInput) - abortMultiPartUploadInput.Bucket = &bucket - abortMultiPartUploadInput.Key = &object - abortMultiPartUploadInput.UploadID = &uploadID - if _, err := c.S3.AbortMultipartUpload(abortMultiPartUploadInput); err != nil { - return iodine.New(err, nil) - } - return nil -} - -// ListParts -func (c *s3Client) ListParts(uploadID string) (contents *client.PartContents, err error) { - bucket, object := c.url2BucketAndObject() - listPartsInput := new(s3.ListPartsInput) - listPartsInput.Bucket = &bucket - listPartsInput.Key = &object - listPartsInput.UploadID = &uploadID - - listPartsOutput, err := c.S3.ListParts(listPartsInput) - if err != nil { - return nil, iodine.New(err, nil) - } - contents = new(client.PartContents) - contents.Key = *listPartsOutput.Key - contents.IsTruncated = *listPartsOutput.IsTruncated - contents.UploadID = *listPartsOutput.UploadID - for _, part := range listPartsOutput.Parts { - newPart := new(client.Part) - newPart.ETag = *part.ETag - newPart.LastModified = *part.LastModified - newPart.PartNumber = *part.PartNumber - newPart.Size = *part.Size - contents.Parts = append(contents.Parts, newPart) - } - return contents, nil - -} diff --git a/pkg/client/s3/object_put.go b/pkg/client/s3/object_put.go index c49023d6..61ee55c3 100644 --- a/pkg/client/s3/object_put.go +++ b/pkg/client/s3/object_put.go @@ -82,7 +82,7 @@ func (c *s3Client) Put(md5HexString string, size int64) (io.WriteCloser, error) return } if res.StatusCode != http.StatusOK { - err := iodine.New(NewError(res), nil) + err := iodine.New(ResponseToError(res), nil) r.CloseWithError(err) blockingWriter.Release(err) return