Fix AWS, again, and update Godeps.

This commit is contained in:
Jeff Mitchell 2015-08-18 18:12:51 -07:00
parent a66ffa9949
commit 3cc4bd0b96
191 changed files with 9002 additions and 11508 deletions

103
Godeps/Godeps.json generated
View File

@ -15,63 +15,68 @@
},
{
"ImportPath": "github.com/aws/aws-sdk-go/aws",
"Comment": "v0.7.2-4-g5df83ba",
"Rev": "5df83ba895b6ba073c0513dddcec6d7473c95592"
"Comment": "v0.9.0rc1-13-g87dbf7e",
"Rev": "87dbf7e29df163bd17d9cea9a03cb75eb8b76d29"
},
{
"ImportPath": "github.com/aws/aws-sdk-go/internal/endpoints",
"Comment": "v0.7.2-4-g5df83ba",
"Rev": "5df83ba895b6ba073c0513dddcec6d7473c95592"
"Comment": "v0.9.0rc1-13-g87dbf7e",
"Rev": "87dbf7e29df163bd17d9cea9a03cb75eb8b76d29"
},
{
"ImportPath": "github.com/aws/aws-sdk-go/internal/protocol/ec2query",
"Comment": "v0.7.2-4-g5df83ba",
"Rev": "5df83ba895b6ba073c0513dddcec6d7473c95592"
"Comment": "v0.9.0rc1-13-g87dbf7e",
"Rev": "87dbf7e29df163bd17d9cea9a03cb75eb8b76d29"
},
{
"ImportPath": "github.com/aws/aws-sdk-go/internal/protocol/query",
"Comment": "v0.7.2-4-g5df83ba",
"Rev": "5df83ba895b6ba073c0513dddcec6d7473c95592"
"Comment": "v0.9.0rc1-13-g87dbf7e",
"Rev": "87dbf7e29df163bd17d9cea9a03cb75eb8b76d29"
},
{
"ImportPath": "github.com/aws/aws-sdk-go/internal/protocol/rest",
"Comment": "v0.7.2-4-g5df83ba",
"Rev": "5df83ba895b6ba073c0513dddcec6d7473c95592"
"Comment": "v0.9.0rc1-13-g87dbf7e",
"Rev": "87dbf7e29df163bd17d9cea9a03cb75eb8b76d29"
},
{
"ImportPath": "github.com/aws/aws-sdk-go/internal/protocol/restxml",
"Comment": "v0.7.2-4-g5df83ba",
"Rev": "5df83ba895b6ba073c0513dddcec6d7473c95592"
"Comment": "v0.9.0rc1-13-g87dbf7e",
"Rev": "87dbf7e29df163bd17d9cea9a03cb75eb8b76d29"
},
{
"ImportPath": "github.com/aws/aws-sdk-go/internal/protocol/xml/xmlutil",
"Comment": "v0.7.2-4-g5df83ba",
"Rev": "5df83ba895b6ba073c0513dddcec6d7473c95592"
"Comment": "v0.9.0rc1-13-g87dbf7e",
"Rev": "87dbf7e29df163bd17d9cea9a03cb75eb8b76d29"
},
{
"ImportPath": "github.com/aws/aws-sdk-go/internal/signer/v4",
"Comment": "v0.7.2-4-g5df83ba",
"Rev": "5df83ba895b6ba073c0513dddcec6d7473c95592"
"Comment": "v0.9.0rc1-13-g87dbf7e",
"Rev": "87dbf7e29df163bd17d9cea9a03cb75eb8b76d29"
},
{
"ImportPath": "github.com/aws/aws-sdk-go/service/ec2",
"Comment": "v0.7.2-4-g5df83ba",
"Rev": "5df83ba895b6ba073c0513dddcec6d7473c95592"
"Comment": "v0.9.0rc1-13-g87dbf7e",
"Rev": "87dbf7e29df163bd17d9cea9a03cb75eb8b76d29"
},
{
"ImportPath": "github.com/aws/aws-sdk-go/service/iam",
"Comment": "v0.7.2-4-g5df83ba",
"Rev": "5df83ba895b6ba073c0513dddcec6d7473c95592"
"Comment": "v0.9.0rc1-13-g87dbf7e",
"Rev": "87dbf7e29df163bd17d9cea9a03cb75eb8b76d29"
},
{
"ImportPath": "github.com/aws/aws-sdk-go/service/s3",
"Comment": "v0.7.2-4-g5df83ba",
"Rev": "5df83ba895b6ba073c0513dddcec6d7473c95592"
"Comment": "v0.9.0rc1-13-g87dbf7e",
"Rev": "87dbf7e29df163bd17d9cea9a03cb75eb8b76d29"
},
{
"ImportPath": "github.com/coreos/go-etcd/etcd",
"Comment": "v2.0.0-18-gc904d70",
"Rev": "c904d7032a70da6551c43929f199244f6a45f4c1"
"Comment": "v2.0.0-28-g126041e",
"Rev": "126041ef7b24a28359a12f8bf7f6a7db6756113d"
},
{
"ImportPath": "github.com/dgrijalva/jwt-go",
"Comment": "v2.3.0-1-g9fe8afe",
"Rev": "9fe8afe96d32468fba230b8b22acea86251f0506"
},
{
"ImportPath": "github.com/duosecurity/duo_api_golang",
@ -83,18 +88,18 @@
},
{
"ImportPath": "github.com/go-ldap/ldap",
"Comment": "v1-14-g406aa05",
"Rev": "406aa05eb8272fb8aa201e410afa6f9fdcb2bf68"
"Comment": "v1-24-g12f2865",
"Rev": "12f28659a82ac70ca6f3fafd977c0e2fdc144f53"
},
{
"ImportPath": "github.com/go-sql-driver/mysql",
"Comment": "v1.2-112-gfb72997",
"Rev": "fb7299726d2e68745a8805b14f2ff44b5c2cfa84"
"Comment": "v1.2-118-g3dd7008",
"Rev": "3dd7008ac1529aca1bcd8a9db75228a71ba23cac"
},
{
"ImportPath": "github.com/gocql/gocql",
"Comment": "1st_gen_framing-221-gf8fb76b",
"Rev": "f8fb76bb772442ea938e4be46ab1666e542411a5"
"Comment": "1st_gen_framing-225-g9d122d6",
"Rev": "9d122d6ceec00b4b73bfb70de5587cdee7078d17"
},
{
"ImportPath": "github.com/golang/groupcache/lru",
@ -106,7 +111,7 @@
},
{
"ImportPath": "github.com/google/go-github/github",
"Rev": "fccd5bb66f985db0a0d150342ca0a9529a23488a"
"Rev": "7277108aa3e8823e0e028f6c74aea2f4ce4a1b5a"
},
{
"ImportPath": "github.com/google/go-querystring/query",
@ -114,8 +119,8 @@
},
{
"ImportPath": "github.com/hashicorp/consul/api",
"Comment": "v0.5.2-144-g2783f2b",
"Rev": "2783f2bfec1823362602924f5cd3c894743dca08"
"Comment": "v0.5.2-216-g134db62",
"Rev": "134db6293762848681fc9244343bbd19f61d8149"
},
{
"ImportPath": "github.com/hashicorp/errwrap",
@ -131,7 +136,7 @@
},
{
"ImportPath": "github.com/hashicorp/golang-lru",
"Rev": "995efda3e073b6946b175ed93901d729ad47466a"
"Rev": "7f9ef20a0256f494e24126014135cf893ab71e9e"
},
{
"ImportPath": "github.com/hashicorp/hcl",
@ -147,8 +152,8 @@
},
{
"ImportPath": "github.com/lib/pq",
"Comment": "go1.0-cutoff-51-ga8d8d01",
"Rev": "a8d8d01c4f91602f876bf5aa210274e8203a6b45"
"Comment": "go1.0-cutoff-59-gb269bd0",
"Rev": "b269bd035a727d6c1081f76e7a239a1b00674c40"
},
{
"ImportPath": "github.com/mitchellh/cli",
@ -164,7 +169,7 @@
},
{
"ImportPath": "github.com/mitchellh/mapstructure",
"Rev": "2caf8efc93669b6c43e0441cdc6aed17546c96f3"
"Rev": "281073eb9eb092240d33ef253c404f1cca550309"
},
{
"ImportPath": "github.com/mitchellh/reflectwalk",
@ -177,11 +182,11 @@
},
{
"ImportPath": "github.com/samuel/go-zookeeper/zk",
"Rev": "c86eba8e7e95efab81f6c0455332e49d39aed12f"
"Rev": "177002e16a0061912f02377e2dd8951a8b3551bc"
},
{
"ImportPath": "github.com/ugorji/go/codec",
"Rev": "821cda7e48749cacf7cad2c6ed01e96457ca7e9d"
"Rev": "5abd4e96a45c386928ed2ca2a7ef63e2533e18ec"
},
{
"ImportPath": "github.com/vaughan0/go-ini",
@ -189,23 +194,23 @@
},
{
"ImportPath": "golang.org/x/crypto/bcrypt",
"Rev": "cc04154d65fb9296747569b107cfd05380b1ea3e"
"Rev": "81bf7719a6b7ce9b665598222362b50122dfc13b"
},
{
"ImportPath": "golang.org/x/crypto/blowfish",
"Rev": "cc04154d65fb9296747569b107cfd05380b1ea3e"
"Rev": "81bf7719a6b7ce9b665598222362b50122dfc13b"
},
{
"ImportPath": "golang.org/x/crypto/ssh/terminal",
"Rev": "cc04154d65fb9296747569b107cfd05380b1ea3e"
"Rev": "81bf7719a6b7ce9b665598222362b50122dfc13b"
},
{
"ImportPath": "golang.org/x/net/context",
"Rev": "d9558e5c97f85372afee28cf2b6059d7d3818919"
"Rev": "66f0418ca41253f8d1a024eb9754e9441a8e79b9"
},
{
"ImportPath": "golang.org/x/oauth2",
"Rev": "b5adcc2dcdf009d0391547edc6ecbaff889f5bb9"
"Rev": "397fe7649477ff2e8ced8fc0b2696f781e53745a"
},
{
"ImportPath": "gopkg.in/asn1-ber.v1",
@ -213,12 +218,8 @@
"Rev": "9eae18c3681ae3d3c677ac2b80a8fe57de45fc09"
},
{
"ImportPath": "gopkg.in/inf.v0",
"Rev": "c85f1217d51339c0fa3a498cc8b2075de695dae6"
},
{
"ImportPath": "github.com/dgrijalva/jwt-go",
"Rev": "e5cb38552fb8426fe9f0f2b3bc8408f238b97b87"
}
"ImportPath": "gopkg.in/inf.v0",
"Rev": "c85f1217d51339c0fa3a498cc8b2075de695dae6"
}
]
}

View File

@ -2,43 +2,14 @@ package aws
import (
"net/http"
"os"
"time"
"github.com/aws/aws-sdk-go/aws/credentials"
)
// DefaultChainCredentials is a Credentials which will find the first available
// credentials Value from the list of Providers.
//
// This should be used in the default case. Once the type of credentials are
// known switching to the specific Credentials will be more efficient.
var DefaultChainCredentials = credentials.NewChainCredentials(
[]credentials.Provider{
&credentials.EnvProvider{},
&credentials.SharedCredentialsProvider{Filename: "", Profile: ""},
&credentials.EC2RoleProvider{ExpiryWindow: 5 * time.Minute},
})
// The default number of retries for a service. The value of -1 indicates that
// the service specific retry default will be used.
const DefaultRetries = -1
// DefaultConfig is the default all service configuration will be based off of.
// By default, all clients use this structure for initialization options unless
// a custom configuration object is passed in.
//
// You may modify this global structure to change all default configuration
// in the SDK. Note that configuration options are copied by value, so any
// modifications must happen before constructing a client.
var DefaultConfig = NewConfig().
WithCredentials(DefaultChainCredentials).
WithRegion(os.Getenv("AWS_REGION")).
WithHTTPClient(http.DefaultClient).
WithMaxRetries(DefaultRetries).
WithLogger(NewDefaultLogger()).
WithLogLevel(LogOff)
// A Config provides service configuration for service clients. By default,
// all clients will use the {DefaultConfig} structure.
type Config struct {

View File

@ -4,18 +4,11 @@ import (
"net/http"
"reflect"
"testing"
"time"
"github.com/aws/aws-sdk-go/aws/credentials"
)
var testCredentials = credentials.NewChainCredentials([]credentials.Provider{
&credentials.EnvProvider{},
&credentials.SharedCredentialsProvider{
Filename: "TestFilename",
Profile: "TestProfile"},
&credentials.EC2RoleProvider{ExpiryWindow: 5 * time.Minute},
})
var testCredentials = credentials.NewStaticCredentials("AKID", "SECRET", "SESSION")
var copyTestConfig = Config{
Credentials: testCredentials,

View File

@ -1,10 +1,9 @@
package aws_test
package aws
import (
"testing"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/stretchr/testify/assert"
)
@ -18,20 +17,20 @@ func TestStringSlice(t *testing.T) {
if in == nil {
continue
}
out := aws.StringSlice(in)
out := StringSlice(in)
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
for i := range out {
assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
}
out2 := aws.StringValueSlice(out)
out2 := StringValueSlice(out)
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
}
}
var testCasesStringValueSlice = [][]*string{
{aws.String("a"), aws.String("b"), nil, aws.String("c")},
{String("a"), String("b"), nil, String("c")},
}
func TestStringValueSlice(t *testing.T) {
@ -39,7 +38,7 @@ func TestStringValueSlice(t *testing.T) {
if in == nil {
continue
}
out := aws.StringValueSlice(in)
out := StringValueSlice(in)
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
for i := range out {
if in[i] == nil {
@ -49,7 +48,7 @@ func TestStringValueSlice(t *testing.T) {
}
}
out2 := aws.StringSlice(out)
out2 := StringSlice(out)
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
for i := range out2 {
if in[i] == nil {
@ -70,13 +69,13 @@ func TestStringMap(t *testing.T) {
if in == nil {
continue
}
out := aws.StringMap(in)
out := StringMap(in)
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
for i := range out {
assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
}
out2 := aws.StringValueMap(out)
out2 := StringValueMap(out)
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
}
@ -91,13 +90,13 @@ func TestBoolSlice(t *testing.T) {
if in == nil {
continue
}
out := aws.BoolSlice(in)
out := BoolSlice(in)
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
for i := range out {
assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
}
out2 := aws.BoolValueSlice(out)
out2 := BoolValueSlice(out)
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
}
@ -110,7 +109,7 @@ func TestBoolValueSlice(t *testing.T) {
if in == nil {
continue
}
out := aws.BoolValueSlice(in)
out := BoolValueSlice(in)
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
for i := range out {
if in[i] == nil {
@ -120,7 +119,7 @@ func TestBoolValueSlice(t *testing.T) {
}
}
out2 := aws.BoolSlice(out)
out2 := BoolSlice(out)
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
for i := range out2 {
if in[i] == nil {
@ -141,13 +140,13 @@ func TestBoolMap(t *testing.T) {
if in == nil {
continue
}
out := aws.BoolMap(in)
out := BoolMap(in)
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
for i := range out {
assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
}
out2 := aws.BoolValueMap(out)
out2 := BoolValueMap(out)
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
}
@ -162,13 +161,13 @@ func TestIntSlice(t *testing.T) {
if in == nil {
continue
}
out := aws.IntSlice(in)
out := IntSlice(in)
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
for i := range out {
assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
}
out2 := aws.IntValueSlice(out)
out2 := IntValueSlice(out)
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
}
@ -181,7 +180,7 @@ func TestIntValueSlice(t *testing.T) {
if in == nil {
continue
}
out := aws.IntValueSlice(in)
out := IntValueSlice(in)
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
for i := range out {
if in[i] == nil {
@ -191,7 +190,7 @@ func TestIntValueSlice(t *testing.T) {
}
}
out2 := aws.IntSlice(out)
out2 := IntSlice(out)
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
for i := range out2 {
if in[i] == nil {
@ -212,13 +211,13 @@ func TestIntMap(t *testing.T) {
if in == nil {
continue
}
out := aws.IntMap(in)
out := IntMap(in)
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
for i := range out {
assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
}
out2 := aws.IntValueMap(out)
out2 := IntValueMap(out)
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
}
@ -233,13 +232,13 @@ func TestInt64Slice(t *testing.T) {
if in == nil {
continue
}
out := aws.Int64Slice(in)
out := Int64Slice(in)
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
for i := range out {
assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
}
out2 := aws.Int64ValueSlice(out)
out2 := Int64ValueSlice(out)
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
}
@ -252,7 +251,7 @@ func TestInt64ValueSlice(t *testing.T) {
if in == nil {
continue
}
out := aws.Int64ValueSlice(in)
out := Int64ValueSlice(in)
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
for i := range out {
if in[i] == nil {
@ -262,7 +261,7 @@ func TestInt64ValueSlice(t *testing.T) {
}
}
out2 := aws.Int64Slice(out)
out2 := Int64Slice(out)
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
for i := range out2 {
if in[i] == nil {
@ -283,13 +282,13 @@ func TestInt64Map(t *testing.T) {
if in == nil {
continue
}
out := aws.Int64Map(in)
out := Int64Map(in)
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
for i := range out {
assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
}
out2 := aws.Int64ValueMap(out)
out2 := Int64ValueMap(out)
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
}
@ -304,13 +303,13 @@ func TestFloat64Slice(t *testing.T) {
if in == nil {
continue
}
out := aws.Float64Slice(in)
out := Float64Slice(in)
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
for i := range out {
assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
}
out2 := aws.Float64ValueSlice(out)
out2 := Float64ValueSlice(out)
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
}
@ -323,7 +322,7 @@ func TestFloat64ValueSlice(t *testing.T) {
if in == nil {
continue
}
out := aws.Float64ValueSlice(in)
out := Float64ValueSlice(in)
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
for i := range out {
if in[i] == nil {
@ -333,7 +332,7 @@ func TestFloat64ValueSlice(t *testing.T) {
}
}
out2 := aws.Float64Slice(out)
out2 := Float64Slice(out)
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
for i := range out2 {
if in[i] == nil {
@ -354,13 +353,13 @@ func TestFloat64Map(t *testing.T) {
if in == nil {
continue
}
out := aws.Float64Map(in)
out := Float64Map(in)
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
for i := range out {
assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
}
out2 := aws.Float64ValueMap(out)
out2 := Float64ValueMap(out)
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
}
@ -375,13 +374,13 @@ func TestTimeSlice(t *testing.T) {
if in == nil {
continue
}
out := aws.TimeSlice(in)
out := TimeSlice(in)
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
for i := range out {
assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
}
out2 := aws.TimeValueSlice(out)
out2 := TimeValueSlice(out)
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
}
@ -394,7 +393,7 @@ func TestTimeValueSlice(t *testing.T) {
if in == nil {
continue
}
out := aws.TimeValueSlice(in)
out := TimeValueSlice(in)
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
for i := range out {
if in[i] == nil {
@ -404,7 +403,7 @@ func TestTimeValueSlice(t *testing.T) {
}
}
out2 := aws.TimeSlice(out)
out2 := TimeSlice(out)
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
for i := range out2 {
if in[i] == nil {
@ -425,13 +424,13 @@ func TestTimeMap(t *testing.T) {
if in == nil {
continue
}
out := aws.TimeMap(in)
out := TimeMap(in)
assert.Len(t, out, len(in), "Unexpected len at idx %d", idx)
for i := range out {
assert.Equal(t, in[i], *(out[i]), "Unexpected value at idx %d", idx)
}
out2 := aws.TimeValueMap(out)
out2 := TimeValueMap(out)
assert.Len(t, out2, len(in), "Unexpected len at idx %d", idx)
assert.Equal(t, in, out2, "Unexpected value at idx %d", idx)
}

View File

@ -1,162 +0,0 @@
package credentials
import (
"bufio"
"encoding/json"
"fmt"
"net/http"
"time"
"github.com/aws/aws-sdk-go/aws/awserr"
)
const metadataCredentialsEndpoint = "http://169.254.169.254/latest/meta-data/iam/security-credentials/"
// A EC2RoleProvider retrieves credentials from the EC2 service, and keeps track if
// those credentials are expired.
//
// Example how to configure the EC2RoleProvider with custom http Client, Endpoint
// or ExpiryWindow
//
// p := &credentials.EC2RoleProvider{
// // Pass in a custom timeout to be used when requesting
// // IAM EC2 Role credentials.
// Client: &http.Client{
// Timeout: 10 * time.Second,
// },
// // Use default EC2 Role metadata endpoint, Alternate endpoints can be
// // specified setting Endpoint to something else.
// Endpoint: "",
// // Do not use early expiry of credentials. If a non zero value is
// // specified the credentials will be expired early
// ExpiryWindow: 0,
// }
type EC2RoleProvider struct {
Expiry
// Endpoint must be fully quantified URL
Endpoint string
// HTTP client to use when connecting to EC2 service
Client *http.Client
// ExpiryWindow will allow the credentials to trigger refreshing prior to
// the credentials actually expiring. This is beneficial so race conditions
// with expiring credentials do not cause request to fail unexpectedly
// due to ExpiredTokenException exceptions.
//
// So a ExpiryWindow of 10s would cause calls to IsExpired() to return true
// 10 seconds before the credentials are actually expired.
//
// If ExpiryWindow is 0 or less it will be ignored.
ExpiryWindow time.Duration
}
// NewEC2RoleCredentials returns a pointer to a new Credentials object
// wrapping the EC2RoleProvider.
//
// Takes a custom http.Client which can be configured for custom handling of
// things such as timeout.
//
// Endpoint is the URL that the EC2RoleProvider will connect to when retrieving
// role and credentials.
//
// Window is the expiry window that will be subtracted from the expiry returned
// by the role credential request. This is done so that the credentials will
// expire sooner than their actual lifespan.
func NewEC2RoleCredentials(client *http.Client, endpoint string, window time.Duration) *Credentials {
return NewCredentials(&EC2RoleProvider{
Endpoint: endpoint,
Client: client,
ExpiryWindow: window,
})
}
// Retrieve retrieves credentials from the EC2 service.
// Error will be returned if the request fails, or unable to extract
// the desired credentials.
func (m *EC2RoleProvider) Retrieve() (Value, error) {
if m.Client == nil {
m.Client = http.DefaultClient
}
if m.Endpoint == "" {
m.Endpoint = metadataCredentialsEndpoint
}
credsList, err := requestCredList(m.Client, m.Endpoint)
if err != nil {
return Value{}, err
}
if len(credsList) == 0 {
return Value{}, awserr.New("EmptyEC2RoleList", "empty EC2 Role list", nil)
}
credsName := credsList[0]
roleCreds, err := requestCred(m.Client, m.Endpoint, credsName)
if err != nil {
return Value{}, err
}
m.SetExpiration(roleCreds.Expiration, m.ExpiryWindow)
return Value{
AccessKeyID: roleCreds.AccessKeyID,
SecretAccessKey: roleCreds.SecretAccessKey,
SessionToken: roleCreds.Token,
}, nil
}
// A ec2RoleCredRespBody provides the shape for deserializing credential
// request responses.
type ec2RoleCredRespBody struct {
Expiration time.Time
AccessKeyID string
SecretAccessKey string
Token string
}
// requestCredList requests a list of credentials from the EC2 service.
// If there are no credentials, or there is an error making or receiving the request
func requestCredList(client *http.Client, endpoint string) ([]string, error) {
resp, err := client.Get(endpoint)
if err != nil {
return nil, awserr.New("ListEC2Role", "failed to list EC2 Roles", err)
}
defer resp.Body.Close()
credsList := []string{}
s := bufio.NewScanner(resp.Body)
for s.Scan() {
credsList = append(credsList, s.Text())
}
if err := s.Err(); err != nil {
return nil, awserr.New("ReadEC2Role", "failed to read list of EC2 Roles", err)
}
return credsList, nil
}
// requestCred requests the credentials for a specific credentials from the EC2 service.
//
// If the credentials cannot be found, or there is an error reading the response
// and error will be returned.
func requestCred(client *http.Client, endpoint, credsName string) (*ec2RoleCredRespBody, error) {
resp, err := client.Get(endpoint + credsName)
if err != nil {
return nil, awserr.New("GetEC2RoleCredentials",
fmt.Sprintf("failed to get %s EC2 Role credentials", credsName),
err)
}
defer resp.Body.Close()
respCreds := &ec2RoleCredRespBody{}
if err := json.NewDecoder(resp.Body).Decode(respCreds); err != nil {
return nil, awserr.New("DecodeEC2RoleCredentials",
fmt.Sprintf("failed to decode %s EC2 Role credentials", credsName),
err)
}
return respCreds, nil
}

View File

@ -1,108 +0,0 @@
package credentials
import (
"fmt"
"github.com/stretchr/testify/assert"
"net/http"
"net/http/httptest"
"testing"
"time"
)
func initTestServer(expireOn string) *httptest.Server {
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.RequestURI == "/" {
fmt.Fprintln(w, "/creds")
} else {
fmt.Fprintf(w, `{
"AccessKeyId" : "accessKey",
"SecretAccessKey" : "secret",
"Token" : "token",
"Expiration" : "%s"
}`, expireOn)
}
}))
return server
}
func TestEC2RoleProvider(t *testing.T) {
server := initTestServer("2014-12-16T01:51:37Z")
defer server.Close()
p := &EC2RoleProvider{Client: http.DefaultClient, Endpoint: server.URL}
creds, err := p.Retrieve()
assert.Nil(t, err, "Expect no error")
assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match")
assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match")
assert.Equal(t, "token", creds.SessionToken, "Expect session token to match")
}
func TestEC2RoleProviderIsExpired(t *testing.T) {
server := initTestServer("2014-12-16T01:51:37Z")
defer server.Close()
p := &EC2RoleProvider{Client: http.DefaultClient, Endpoint: server.URL}
p.CurrentTime = func() time.Time {
return time.Date(2014, 12, 15, 21, 26, 0, 0, time.UTC)
}
assert.True(t, p.IsExpired(), "Expect creds to be expired before retrieve.")
_, err := p.Retrieve()
assert.Nil(t, err, "Expect no error")
assert.False(t, p.IsExpired(), "Expect creds to not be expired after retrieve.")
p.CurrentTime = func() time.Time {
return time.Date(3014, 12, 15, 21, 26, 0, 0, time.UTC)
}
assert.True(t, p.IsExpired(), "Expect creds to be expired.")
}
func TestEC2RoleProviderExpiryWindowIsExpired(t *testing.T) {
server := initTestServer("2014-12-16T01:51:37Z")
defer server.Close()
p := &EC2RoleProvider{Client: http.DefaultClient, Endpoint: server.URL, ExpiryWindow: time.Hour * 1}
p.CurrentTime = func() time.Time {
return time.Date(2014, 12, 15, 0, 51, 37, 0, time.UTC)
}
assert.True(t, p.IsExpired(), "Expect creds to be expired before retrieve.")
_, err := p.Retrieve()
assert.Nil(t, err, "Expect no error")
assert.False(t, p.IsExpired(), "Expect creds to not be expired after retrieve.")
p.CurrentTime = func() time.Time {
return time.Date(2014, 12, 16, 0, 55, 37, 0, time.UTC)
}
assert.True(t, p.IsExpired(), "Expect creds to be expired.")
}
func BenchmarkEC2RoleProvider(b *testing.B) {
server := initTestServer("2014-12-16T01:51:37Z")
defer server.Close()
p := &EC2RoleProvider{Client: http.DefaultClient, Endpoint: server.URL}
_, err := p.Retrieve()
if err != nil {
b.Fatal(err)
}
b.ResetTimer()
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
_, err := p.Retrieve()
if err != nil {
b.Fatal(err)
}
}
})
}

View File

@ -22,8 +22,12 @@ var (
//
// Profile ini file example: $HOME/.aws/credentials
type SharedCredentialsProvider struct {
// Path to the shared credentials file. If empty will default to current user's
// home directory.
// Path to the shared credentials file.
//
// If empty will look for "AWS_SHARED_CREDENTIALS_FILE" env variable. If the
// env value is empty will default to current user's home directory.
// Linux/OSX: "$HOME/.aws/credentials"
// Windows: "%USERPROFILE%\.aws\credentials"
Filename string
// AWS Profile to extract credentials from the shared credentials file. If empty
@ -106,6 +110,10 @@ func loadProfile(filename, profile string) (Value, error) {
// Will return an error if the user's home directory path cannot be found.
func (p *SharedCredentialsProvider) filename() (string, error) {
if p.Filename == "" {
if p.Filename = os.Getenv("AWS_SHARED_CREDENTIALS_FILE"); p.Filename != "" {
return p.Filename, nil
}
homeDir := os.Getenv("HOME") // *nix
if homeDir == "" { // Windows
homeDir = os.Getenv("USERPROFILE")

View File

@ -31,6 +31,19 @@ func TestSharedCredentialsProviderIsExpired(t *testing.T) {
assert.False(t, p.IsExpired(), "Expect creds to not be expired after retrieve")
}
func TestSharedCredentialsProviderWithAWS_SHARED_CREDENTIALS_FILE(t *testing.T) {
os.Clearenv()
os.Setenv("AWS_SHARED_CREDENTIALS_FILE", "example.ini")
p := SharedCredentialsProvider{}
creds, err := p.Retrieve()
assert.Nil(t, err, "Expect no error")
assert.Equal(t, "accessKey", creds.AccessKeyID, "Expect access key ID to match")
assert.Equal(t, "secret", creds.SecretAccessKey, "Expect secret access key to match")
assert.Equal(t, "token", creds.SessionToken, "Expect session token to match")
}
func TestSharedCredentialsProviderWithAWS_PROFILE(t *testing.T) {
os.Clearenv()
os.Setenv("AWS_PROFILE", "no_token")

View File

@ -6,10 +6,11 @@ package stscreds
import (
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/service/sts"
"time"
)
// AssumeRoler represents the minimal subset of the STS client API used by this provider.
@ -101,7 +102,7 @@ func (p *AssumeRoleProvider) Retrieve() (credentials.Value, error) {
roleOutput, err := p.Client.AssumeRole(&sts.AssumeRoleInput{
DurationSeconds: aws.Int64(int64(p.Duration / time.Second)),
RoleARN: aws.String(p.RoleARN),
RoleArn: aws.String(p.RoleARN),
RoleSessionName: aws.String(p.RoleSessionName),
})
@ -113,7 +114,7 @@ func (p *AssumeRoleProvider) Retrieve() (credentials.Value, error) {
p.SetExpiration(*roleOutput.Credentials.Expiration, p.ExpiryWindow)
return credentials.Value{
AccessKeyID: *roleOutput.Credentials.AccessKeyID,
AccessKeyID: *roleOutput.Credentials.AccessKeyId,
SecretAccessKey: *roleOutput.Credentials.SecretAccessKey,
SessionToken: *roleOutput.Credentials.SessionToken,
}, nil

View File

@ -1,11 +1,12 @@
package stscreds
import (
"testing"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/sts"
"github.com/stretchr/testify/assert"
"testing"
"time"
)
type stubSTS struct {
@ -16,7 +17,7 @@ func (s *stubSTS) AssumeRole(input *sts.AssumeRoleInput) (*sts.AssumeRoleOutput,
return &sts.AssumeRoleOutput{
Credentials: &sts.Credentials{
// Just reflect the role arn to the provider.
AccessKeyID: input.RoleARN,
AccessKeyId: input.RoleArn,
SecretAccessKey: aws.String("assumedSecretAccessKey"),
SessionToken: aws.String("assumedSessionToken"),
Expiration: &expiry,

View File

@ -0,0 +1,38 @@
package defaults
import (
"net/http"
"os"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds"
)
// DefaultChainCredentials is a Credentials which will find the first available
// credentials Value from the list of Providers.
//
// This should be used in the default case. Once the type of credentials are
// known switching to the specific Credentials will be more efficient.
var DefaultChainCredentials = credentials.NewChainCredentials(
[]credentials.Provider{
&credentials.EnvProvider{},
&credentials.SharedCredentialsProvider{Filename: "", Profile: ""},
&ec2rolecreds.EC2RoleProvider{ExpiryWindow: 5 * time.Minute},
})
// DefaultConfig is the default all service configuration will be based off of.
// By default, all clients use this structure for initialization options unless
// a custom configuration object is passed in.
//
// You may modify this global structure to change all default configuration
// in the SDK. Note that configuration options are copied by value, so any
// modifications must happen before constructing a client.
var DefaultConfig = aws.NewConfig().
WithCredentials(DefaultChainCredentials).
WithRegion(os.Getenv("AWS_REGION")).
WithHTTPClient(http.DefaultClient).
WithMaxRetries(aws.DefaultRetries).
WithLogger(aws.NewDefaultLogger()).
WithLogLevel(aws.LogOff)

View File

@ -1,157 +0,0 @@
package aws
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"regexp"
"strconv"
"time"
"github.com/aws/aws-sdk-go/aws/awserr"
)
var sleepDelay = func(delay time.Duration) {
time.Sleep(delay)
}
// Interface for matching types which also have a Len method.
type lener interface {
Len() int
}
// BuildContentLength builds the content length of a request based on the body,
// or will use the HTTPRequest.Header's "Content-Length" if defined. If unable
// to determine request body length and no "Content-Length" was specified it will panic.
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:
r.bodyStart, _ = body.Seek(0, 1)
end, _ := body.Seek(0, 2)
body.Seek(r.bodyStart, 0) // make sure to seek back to original location
length = end - r.bodyStart
default:
panic("Cannot get length of body, must provide `ContentLength`")
}
r.HTTPRequest.ContentLength = length
r.HTTPRequest.Header.Set("Content-Length", fmt.Sprintf("%d", length))
}
// UserAgentHandler is a request handler for injecting User agent into requests.
func UserAgentHandler(r *Request) {
r.HTTPRequest.Header.Set("User-Agent", SDKName+"/"+SDKVersion)
}
var reStatusCode = regexp.MustCompile(`^(\d+)`)
// SendHandler is a request handler to send service request using HTTP client.
func SendHandler(r *Request) {
var err error
r.HTTPResponse, err = r.Service.Config.HTTPClient.Do(r.HTTPRequest)
if err != nil {
// Capture the case where url.Error is returned for error processing
// response. e.g. 301 without location header comes back as string
// error and r.HTTPResponse is nil. Other url redirect errors will
// comeback in a similar method.
if e, ok := err.(*url.Error); ok {
if s := reStatusCode.FindStringSubmatch(e.Error()); s != nil {
code, _ := strconv.ParseInt(s[1], 10, 64)
r.HTTPResponse = &http.Response{
StatusCode: int(code),
Status: http.StatusText(int(code)),
Body: ioutil.NopCloser(bytes.NewReader([]byte{})),
}
return
}
}
if r.HTTPRequest == nil {
// Add a dummy request response object to ensure the HTTPResponse
// value is consistent.
r.HTTPResponse = &http.Response{
StatusCode: int(0),
Status: http.StatusText(int(0)),
Body: ioutil.NopCloser(bytes.NewReader([]byte{})),
}
}
// Catch all other request errors.
r.Error = awserr.New("RequestError", "send request failed", err)
r.Retryable = Bool(true) // network errors are retryable
}
}
// ValidateResponseHandler is a request handler to validate service response.
func ValidateResponseHandler(r *Request) {
if r.HTTPResponse.StatusCode == 0 || r.HTTPResponse.StatusCode >= 300 {
// this may be replaced by an UnmarshalError handler
r.Error = awserr.New("UnknownError", "unknown error", nil)
}
}
// AfterRetryHandler performs final checks to determine if the request should
// be retried and how long to delay.
func AfterRetryHandler(r *Request) {
// If one of the other handlers already set the retry state
// we don't want to override it based on the service's state
if r.Retryable == nil {
r.Retryable = Bool(r.Service.ShouldRetry(r))
}
if r.WillRetry() {
r.RetryDelay = r.Service.RetryRules(r)
sleepDelay(r.RetryDelay)
// when the expired token exception occurs the credentials
// need to be expired locally so that the next request to
// get credentials will trigger a credentials refresh.
if r.Error != nil {
if err, ok := r.Error.(awserr.Error); ok {
if isCodeExpiredCreds(err.Code()) {
r.Config.Credentials.Expire()
}
}
}
r.RetryCount++
r.Error = nil
}
}
var (
// ErrMissingRegion is an error that is returned if region configuration is
// not found.
//
// @readonly
ErrMissingRegion error = awserr.New("MissingRegion", "could not find region configuration", nil)
// ErrMissingEndpoint is an error that is returned if an endpoint cannot be
// resolved for a service.
//
// @readonly
ErrMissingEndpoint error = awserr.New("MissingEndpoint", "'Endpoint' configuration is required for this service", nil)
)
// ValidateEndpointHandler is a request handler to validate a request had the
// appropriate Region and Endpoint set. Will set r.Error if the endpoint or
// region is not valid.
func ValidateEndpointHandler(r *Request) {
if r.Service.SigningRegion == "" && StringValue(r.Service.Config.Region) == "" {
r.Error = ErrMissingRegion
} else if r.Service.Endpoint == "" {
r.Error = ErrMissingEndpoint
}
}

View File

@ -1,81 +0,0 @@
package aws
import (
"net/http"
"os"
"testing"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/stretchr/testify/assert"
)
func TestValidateEndpointHandler(t *testing.T) {
os.Clearenv()
svc := NewService(NewConfig().WithRegion("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)
}
type mockCredsProvider struct {
expired bool
retrieveCalled bool
}
func (m *mockCredsProvider) Retrieve() (credentials.Value, error) {
m.retrieveCalled = true
return credentials.Value{}, nil
}
func (m *mockCredsProvider) IsExpired() bool {
return m.expired
}
func TestAfterRetryRefreshCreds(t *testing.T) {
os.Clearenv()
credProvider := &mockCredsProvider{}
svc := NewService(&Config{Credentials: credentials.NewCredentials(credProvider), MaxRetries: Int(1)})
svc.Handlers.Clear()
svc.Handlers.ValidateResponse.PushBack(func(r *Request) {
r.Error = awserr.New("UnknownError", "", nil)
r.HTTPResponse = &http.Response{StatusCode: 400}
})
svc.Handlers.UnmarshalError.PushBack(func(r *Request) {
r.Error = awserr.New("ExpiredTokenException", "", nil)
})
svc.Handlers.AfterRetry.PushBack(func(r *Request) {
AfterRetryHandler(r)
})
assert.True(t, svc.Config.Credentials.IsExpired(), "Expect to start out expired")
assert.False(t, credProvider.retrieveCalled)
req := NewRequest(svc, &Operation{Name: "Operation"}, nil, nil)
req.Send()
assert.True(t, svc.Config.Credentials.IsExpired())
assert.False(t, credProvider.retrieveCalled)
_, err := svc.Config.Credentials.Get()
assert.NoError(t, err)
assert.True(t, credProvider.retrieveCalled)
}

View File

@ -1,85 +0,0 @@
package aws
// A Handlers provides a collection of request handlers for various
// stages of handling requests.
type Handlers struct {
Validate HandlerList
Build HandlerList
Sign HandlerList
Send HandlerList
ValidateResponse HandlerList
Unmarshal HandlerList
UnmarshalMeta HandlerList
UnmarshalError HandlerList
Retry HandlerList
AfterRetry HandlerList
}
// copy returns of this handler's lists.
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 HandlerList 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)
}
}

View File

@ -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 = Bool(true) })
l.Run(r)
if r.Data != nil {
t.Error("Expected handler to execute")
}
}

View File

@ -1,89 +0,0 @@
package aws
import (
"fmt"
"reflect"
"strings"
"github.com/aws/aws-sdk-go/aws/awserr"
)
// ValidateParameters is a request handler to validate the input parameters.
// Validating parameters only has meaning if done prior to the request being sent.
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 = awserr.New("InvalidParameter", msg, nil)
}
}
}
// A validator validates values. Collects validations errors which occurs.
type validator struct {
errors []string
}
// validateAny will validate any struct, slice or map type. All validations
// are also performed recursively for nested types.
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()))
}
}
}
// validateStruct will validate the struct value's fields. If the structure has
// nested types those types will be validated also.
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, reflect.Map:
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)
}
}
}

View File

@ -1,84 +0,0 @@
package aws_test
import (
"testing"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"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.Bool(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)
assert.Error(t, req.Error)
assert.Equal(t, "InvalidParameter", req.Error.(awserr.Error).Code())
assert.Equal(t, "3 validation errors:\n- missing required parameter: RequiredList\n- missing required parameter: RequiredMap\n- missing required parameter: RequiredBool", req.Error.(awserr.Error).Message())
}
func TestNestedMissingRequiredParameters(t *testing.T) {
input := &StructShape{
RequiredList: []*ConditionalStructShape{{}},
RequiredMap: map[string]*ConditionalStructShape{
"key1": {Name: aws.String("Name")},
"key2": {},
},
RequiredBool: aws.Bool(true),
OptionalStruct: &ConditionalStructShape{},
}
req := aws.NewRequest(service, &aws.Operation{}, input, nil)
aws.ValidateParameters(req)
assert.Error(t, req.Error)
assert.Equal(t, "InvalidParameter", req.Error.(awserr.Error).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", req.Error.(awserr.Error).Message())
}

View File

@ -1,312 +0,0 @@
package aws
import (
"bytes"
"io"
"io/ioutil"
"net/http"
"net/url"
"reflect"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws/awsutil"
)
// A Request is the service request to be made.
type Request struct {
*Service
Handlers Handlers
Time time.Time
ExpireTime time.Duration
Operation *Operation
HTTPRequest *http.Request
HTTPResponse *http.Response
Body io.ReadSeeker
bodyStart int64 // offset from beginning of Body that the request body starts
Params interface{}
Error error
Data interface{}
RequestID string
RetryCount uint
Retryable *bool
RetryDelay time.Duration
built bool
}
// An Operation is the service API operation to be made.
type Operation struct {
Name string
HTTPMethod string
HTTPPath string
*Paginator
}
// Paginator keeps track of pagination configuration for an API operation.
type Paginator struct {
InputTokens []string
OutputTokens []string
LimitToken string
TruncationToken string
}
// NewRequest returns a new Request pointer for the service API
// operation and parameters.
//
// Params is any value of input parameters to be the request payload.
// Data is pointer value to an object which the request's response
// payload will be deserialized to.
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
}
// WillRetry returns if the request's can be retried.
func (r *Request) WillRetry() bool {
return r.Error != nil && BoolValue(r.Retryable) && r.RetryCount < r.Service.MaxRetries()
}
// ParamsFilled returns if the request's parameters have been populated
// and the parameters are valid. False is returned if no parameters are
// provided or invalid.
func (r *Request) ParamsFilled() bool {
return r.Params != nil && reflect.ValueOf(r.Params).Elem().IsValid()
}
// DataFilled returns true if the request's data for response deserialization
// target has been set and is a valid. False is returned if data is not
// set, or is invalid.
func (r *Request) DataFilled() bool {
return r.Data != nil && reflect.ValueOf(r.Data).Elem().IsValid()
}
// SetBufferBody will set the request's body bytes that will be sent to
// the service API.
func (r *Request) SetBufferBody(buf []byte) {
r.SetReaderBody(bytes.NewReader(buf))
}
// SetStringBody sets the body of the request to be backed by a string.
func (r *Request) SetStringBody(s string) {
r.SetReaderBody(strings.NewReader(s))
}
// SetReaderBody will set the request's body reader.
func (r *Request) SetReaderBody(reader io.ReadSeeker) {
r.HTTPRequest.Body = ioutil.NopCloser(reader)
r.Body = reader
}
// Presign returns the request's signed URL. Error will be returned
// if the signing fails.
func (r *Request) Presign(expireTime time.Duration) (string, error) {
r.ExpireTime = expireTime
r.Sign()
if r.Error != nil {
return "", r.Error
}
return r.HTTPRequest.URL.String(), nil
}
// Build will build the request's object so it can be signed and sent
// to the service. Build will also validate all the request's parameters.
// Anny additional build Handlers set on this request will be run
// in the order they were set.
//
// The request will only be built once. Multiple calls to build will have
// no effect.
//
// If any Validate or Build errors occur the build will stop and the error
// which occurred will be returned.
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
}
// Sign will sign the request retuning error if errors are encountered.
//
// Send will build the request prior to signing. All Sign Handlers will
// be executed in the order they were set.
func (r *Request) Sign() error {
r.Build()
if r.Error != nil {
return r.Error
}
r.Handlers.Sign.Run(r)
return r.Error
}
// Send will send the request returning error if errors are encountered.
//
// Send will sign the request prior to sending. All Send Handlers will
// be executed in the order they were set.
func (r *Request) Send() error {
for {
r.Sign()
if r.Error != nil {
return r.Error
}
if BoolValue(r.Retryable) {
// Re-seek the body back to the original point in for a retry so that
// send will send the body's contents again in the upcoming request.
r.Body.Seek(r.bodyStart, 0)
}
r.Retryable = nil
r.Handlers.Send.Run(r)
if r.Error != nil {
r.Handlers.Retry.Run(r)
r.Handlers.AfterRetry.Run(r)
if r.Error != nil {
return r.Error
}
continue
}
r.Handlers.UnmarshalMeta.Run(r)
r.Handlers.ValidateResponse.Run(r)
if r.Error != nil {
r.Handlers.UnmarshalError.Run(r)
r.Handlers.Retry.Run(r)
r.Handlers.AfterRetry.Run(r)
if r.Error != nil {
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
}
break
}
return nil
}
// HasNextPage returns true if this request has more pages of data available.
func (r *Request) HasNextPage() bool {
return r.nextPageTokens() != nil
}
// nextPageTokens returns the tokens to use when asking for the next page of
// data.
func (r *Request) nextPageTokens() []interface{} {
if r.Operation.Paginator == nil {
return nil
}
if r.Operation.TruncationToken != "" {
tr := awsutil.ValuesAtAnyPath(r.Data, r.Operation.TruncationToken)
if tr == nil || len(tr) == 0 {
return nil
}
switch v := tr[0].(type) {
case bool:
if v == false {
return nil
}
}
}
found := false
tokens := make([]interface{}, len(r.Operation.OutputTokens))
for i, outtok := range r.Operation.OutputTokens {
v := awsutil.ValuesAtAnyPath(r.Data, outtok)
if v != nil && len(v) > 0 {
found = true
tokens[i] = v[0]
}
}
if found {
return tokens
}
return nil
}
// NextPage returns a new Request that can be executed to return the next
// page of result data. Call .Send() on this request to execute it.
func (r *Request) NextPage() *Request {
tokens := r.nextPageTokens()
if tokens == nil {
return nil
}
data := reflect.New(reflect.TypeOf(r.Data).Elem()).Interface()
nr := NewRequest(r.Service, r.Operation, awsutil.CopyOf(r.Params), data)
for i, intok := range nr.Operation.InputTokens {
awsutil.SetValueAtAnyPath(nr.Params, intok, tokens[i])
}
return nr
}
// EachPage iterates over each page of a paginated request object. The fn
// parameter should be a function with the following sample signature:
//
// func(page *T, lastPage bool) bool {
// return true // return false to stop iterating
// }
//
// Where "T" is the structure type matching the output structure of the given
// operation. For example, a request object generated by
// DynamoDB.ListTablesRequest() would expect to see dynamodb.ListTablesOutput
// as the structure "T". The lastPage value represents whether the page is
// the last page of data or not. The return value of this function should
// return true to keep iterating or false to stop.
func (r *Request) EachPage(fn func(data interface{}, isLastPage bool) (shouldContinue bool)) error {
for page := r; page != nil; page = page.NextPage() {
page.Send()
shouldContinue := fn(page.Data, !page.HasNextPage())
if page.Error != nil || !shouldContinue {
return page.Error
}
}
return nil
}

View File

@ -1,305 +0,0 @@
package aws_test
import (
"testing"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/internal/test/unit"
"github.com/aws/aws-sdk-go/service/dynamodb"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/stretchr/testify/assert"
)
var _ = unit.Imported
// Use DynamoDB methods for simplicity
func TestPagination(t *testing.T) {
db := dynamodb.New(nil)
tokens, pages, numPages, gotToEnd := []string{}, []string{}, 0, false
reqNum := 0
resps := []*dynamodb.ListTablesOutput{
{TableNames: []*string{aws.String("Table1"), aws.String("Table2")}, LastEvaluatedTableName: aws.String("Table2")},
{TableNames: []*string{aws.String("Table3"), aws.String("Table4")}, LastEvaluatedTableName: aws.String("Table4")},
{TableNames: []*string{aws.String("Table5")}},
}
db.Handlers.Send.Clear() // mock sending
db.Handlers.Unmarshal.Clear()
db.Handlers.UnmarshalMeta.Clear()
db.Handlers.ValidateResponse.Clear()
db.Handlers.Build.PushBack(func(r *aws.Request) {
in := r.Params.(*dynamodb.ListTablesInput)
if in == nil {
tokens = append(tokens, "")
} else if in.ExclusiveStartTableName != nil {
tokens = append(tokens, *in.ExclusiveStartTableName)
}
})
db.Handlers.Unmarshal.PushBack(func(r *aws.Request) {
r.Data = resps[reqNum]
reqNum++
})
params := &dynamodb.ListTablesInput{Limit: aws.Int64(2)}
err := db.ListTablesPages(params, func(p *dynamodb.ListTablesOutput, last bool) bool {
numPages++
for _, t := range p.TableNames {
pages = append(pages, *t)
}
if last {
if gotToEnd {
assert.Fail(t, "last=true happened twice")
}
gotToEnd = true
}
return true
})
assert.Equal(t, []string{"Table2", "Table4"}, tokens)
assert.Equal(t, []string{"Table1", "Table2", "Table3", "Table4", "Table5"}, pages)
assert.Equal(t, 3, numPages)
assert.True(t, gotToEnd)
assert.Nil(t, err)
assert.Nil(t, params.ExclusiveStartTableName)
}
// Use DynamoDB methods for simplicity
func TestPaginationEachPage(t *testing.T) {
db := dynamodb.New(nil)
tokens, pages, numPages, gotToEnd := []string{}, []string{}, 0, false
reqNum := 0
resps := []*dynamodb.ListTablesOutput{
{TableNames: []*string{aws.String("Table1"), aws.String("Table2")}, LastEvaluatedTableName: aws.String("Table2")},
{TableNames: []*string{aws.String("Table3"), aws.String("Table4")}, LastEvaluatedTableName: aws.String("Table4")},
{TableNames: []*string{aws.String("Table5")}},
}
db.Handlers.Send.Clear() // mock sending
db.Handlers.Unmarshal.Clear()
db.Handlers.UnmarshalMeta.Clear()
db.Handlers.ValidateResponse.Clear()
db.Handlers.Build.PushBack(func(r *aws.Request) {
in := r.Params.(*dynamodb.ListTablesInput)
if in == nil {
tokens = append(tokens, "")
} else if in.ExclusiveStartTableName != nil {
tokens = append(tokens, *in.ExclusiveStartTableName)
}
})
db.Handlers.Unmarshal.PushBack(func(r *aws.Request) {
r.Data = resps[reqNum]
reqNum++
})
params := &dynamodb.ListTablesInput{Limit: aws.Int64(2)}
req, _ := db.ListTablesRequest(params)
err := req.EachPage(func(p interface{}, last bool) bool {
numPages++
for _, t := range p.(*dynamodb.ListTablesOutput).TableNames {
pages = append(pages, *t)
}
if last {
if gotToEnd {
assert.Fail(t, "last=true happened twice")
}
gotToEnd = true
}
return true
})
assert.Equal(t, []string{"Table2", "Table4"}, tokens)
assert.Equal(t, []string{"Table1", "Table2", "Table3", "Table4", "Table5"}, pages)
assert.Equal(t, 3, numPages)
assert.True(t, gotToEnd)
assert.Nil(t, err)
}
// Use DynamoDB methods for simplicity
func TestPaginationEarlyExit(t *testing.T) {
db := dynamodb.New(nil)
numPages, gotToEnd := 0, false
reqNum := 0
resps := []*dynamodb.ListTablesOutput{
{TableNames: []*string{aws.String("Table1"), aws.String("Table2")}, LastEvaluatedTableName: aws.String("Table2")},
{TableNames: []*string{aws.String("Table3"), aws.String("Table4")}, LastEvaluatedTableName: aws.String("Table4")},
{TableNames: []*string{aws.String("Table5")}},
}
db.Handlers.Send.Clear() // mock sending
db.Handlers.Unmarshal.Clear()
db.Handlers.UnmarshalMeta.Clear()
db.Handlers.ValidateResponse.Clear()
db.Handlers.Unmarshal.PushBack(func(r *aws.Request) {
r.Data = resps[reqNum]
reqNum++
})
params := &dynamodb.ListTablesInput{Limit: aws.Int64(2)}
err := db.ListTablesPages(params, func(p *dynamodb.ListTablesOutput, last bool) bool {
numPages++
if numPages == 2 {
return false
}
if last {
if gotToEnd {
assert.Fail(t, "last=true happened twice")
}
gotToEnd = true
}
return true
})
assert.Equal(t, 2, numPages)
assert.False(t, gotToEnd)
assert.Nil(t, err)
}
func TestSkipPagination(t *testing.T) {
client := s3.New(nil)
client.Handlers.Send.Clear() // mock sending
client.Handlers.Unmarshal.Clear()
client.Handlers.UnmarshalMeta.Clear()
client.Handlers.ValidateResponse.Clear()
client.Handlers.Unmarshal.PushBack(func(r *aws.Request) {
r.Data = &s3.HeadBucketOutput{}
})
req, _ := client.HeadBucketRequest(&s3.HeadBucketInput{Bucket: aws.String("bucket")})
numPages, gotToEnd := 0, false
req.EachPage(func(p interface{}, last bool) bool {
numPages++
if last {
gotToEnd = true
}
return true
})
assert.Equal(t, 1, numPages)
assert.True(t, gotToEnd)
}
// Use S3 for simplicity
func TestPaginationTruncation(t *testing.T) {
count := 0
client := s3.New(nil)
reqNum := &count
resps := []*s3.ListObjectsOutput{
{IsTruncated: aws.Bool(true), Contents: []*s3.Object{{Key: aws.String("Key1")}}},
{IsTruncated: aws.Bool(true), Contents: []*s3.Object{{Key: aws.String("Key2")}}},
{IsTruncated: aws.Bool(false), Contents: []*s3.Object{{Key: aws.String("Key3")}}},
{IsTruncated: aws.Bool(true), Contents: []*s3.Object{{Key: aws.String("Key4")}}},
}
client.Handlers.Send.Clear() // mock sending
client.Handlers.Unmarshal.Clear()
client.Handlers.UnmarshalMeta.Clear()
client.Handlers.ValidateResponse.Clear()
client.Handlers.Unmarshal.PushBack(func(r *aws.Request) {
r.Data = resps[*reqNum]
*reqNum++
})
params := &s3.ListObjectsInput{Bucket: aws.String("bucket")}
results := []string{}
err := client.ListObjectsPages(params, func(p *s3.ListObjectsOutput, last bool) bool {
results = append(results, *p.Contents[0].Key)
return true
})
assert.Equal(t, []string{"Key1", "Key2", "Key3"}, results)
assert.Nil(t, err)
// Try again without truncation token at all
count = 0
resps[1].IsTruncated = nil
resps[2].IsTruncated = aws.Bool(true)
results = []string{}
err = client.ListObjectsPages(params, func(p *s3.ListObjectsOutput, last bool) bool {
results = append(results, *p.Contents[0].Key)
return true
})
assert.Equal(t, []string{"Key1", "Key2"}, results)
assert.Nil(t, err)
}
// Benchmarks
var benchResps = []*dynamodb.ListTablesOutput{
{TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
{TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
{TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
{TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
{TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
{TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
{TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
{TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
{TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
{TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
{TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
{TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
{TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
{TableNames: []*string{aws.String("TABLE")}},
}
var benchDb = func() *dynamodb.DynamoDB {
db := dynamodb.New(nil)
db.Handlers.Send.Clear() // mock sending
db.Handlers.Unmarshal.Clear()
db.Handlers.UnmarshalMeta.Clear()
db.Handlers.ValidateResponse.Clear()
return db
}
func BenchmarkCodegenIterator(b *testing.B) {
reqNum := 0
db := benchDb()
db.Handlers.Unmarshal.PushBack(func(r *aws.Request) {
r.Data = benchResps[reqNum]
reqNum++
})
input := &dynamodb.ListTablesInput{Limit: aws.Int64(2)}
iter := func(fn func(*dynamodb.ListTablesOutput, bool) bool) error {
page, _ := db.ListTablesRequest(input)
for ; page != nil; page = page.NextPage() {
page.Send()
out := page.Data.(*dynamodb.ListTablesOutput)
if result := fn(out, !page.HasNextPage()); page.Error != nil || !result {
return page.Error
}
}
return nil
}
for i := 0; i < b.N; i++ {
reqNum = 0
iter(func(p *dynamodb.ListTablesOutput, last bool) bool {
return true
})
}
}
func BenchmarkEachPageIterator(b *testing.B) {
reqNum := 0
db := benchDb()
db.Handlers.Unmarshal.PushBack(func(r *aws.Request) {
r.Data = benchResps[reqNum]
reqNum++
})
input := &dynamodb.ListTablesInput{Limit: aws.Int64(2)}
for i := 0; i < b.N; i++ {
reqNum = 0
req, _ := db.ListTablesRequest(input)
req.EachPage(func(p interface{}, last bool) bool {
return true
})
}
}

View File

@ -1,225 +0,0 @@
package aws
import (
"bytes"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"testing"
"time"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/credentials"
"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 = awserr.New("UnmarshaleError", req.HTTPResponse.Status, err)
return
}
if len(bodyBytes) == 0 {
req.Error = awserr.NewRequestFailure(
awserr.New("UnmarshaleError", req.HTTPResponse.Status, fmt.Errorf("empty body")),
req.HTTPResponse.StatusCode,
"",
)
return
}
var jsonErr jsonErrorResponse
if err := json.Unmarshal(bodyBytes, &jsonErr); err != nil {
req.Error = awserr.New("UnmarshaleError", "JSON unmarshal", err)
return
}
req.Error = awserr.NewRequestFailure(
awserr.New(jsonErr.Code, jsonErr.Message, nil),
req.HTTPResponse.StatusCode,
"",
)
}
type jsonErrorResponse struct {
Code string `json:"__type"`
Message string `json:"message"`
}
// test that retries occur for 5xx status codes
func TestRequestRecoverRetry5xx(t *testing.T) {
reqNum := 0
reqs := []http.Response{
{StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
{StatusCode: 501, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
{StatusCode: 200, Body: body(`{"data":"valid"}`)},
}
s := NewService(NewConfig().WithMaxRetries(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)
}
// test that retries occur for 4xx status codes with a response type that can be retried - see `shouldRetry`
func TestRequestRecoverRetry4xxRetryable(t *testing.T) {
reqNum := 0
reqs := []http.Response{
{StatusCode: 400, Body: body(`{"__type":"Throttling","message":"Rate exceeded."}`)},
{StatusCode: 429, Body: body(`{"__type":"ProvisionedThroughputExceededException","message":"Rate exceeded."}`)},
{StatusCode: 200, Body: body(`{"data":"valid"}`)},
}
s := NewService(NewConfig().WithMaxRetries(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)
}
// test that retries don't occur for 4xx status codes with a response type that can't be retried
func TestRequest4xxUnretryable(t *testing.T) {
s := NewService(NewConfig().WithMaxRetries(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 = &http.Response{StatusCode: 401, Body: body(`{"__type":"SignatureDoesNotMatch","message":"Signature does not match."}`)}
})
out := &testData{}
r := NewRequest(s, &Operation{Name: "Operation"}, nil, out)
err := r.Send()
assert.NotNil(t, err)
if e, ok := err.(awserr.RequestFailure); ok {
assert.Equal(t, 401, e.StatusCode())
} else {
assert.Fail(t, "Expected error to be a service failure")
}
assert.Equal(t, "SignatureDoesNotMatch", err.(awserr.Error).Code())
assert.Equal(t, "Signature does not match.", err.(awserr.Error).Message())
assert.Equal(t, 0, int(r.RetryCount))
}
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(NewConfig().WithMaxRetries(DefaultRetries))
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()
assert.NotNil(t, err)
if e, ok := err.(awserr.RequestFailure); ok {
assert.Equal(t, 500, e.StatusCode())
} else {
assert.Fail(t, "Expected error to be a service failure")
}
assert.Equal(t, "UnknownError", err.(awserr.Error).Code())
assert.Equal(t, "An error occurred.", err.(awserr.Error).Message())
assert.Equal(t, 3, int(r.RetryCount))
expectDelays := []struct{ min, max time.Duration }{{30, 59}, {60, 118}, {120, 236}}
for i, v := range delays {
min := expectDelays[i].min * time.Millisecond
max := expectDelays[i].max * time.Millisecond
assert.True(t, min <= v && v <= max,
"Expect delay to be within range, i:%d, v:%s, min:%s, max:%s", i, v, min, max)
}
}
// test that the request is retried after the credentials are expired.
func TestRequestRecoverExpiredCreds(t *testing.T) {
reqNum := 0
reqs := []http.Response{
{StatusCode: 400, Body: body(`{"__type":"ExpiredTokenException","message":"expired token"}`)},
{StatusCode: 200, Body: body(`{"data":"valid"}`)},
}
s := NewService(&Config{MaxRetries: Int(10), Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "")})
s.Handlers.Validate.Clear()
s.Handlers.Unmarshal.PushBack(unmarshal)
s.Handlers.UnmarshalError.PushBack(unmarshalError)
credExpiredBeforeRetry := false
credExpiredAfterRetry := false
s.Handlers.AfterRetry.PushBack(func(r *Request) {
credExpiredAfterRetry = r.Config.Credentials.IsExpired()
})
s.Handlers.Sign.Clear()
s.Handlers.Sign.PushBack(func(r *Request) {
r.Config.Credentials.Get()
})
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.False(t, credExpiredBeforeRetry, "Expect valid creds before retry check")
assert.True(t, credExpiredAfterRetry, "Expect expired creds after retry check")
assert.False(t, s.Config.Credentials.IsExpired(), "Expect valid creds after cred expired recovery")
assert.Equal(t, 1, int(r.RetryCount))
assert.Equal(t, "valid", out.Data)
}

View File

@ -1,194 +0,0 @@
package aws
import (
"fmt"
"math"
"math/rand"
"net/http"
"net/http/httputil"
"regexp"
"time"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/internal/endpoints"
)
// A Service implements the base service request and response handling
// used by all services.
type Service struct {
Config *Config
Handlers Handlers
ServiceName string
APIVersion string
Endpoint string
SigningName string
SigningRegion string
JSONVersion string
TargetPrefix string
RetryRules func(*Request) time.Duration
ShouldRetry func(*Request) bool
DefaultMaxRetries uint
}
var schemeRE = regexp.MustCompile("^([^:]+)://")
// NewService will return a pointer to a new Server object initialized.
func NewService(config *Config) *Service {
svc := &Service{Config: config}
svc.Initialize()
return svc
}
// Initialize initializes the service.
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 !BoolValue(s.Config.DisableParamValidation) {
s.Handlers.Validate.PushBack(ValidateParameters)
}
}
// buildEndpoint builds the endpoint values the service will use to make requests with.
func (s *Service) buildEndpoint() {
if StringValue(s.Config.Endpoint) != "" {
s.Endpoint = *s.Config.Endpoint
} else {
s.Endpoint, s.SigningRegion =
endpoints.EndpointForRegion(s.ServiceName, StringValue(s.Config.Region))
}
if s.Endpoint != "" && !schemeRE.MatchString(s.Endpoint) {
scheme := "https"
if BoolValue(s.Config.DisableSSL) {
scheme = "http"
}
s.Endpoint = scheme + "://" + s.Endpoint
}
}
// AddDebugHandlers injects debug logging handlers into the service to log request
// debug information.
func (s *Service) AddDebugHandlers() {
if !s.Config.LogLevel.AtLeast(LogDebug) {
return
}
s.Handlers.Send.PushFront(logRequest)
s.Handlers.Send.PushBack(logResponse)
}
const logReqMsg = `DEBUG: Request %s/%s Details:
---[ REQUEST POST-SIGN ]-----------------------------
%s
-----------------------------------------------------`
func logRequest(r *Request) {
logBody := r.Config.LogLevel.Matches(LogDebugWithHTTPBody)
dumpedBody, _ := httputil.DumpRequestOut(r.HTTPRequest, logBody)
r.Config.Logger.Log(fmt.Sprintf(logReqMsg, r.ServiceName, r.Operation.Name, string(dumpedBody)))
}
const logRespMsg = `DEBUG: Response %s/%s Details:
---[ RESPONSE ]--------------------------------------
%s
-----------------------------------------------------`
func logResponse(r *Request) {
var msg = "no reponse data"
if r.HTTPResponse != nil {
logBody := r.Config.LogLevel.Matches(LogDebugWithHTTPBody)
dumpedBody, _ := httputil.DumpResponse(r.HTTPResponse, logBody)
msg = string(dumpedBody)
} else if r.Error != nil {
msg = r.Error.Error()
}
r.Config.Logger.Log(fmt.Sprintf(logRespMsg, r.ServiceName, r.Operation.Name, msg))
}
// MaxRetries returns the number of maximum returns the service will use to make
// an individual API request.
func (s *Service) MaxRetries() uint {
if IntValue(s.Config.MaxRetries) < 0 {
return s.DefaultMaxRetries
}
return uint(IntValue(s.Config.MaxRetries))
}
var seededRand = rand.New(rand.NewSource(time.Now().UnixNano()))
// retryRules returns the delay duration before retrying this request again
func retryRules(r *Request) time.Duration {
delay := int(math.Pow(2, float64(r.RetryCount))) * (seededRand.Intn(30) + 30)
return time.Duration(delay) * time.Millisecond
}
// retryableCodes is a collection of service response codes which are retry-able
// without any further action.
var retryableCodes = map[string]struct{}{
"RequestError": {},
"ProvisionedThroughputExceededException": {},
"Throttling": {},
"ThrottlingException": {},
"RequestLimitExceeded": {},
"RequestThrottled": {},
}
// credsExpiredCodes is a collection of error codes which signify the credentials
// need to be refreshed. Expired tokens require refreshing of credentials, and
// resigning before the request can be retried.
var credsExpiredCodes = map[string]struct{}{
"ExpiredToken": {},
"ExpiredTokenException": {},
"RequestExpired": {}, // EC2 Only
}
func isCodeRetryable(code string) bool {
if _, ok := retryableCodes[code]; ok {
return true
}
return isCodeExpiredCreds(code)
}
func isCodeExpiredCreds(code string) bool {
_, ok := credsExpiredCodes[code]
return ok
}
// shouldRetry returns if the request should be retried.
func shouldRetry(r *Request) bool {
if r.HTTPResponse.StatusCode >= 500 {
return true
}
if r.Error != nil {
if err, ok := r.Error.(awserr.Error); ok {
return isCodeRetryable(err.Code())
}
}
return false
}

View File

@ -2,6 +2,7 @@ package aws
import (
"io"
"sync"
)
// ReadSeekCloser wraps a io.Reader returning a ReaderSeakerCloser
@ -53,3 +54,35 @@ func (r ReaderSeekerCloser) Close() error {
}
return nil
}
// A WriteAtBuffer provides a in memory buffer supporting the io.WriterAt interface
// Can be used with the s3manager.Downloader to download content to a buffer
// in memory. Safe to use concurrently.
type WriteAtBuffer struct {
buf []byte
m sync.Mutex
}
// WriteAt writes a slice of bytes to a buffer starting at the position provided
// The number of bytes written will be returned, or error. Can overwrite previous
// written slices if the write ats overlap.
func (b *WriteAtBuffer) WriteAt(p []byte, pos int64) (n int, err error) {
b.m.Lock()
defer b.m.Unlock()
expLen := pos + int64(len(p))
if int64(len(b.buf)) < expLen {
newBuf := make([]byte, expLen)
copy(newBuf, b.buf)
b.buf = newBuf
}
copy(b.buf[pos:], p)
return len(p), nil
}
// Bytes returns a slice of bytes written to the buffer.
func (b *WriteAtBuffer) Bytes() []byte {
b.m.Lock()
defer b.m.Unlock()
return b.buf[:len(b.buf):len(b.buf)]
}

View File

@ -0,0 +1,56 @@
package aws
import (
"math/rand"
"testing"
"github.com/stretchr/testify/assert"
)
func TestWriteAtBuffer(t *testing.T) {
b := &WriteAtBuffer{}
n, err := b.WriteAt([]byte{1}, 0)
assert.NoError(t, err)
assert.Equal(t, 1, n)
n, err = b.WriteAt([]byte{1, 1, 1}, 5)
assert.NoError(t, err)
assert.Equal(t, 3, n)
n, err = b.WriteAt([]byte{2}, 1)
assert.NoError(t, err)
assert.Equal(t, 1, n)
n, err = b.WriteAt([]byte{3}, 2)
assert.NoError(t, err)
assert.Equal(t, 1, n)
assert.Equal(t, []byte{1, 2, 3, 0, 0, 1, 1, 1}, b.Bytes())
}
func BenchmarkWriteAtBuffer(b *testing.B) {
buf := &WriteAtBuffer{}
r := rand.New(rand.NewSource(1))
b.ResetTimer()
for i := 0; i < b.N; i++ {
to := r.Intn(10) * 4096
bs := make([]byte, to)
buf.WriteAt(bs, r.Int63n(10)*4096)
}
}
func BenchmarkWriteAtBufferParallel(b *testing.B) {
buf := &WriteAtBuffer{}
r := rand.New(rand.NewSource(1))
b.ResetTimer()
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
to := r.Intn(10) * 4096
bs := make([]byte, to)
buf.WriteAt(bs, r.Int63n(10)*4096)
}
})
}

View File

@ -5,4 +5,4 @@ package aws
const SDKName = "aws-sdk-go"
// SDKVersion is the version of this SDK
const SDKVersion = "0.7.2"
const SDKVersion = "0.9.0rc1"

View File

@ -6,13 +6,13 @@ package ec2query
import (
"net/url"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/internal/protocol/query/queryutil"
)
// Build builds a request for the EC2 protocol.
func Build(r *aws.Request) {
func Build(r *service.Request) {
body := url.Values{
"Action": {r.Operation.Name},
"Version": {r.Service.APIVersion},

View File

@ -12,6 +12,8 @@ import (
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/defaults"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/internal/protocol/ec2query"
"github.com/aws/aws-sdk-go/internal/protocol/xml/xmlutil"
"github.com/aws/aws-sdk-go/internal/signer/v4"
@ -31,13 +33,13 @@ var _ = url.Values{}
var _ = io.EOF
type InputService1ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService1ProtocolTest client.
func NewInputService1ProtocolTest(config *aws.Config) *InputService1ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice1protocoltest",
APIVersion: "2014-01-01",
}
@ -55,8 +57,8 @@ func NewInputService1ProtocolTest(config *aws.Config) *InputService1ProtocolTest
// 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)
func (c *InputService1ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -64,8 +66,8 @@ func (c *InputService1ProtocolTest) newRequest(op *aws.Operation, params, data i
const opInputService1TestCaseOperation1 = "OperationName"
// InputService1TestCaseOperation1Request generates a request for the InputService1TestCaseOperation1 operation.
func (c *InputService1ProtocolTest) InputService1TestCaseOperation1Request(input *InputService1TestShapeInputShape) (req *aws.Request, output *InputService1TestShapeInputService1TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService1ProtocolTest) InputService1TestCaseOperation1Request(input *InputService1TestShapeInputShape) (req *service.Request, output *InputService1TestShapeInputService1TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService1TestCaseOperation1,
}
@ -106,13 +108,13 @@ type metadataInputService1TestShapeInputShape struct {
}
type InputService2ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService2ProtocolTest client.
func NewInputService2ProtocolTest(config *aws.Config) *InputService2ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice2protocoltest",
APIVersion: "2014-01-01",
}
@ -130,8 +132,8 @@ func NewInputService2ProtocolTest(config *aws.Config) *InputService2ProtocolTest
// 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)
func (c *InputService2ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -139,8 +141,8 @@ func (c *InputService2ProtocolTest) newRequest(op *aws.Operation, params, data i
const opInputService2TestCaseOperation1 = "OperationName"
// InputService2TestCaseOperation1Request generates a request for the InputService2TestCaseOperation1 operation.
func (c *InputService2ProtocolTest) InputService2TestCaseOperation1Request(input *InputService2TestShapeInputShape) (req *aws.Request, output *InputService2TestShapeInputService2TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService2ProtocolTest) InputService2TestCaseOperation1Request(input *InputService2TestShapeInputShape) (req *service.Request, output *InputService2TestShapeInputService2TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService2TestCaseOperation1,
}
@ -183,13 +185,13 @@ type metadataInputService2TestShapeInputShape struct {
}
type InputService3ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService3ProtocolTest client.
func NewInputService3ProtocolTest(config *aws.Config) *InputService3ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice3protocoltest",
APIVersion: "2014-01-01",
}
@ -207,8 +209,8 @@ func NewInputService3ProtocolTest(config *aws.Config) *InputService3ProtocolTest
// 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)
func (c *InputService3ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -216,8 +218,8 @@ func (c *InputService3ProtocolTest) newRequest(op *aws.Operation, params, data i
const opInputService3TestCaseOperation1 = "OperationName"
// InputService3TestCaseOperation1Request generates a request for the InputService3TestCaseOperation1 operation.
func (c *InputService3ProtocolTest) InputService3TestCaseOperation1Request(input *InputService3TestShapeInputShape) (req *aws.Request, output *InputService3TestShapeInputService3TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService3ProtocolTest) InputService3TestCaseOperation1Request(input *InputService3TestShapeInputShape) (req *service.Request, output *InputService3TestShapeInputService3TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService3TestCaseOperation1,
}
@ -266,13 +268,13 @@ type metadataInputService3TestShapeStructType struct {
}
type InputService4ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService4ProtocolTest client.
func NewInputService4ProtocolTest(config *aws.Config) *InputService4ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice4protocoltest",
APIVersion: "2014-01-01",
}
@ -290,8 +292,8 @@ func NewInputService4ProtocolTest(config *aws.Config) *InputService4ProtocolTest
// 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)
func (c *InputService4ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -299,8 +301,8 @@ func (c *InputService4ProtocolTest) newRequest(op *aws.Operation, params, data i
const opInputService4TestCaseOperation1 = "OperationName"
// InputService4TestCaseOperation1Request generates a request for the InputService4TestCaseOperation1 operation.
func (c *InputService4ProtocolTest) InputService4TestCaseOperation1Request(input *InputService4TestShapeInputShape) (req *aws.Request, output *InputService4TestShapeInputService4TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService4ProtocolTest) InputService4TestCaseOperation1Request(input *InputService4TestShapeInputShape) (req *service.Request, output *InputService4TestShapeInputService4TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService4TestCaseOperation1,
}
@ -339,13 +341,13 @@ type metadataInputService4TestShapeInputShape struct {
}
type InputService5ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService5ProtocolTest client.
func NewInputService5ProtocolTest(config *aws.Config) *InputService5ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice5protocoltest",
APIVersion: "2014-01-01",
}
@ -363,8 +365,8 @@ func NewInputService5ProtocolTest(config *aws.Config) *InputService5ProtocolTest
// 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)
func (c *InputService5ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -372,8 +374,8 @@ func (c *InputService5ProtocolTest) newRequest(op *aws.Operation, params, data i
const opInputService5TestCaseOperation1 = "OperationName"
// InputService5TestCaseOperation1Request generates a request for the InputService5TestCaseOperation1 operation.
func (c *InputService5ProtocolTest) InputService5TestCaseOperation1Request(input *InputService5TestShapeInputShape) (req *aws.Request, output *InputService5TestShapeInputService5TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService5ProtocolTest) InputService5TestCaseOperation1Request(input *InputService5TestShapeInputShape) (req *service.Request, output *InputService5TestShapeInputService5TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService5TestCaseOperation1,
}
@ -412,13 +414,13 @@ type metadataInputService5TestShapeInputShape struct {
}
type InputService6ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService6ProtocolTest client.
func NewInputService6ProtocolTest(config *aws.Config) *InputService6ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice6protocoltest",
APIVersion: "2014-01-01",
}
@ -436,8 +438,8 @@ func NewInputService6ProtocolTest(config *aws.Config) *InputService6ProtocolTest
// 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)
func (c *InputService6ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -445,8 +447,8 @@ func (c *InputService6ProtocolTest) newRequest(op *aws.Operation, params, data i
const opInputService6TestCaseOperation1 = "OperationName"
// InputService6TestCaseOperation1Request generates a request for the InputService6TestCaseOperation1 operation.
func (c *InputService6ProtocolTest) InputService6TestCaseOperation1Request(input *InputService6TestShapeInputShape) (req *aws.Request, output *InputService6TestShapeInputService6TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService6ProtocolTest) InputService6TestCaseOperation1Request(input *InputService6TestShapeInputShape) (req *service.Request, output *InputService6TestShapeInputService6TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService6TestCaseOperation1,
}
@ -485,13 +487,13 @@ type metadataInputService6TestShapeInputShape struct {
}
type InputService7ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService7ProtocolTest client.
func NewInputService7ProtocolTest(config *aws.Config) *InputService7ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice7protocoltest",
APIVersion: "2014-01-01",
}
@ -509,8 +511,8 @@ func NewInputService7ProtocolTest(config *aws.Config) *InputService7ProtocolTest
// 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)
func (c *InputService7ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -518,8 +520,8 @@ func (c *InputService7ProtocolTest) newRequest(op *aws.Operation, params, data i
const opInputService7TestCaseOperation1 = "OperationName"
// InputService7TestCaseOperation1Request generates a request for the InputService7TestCaseOperation1 operation.
func (c *InputService7ProtocolTest) InputService7TestCaseOperation1Request(input *InputService7TestShapeInputShape) (req *aws.Request, output *InputService7TestShapeInputService7TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService7ProtocolTest) InputService7TestCaseOperation1Request(input *InputService7TestShapeInputShape) (req *service.Request, output *InputService7TestShapeInputService7TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService7TestCaseOperation1,
}
@ -558,13 +560,13 @@ type metadataInputService7TestShapeInputShape struct {
}
type InputService8ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService8ProtocolTest client.
func NewInputService8ProtocolTest(config *aws.Config) *InputService8ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice8protocoltest",
APIVersion: "2014-01-01",
}
@ -582,8 +584,8 @@ func NewInputService8ProtocolTest(config *aws.Config) *InputService8ProtocolTest
// 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)
func (c *InputService8ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -591,8 +593,8 @@ func (c *InputService8ProtocolTest) newRequest(op *aws.Operation, params, data i
const opInputService8TestCaseOperation1 = "OperationName"
// InputService8TestCaseOperation1Request generates a request for the InputService8TestCaseOperation1 operation.
func (c *InputService8ProtocolTest) InputService8TestCaseOperation1Request(input *InputService8TestShapeInputShape) (req *aws.Request, output *InputService8TestShapeInputService8TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService8ProtocolTest) InputService8TestCaseOperation1Request(input *InputService8TestShapeInputShape) (req *service.Request, output *InputService8TestShapeInputService8TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService8TestCaseOperation1,
}

View File

@ -6,13 +6,13 @@ import (
"encoding/xml"
"io"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/internal/protocol/xml/xmlutil"
)
// Unmarshal unmarshals a response body for the EC2 protocol.
func Unmarshal(r *aws.Request) {
func Unmarshal(r *service.Request) {
defer r.HTTPResponse.Body.Close()
if r.DataFilled() {
decoder := xml.NewDecoder(r.HTTPResponse.Body)
@ -25,7 +25,7 @@ func Unmarshal(r *aws.Request) {
}
// UnmarshalMeta unmarshals response headers for the EC2 protocol.
func UnmarshalMeta(r *aws.Request) {
func UnmarshalMeta(r *service.Request) {
// TODO implement unmarshaling of request IDs
}
@ -37,7 +37,7 @@ type xmlErrorResponse struct {
}
// UnmarshalError unmarshals a response error for the EC2 protocol.
func UnmarshalError(r *aws.Request) {
func UnmarshalError(r *service.Request) {
defer r.HTTPResponse.Body.Close()
resp := &xmlErrorResponse{}

View File

@ -12,6 +12,8 @@ import (
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/defaults"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/internal/protocol/ec2query"
"github.com/aws/aws-sdk-go/internal/protocol/xml/xmlutil"
"github.com/aws/aws-sdk-go/internal/signer/v4"
@ -31,13 +33,13 @@ var _ = url.Values{}
var _ = io.EOF
type OutputService1ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService1ProtocolTest client.
func NewOutputService1ProtocolTest(config *aws.Config) *OutputService1ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice1protocoltest",
APIVersion: "",
}
@ -55,8 +57,8 @@ func NewOutputService1ProtocolTest(config *aws.Config) *OutputService1ProtocolTe
// 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)
func (c *OutputService1ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -64,8 +66,8 @@ func (c *OutputService1ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService1TestCaseOperation1 = "OperationName"
// OutputService1TestCaseOperation1Request generates a request for the OutputService1TestCaseOperation1 operation.
func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1Request(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (req *aws.Request, output *OutputService1TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1Request(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (req *service.Request, output *OutputService1TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService1TestCaseOperation1,
}
@ -118,13 +120,13 @@ type metadataOutputService1TestShapeOutputShape struct {
}
type OutputService2ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService2ProtocolTest client.
func NewOutputService2ProtocolTest(config *aws.Config) *OutputService2ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice2protocoltest",
APIVersion: "",
}
@ -142,8 +144,8 @@ func NewOutputService2ProtocolTest(config *aws.Config) *OutputService2ProtocolTe
// 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)
func (c *OutputService2ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -151,8 +153,8 @@ func (c *OutputService2ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService2TestCaseOperation1 = "OperationName"
// OutputService2TestCaseOperation1Request generates a request for the OutputService2TestCaseOperation1 operation.
func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1Request(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (req *aws.Request, output *OutputService2TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1Request(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (req *service.Request, output *OutputService2TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService2TestCaseOperation1,
}
@ -191,13 +193,13 @@ type metadataOutputService2TestShapeOutputShape struct {
}
type OutputService3ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService3ProtocolTest client.
func NewOutputService3ProtocolTest(config *aws.Config) *OutputService3ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice3protocoltest",
APIVersion: "",
}
@ -215,8 +217,8 @@ func NewOutputService3ProtocolTest(config *aws.Config) *OutputService3ProtocolTe
// 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)
func (c *OutputService3ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -224,8 +226,8 @@ func (c *OutputService3ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService3TestCaseOperation1 = "OperationName"
// OutputService3TestCaseOperation1Request generates a request for the OutputService3TestCaseOperation1 operation.
func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1Request(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (req *aws.Request, output *OutputService3TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1Request(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (req *service.Request, output *OutputService3TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService3TestCaseOperation1,
}
@ -264,13 +266,13 @@ type metadataOutputService3TestShapeOutputShape struct {
}
type OutputService4ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService4ProtocolTest client.
func NewOutputService4ProtocolTest(config *aws.Config) *OutputService4ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice4protocoltest",
APIVersion: "",
}
@ -288,8 +290,8 @@ func NewOutputService4ProtocolTest(config *aws.Config) *OutputService4ProtocolTe
// 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)
func (c *OutputService4ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -297,8 +299,8 @@ func (c *OutputService4ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService4TestCaseOperation1 = "OperationName"
// OutputService4TestCaseOperation1Request generates a request for the OutputService4TestCaseOperation1 operation.
func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1Request(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (req *aws.Request, output *OutputService4TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1Request(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (req *service.Request, output *OutputService4TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService4TestCaseOperation1,
}
@ -337,13 +339,13 @@ type metadataOutputService4TestShapeOutputShape struct {
}
type OutputService5ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService5ProtocolTest client.
func NewOutputService5ProtocolTest(config *aws.Config) *OutputService5ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice5protocoltest",
APIVersion: "",
}
@ -361,8 +363,8 @@ func NewOutputService5ProtocolTest(config *aws.Config) *OutputService5ProtocolTe
// 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)
func (c *OutputService5ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -370,8 +372,8 @@ func (c *OutputService5ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService5TestCaseOperation1 = "OperationName"
// OutputService5TestCaseOperation1Request generates a request for the OutputService5TestCaseOperation1 operation.
func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1Request(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (req *aws.Request, output *OutputService5TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1Request(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (req *service.Request, output *OutputService5TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService5TestCaseOperation1,
}
@ -410,13 +412,13 @@ type metadataOutputService5TestShapeOutputShape struct {
}
type OutputService6ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService6ProtocolTest client.
func NewOutputService6ProtocolTest(config *aws.Config) *OutputService6ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice6protocoltest",
APIVersion: "",
}
@ -434,8 +436,8 @@ func NewOutputService6ProtocolTest(config *aws.Config) *OutputService6ProtocolTe
// 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)
func (c *OutputService6ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -443,8 +445,8 @@ func (c *OutputService6ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService6TestCaseOperation1 = "OperationName"
// OutputService6TestCaseOperation1Request generates a request for the OutputService6TestCaseOperation1 operation.
func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1Request(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (req *aws.Request, output *OutputService6TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1Request(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (req *service.Request, output *OutputService6TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService6TestCaseOperation1,
}
@ -493,13 +495,13 @@ type metadataOutputService6TestShapeStructureType struct {
}
type OutputService7ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService7ProtocolTest client.
func NewOutputService7ProtocolTest(config *aws.Config) *OutputService7ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice7protocoltest",
APIVersion: "",
}
@ -517,8 +519,8 @@ func NewOutputService7ProtocolTest(config *aws.Config) *OutputService7ProtocolTe
// 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)
func (c *OutputService7ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -526,8 +528,8 @@ func (c *OutputService7ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService7TestCaseOperation1 = "OperationName"
// OutputService7TestCaseOperation1Request generates a request for the OutputService7TestCaseOperation1 operation.
func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1Request(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (req *aws.Request, output *OutputService7TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1Request(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (req *service.Request, output *OutputService7TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService7TestCaseOperation1,
}
@ -566,13 +568,13 @@ type metadataOutputService7TestShapeOutputShape struct {
}
type OutputService8ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService8ProtocolTest client.
func NewOutputService8ProtocolTest(config *aws.Config) *OutputService8ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice8protocoltest",
APIVersion: "",
}
@ -590,8 +592,8 @@ func NewOutputService8ProtocolTest(config *aws.Config) *OutputService8ProtocolTe
// 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)
func (c *OutputService8ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -599,8 +601,8 @@ func (c *OutputService8ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService8TestCaseOperation1 = "OperationName"
// OutputService8TestCaseOperation1Request generates a request for the OutputService8TestCaseOperation1 operation.
func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1Request(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (req *aws.Request, output *OutputService8TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1Request(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (req *service.Request, output *OutputService8TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService8TestCaseOperation1,
}

View File

@ -6,13 +6,13 @@ package query
import (
"net/url"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/internal/protocol/query/queryutil"
)
// Build builds a request for an AWS Query service.
func Build(r *aws.Request) {
func Build(r *service.Request) {
body := url.Values{
"Action": {r.Operation.Name},
"Version": {r.Service.APIVersion},

View File

@ -12,6 +12,8 @@ import (
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/defaults"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/internal/protocol/query"
"github.com/aws/aws-sdk-go/internal/protocol/xml/xmlutil"
"github.com/aws/aws-sdk-go/internal/signer/v4"
@ -31,13 +33,13 @@ var _ = url.Values{}
var _ = io.EOF
type InputService1ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService1ProtocolTest client.
func NewInputService1ProtocolTest(config *aws.Config) *InputService1ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice1protocoltest",
APIVersion: "2014-01-01",
}
@ -55,8 +57,8 @@ func NewInputService1ProtocolTest(config *aws.Config) *InputService1ProtocolTest
// 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)
func (c *InputService1ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -64,8 +66,8 @@ func (c *InputService1ProtocolTest) newRequest(op *aws.Operation, params, data i
const opInputService1TestCaseOperation1 = "OperationName"
// InputService1TestCaseOperation1Request generates a request for the InputService1TestCaseOperation1 operation.
func (c *InputService1ProtocolTest) InputService1TestCaseOperation1Request(input *InputService1TestShapeInputShape) (req *aws.Request, output *InputService1TestShapeInputService1TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService1ProtocolTest) InputService1TestCaseOperation1Request(input *InputService1TestShapeInputShape) (req *service.Request, output *InputService1TestShapeInputService1TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService1TestCaseOperation1,
}
@ -106,13 +108,13 @@ type metadataInputService1TestShapeInputShape struct {
}
type InputService2ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService2ProtocolTest client.
func NewInputService2ProtocolTest(config *aws.Config) *InputService2ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice2protocoltest",
APIVersion: "2014-01-01",
}
@ -130,8 +132,8 @@ func NewInputService2ProtocolTest(config *aws.Config) *InputService2ProtocolTest
// 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)
func (c *InputService2ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -139,8 +141,8 @@ func (c *InputService2ProtocolTest) newRequest(op *aws.Operation, params, data i
const opInputService2TestCaseOperation1 = "OperationName"
// InputService2TestCaseOperation1Request generates a request for the InputService2TestCaseOperation1 operation.
func (c *InputService2ProtocolTest) InputService2TestCaseOperation1Request(input *InputService2TestShapeInputShape) (req *aws.Request, output *InputService2TestShapeInputService2TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService2ProtocolTest) InputService2TestCaseOperation1Request(input *InputService2TestShapeInputShape) (req *service.Request, output *InputService2TestShapeInputService2TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService2TestCaseOperation1,
}
@ -189,13 +191,13 @@ type metadataInputService2TestShapeStructType struct {
}
type InputService3ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService3ProtocolTest client.
func NewInputService3ProtocolTest(config *aws.Config) *InputService3ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice3protocoltest",
APIVersion: "2014-01-01",
}
@ -213,8 +215,8 @@ func NewInputService3ProtocolTest(config *aws.Config) *InputService3ProtocolTest
// 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)
func (c *InputService3ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -222,8 +224,8 @@ func (c *InputService3ProtocolTest) newRequest(op *aws.Operation, params, data i
const opInputService3TestCaseOperation1 = "OperationName"
// InputService3TestCaseOperation1Request generates a request for the InputService3TestCaseOperation1 operation.
func (c *InputService3ProtocolTest) InputService3TestCaseOperation1Request(input *InputService3TestShapeInputShape) (req *aws.Request, output *InputService3TestShapeInputService3TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService3ProtocolTest) InputService3TestCaseOperation1Request(input *InputService3TestShapeInputShape) (req *service.Request, output *InputService3TestShapeInputService3TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService3TestCaseOperation1,
}
@ -246,8 +248,8 @@ func (c *InputService3ProtocolTest) InputService3TestCaseOperation1(input *Input
const opInputService3TestCaseOperation2 = "OperationName"
// InputService3TestCaseOperation2Request generates a request for the InputService3TestCaseOperation2 operation.
func (c *InputService3ProtocolTest) InputService3TestCaseOperation2Request(input *InputService3TestShapeInputShape) (req *aws.Request, output *InputService3TestShapeInputService3TestCaseOperation2Output) {
op := &aws.Operation{
func (c *InputService3ProtocolTest) InputService3TestCaseOperation2Request(input *InputService3TestShapeInputShape) (req *service.Request, output *InputService3TestShapeInputService3TestCaseOperation2Output) {
op := &service.Operation{
Name: opInputService3TestCaseOperation2,
}
@ -294,13 +296,13 @@ type metadataInputService3TestShapeInputShape struct {
}
type InputService4ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService4ProtocolTest client.
func NewInputService4ProtocolTest(config *aws.Config) *InputService4ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice4protocoltest",
APIVersion: "2014-01-01",
}
@ -318,8 +320,8 @@ func NewInputService4ProtocolTest(config *aws.Config) *InputService4ProtocolTest
// 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)
func (c *InputService4ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -327,8 +329,8 @@ func (c *InputService4ProtocolTest) newRequest(op *aws.Operation, params, data i
const opInputService4TestCaseOperation1 = "OperationName"
// InputService4TestCaseOperation1Request generates a request for the InputService4TestCaseOperation1 operation.
func (c *InputService4ProtocolTest) InputService4TestCaseOperation1Request(input *InputService4TestShapeInputShape) (req *aws.Request, output *InputService4TestShapeInputService4TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService4ProtocolTest) InputService4TestCaseOperation1Request(input *InputService4TestShapeInputShape) (req *service.Request, output *InputService4TestShapeInputService4TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService4TestCaseOperation1,
}
@ -351,8 +353,8 @@ func (c *InputService4ProtocolTest) InputService4TestCaseOperation1(input *Input
const opInputService4TestCaseOperation2 = "OperationName"
// InputService4TestCaseOperation2Request generates a request for the InputService4TestCaseOperation2 operation.
func (c *InputService4ProtocolTest) InputService4TestCaseOperation2Request(input *InputService4TestShapeInputShape) (req *aws.Request, output *InputService4TestShapeInputService4TestCaseOperation2Output) {
op := &aws.Operation{
func (c *InputService4ProtocolTest) InputService4TestCaseOperation2Request(input *InputService4TestShapeInputShape) (req *service.Request, output *InputService4TestShapeInputService4TestCaseOperation2Output) {
op := &service.Operation{
Name: opInputService4TestCaseOperation2,
}
@ -401,13 +403,13 @@ type metadataInputService4TestShapeInputShape struct {
}
type InputService5ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService5ProtocolTest client.
func NewInputService5ProtocolTest(config *aws.Config) *InputService5ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice5protocoltest",
APIVersion: "2014-01-01",
}
@ -425,8 +427,8 @@ func NewInputService5ProtocolTest(config *aws.Config) *InputService5ProtocolTest
// 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)
func (c *InputService5ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -434,8 +436,8 @@ func (c *InputService5ProtocolTest) newRequest(op *aws.Operation, params, data i
const opInputService5TestCaseOperation1 = "OperationName"
// InputService5TestCaseOperation1Request generates a request for the InputService5TestCaseOperation1 operation.
func (c *InputService5ProtocolTest) InputService5TestCaseOperation1Request(input *InputService5TestShapeInputShape) (req *aws.Request, output *InputService5TestShapeInputService5TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService5ProtocolTest) InputService5TestCaseOperation1Request(input *InputService5TestShapeInputShape) (req *service.Request, output *InputService5TestShapeInputService5TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService5TestCaseOperation1,
}
@ -458,8 +460,8 @@ func (c *InputService5ProtocolTest) InputService5TestCaseOperation1(input *Input
const opInputService5TestCaseOperation2 = "OperationName"
// InputService5TestCaseOperation2Request generates a request for the InputService5TestCaseOperation2 operation.
func (c *InputService5ProtocolTest) InputService5TestCaseOperation2Request(input *InputService5TestShapeInputShape) (req *aws.Request, output *InputService5TestShapeInputService5TestCaseOperation2Output) {
op := &aws.Operation{
func (c *InputService5ProtocolTest) InputService5TestCaseOperation2Request(input *InputService5TestShapeInputShape) (req *service.Request, output *InputService5TestShapeInputService5TestCaseOperation2Output) {
op := &service.Operation{
Name: opInputService5TestCaseOperation2,
}
@ -506,13 +508,13 @@ type metadataInputService5TestShapeInputShape struct {
}
type InputService6ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService6ProtocolTest client.
func NewInputService6ProtocolTest(config *aws.Config) *InputService6ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice6protocoltest",
APIVersion: "2014-01-01",
}
@ -530,8 +532,8 @@ func NewInputService6ProtocolTest(config *aws.Config) *InputService6ProtocolTest
// 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)
func (c *InputService6ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -539,8 +541,8 @@ func (c *InputService6ProtocolTest) newRequest(op *aws.Operation, params, data i
const opInputService6TestCaseOperation1 = "OperationName"
// InputService6TestCaseOperation1Request generates a request for the InputService6TestCaseOperation1 operation.
func (c *InputService6ProtocolTest) InputService6TestCaseOperation1Request(input *InputService6TestShapeInputShape) (req *aws.Request, output *InputService6TestShapeInputService6TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService6ProtocolTest) InputService6TestCaseOperation1Request(input *InputService6TestShapeInputShape) (req *service.Request, output *InputService6TestShapeInputService6TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService6TestCaseOperation1,
}
@ -579,13 +581,13 @@ type metadataInputService6TestShapeInputShape struct {
}
type InputService7ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService7ProtocolTest client.
func NewInputService7ProtocolTest(config *aws.Config) *InputService7ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice7protocoltest",
APIVersion: "2014-01-01",
}
@ -603,8 +605,8 @@ func NewInputService7ProtocolTest(config *aws.Config) *InputService7ProtocolTest
// 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)
func (c *InputService7ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -612,8 +614,8 @@ func (c *InputService7ProtocolTest) newRequest(op *aws.Operation, params, data i
const opInputService7TestCaseOperation1 = "OperationName"
// InputService7TestCaseOperation1Request generates a request for the InputService7TestCaseOperation1 operation.
func (c *InputService7ProtocolTest) InputService7TestCaseOperation1Request(input *InputService7TestShapeInputShape) (req *aws.Request, output *InputService7TestShapeInputService7TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService7ProtocolTest) InputService7TestCaseOperation1Request(input *InputService7TestShapeInputShape) (req *service.Request, output *InputService7TestShapeInputService7TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService7TestCaseOperation1,
}
@ -652,13 +654,13 @@ type metadataInputService7TestShapeInputShape struct {
}
type InputService8ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService8ProtocolTest client.
func NewInputService8ProtocolTest(config *aws.Config) *InputService8ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice8protocoltest",
APIVersion: "2014-01-01",
}
@ -676,8 +678,8 @@ func NewInputService8ProtocolTest(config *aws.Config) *InputService8ProtocolTest
// 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)
func (c *InputService8ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -685,8 +687,8 @@ func (c *InputService8ProtocolTest) newRequest(op *aws.Operation, params, data i
const opInputService8TestCaseOperation1 = "OperationName"
// InputService8TestCaseOperation1Request generates a request for the InputService8TestCaseOperation1 operation.
func (c *InputService8ProtocolTest) InputService8TestCaseOperation1Request(input *InputService8TestShapeInputShape) (req *aws.Request, output *InputService8TestShapeInputService8TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService8ProtocolTest) InputService8TestCaseOperation1Request(input *InputService8TestShapeInputShape) (req *service.Request, output *InputService8TestShapeInputService8TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService8TestCaseOperation1,
}
@ -725,13 +727,13 @@ type metadataInputService8TestShapeInputShape struct {
}
type InputService9ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService9ProtocolTest client.
func NewInputService9ProtocolTest(config *aws.Config) *InputService9ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice9protocoltest",
APIVersion: "2014-01-01",
}
@ -749,8 +751,8 @@ func NewInputService9ProtocolTest(config *aws.Config) *InputService9ProtocolTest
// 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)
func (c *InputService9ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -758,8 +760,8 @@ func (c *InputService9ProtocolTest) newRequest(op *aws.Operation, params, data i
const opInputService9TestCaseOperation1 = "OperationName"
// InputService9TestCaseOperation1Request generates a request for the InputService9TestCaseOperation1 operation.
func (c *InputService9ProtocolTest) InputService9TestCaseOperation1Request(input *InputService9TestShapeInputShape) (req *aws.Request, output *InputService9TestShapeInputService9TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService9ProtocolTest) InputService9TestCaseOperation1Request(input *InputService9TestShapeInputShape) (req *service.Request, output *InputService9TestShapeInputService9TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService9TestCaseOperation1,
}
@ -782,8 +784,8 @@ func (c *InputService9ProtocolTest) InputService9TestCaseOperation1(input *Input
const opInputService9TestCaseOperation2 = "OperationName"
// InputService9TestCaseOperation2Request generates a request for the InputService9TestCaseOperation2 operation.
func (c *InputService9ProtocolTest) InputService9TestCaseOperation2Request(input *InputService9TestShapeInputShape) (req *aws.Request, output *InputService9TestShapeInputService9TestCaseOperation2Output) {
op := &aws.Operation{
func (c *InputService9ProtocolTest) InputService9TestCaseOperation2Request(input *InputService9TestShapeInputShape) (req *service.Request, output *InputService9TestShapeInputService9TestCaseOperation2Output) {
op := &service.Operation{
Name: opInputService9TestCaseOperation2,
}
@ -806,8 +808,8 @@ func (c *InputService9ProtocolTest) InputService9TestCaseOperation2(input *Input
const opInputService9TestCaseOperation3 = "OperationName"
// InputService9TestCaseOperation3Request generates a request for the InputService9TestCaseOperation3 operation.
func (c *InputService9ProtocolTest) InputService9TestCaseOperation3Request(input *InputService9TestShapeInputShape) (req *aws.Request, output *InputService9TestShapeInputService9TestCaseOperation3Output) {
op := &aws.Operation{
func (c *InputService9ProtocolTest) InputService9TestCaseOperation3Request(input *InputService9TestShapeInputShape) (req *service.Request, output *InputService9TestShapeInputService9TestCaseOperation3Output) {
op := &service.Operation{
Name: opInputService9TestCaseOperation3,
}
@ -830,8 +832,8 @@ func (c *InputService9ProtocolTest) InputService9TestCaseOperation3(input *Input
const opInputService9TestCaseOperation4 = "OperationName"
// InputService9TestCaseOperation4Request generates a request for the InputService9TestCaseOperation4 operation.
func (c *InputService9ProtocolTest) InputService9TestCaseOperation4Request(input *InputService9TestShapeInputShape) (req *aws.Request, output *InputService9TestShapeInputService9TestCaseOperation4Output) {
op := &aws.Operation{
func (c *InputService9ProtocolTest) InputService9TestCaseOperation4Request(input *InputService9TestShapeInputShape) (req *service.Request, output *InputService9TestShapeInputService9TestCaseOperation4Output) {
op := &service.Operation{
Name: opInputService9TestCaseOperation4,
}
@ -854,8 +856,8 @@ func (c *InputService9ProtocolTest) InputService9TestCaseOperation4(input *Input
const opInputService9TestCaseOperation5 = "OperationName"
// InputService9TestCaseOperation5Request generates a request for the InputService9TestCaseOperation5 operation.
func (c *InputService9ProtocolTest) InputService9TestCaseOperation5Request(input *InputService9TestShapeInputShape) (req *aws.Request, output *InputService9TestShapeInputService9TestCaseOperation5Output) {
op := &aws.Operation{
func (c *InputService9ProtocolTest) InputService9TestCaseOperation5Request(input *InputService9TestShapeInputShape) (req *service.Request, output *InputService9TestShapeInputService9TestCaseOperation5Output) {
op := &service.Operation{
Name: opInputService9TestCaseOperation5,
}
@ -878,8 +880,8 @@ func (c *InputService9ProtocolTest) InputService9TestCaseOperation5(input *Input
const opInputService9TestCaseOperation6 = "OperationName"
// InputService9TestCaseOperation6Request generates a request for the InputService9TestCaseOperation6 operation.
func (c *InputService9ProtocolTest) InputService9TestCaseOperation6Request(input *InputService9TestShapeInputShape) (req *aws.Request, output *InputService9TestShapeInputService9TestCaseOperation6Output) {
op := &aws.Operation{
func (c *InputService9ProtocolTest) InputService9TestCaseOperation6Request(input *InputService9TestShapeInputShape) (req *service.Request, output *InputService9TestShapeInputService9TestCaseOperation6Output) {
op := &service.Operation{
Name: opInputService9TestCaseOperation6,
}

View File

@ -5,13 +5,13 @@ package query
import (
"encoding/xml"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/internal/protocol/xml/xmlutil"
)
// Unmarshal unmarshals a response for an AWS Query service.
func Unmarshal(r *aws.Request) {
func Unmarshal(r *service.Request) {
defer r.HTTPResponse.Body.Close()
if r.DataFilled() {
decoder := xml.NewDecoder(r.HTTPResponse.Body)
@ -24,6 +24,6 @@ func Unmarshal(r *aws.Request) {
}
// UnmarshalMeta unmarshals header response values for an AWS Query service.
func UnmarshalMeta(r *aws.Request) {
func UnmarshalMeta(r *service.Request) {
// TODO implement unmarshaling of request IDs
}

View File

@ -4,8 +4,8 @@ import (
"encoding/xml"
"io"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/service"
)
type xmlErrorResponse struct {
@ -16,7 +16,7 @@ type xmlErrorResponse struct {
}
// UnmarshalError unmarshals an error response for an AWS Query service.
func UnmarshalError(r *aws.Request) {
func UnmarshalError(r *service.Request) {
defer r.HTTPResponse.Body.Close()
resp := &xmlErrorResponse{}

View File

@ -12,6 +12,8 @@ import (
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/defaults"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/internal/protocol/query"
"github.com/aws/aws-sdk-go/internal/protocol/xml/xmlutil"
"github.com/aws/aws-sdk-go/internal/signer/v4"
@ -31,13 +33,13 @@ var _ = url.Values{}
var _ = io.EOF
type OutputService1ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService1ProtocolTest client.
func NewOutputService1ProtocolTest(config *aws.Config) *OutputService1ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice1protocoltest",
APIVersion: "",
}
@ -55,8 +57,8 @@ func NewOutputService1ProtocolTest(config *aws.Config) *OutputService1ProtocolTe
// 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)
func (c *OutputService1ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -64,8 +66,8 @@ func (c *OutputService1ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService1TestCaseOperation1 = "OperationName"
// OutputService1TestCaseOperation1Request generates a request for the OutputService1TestCaseOperation1 operation.
func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1Request(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (req *aws.Request, output *OutputService1TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1Request(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (req *service.Request, output *OutputService1TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService1TestCaseOperation1,
}
@ -120,13 +122,13 @@ type metadataOutputService1TestShapeOutputShape struct {
}
type OutputService2ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService2ProtocolTest client.
func NewOutputService2ProtocolTest(config *aws.Config) *OutputService2ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice2protocoltest",
APIVersion: "",
}
@ -144,8 +146,8 @@ func NewOutputService2ProtocolTest(config *aws.Config) *OutputService2ProtocolTe
// 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)
func (c *OutputService2ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -153,8 +155,8 @@ func (c *OutputService2ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService2TestCaseOperation1 = "OperationName"
// OutputService2TestCaseOperation1Request generates a request for the OutputService2TestCaseOperation1 operation.
func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1Request(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (req *aws.Request, output *OutputService2TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1Request(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (req *service.Request, output *OutputService2TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService2TestCaseOperation1,
}
@ -195,13 +197,13 @@ type metadataOutputService2TestShapeOutputShape struct {
}
type OutputService3ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService3ProtocolTest client.
func NewOutputService3ProtocolTest(config *aws.Config) *OutputService3ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice3protocoltest",
APIVersion: "",
}
@ -219,8 +221,8 @@ func NewOutputService3ProtocolTest(config *aws.Config) *OutputService3ProtocolTe
// 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)
func (c *OutputService3ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -228,8 +230,8 @@ func (c *OutputService3ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService3TestCaseOperation1 = "OperationName"
// OutputService3TestCaseOperation1Request generates a request for the OutputService3TestCaseOperation1 operation.
func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1Request(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (req *aws.Request, output *OutputService3TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1Request(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (req *service.Request, output *OutputService3TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService3TestCaseOperation1,
}
@ -268,13 +270,13 @@ type metadataOutputService3TestShapeOutputShape struct {
}
type OutputService4ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService4ProtocolTest client.
func NewOutputService4ProtocolTest(config *aws.Config) *OutputService4ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice4protocoltest",
APIVersion: "",
}
@ -292,8 +294,8 @@ func NewOutputService4ProtocolTest(config *aws.Config) *OutputService4ProtocolTe
// 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)
func (c *OutputService4ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -301,8 +303,8 @@ func (c *OutputService4ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService4TestCaseOperation1 = "OperationName"
// OutputService4TestCaseOperation1Request generates a request for the OutputService4TestCaseOperation1 operation.
func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1Request(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (req *aws.Request, output *OutputService4TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1Request(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (req *service.Request, output *OutputService4TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService4TestCaseOperation1,
}
@ -341,13 +343,13 @@ type metadataOutputService4TestShapeOutputShape struct {
}
type OutputService5ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService5ProtocolTest client.
func NewOutputService5ProtocolTest(config *aws.Config) *OutputService5ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice5protocoltest",
APIVersion: "",
}
@ -365,8 +367,8 @@ func NewOutputService5ProtocolTest(config *aws.Config) *OutputService5ProtocolTe
// 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)
func (c *OutputService5ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -374,8 +376,8 @@ func (c *OutputService5ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService5TestCaseOperation1 = "OperationName"
// OutputService5TestCaseOperation1Request generates a request for the OutputService5TestCaseOperation1 operation.
func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1Request(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (req *aws.Request, output *OutputService5TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1Request(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (req *service.Request, output *OutputService5TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService5TestCaseOperation1,
}
@ -414,13 +416,13 @@ type metadataOutputService5TestShapeOutputShape struct {
}
type OutputService6ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService6ProtocolTest client.
func NewOutputService6ProtocolTest(config *aws.Config) *OutputService6ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice6protocoltest",
APIVersion: "",
}
@ -438,8 +440,8 @@ func NewOutputService6ProtocolTest(config *aws.Config) *OutputService6ProtocolTe
// 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)
func (c *OutputService6ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -447,8 +449,8 @@ func (c *OutputService6ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService6TestCaseOperation1 = "OperationName"
// OutputService6TestCaseOperation1Request generates a request for the OutputService6TestCaseOperation1 operation.
func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1Request(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (req *aws.Request, output *OutputService6TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1Request(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (req *service.Request, output *OutputService6TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService6TestCaseOperation1,
}
@ -487,13 +489,13 @@ type metadataOutputService6TestShapeOutputShape struct {
}
type OutputService7ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService7ProtocolTest client.
func NewOutputService7ProtocolTest(config *aws.Config) *OutputService7ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice7protocoltest",
APIVersion: "",
}
@ -511,8 +513,8 @@ func NewOutputService7ProtocolTest(config *aws.Config) *OutputService7ProtocolTe
// 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)
func (c *OutputService7ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -520,8 +522,8 @@ func (c *OutputService7ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService7TestCaseOperation1 = "OperationName"
// OutputService7TestCaseOperation1Request generates a request for the OutputService7TestCaseOperation1 operation.
func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1Request(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (req *aws.Request, output *OutputService7TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1Request(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (req *service.Request, output *OutputService7TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService7TestCaseOperation1,
}
@ -560,13 +562,13 @@ type metadataOutputService7TestShapeOutputShape struct {
}
type OutputService8ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService8ProtocolTest client.
func NewOutputService8ProtocolTest(config *aws.Config) *OutputService8ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice8protocoltest",
APIVersion: "",
}
@ -584,8 +586,8 @@ func NewOutputService8ProtocolTest(config *aws.Config) *OutputService8ProtocolTe
// 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)
func (c *OutputService8ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -593,8 +595,8 @@ func (c *OutputService8ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService8TestCaseOperation1 = "OperationName"
// OutputService8TestCaseOperation1Request generates a request for the OutputService8TestCaseOperation1 operation.
func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1Request(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (req *aws.Request, output *OutputService8TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1Request(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (req *service.Request, output *OutputService8TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService8TestCaseOperation1,
}
@ -647,13 +649,13 @@ type metadataOutputService8TestShapeStructureShape struct {
}
type OutputService9ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService9ProtocolTest client.
func NewOutputService9ProtocolTest(config *aws.Config) *OutputService9ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice9protocoltest",
APIVersion: "",
}
@ -671,8 +673,8 @@ func NewOutputService9ProtocolTest(config *aws.Config) *OutputService9ProtocolTe
// 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)
func (c *OutputService9ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -680,8 +682,8 @@ func (c *OutputService9ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService9TestCaseOperation1 = "OperationName"
// OutputService9TestCaseOperation1Request generates a request for the OutputService9TestCaseOperation1 operation.
func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1Request(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (req *aws.Request, output *OutputService9TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1Request(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (req *service.Request, output *OutputService9TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService9TestCaseOperation1,
}
@ -734,13 +736,13 @@ type metadataOutputService9TestShapeStructureShape struct {
}
type OutputService10ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService10ProtocolTest client.
func NewOutputService10ProtocolTest(config *aws.Config) *OutputService10ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice10protocoltest",
APIVersion: "",
}
@ -758,8 +760,8 @@ func NewOutputService10ProtocolTest(config *aws.Config) *OutputService10Protocol
// 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)
func (c *OutputService10ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -767,8 +769,8 @@ func (c *OutputService10ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService10TestCaseOperation1 = "OperationName"
// OutputService10TestCaseOperation1Request generates a request for the OutputService10TestCaseOperation1 operation.
func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1Request(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (req *aws.Request, output *OutputService10TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1Request(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (req *service.Request, output *OutputService10TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService10TestCaseOperation1,
}
@ -807,13 +809,13 @@ type metadataOutputService10TestShapeOutputShape struct {
}
type OutputService11ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService11ProtocolTest client.
func NewOutputService11ProtocolTest(config *aws.Config) *OutputService11ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice11protocoltest",
APIVersion: "",
}
@ -831,8 +833,8 @@ func NewOutputService11ProtocolTest(config *aws.Config) *OutputService11Protocol
// 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)
func (c *OutputService11ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -840,8 +842,8 @@ func (c *OutputService11ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService11TestCaseOperation1 = "OperationName"
// OutputService11TestCaseOperation1Request generates a request for the OutputService11TestCaseOperation1 operation.
func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1Request(input *OutputService11TestShapeOutputService11TestCaseOperation1Input) (req *aws.Request, output *OutputService11TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1Request(input *OutputService11TestShapeOutputService11TestCaseOperation1Input) (req *service.Request, output *OutputService11TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService11TestCaseOperation1,
}
@ -890,13 +892,13 @@ type metadataOutputService11TestShapeStructType struct {
}
type OutputService12ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService12ProtocolTest client.
func NewOutputService12ProtocolTest(config *aws.Config) *OutputService12ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice12protocoltest",
APIVersion: "",
}
@ -914,8 +916,8 @@ func NewOutputService12ProtocolTest(config *aws.Config) *OutputService12Protocol
// 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)
func (c *OutputService12ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -923,8 +925,8 @@ func (c *OutputService12ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService12TestCaseOperation1 = "OperationName"
// OutputService12TestCaseOperation1Request generates a request for the OutputService12TestCaseOperation1 operation.
func (c *OutputService12ProtocolTest) OutputService12TestCaseOperation1Request(input *OutputService12TestShapeOutputService12TestCaseOperation1Input) (req *aws.Request, output *OutputService12TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService12ProtocolTest) OutputService12TestCaseOperation1Request(input *OutputService12TestShapeOutputService12TestCaseOperation1Input) (req *service.Request, output *OutputService12TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService12TestCaseOperation1,
}
@ -963,13 +965,13 @@ type metadataOutputService12TestShapeOutputShape struct {
}
type OutputService13ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService13ProtocolTest client.
func NewOutputService13ProtocolTest(config *aws.Config) *OutputService13ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice13protocoltest",
APIVersion: "",
}
@ -987,8 +989,8 @@ func NewOutputService13ProtocolTest(config *aws.Config) *OutputService13Protocol
// 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)
func (c *OutputService13ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -996,8 +998,8 @@ func (c *OutputService13ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService13TestCaseOperation1 = "OperationName"
// OutputService13TestCaseOperation1Request generates a request for the OutputService13TestCaseOperation1 operation.
func (c *OutputService13ProtocolTest) OutputService13TestCaseOperation1Request(input *OutputService13TestShapeOutputService13TestCaseOperation1Input) (req *aws.Request, output *OutputService13TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService13ProtocolTest) OutputService13TestCaseOperation1Request(input *OutputService13TestShapeOutputService13TestCaseOperation1Input) (req *service.Request, output *OutputService13TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService13TestCaseOperation1,
}
@ -1036,13 +1038,13 @@ type metadataOutputService13TestShapeOutputShape struct {
}
type OutputService14ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService14ProtocolTest client.
func NewOutputService14ProtocolTest(config *aws.Config) *OutputService14ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice14protocoltest",
APIVersion: "",
}
@ -1060,8 +1062,8 @@ func NewOutputService14ProtocolTest(config *aws.Config) *OutputService14Protocol
// 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)
func (c *OutputService14ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -1069,8 +1071,8 @@ func (c *OutputService14ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService14TestCaseOperation1 = "OperationName"
// OutputService14TestCaseOperation1Request generates a request for the OutputService14TestCaseOperation1 operation.
func (c *OutputService14ProtocolTest) OutputService14TestCaseOperation1Request(input *OutputService14TestShapeOutputService14TestCaseOperation1Input) (req *aws.Request, output *OutputService14TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService14ProtocolTest) OutputService14TestCaseOperation1Request(input *OutputService14TestShapeOutputService14TestCaseOperation1Input) (req *service.Request, output *OutputService14TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService14TestCaseOperation1,
}

View File

@ -1,4 +1,4 @@
// Package rest provides RESTful serialisation of AWS requests and responses.
// Package rest provides RESTful serialization of AWS requests and responses.
package rest
import (
@ -13,8 +13,8 @@ import (
"strings"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/service"
)
// RFC822 returns an RFC822 formatted timestamp for AWS protocols
@ -37,7 +37,7 @@ func init() {
}
// Build builds the REST component of a service request.
func Build(r *aws.Request) {
func Build(r *service.Request) {
if r.ParamsFilled() {
v := reflect.ValueOf(r.Params).Elem()
buildLocationElements(r, v)
@ -45,7 +45,7 @@ func Build(r *aws.Request) {
}
}
func buildLocationElements(r *aws.Request, v reflect.Value) {
func buildLocationElements(r *service.Request, v reflect.Value) {
query := r.HTTPRequest.URL.Query()
for i := 0; i < v.NumField(); i++ {
@ -87,7 +87,7 @@ func buildLocationElements(r *aws.Request, v reflect.Value) {
updatePath(r.HTTPRequest.URL, r.HTTPRequest.URL.Path)
}
func buildBody(r *aws.Request, v reflect.Value) {
func buildBody(r *service.Request, v reflect.Value) {
if field, ok := v.Type().FieldByName("SDKShapeTraits"); ok {
if payloadName := field.Tag.Get("payload"); payloadName != "" {
pfield, _ := v.Type().FieldByName(payloadName)
@ -112,7 +112,7 @@ func buildBody(r *aws.Request, v reflect.Value) {
}
}
func buildHeader(r *aws.Request, v reflect.Value, name string) {
func buildHeader(r *service.Request, v reflect.Value, name string) {
str, err := convertType(v)
if err != nil {
r.Error = awserr.New("SerializationError", "failed to encode REST request", err)
@ -121,7 +121,7 @@ func buildHeader(r *aws.Request, v reflect.Value, name string) {
}
}
func buildHeaderMap(r *aws.Request, v reflect.Value, prefix string) {
func buildHeaderMap(r *service.Request, v reflect.Value, prefix string) {
for _, key := range v.MapKeys() {
str, err := convertType(v.MapIndex(key))
if err != nil {
@ -132,7 +132,7 @@ func buildHeaderMap(r *aws.Request, v reflect.Value, prefix string) {
}
}
func buildURI(r *aws.Request, v reflect.Value, name string) {
func buildURI(r *service.Request, v reflect.Value, name string) {
value, err := convertType(v)
if err != nil {
r.Error = awserr.New("SerializationError", "failed to encode REST request", err)
@ -144,7 +144,7 @@ func buildURI(r *aws.Request, v reflect.Value, name string) {
}
}
func buildQueryString(r *aws.Request, v reflect.Value, name string, query url.Values) {
func buildQueryString(r *service.Request, v reflect.Value, name string, query url.Values) {
str, err := convertType(v)
if err != nil {
r.Error = awserr.New("SerializationError", "failed to encode REST request", err)

View File

@ -12,10 +12,11 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/service"
)
// Unmarshal unmarshals the REST component of a response in a REST service.
func Unmarshal(r *aws.Request) {
func Unmarshal(r *service.Request) {
if r.DataFilled() {
v := reflect.Indirect(reflect.ValueOf(r.Data))
unmarshalBody(r, v)
@ -23,7 +24,7 @@ func Unmarshal(r *aws.Request) {
}
}
func unmarshalBody(r *aws.Request, v reflect.Value) {
func unmarshalBody(r *service.Request, v reflect.Value) {
if field, ok := v.Type().FieldByName("SDKShapeTraits"); ok {
if payloadName := field.Tag.Get("payload"); payloadName != "" {
pfield, _ := v.Type().FieldByName(payloadName)
@ -64,7 +65,7 @@ func unmarshalBody(r *aws.Request, v reflect.Value) {
}
}
func unmarshalLocationElements(r *aws.Request, v reflect.Value) {
func unmarshalLocationElements(r *service.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]) {

View File

@ -12,6 +12,8 @@ import (
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/defaults"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/internal/protocol/restxml"
"github.com/aws/aws-sdk-go/internal/protocol/xml/xmlutil"
"github.com/aws/aws-sdk-go/internal/signer/v4"
@ -31,13 +33,13 @@ var _ = url.Values{}
var _ = io.EOF
type InputService1ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService1ProtocolTest client.
func NewInputService1ProtocolTest(config *aws.Config) *InputService1ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice1protocoltest",
APIVersion: "2014-01-01",
}
@ -55,8 +57,8 @@ func NewInputService1ProtocolTest(config *aws.Config) *InputService1ProtocolTest
// 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)
func (c *InputService1ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -64,8 +66,8 @@ func (c *InputService1ProtocolTest) newRequest(op *aws.Operation, params, data i
const opInputService1TestCaseOperation1 = "OperationName"
// InputService1TestCaseOperation1Request generates a request for the InputService1TestCaseOperation1 operation.
func (c *InputService1ProtocolTest) InputService1TestCaseOperation1Request(input *InputService1TestShapeInputShape) (req *aws.Request, output *InputService1TestShapeInputService1TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService1ProtocolTest) InputService1TestCaseOperation1Request(input *InputService1TestShapeInputShape) (req *service.Request, output *InputService1TestShapeInputService1TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService1TestCaseOperation1,
HTTPMethod: "POST",
HTTPPath: "/2014-01-01/hostedzone",
@ -90,8 +92,8 @@ func (c *InputService1ProtocolTest) InputService1TestCaseOperation1(input *Input
const opInputService1TestCaseOperation2 = "OperationName"
// InputService1TestCaseOperation2Request generates a request for the InputService1TestCaseOperation2 operation.
func (c *InputService1ProtocolTest) InputService1TestCaseOperation2Request(input *InputService1TestShapeInputShape) (req *aws.Request, output *InputService1TestShapeInputService1TestCaseOperation2Output) {
op := &aws.Operation{
func (c *InputService1ProtocolTest) InputService1TestCaseOperation2Request(input *InputService1TestShapeInputShape) (req *service.Request, output *InputService1TestShapeInputService1TestCaseOperation2Output) {
op := &service.Operation{
Name: opInputService1TestCaseOperation2,
HTTPMethod: "PUT",
HTTPPath: "/2014-01-01/hostedzone",
@ -142,13 +144,13 @@ type metadataInputService1TestShapeInputShape struct {
}
type InputService2ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService2ProtocolTest client.
func NewInputService2ProtocolTest(config *aws.Config) *InputService2ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice2protocoltest",
APIVersion: "2014-01-01",
}
@ -166,8 +168,8 @@ func NewInputService2ProtocolTest(config *aws.Config) *InputService2ProtocolTest
// 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)
func (c *InputService2ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -175,8 +177,8 @@ func (c *InputService2ProtocolTest) newRequest(op *aws.Operation, params, data i
const opInputService2TestCaseOperation1 = "OperationName"
// InputService2TestCaseOperation1Request generates a request for the InputService2TestCaseOperation1 operation.
func (c *InputService2ProtocolTest) InputService2TestCaseOperation1Request(input *InputService2TestShapeInputShape) (req *aws.Request, output *InputService2TestShapeInputService2TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService2ProtocolTest) InputService2TestCaseOperation1Request(input *InputService2TestShapeInputShape) (req *service.Request, output *InputService2TestShapeInputService2TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService2TestCaseOperation1,
HTTPMethod: "POST",
HTTPPath: "/2014-01-01/hostedzone",
@ -223,13 +225,13 @@ type metadataInputService2TestShapeInputShape struct {
}
type InputService3ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService3ProtocolTest client.
func NewInputService3ProtocolTest(config *aws.Config) *InputService3ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice3protocoltest",
APIVersion: "2014-01-01",
}
@ -247,8 +249,8 @@ func NewInputService3ProtocolTest(config *aws.Config) *InputService3ProtocolTest
// 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)
func (c *InputService3ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -256,8 +258,8 @@ func (c *InputService3ProtocolTest) newRequest(op *aws.Operation, params, data i
const opInputService3TestCaseOperation1 = "OperationName"
// InputService3TestCaseOperation1Request generates a request for the InputService3TestCaseOperation1 operation.
func (c *InputService3ProtocolTest) InputService3TestCaseOperation1Request(input *InputService3TestShapeInputShape) (req *aws.Request, output *InputService3TestShapeInputService3TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService3ProtocolTest) InputService3TestCaseOperation1Request(input *InputService3TestShapeInputShape) (req *service.Request, output *InputService3TestShapeInputService3TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService3TestCaseOperation1,
HTTPMethod: "POST",
HTTPPath: "/2014-01-01/hostedzone",
@ -312,13 +314,13 @@ type metadataInputService3TestShapeSubStructure struct {
}
type InputService4ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService4ProtocolTest client.
func NewInputService4ProtocolTest(config *aws.Config) *InputService4ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice4protocoltest",
APIVersion: "2014-01-01",
}
@ -336,8 +338,8 @@ func NewInputService4ProtocolTest(config *aws.Config) *InputService4ProtocolTest
// 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)
func (c *InputService4ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -345,8 +347,8 @@ func (c *InputService4ProtocolTest) newRequest(op *aws.Operation, params, data i
const opInputService4TestCaseOperation1 = "OperationName"
// InputService4TestCaseOperation1Request generates a request for the InputService4TestCaseOperation1 operation.
func (c *InputService4ProtocolTest) InputService4TestCaseOperation1Request(input *InputService4TestShapeInputShape) (req *aws.Request, output *InputService4TestShapeInputService4TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService4ProtocolTest) InputService4TestCaseOperation1Request(input *InputService4TestShapeInputShape) (req *service.Request, output *InputService4TestShapeInputService4TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService4TestCaseOperation1,
HTTPMethod: "POST",
HTTPPath: "/2014-01-01/hostedzone",
@ -401,13 +403,13 @@ type metadataInputService4TestShapeSubStructure struct {
}
type InputService5ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService5ProtocolTest client.
func NewInputService5ProtocolTest(config *aws.Config) *InputService5ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice5protocoltest",
APIVersion: "2014-01-01",
}
@ -425,8 +427,8 @@ func NewInputService5ProtocolTest(config *aws.Config) *InputService5ProtocolTest
// 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)
func (c *InputService5ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -434,8 +436,8 @@ func (c *InputService5ProtocolTest) newRequest(op *aws.Operation, params, data i
const opInputService5TestCaseOperation1 = "OperationName"
// InputService5TestCaseOperation1Request generates a request for the InputService5TestCaseOperation1 operation.
func (c *InputService5ProtocolTest) InputService5TestCaseOperation1Request(input *InputService5TestShapeInputShape) (req *aws.Request, output *InputService5TestShapeInputService5TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService5ProtocolTest) InputService5TestCaseOperation1Request(input *InputService5TestShapeInputShape) (req *service.Request, output *InputService5TestShapeInputService5TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService5TestCaseOperation1,
HTTPMethod: "POST",
HTTPPath: "/2014-01-01/hostedzone",
@ -476,13 +478,13 @@ type metadataInputService5TestShapeInputShape struct {
}
type InputService6ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService6ProtocolTest client.
func NewInputService6ProtocolTest(config *aws.Config) *InputService6ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice6protocoltest",
APIVersion: "2014-01-01",
}
@ -500,8 +502,8 @@ func NewInputService6ProtocolTest(config *aws.Config) *InputService6ProtocolTest
// 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)
func (c *InputService6ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -509,8 +511,8 @@ func (c *InputService6ProtocolTest) newRequest(op *aws.Operation, params, data i
const opInputService6TestCaseOperation1 = "OperationName"
// InputService6TestCaseOperation1Request generates a request for the InputService6TestCaseOperation1 operation.
func (c *InputService6ProtocolTest) InputService6TestCaseOperation1Request(input *InputService6TestShapeInputShape) (req *aws.Request, output *InputService6TestShapeInputService6TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService6ProtocolTest) InputService6TestCaseOperation1Request(input *InputService6TestShapeInputShape) (req *service.Request, output *InputService6TestShapeInputService6TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService6TestCaseOperation1,
HTTPMethod: "POST",
HTTPPath: "/2014-01-01/hostedzone",
@ -551,13 +553,13 @@ type metadataInputService6TestShapeInputShape struct {
}
type InputService7ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService7ProtocolTest client.
func NewInputService7ProtocolTest(config *aws.Config) *InputService7ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice7protocoltest",
APIVersion: "2014-01-01",
}
@ -575,8 +577,8 @@ func NewInputService7ProtocolTest(config *aws.Config) *InputService7ProtocolTest
// 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)
func (c *InputService7ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -584,8 +586,8 @@ func (c *InputService7ProtocolTest) newRequest(op *aws.Operation, params, data i
const opInputService7TestCaseOperation1 = "OperationName"
// InputService7TestCaseOperation1Request generates a request for the InputService7TestCaseOperation1 operation.
func (c *InputService7ProtocolTest) InputService7TestCaseOperation1Request(input *InputService7TestShapeInputShape) (req *aws.Request, output *InputService7TestShapeInputService7TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService7ProtocolTest) InputService7TestCaseOperation1Request(input *InputService7TestShapeInputShape) (req *service.Request, output *InputService7TestShapeInputService7TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService7TestCaseOperation1,
HTTPMethod: "POST",
HTTPPath: "/2014-01-01/hostedzone",
@ -626,13 +628,13 @@ type metadataInputService7TestShapeInputShape struct {
}
type InputService8ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService8ProtocolTest client.
func NewInputService8ProtocolTest(config *aws.Config) *InputService8ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice8protocoltest",
APIVersion: "2014-01-01",
}
@ -650,8 +652,8 @@ func NewInputService8ProtocolTest(config *aws.Config) *InputService8ProtocolTest
// 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)
func (c *InputService8ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -659,8 +661,8 @@ func (c *InputService8ProtocolTest) newRequest(op *aws.Operation, params, data i
const opInputService8TestCaseOperation1 = "OperationName"
// InputService8TestCaseOperation1Request generates a request for the InputService8TestCaseOperation1 operation.
func (c *InputService8ProtocolTest) InputService8TestCaseOperation1Request(input *InputService8TestShapeInputShape) (req *aws.Request, output *InputService8TestShapeInputService8TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService8ProtocolTest) InputService8TestCaseOperation1Request(input *InputService8TestShapeInputShape) (req *service.Request, output *InputService8TestShapeInputService8TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService8TestCaseOperation1,
HTTPMethod: "POST",
HTTPPath: "/2014-01-01/hostedzone",
@ -701,13 +703,13 @@ type metadataInputService8TestShapeInputShape struct {
}
type InputService9ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService9ProtocolTest client.
func NewInputService9ProtocolTest(config *aws.Config) *InputService9ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice9protocoltest",
APIVersion: "2014-01-01",
}
@ -725,8 +727,8 @@ func NewInputService9ProtocolTest(config *aws.Config) *InputService9ProtocolTest
// 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)
func (c *InputService9ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -734,8 +736,8 @@ func (c *InputService9ProtocolTest) newRequest(op *aws.Operation, params, data i
const opInputService9TestCaseOperation1 = "OperationName"
// InputService9TestCaseOperation1Request generates a request for the InputService9TestCaseOperation1 operation.
func (c *InputService9ProtocolTest) InputService9TestCaseOperation1Request(input *InputService9TestShapeInputShape) (req *aws.Request, output *InputService9TestShapeInputService9TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService9ProtocolTest) InputService9TestCaseOperation1Request(input *InputService9TestShapeInputShape) (req *service.Request, output *InputService9TestShapeInputService9TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService9TestCaseOperation1,
HTTPMethod: "POST",
HTTPPath: "/2014-01-01/hostedzone",
@ -786,13 +788,13 @@ type metadataInputService9TestShapeSingleFieldStruct struct {
}
type InputService10ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService10ProtocolTest client.
func NewInputService10ProtocolTest(config *aws.Config) *InputService10ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice10protocoltest",
APIVersion: "2014-01-01",
}
@ -810,8 +812,8 @@ func NewInputService10ProtocolTest(config *aws.Config) *InputService10ProtocolTe
// 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)
func (c *InputService10ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -819,8 +821,8 @@ func (c *InputService10ProtocolTest) newRequest(op *aws.Operation, params, data
const opInputService10TestCaseOperation1 = "OperationName"
// InputService10TestCaseOperation1Request generates a request for the InputService10TestCaseOperation1 operation.
func (c *InputService10ProtocolTest) InputService10TestCaseOperation1Request(input *InputService10TestShapeInputShape) (req *aws.Request, output *InputService10TestShapeInputService10TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService10ProtocolTest) InputService10TestCaseOperation1Request(input *InputService10TestShapeInputShape) (req *service.Request, output *InputService10TestShapeInputService10TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService10TestCaseOperation1,
HTTPMethod: "POST",
HTTPPath: "/2014-01-01/hostedzone",
@ -873,13 +875,13 @@ type metadataInputService10TestShapeStructureShape struct {
}
type InputService11ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService11ProtocolTest client.
func NewInputService11ProtocolTest(config *aws.Config) *InputService11ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice11protocoltest",
APIVersion: "2014-01-01",
}
@ -897,8 +899,8 @@ func NewInputService11ProtocolTest(config *aws.Config) *InputService11ProtocolTe
// 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)
func (c *InputService11ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -906,8 +908,8 @@ func (c *InputService11ProtocolTest) newRequest(op *aws.Operation, params, data
const opInputService11TestCaseOperation1 = "OperationName"
// InputService11TestCaseOperation1Request generates a request for the InputService11TestCaseOperation1 operation.
func (c *InputService11ProtocolTest) InputService11TestCaseOperation1Request(input *InputService11TestShapeInputShape) (req *aws.Request, output *InputService11TestShapeInputService11TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService11ProtocolTest) InputService11TestCaseOperation1Request(input *InputService11TestShapeInputShape) (req *service.Request, output *InputService11TestShapeInputService11TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService11TestCaseOperation1,
HTTPMethod: "POST",
HTTPPath: "/",
@ -948,13 +950,13 @@ type metadataInputService11TestShapeInputShape struct {
}
type InputService12ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService12ProtocolTest client.
func NewInputService12ProtocolTest(config *aws.Config) *InputService12ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice12protocoltest",
APIVersion: "2014-01-01",
}
@ -972,8 +974,8 @@ func NewInputService12ProtocolTest(config *aws.Config) *InputService12ProtocolTe
// 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)
func (c *InputService12ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -981,8 +983,8 @@ func (c *InputService12ProtocolTest) newRequest(op *aws.Operation, params, data
const opInputService12TestCaseOperation1 = "OperationName"
// InputService12TestCaseOperation1Request generates a request for the InputService12TestCaseOperation1 operation.
func (c *InputService12ProtocolTest) InputService12TestCaseOperation1Request(input *InputService12TestShapeInputShape) (req *aws.Request, output *InputService12TestShapeInputService12TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService12ProtocolTest) InputService12TestCaseOperation1Request(input *InputService12TestShapeInputShape) (req *service.Request, output *InputService12TestShapeInputService12TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService12TestCaseOperation1,
HTTPMethod: "POST",
HTTPPath: "/",
@ -1023,13 +1025,13 @@ type metadataInputService12TestShapeInputShape struct {
}
type InputService13ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService13ProtocolTest client.
func NewInputService13ProtocolTest(config *aws.Config) *InputService13ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice13protocoltest",
APIVersion: "2014-01-01",
}
@ -1047,8 +1049,8 @@ func NewInputService13ProtocolTest(config *aws.Config) *InputService13ProtocolTe
// 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)
func (c *InputService13ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -1056,8 +1058,8 @@ func (c *InputService13ProtocolTest) newRequest(op *aws.Operation, params, data
const opInputService13TestCaseOperation1 = "OperationName"
// InputService13TestCaseOperation1Request generates a request for the InputService13TestCaseOperation1 operation.
func (c *InputService13ProtocolTest) InputService13TestCaseOperation1Request(input *InputService13TestShapeInputShape) (req *aws.Request, output *InputService13TestShapeInputService13TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService13ProtocolTest) InputService13TestCaseOperation1Request(input *InputService13TestShapeInputShape) (req *service.Request, output *InputService13TestShapeInputService13TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService13TestCaseOperation1,
HTTPMethod: "POST",
HTTPPath: "/",
@ -1082,8 +1084,8 @@ func (c *InputService13ProtocolTest) InputService13TestCaseOperation1(input *Inp
const opInputService13TestCaseOperation2 = "OperationName"
// InputService13TestCaseOperation2Request generates a request for the InputService13TestCaseOperation2 operation.
func (c *InputService13ProtocolTest) InputService13TestCaseOperation2Request(input *InputService13TestShapeInputShape) (req *aws.Request, output *InputService13TestShapeInputService13TestCaseOperation2Output) {
op := &aws.Operation{
func (c *InputService13ProtocolTest) InputService13TestCaseOperation2Request(input *InputService13TestShapeInputShape) (req *service.Request, output *InputService13TestShapeInputService13TestCaseOperation2Output) {
op := &service.Operation{
Name: opInputService13TestCaseOperation2,
HTTPMethod: "POST",
HTTPPath: "/",
@ -1132,13 +1134,13 @@ type metadataInputService13TestShapeInputShape struct {
}
type InputService14ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService14ProtocolTest client.
func NewInputService14ProtocolTest(config *aws.Config) *InputService14ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice14protocoltest",
APIVersion: "2014-01-01",
}
@ -1156,8 +1158,8 @@ func NewInputService14ProtocolTest(config *aws.Config) *InputService14ProtocolTe
// 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)
func (c *InputService14ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -1165,8 +1167,8 @@ func (c *InputService14ProtocolTest) newRequest(op *aws.Operation, params, data
const opInputService14TestCaseOperation1 = "OperationName"
// InputService14TestCaseOperation1Request generates a request for the InputService14TestCaseOperation1 operation.
func (c *InputService14ProtocolTest) InputService14TestCaseOperation1Request(input *InputService14TestShapeInputShape) (req *aws.Request, output *InputService14TestShapeInputService14TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService14ProtocolTest) InputService14TestCaseOperation1Request(input *InputService14TestShapeInputShape) (req *service.Request, output *InputService14TestShapeInputService14TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService14TestCaseOperation1,
HTTPMethod: "POST",
HTTPPath: "/",
@ -1191,8 +1193,8 @@ func (c *InputService14ProtocolTest) InputService14TestCaseOperation1(input *Inp
const opInputService14TestCaseOperation2 = "OperationName"
// InputService14TestCaseOperation2Request generates a request for the InputService14TestCaseOperation2 operation.
func (c *InputService14ProtocolTest) InputService14TestCaseOperation2Request(input *InputService14TestShapeInputShape) (req *aws.Request, output *InputService14TestShapeInputService14TestCaseOperation2Output) {
op := &aws.Operation{
func (c *InputService14ProtocolTest) InputService14TestCaseOperation2Request(input *InputService14TestShapeInputShape) (req *service.Request, output *InputService14TestShapeInputService14TestCaseOperation2Output) {
op := &service.Operation{
Name: opInputService14TestCaseOperation2,
HTTPMethod: "POST",
HTTPPath: "/",
@ -1217,8 +1219,8 @@ func (c *InputService14ProtocolTest) InputService14TestCaseOperation2(input *Inp
const opInputService14TestCaseOperation3 = "OperationName"
// InputService14TestCaseOperation3Request generates a request for the InputService14TestCaseOperation3 operation.
func (c *InputService14ProtocolTest) InputService14TestCaseOperation3Request(input *InputService14TestShapeInputShape) (req *aws.Request, output *InputService14TestShapeInputService14TestCaseOperation3Output) {
op := &aws.Operation{
func (c *InputService14ProtocolTest) InputService14TestCaseOperation3Request(input *InputService14TestShapeInputShape) (req *service.Request, output *InputService14TestShapeInputService14TestCaseOperation3Output) {
op := &service.Operation{
Name: opInputService14TestCaseOperation3,
HTTPMethod: "POST",
HTTPPath: "/",
@ -1285,13 +1287,13 @@ type metadataInputService14TestShapeInputShape struct {
}
type InputService15ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService15ProtocolTest client.
func NewInputService15ProtocolTest(config *aws.Config) *InputService15ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice15protocoltest",
APIVersion: "2014-01-01",
}
@ -1309,8 +1311,8 @@ func NewInputService15ProtocolTest(config *aws.Config) *InputService15ProtocolTe
// 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)
func (c *InputService15ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -1318,8 +1320,8 @@ func (c *InputService15ProtocolTest) newRequest(op *aws.Operation, params, data
const opInputService15TestCaseOperation1 = "OperationName"
// InputService15TestCaseOperation1Request generates a request for the InputService15TestCaseOperation1 operation.
func (c *InputService15ProtocolTest) InputService15TestCaseOperation1Request(input *InputService15TestShapeInputShape) (req *aws.Request, output *InputService15TestShapeInputService15TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService15ProtocolTest) InputService15TestCaseOperation1Request(input *InputService15TestShapeInputShape) (req *service.Request, output *InputService15TestShapeInputService15TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService15TestCaseOperation1,
HTTPMethod: "POST",
HTTPPath: "/",
@ -1382,13 +1384,13 @@ type metadataInputService15TestShapeInputShape struct {
}
type InputService16ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService16ProtocolTest client.
func NewInputService16ProtocolTest(config *aws.Config) *InputService16ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice16protocoltest",
APIVersion: "2014-01-01",
}
@ -1406,8 +1408,8 @@ func NewInputService16ProtocolTest(config *aws.Config) *InputService16ProtocolTe
// 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)
func (c *InputService16ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -1415,8 +1417,8 @@ func (c *InputService16ProtocolTest) newRequest(op *aws.Operation, params, data
const opInputService16TestCaseOperation1 = "OperationName"
// InputService16TestCaseOperation1Request generates a request for the InputService16TestCaseOperation1 operation.
func (c *InputService16ProtocolTest) InputService16TestCaseOperation1Request(input *InputService16TestShapeInputShape) (req *aws.Request, output *InputService16TestShapeInputService16TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService16ProtocolTest) InputService16TestCaseOperation1Request(input *InputService16TestShapeInputShape) (req *service.Request, output *InputService16TestShapeInputService16TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService16TestCaseOperation1,
HTTPMethod: "GET",
HTTPPath: "/{Bucket}/{Key+}",
@ -1459,13 +1461,13 @@ type metadataInputService16TestShapeInputShape struct {
}
type InputService17ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService17ProtocolTest client.
func NewInputService17ProtocolTest(config *aws.Config) *InputService17ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice17protocoltest",
APIVersion: "2014-01-01",
}
@ -1483,8 +1485,8 @@ func NewInputService17ProtocolTest(config *aws.Config) *InputService17ProtocolTe
// 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)
func (c *InputService17ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -1492,8 +1494,8 @@ func (c *InputService17ProtocolTest) newRequest(op *aws.Operation, params, data
const opInputService17TestCaseOperation1 = "OperationName"
// InputService17TestCaseOperation1Request generates a request for the InputService17TestCaseOperation1 operation.
func (c *InputService17ProtocolTest) InputService17TestCaseOperation1Request(input *InputService17TestShapeInputShape) (req *aws.Request, output *InputService17TestShapeInputService17TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService17ProtocolTest) InputService17TestCaseOperation1Request(input *InputService17TestShapeInputShape) (req *service.Request, output *InputService17TestShapeInputService17TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService17TestCaseOperation1,
HTTPMethod: "POST",
HTTPPath: "/path",
@ -1518,8 +1520,8 @@ func (c *InputService17ProtocolTest) InputService17TestCaseOperation1(input *Inp
const opInputService17TestCaseOperation2 = "OperationName"
// InputService17TestCaseOperation2Request generates a request for the InputService17TestCaseOperation2 operation.
func (c *InputService17ProtocolTest) InputService17TestCaseOperation2Request(input *InputService17TestShapeInputShape) (req *aws.Request, output *InputService17TestShapeInputService17TestCaseOperation2Output) {
op := &aws.Operation{
func (c *InputService17ProtocolTest) InputService17TestCaseOperation2Request(input *InputService17TestShapeInputShape) (req *service.Request, output *InputService17TestShapeInputService17TestCaseOperation2Output) {
op := &service.Operation{
Name: opInputService17TestCaseOperation2,
HTTPMethod: "POST",
HTTPPath: "/path?abc=mno",
@ -1568,13 +1570,13 @@ type metadataInputService17TestShapeInputShape struct {
}
type InputService18ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService18ProtocolTest client.
func NewInputService18ProtocolTest(config *aws.Config) *InputService18ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice18protocoltest",
APIVersion: "2014-01-01",
}
@ -1592,8 +1594,8 @@ func NewInputService18ProtocolTest(config *aws.Config) *InputService18ProtocolTe
// 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)
func (c *InputService18ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -1601,8 +1603,8 @@ func (c *InputService18ProtocolTest) newRequest(op *aws.Operation, params, data
const opInputService18TestCaseOperation1 = "OperationName"
// InputService18TestCaseOperation1Request generates a request for the InputService18TestCaseOperation1 operation.
func (c *InputService18ProtocolTest) InputService18TestCaseOperation1Request(input *InputService18TestShapeInputShape) (req *aws.Request, output *InputService18TestShapeInputService18TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService18ProtocolTest) InputService18TestCaseOperation1Request(input *InputService18TestShapeInputShape) (req *service.Request, output *InputService18TestShapeInputService18TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService18TestCaseOperation1,
HTTPMethod: "POST",
HTTPPath: "/path",
@ -1627,8 +1629,8 @@ func (c *InputService18ProtocolTest) InputService18TestCaseOperation1(input *Inp
const opInputService18TestCaseOperation2 = "OperationName"
// InputService18TestCaseOperation2Request generates a request for the InputService18TestCaseOperation2 operation.
func (c *InputService18ProtocolTest) InputService18TestCaseOperation2Request(input *InputService18TestShapeInputShape) (req *aws.Request, output *InputService18TestShapeInputService18TestCaseOperation2Output) {
op := &aws.Operation{
func (c *InputService18ProtocolTest) InputService18TestCaseOperation2Request(input *InputService18TestShapeInputShape) (req *service.Request, output *InputService18TestShapeInputService18TestCaseOperation2Output) {
op := &service.Operation{
Name: opInputService18TestCaseOperation2,
HTTPMethod: "POST",
HTTPPath: "/path",
@ -1653,8 +1655,8 @@ func (c *InputService18ProtocolTest) InputService18TestCaseOperation2(input *Inp
const opInputService18TestCaseOperation3 = "OperationName"
// InputService18TestCaseOperation3Request generates a request for the InputService18TestCaseOperation3 operation.
func (c *InputService18ProtocolTest) InputService18TestCaseOperation3Request(input *InputService18TestShapeInputShape) (req *aws.Request, output *InputService18TestShapeInputService18TestCaseOperation3Output) {
op := &aws.Operation{
func (c *InputService18ProtocolTest) InputService18TestCaseOperation3Request(input *InputService18TestShapeInputShape) (req *service.Request, output *InputService18TestShapeInputService18TestCaseOperation3Output) {
op := &service.Operation{
Name: opInputService18TestCaseOperation3,
HTTPMethod: "POST",
HTTPPath: "/path",
@ -1679,8 +1681,8 @@ func (c *InputService18ProtocolTest) InputService18TestCaseOperation3(input *Inp
const opInputService18TestCaseOperation4 = "OperationName"
// InputService18TestCaseOperation4Request generates a request for the InputService18TestCaseOperation4 operation.
func (c *InputService18ProtocolTest) InputService18TestCaseOperation4Request(input *InputService18TestShapeInputShape) (req *aws.Request, output *InputService18TestShapeInputService18TestCaseOperation4Output) {
op := &aws.Operation{
func (c *InputService18ProtocolTest) InputService18TestCaseOperation4Request(input *InputService18TestShapeInputShape) (req *service.Request, output *InputService18TestShapeInputService18TestCaseOperation4Output) {
op := &service.Operation{
Name: opInputService18TestCaseOperation4,
HTTPMethod: "POST",
HTTPPath: "/path",
@ -1705,8 +1707,8 @@ func (c *InputService18ProtocolTest) InputService18TestCaseOperation4(input *Inp
const opInputService18TestCaseOperation5 = "OperationName"
// InputService18TestCaseOperation5Request generates a request for the InputService18TestCaseOperation5 operation.
func (c *InputService18ProtocolTest) InputService18TestCaseOperation5Request(input *InputService18TestShapeInputShape) (req *aws.Request, output *InputService18TestShapeInputService18TestCaseOperation5Output) {
op := &aws.Operation{
func (c *InputService18ProtocolTest) InputService18TestCaseOperation5Request(input *InputService18TestShapeInputShape) (req *service.Request, output *InputService18TestShapeInputService18TestCaseOperation5Output) {
op := &service.Operation{
Name: opInputService18TestCaseOperation5,
HTTPMethod: "POST",
HTTPPath: "/path",
@ -1731,8 +1733,8 @@ func (c *InputService18ProtocolTest) InputService18TestCaseOperation5(input *Inp
const opInputService18TestCaseOperation6 = "OperationName"
// InputService18TestCaseOperation6Request generates a request for the InputService18TestCaseOperation6 operation.
func (c *InputService18ProtocolTest) InputService18TestCaseOperation6Request(input *InputService18TestShapeInputShape) (req *aws.Request, output *InputService18TestShapeInputService18TestCaseOperation6Output) {
op := &aws.Operation{
func (c *InputService18ProtocolTest) InputService18TestCaseOperation6Request(input *InputService18TestShapeInputShape) (req *service.Request, output *InputService18TestShapeInputService18TestCaseOperation6Output) {
op := &service.Operation{
Name: opInputService18TestCaseOperation6,
HTTPMethod: "POST",
HTTPPath: "/path",
@ -1829,13 +1831,13 @@ type metadataInputService18TestShapeRecursiveStructType struct {
}
type InputService19ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new InputService19ProtocolTest client.
func NewInputService19ProtocolTest(config *aws.Config) *InputService19ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "inputservice19protocoltest",
APIVersion: "2014-01-01",
}
@ -1853,8 +1855,8 @@ func NewInputService19ProtocolTest(config *aws.Config) *InputService19ProtocolTe
// 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)
func (c *InputService19ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -1862,8 +1864,8 @@ func (c *InputService19ProtocolTest) newRequest(op *aws.Operation, params, data
const opInputService19TestCaseOperation1 = "OperationName"
// InputService19TestCaseOperation1Request generates a request for the InputService19TestCaseOperation1 operation.
func (c *InputService19ProtocolTest) InputService19TestCaseOperation1Request(input *InputService19TestShapeInputShape) (req *aws.Request, output *InputService19TestShapeInputService19TestCaseOperation1Output) {
op := &aws.Operation{
func (c *InputService19ProtocolTest) InputService19TestCaseOperation1Request(input *InputService19TestShapeInputShape) (req *service.Request, output *InputService19TestShapeInputService19TestCaseOperation1Output) {
op := &service.Operation{
Name: opInputService19TestCaseOperation1,
HTTPMethod: "POST",
HTTPPath: "/path",

View File

@ -9,15 +9,15 @@ import (
"bytes"
"encoding/xml"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/internal/protocol/query"
"github.com/aws/aws-sdk-go/internal/protocol/rest"
"github.com/aws/aws-sdk-go/internal/protocol/xml/xmlutil"
)
// Build builds a request payload for the REST XML protocol.
func Build(r *aws.Request) {
func Build(r *service.Request) {
rest.Build(r)
if t := rest.PayloadType(r.Params); t == "structure" || t == "" {
@ -32,7 +32,7 @@ func Build(r *aws.Request) {
}
// Unmarshal unmarshals a payload response for the REST XML protocol.
func Unmarshal(r *aws.Request) {
func Unmarshal(r *service.Request) {
if t := rest.PayloadType(r.Data); t == "structure" || t == "" {
defer r.HTTPResponse.Body.Close()
decoder := xml.NewDecoder(r.HTTPResponse.Body)
@ -45,11 +45,11 @@ func Unmarshal(r *aws.Request) {
}
// UnmarshalMeta unmarshals response headers for the REST XML protocol.
func UnmarshalMeta(r *aws.Request) {
func UnmarshalMeta(r *service.Request) {
rest.Unmarshal(r)
}
// UnmarshalError unmarshals a response error for the REST XML protocol.
func UnmarshalError(r *aws.Request) {
func UnmarshalError(r *service.Request) {
query.UnmarshalError(r)
}

View File

@ -12,6 +12,8 @@ import (
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/defaults"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/internal/protocol/restxml"
"github.com/aws/aws-sdk-go/internal/protocol/xml/xmlutil"
"github.com/aws/aws-sdk-go/internal/signer/v4"
@ -31,13 +33,13 @@ var _ = url.Values{}
var _ = io.EOF
type OutputService1ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService1ProtocolTest client.
func NewOutputService1ProtocolTest(config *aws.Config) *OutputService1ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice1protocoltest",
APIVersion: "",
}
@ -55,8 +57,8 @@ func NewOutputService1ProtocolTest(config *aws.Config) *OutputService1ProtocolTe
// 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)
func (c *OutputService1ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -64,8 +66,8 @@ func (c *OutputService1ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService1TestCaseOperation1 = "OperationName"
// OutputService1TestCaseOperation1Request generates a request for the OutputService1TestCaseOperation1 operation.
func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1Request(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (req *aws.Request, output *OutputService1TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1Request(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (req *service.Request, output *OutputService1TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService1TestCaseOperation1,
}
@ -88,8 +90,8 @@ func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1(input *Out
const opOutputService1TestCaseOperation2 = "OperationName"
// OutputService1TestCaseOperation2Request generates a request for the OutputService1TestCaseOperation2 operation.
func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation2Request(input *OutputService1TestShapeOutputService1TestCaseOperation2Input) (req *aws.Request, output *OutputService1TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation2Request(input *OutputService1TestShapeOutputService1TestCaseOperation2Input) (req *service.Request, output *OutputService1TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService1TestCaseOperation2,
}
@ -156,13 +158,13 @@ type metadataOutputService1TestShapeOutputShape struct {
}
type OutputService2ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService2ProtocolTest client.
func NewOutputService2ProtocolTest(config *aws.Config) *OutputService2ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice2protocoltest",
APIVersion: "",
}
@ -180,8 +182,8 @@ func NewOutputService2ProtocolTest(config *aws.Config) *OutputService2ProtocolTe
// 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)
func (c *OutputService2ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -189,8 +191,8 @@ func (c *OutputService2ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService2TestCaseOperation1 = "OperationName"
// OutputService2TestCaseOperation1Request generates a request for the OutputService2TestCaseOperation1 operation.
func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1Request(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (req *aws.Request, output *OutputService2TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1Request(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (req *service.Request, output *OutputService2TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService2TestCaseOperation1,
}
@ -229,13 +231,13 @@ type metadataOutputService2TestShapeOutputShape struct {
}
type OutputService3ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService3ProtocolTest client.
func NewOutputService3ProtocolTest(config *aws.Config) *OutputService3ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice3protocoltest",
APIVersion: "",
}
@ -253,8 +255,8 @@ func NewOutputService3ProtocolTest(config *aws.Config) *OutputService3ProtocolTe
// 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)
func (c *OutputService3ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -262,8 +264,8 @@ func (c *OutputService3ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService3TestCaseOperation1 = "OperationName"
// OutputService3TestCaseOperation1Request generates a request for the OutputService3TestCaseOperation1 operation.
func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1Request(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (req *aws.Request, output *OutputService3TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1Request(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (req *service.Request, output *OutputService3TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService3TestCaseOperation1,
}
@ -302,13 +304,13 @@ type metadataOutputService3TestShapeOutputShape struct {
}
type OutputService4ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService4ProtocolTest client.
func NewOutputService4ProtocolTest(config *aws.Config) *OutputService4ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice4protocoltest",
APIVersion: "",
}
@ -326,8 +328,8 @@ func NewOutputService4ProtocolTest(config *aws.Config) *OutputService4ProtocolTe
// 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)
func (c *OutputService4ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -335,8 +337,8 @@ func (c *OutputService4ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService4TestCaseOperation1 = "OperationName"
// OutputService4TestCaseOperation1Request generates a request for the OutputService4TestCaseOperation1 operation.
func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1Request(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (req *aws.Request, output *OutputService4TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1Request(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (req *service.Request, output *OutputService4TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService4TestCaseOperation1,
}
@ -375,13 +377,13 @@ type metadataOutputService4TestShapeOutputShape struct {
}
type OutputService5ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService5ProtocolTest client.
func NewOutputService5ProtocolTest(config *aws.Config) *OutputService5ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice5protocoltest",
APIVersion: "",
}
@ -399,8 +401,8 @@ func NewOutputService5ProtocolTest(config *aws.Config) *OutputService5ProtocolTe
// 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)
func (c *OutputService5ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -408,8 +410,8 @@ func (c *OutputService5ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService5TestCaseOperation1 = "OperationName"
// OutputService5TestCaseOperation1Request generates a request for the OutputService5TestCaseOperation1 operation.
func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1Request(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (req *aws.Request, output *OutputService5TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1Request(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (req *service.Request, output *OutputService5TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService5TestCaseOperation1,
}
@ -448,13 +450,13 @@ type metadataOutputService5TestShapeOutputShape struct {
}
type OutputService6ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService6ProtocolTest client.
func NewOutputService6ProtocolTest(config *aws.Config) *OutputService6ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice6protocoltest",
APIVersion: "",
}
@ -472,8 +474,8 @@ func NewOutputService6ProtocolTest(config *aws.Config) *OutputService6ProtocolTe
// 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)
func (c *OutputService6ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -481,8 +483,8 @@ func (c *OutputService6ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService6TestCaseOperation1 = "OperationName"
// OutputService6TestCaseOperation1Request generates a request for the OutputService6TestCaseOperation1 operation.
func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1Request(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (req *aws.Request, output *OutputService6TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1Request(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (req *service.Request, output *OutputService6TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService6TestCaseOperation1,
}
@ -531,13 +533,13 @@ type metadataOutputService6TestShapeSingleStructure struct {
}
type OutputService7ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService7ProtocolTest client.
func NewOutputService7ProtocolTest(config *aws.Config) *OutputService7ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice7protocoltest",
APIVersion: "",
}
@ -555,8 +557,8 @@ func NewOutputService7ProtocolTest(config *aws.Config) *OutputService7ProtocolTe
// 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)
func (c *OutputService7ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -564,8 +566,8 @@ func (c *OutputService7ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService7TestCaseOperation1 = "OperationName"
// OutputService7TestCaseOperation1Request generates a request for the OutputService7TestCaseOperation1 operation.
func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1Request(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (req *aws.Request, output *OutputService7TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1Request(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (req *service.Request, output *OutputService7TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService7TestCaseOperation1,
}
@ -604,13 +606,13 @@ type metadataOutputService7TestShapeOutputShape struct {
}
type OutputService8ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService8ProtocolTest client.
func NewOutputService8ProtocolTest(config *aws.Config) *OutputService8ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice8protocoltest",
APIVersion: "",
}
@ -628,8 +630,8 @@ func NewOutputService8ProtocolTest(config *aws.Config) *OutputService8ProtocolTe
// 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)
func (c *OutputService8ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -637,8 +639,8 @@ func (c *OutputService8ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService8TestCaseOperation1 = "OperationName"
// OutputService8TestCaseOperation1Request generates a request for the OutputService8TestCaseOperation1 operation.
func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1Request(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (req *aws.Request, output *OutputService8TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService8ProtocolTest) OutputService8TestCaseOperation1Request(input *OutputService8TestShapeOutputService8TestCaseOperation1Input) (req *service.Request, output *OutputService8TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService8TestCaseOperation1,
}
@ -677,13 +679,13 @@ type metadataOutputService8TestShapeOutputShape struct {
}
type OutputService9ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService9ProtocolTest client.
func NewOutputService9ProtocolTest(config *aws.Config) *OutputService9ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice9protocoltest",
APIVersion: "",
}
@ -701,8 +703,8 @@ func NewOutputService9ProtocolTest(config *aws.Config) *OutputService9ProtocolTe
// 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)
func (c *OutputService9ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -710,8 +712,8 @@ func (c *OutputService9ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService9TestCaseOperation1 = "OperationName"
// OutputService9TestCaseOperation1Request generates a request for the OutputService9TestCaseOperation1 operation.
func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1Request(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (req *aws.Request, output *OutputService9TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService9ProtocolTest) OutputService9TestCaseOperation1Request(input *OutputService9TestShapeOutputService9TestCaseOperation1Input) (req *service.Request, output *OutputService9TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService9TestCaseOperation1,
}
@ -762,13 +764,13 @@ type metadataOutputService9TestShapeSingleStructure struct {
}
type OutputService10ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService10ProtocolTest client.
func NewOutputService10ProtocolTest(config *aws.Config) *OutputService10ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice10protocoltest",
APIVersion: "",
}
@ -786,8 +788,8 @@ func NewOutputService10ProtocolTest(config *aws.Config) *OutputService10Protocol
// 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)
func (c *OutputService10ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -795,8 +797,8 @@ func (c *OutputService10ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService10TestCaseOperation1 = "OperationName"
// OutputService10TestCaseOperation1Request generates a request for the OutputService10TestCaseOperation1 operation.
func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1Request(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (req *aws.Request, output *OutputService10TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1Request(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (req *service.Request, output *OutputService10TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService10TestCaseOperation1,
}
@ -835,13 +837,13 @@ type metadataOutputService10TestShapeOutputShape struct {
}
type OutputService11ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService11ProtocolTest client.
func NewOutputService11ProtocolTest(config *aws.Config) *OutputService11ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice11protocoltest",
APIVersion: "",
}
@ -859,8 +861,8 @@ func NewOutputService11ProtocolTest(config *aws.Config) *OutputService11Protocol
// 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)
func (c *OutputService11ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -868,8 +870,8 @@ func (c *OutputService11ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService11TestCaseOperation1 = "OperationName"
// OutputService11TestCaseOperation1Request generates a request for the OutputService11TestCaseOperation1 operation.
func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1Request(input *OutputService11TestShapeOutputService11TestCaseOperation1Input) (req *aws.Request, output *OutputService11TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService11ProtocolTest) OutputService11TestCaseOperation1Request(input *OutputService11TestShapeOutputService11TestCaseOperation1Input) (req *service.Request, output *OutputService11TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService11TestCaseOperation1,
}
@ -924,13 +926,13 @@ type metadataOutputService11TestShapeOutputShape struct {
}
type OutputService12ProtocolTest struct {
*aws.Service
*service.Service
}
// New returns a new OutputService12ProtocolTest client.
func NewOutputService12ProtocolTest(config *aws.Config) *OutputService12ProtocolTest {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "outputservice12protocoltest",
APIVersion: "",
}
@ -948,8 +950,8 @@ func NewOutputService12ProtocolTest(config *aws.Config) *OutputService12Protocol
// 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)
func (c *OutputService12ProtocolTest) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
return req
}
@ -957,8 +959,8 @@ func (c *OutputService12ProtocolTest) newRequest(op *aws.Operation, params, data
const opOutputService12TestCaseOperation1 = "OperationName"
// OutputService12TestCaseOperation1Request generates a request for the OutputService12TestCaseOperation1 operation.
func (c *OutputService12ProtocolTest) OutputService12TestCaseOperation1Request(input *OutputService12TestShapeOutputService12TestCaseOperation1Input) (req *aws.Request, output *OutputService12TestShapeOutputShape) {
op := &aws.Operation{
func (c *OutputService12ProtocolTest) OutputService12TestCaseOperation1Request(input *OutputService12TestShapeOutputService12TestCaseOperation1Input) (req *service.Request, output *OutputService12TestShapeOutputShape) {
op := &service.Operation{
Name: opOutputService12TestCaseOperation1,
}

View File

@ -16,6 +16,7 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/internal/protocol/rest"
)
@ -63,7 +64,7 @@ type signer struct {
// Will sign the requests with the service config's Credentials object
// Signing is skipped if the credentials is the credentials.AnonymousCredentials
// object.
func Sign(req *aws.Request) {
func Sign(req *service.Request) {
// If the request does not need to be signed ignore the signing of the
// request if the AnonymousCredentials object is used.
if req.Service.Config.Credentials == credentials.AnonymousCredentials {

View File

@ -8,6 +8,7 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/stretchr/testify/assert"
)
@ -116,9 +117,9 @@ func TestSignPrecomputedBodyChecksum(t *testing.T) {
}
func TestAnonymousCredentials(t *testing.T) {
r := aws.NewRequest(
aws.NewService(&aws.Config{Credentials: credentials.AnonymousCredentials}),
&aws.Operation{
r := service.NewRequest(
service.NewService(&aws.Config{Credentials: credentials.AnonymousCredentials}),
&service.Operation{
Name: "BatchGetItem",
HTTPMethod: "POST",
HTTPPath: "/",
@ -140,12 +141,12 @@ func TestAnonymousCredentials(t *testing.T) {
}
func TestIgnoreResignRequestWithValidCreds(t *testing.T) {
r := aws.NewRequest(
aws.NewService(&aws.Config{
r := service.NewRequest(
service.NewService(&aws.Config{
Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "SESSION"),
Region: aws.String("us-west-2"),
}),
&aws.Operation{
&service.Operation{
Name: "BatchGetItem",
HTTPMethod: "POST",
HTTPPath: "/",
@ -162,12 +163,12 @@ func TestIgnoreResignRequestWithValidCreds(t *testing.T) {
}
func TestIgnorePreResignRequestWithValidCreds(t *testing.T) {
r := aws.NewRequest(
aws.NewService(&aws.Config{
r := service.NewRequest(
service.NewService(&aws.Config{
Credentials: credentials.NewStaticCredentials("AKID", "SECRET", "SESSION"),
Region: aws.String("us-west-2"),
}),
&aws.Operation{
&service.Operation{
Name: "BatchGetItem",
HTTPMethod: "POST",
HTTPPath: "/",
@ -186,9 +187,9 @@ func TestIgnorePreResignRequestWithValidCreds(t *testing.T) {
func TestResignRequestExpiredCreds(t *testing.T) {
creds := credentials.NewStaticCredentials("AKID", "SECRET", "SESSION")
r := aws.NewRequest(
aws.NewService(&aws.Config{Credentials: creds}),
&aws.Operation{
r := service.NewRequest(
service.NewService(&aws.Config{Credentials: creds}),
&service.Operation{
Name: "BatchGetItem",
HTTPMethod: "POST",
HTTPPath: "/",
@ -208,9 +209,9 @@ func TestResignRequestExpiredCreds(t *testing.T) {
func TestPreResignRequestExpiredCreds(t *testing.T) {
provider := &credentials.StaticProvider{credentials.Value{"AKID", "SECRET", "SESSION"}}
creds := credentials.NewCredentials(provider)
r := aws.NewRequest(
aws.NewService(&aws.Config{Credentials: creds}),
&aws.Operation{
r := service.NewRequest(
service.NewService(&aws.Config{Credentials: creds}),
&service.Operation{
Name: "BatchGetItem",
HTTPMethod: "POST",
HTTPPath: "/",

File diff suppressed because it is too large Load Diff

View File

@ -3,19 +3,19 @@ package ec2
import (
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awsutil"
"github.com/aws/aws-sdk-go/aws/service"
)
func init() {
initRequest = func(r *aws.Request) {
initRequest = func(r *service.Request) {
if r.Operation.Name == opCopySnapshot { // fill the PresignedURL parameter
r.Handlers.Build.PushFront(fillPresignedURL)
}
}
}
func fillPresignedURL(r *aws.Request) {
func fillPresignedURL(r *service.Request) {
if !r.ParamsFilled() {
return
}
@ -23,7 +23,7 @@ func fillPresignedURL(r *aws.Request) {
params := r.Params.(*CopySnapshotInput)
// Stop if PresignedURL/DestinationRegion is set
if params.PresignedURL != nil || params.DestinationRegion != nil {
if params.PresignedUrl != nil || params.DestinationRegion != nil {
return
}
@ -53,5 +53,5 @@ func fillPresignedURL(r *aws.Request) {
}
// We have our URL, set it on params
params.PresignedURL = &url
params.PresignedUrl = &url
}

View File

@ -24,7 +24,7 @@ func TestCopySnapshotPresignedURL(t *testing.T) {
req, _ := svc.CopySnapshotRequest(&ec2.CopySnapshotInput{
SourceRegion: aws.String("us-west-1"),
SourceSnapshotID: aws.String("snap-id"),
SourceSnapshotId: aws.String("snap-id"),
})
req.Sign()

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,8 @@ package ec2
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/defaults"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/internal/protocol/ec2query"
"github.com/aws/aws-sdk-go/internal/signer/v4"
)
@ -13,19 +15,19 @@ import (
// need to invest in hardware up front, so you can develop and deploy applications
// faster.
type EC2 struct {
*aws.Service
*service.Service
}
// Used for custom service initialization logic
var initService func(*aws.Service)
var initService func(*service.Service)
// Used for custom request initialization logic
var initRequest func(*aws.Request)
var initRequest func(*service.Request)
// New returns a new EC2 client.
func New(config *aws.Config) *EC2 {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "ec2",
APIVersion: "2015-04-15",
}
@ -48,8 +50,8 @@ func New(config *aws.Config) *EC2 {
// newRequest creates a new request for a EC2 operation and runs any
// custom request initialization.
func (c *EC2) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {
req := aws.NewRequest(c.Service, op, params, data)
func (c *EC2) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
// Run custom request initialization if present
if initRequest != nil {

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,7 @@ func ExampleIAM_AddClientIDToOpenIDConnectProvider() {
params := &iam.AddClientIDToOpenIDConnectProviderInput{
ClientID: aws.String("clientIDType"), // Required
OpenIDConnectProviderARN: aws.String("arnType"), // Required
OpenIDConnectProviderArn: aws.String("arnType"), // Required
}
resp, err := svc.AddClientIDToOpenIDConnectProvider(params)
@ -105,7 +105,7 @@ func ExampleIAM_AttachGroupPolicy() {
params := &iam.AttachGroupPolicyInput{
GroupName: aws.String("groupNameType"), // Required
PolicyARN: aws.String("arnType"), // Required
PolicyArn: aws.String("arnType"), // Required
}
resp, err := svc.AttachGroupPolicy(params)
@ -132,7 +132,7 @@ func ExampleIAM_AttachRolePolicy() {
svc := iam.New(nil)
params := &iam.AttachRolePolicyInput{
PolicyARN: aws.String("arnType"), // Required
PolicyArn: aws.String("arnType"), // Required
RoleName: aws.String("roleNameType"), // Required
}
resp, err := svc.AttachRolePolicy(params)
@ -160,7 +160,7 @@ func ExampleIAM_AttachUserPolicy() {
svc := iam.New(nil)
params := &iam.AttachUserPolicyInput{
PolicyARN: aws.String("arnType"), // Required
PolicyArn: aws.String("arnType"), // Required
UserName: aws.String("userNameType"), // Required
}
resp, err := svc.AttachUserPolicy(params)
@ -359,7 +359,7 @@ func ExampleIAM_CreateOpenIDConnectProvider() {
aws.String("thumbprintType"), // Required
// More values...
},
URL: aws.String("OpenIDConnectProviderUrlType"), // Required
Url: aws.String("OpenIDConnectProviderUrlType"), // Required
ClientIDList: []*string{
aws.String("clientIDType"), // Required
// More values...
@ -420,7 +420,7 @@ func ExampleIAM_CreatePolicyVersion() {
svc := iam.New(nil)
params := &iam.CreatePolicyVersionInput{
PolicyARN: aws.String("arnType"), // Required
PolicyArn: aws.String("arnType"), // Required
PolicyDocument: aws.String("policyDocumentType"), // Required
SetAsDefault: aws.Bool(true),
}
@ -590,7 +590,7 @@ func ExampleIAM_DeleteAccessKey() {
svc := iam.New(nil)
params := &iam.DeleteAccessKeyInput{
AccessKeyID: aws.String("accessKeyIdType"), // Required
AccessKeyId: aws.String("accessKeyIdType"), // Required
UserName: aws.String("existingUserNameType"),
}
resp, err := svc.DeleteAccessKey(params)
@ -779,7 +779,7 @@ func ExampleIAM_DeleteOpenIDConnectProvider() {
svc := iam.New(nil)
params := &iam.DeleteOpenIDConnectProviderInput{
OpenIDConnectProviderARN: aws.String("arnType"), // Required
OpenIDConnectProviderArn: aws.String("arnType"), // Required
}
resp, err := svc.DeleteOpenIDConnectProvider(params)
@ -806,7 +806,7 @@ func ExampleIAM_DeletePolicy() {
svc := iam.New(nil)
params := &iam.DeletePolicyInput{
PolicyARN: aws.String("arnType"), // Required
PolicyArn: aws.String("arnType"), // Required
}
resp, err := svc.DeletePolicy(params)
@ -833,8 +833,8 @@ func ExampleIAM_DeletePolicyVersion() {
svc := iam.New(nil)
params := &iam.DeletePolicyVersionInput{
PolicyARN: aws.String("arnType"), // Required
VersionID: aws.String("policyVersionIdType"), // Required
PolicyArn: aws.String("arnType"), // Required
VersionId: aws.String("policyVersionIdType"), // Required
}
resp, err := svc.DeletePolicyVersion(params)
@ -916,7 +916,7 @@ func ExampleIAM_DeleteSAMLProvider() {
svc := iam.New(nil)
params := &iam.DeleteSAMLProviderInput{
SAMLProviderARN: aws.String("arnType"), // Required
SAMLProviderArn: aws.String("arnType"), // Required
}
resp, err := svc.DeleteSAMLProvider(params)
@ -943,7 +943,7 @@ func ExampleIAM_DeleteSSHPublicKey() {
svc := iam.New(nil)
params := &iam.DeleteSSHPublicKeyInput{
SSHPublicKeyID: aws.String("publicKeyIdType"), // Required
SSHPublicKeyId: aws.String("publicKeyIdType"), // Required
UserName: aws.String("userNameType"), // Required
}
resp, err := svc.DeleteSSHPublicKey(params)
@ -998,7 +998,7 @@ func ExampleIAM_DeleteSigningCertificate() {
svc := iam.New(nil)
params := &iam.DeleteSigningCertificateInput{
CertificateID: aws.String("certificateIdType"), // Required
CertificateId: aws.String("certificateIdType"), // Required
UserName: aws.String("existingUserNameType"),
}
resp, err := svc.DeleteSigningCertificate(params)
@ -1109,7 +1109,7 @@ func ExampleIAM_DetachGroupPolicy() {
params := &iam.DetachGroupPolicyInput{
GroupName: aws.String("groupNameType"), // Required
PolicyARN: aws.String("arnType"), // Required
PolicyArn: aws.String("arnType"), // Required
}
resp, err := svc.DetachGroupPolicy(params)
@ -1136,7 +1136,7 @@ func ExampleIAM_DetachRolePolicy() {
svc := iam.New(nil)
params := &iam.DetachRolePolicyInput{
PolicyARN: aws.String("arnType"), // Required
PolicyArn: aws.String("arnType"), // Required
RoleName: aws.String("roleNameType"), // Required
}
resp, err := svc.DetachRolePolicy(params)
@ -1164,7 +1164,7 @@ func ExampleIAM_DetachUserPolicy() {
svc := iam.New(nil)
params := &iam.DetachUserPolicyInput{
PolicyARN: aws.String("arnType"), // Required
PolicyArn: aws.String("arnType"), // Required
UserName: aws.String("userNameType"), // Required
}
resp, err := svc.DetachUserPolicy(params)
@ -1247,7 +1247,7 @@ func ExampleIAM_GetAccessKeyLastUsed() {
svc := iam.New(nil)
params := &iam.GetAccessKeyLastUsedInput{
AccessKeyID: aws.String("accessKeyIdType"), // Required
AccessKeyId: aws.String("accessKeyIdType"), // Required
}
resp, err := svc.GetAccessKeyLastUsed(params)
@ -1492,7 +1492,7 @@ func ExampleIAM_GetOpenIDConnectProvider() {
svc := iam.New(nil)
params := &iam.GetOpenIDConnectProviderInput{
OpenIDConnectProviderARN: aws.String("arnType"), // Required
OpenIDConnectProviderArn: aws.String("arnType"), // Required
}
resp, err := svc.GetOpenIDConnectProvider(params)
@ -1519,7 +1519,7 @@ func ExampleIAM_GetPolicy() {
svc := iam.New(nil)
params := &iam.GetPolicyInput{
PolicyARN: aws.String("arnType"), // Required
PolicyArn: aws.String("arnType"), // Required
}
resp, err := svc.GetPolicy(params)
@ -1546,8 +1546,8 @@ func ExampleIAM_GetPolicyVersion() {
svc := iam.New(nil)
params := &iam.GetPolicyVersionInput{
PolicyARN: aws.String("arnType"), // Required
VersionID: aws.String("policyVersionIdType"), // Required
PolicyArn: aws.String("arnType"), // Required
VersionId: aws.String("policyVersionIdType"), // Required
}
resp, err := svc.GetPolicyVersion(params)
@ -1629,7 +1629,7 @@ func ExampleIAM_GetSAMLProvider() {
svc := iam.New(nil)
params := &iam.GetSAMLProviderInput{
SAMLProviderARN: aws.String("arnType"), // Required
SAMLProviderArn: aws.String("arnType"), // Required
}
resp, err := svc.GetSAMLProvider(params)
@ -1657,7 +1657,7 @@ func ExampleIAM_GetSSHPublicKey() {
params := &iam.GetSSHPublicKeyInput{
Encoding: aws.String("encodingType"), // Required
SSHPublicKeyID: aws.String("publicKeyIdType"), // Required
SSHPublicKeyId: aws.String("publicKeyIdType"), // Required
UserName: aws.String("userNameType"), // Required
}
resp, err := svc.GetSSHPublicKey(params)
@ -1914,7 +1914,7 @@ func ExampleIAM_ListEntitiesForPolicy() {
svc := iam.New(nil)
params := &iam.ListEntitiesForPolicyInput{
PolicyARN: aws.String("arnType"), // Required
PolicyArn: aws.String("arnType"), // Required
EntityFilter: aws.String("EntityType"),
Marker: aws.String("markerType"),
MaxItems: aws.Int64(1),
@ -2175,7 +2175,7 @@ func ExampleIAM_ListPolicyVersions() {
svc := iam.New(nil)
params := &iam.ListPolicyVersionsInput{
PolicyARN: aws.String("arnType"), // Required
PolicyArn: aws.String("arnType"), // Required
Marker: aws.String("markerType"),
MaxItems: aws.Int64(1),
}
@ -2549,7 +2549,7 @@ func ExampleIAM_RemoveClientIDFromOpenIDConnectProvider() {
params := &iam.RemoveClientIDFromOpenIDConnectProviderInput{
ClientID: aws.String("clientIDType"), // Required
OpenIDConnectProviderARN: aws.String("arnType"), // Required
OpenIDConnectProviderArn: aws.String("arnType"), // Required
}
resp, err := svc.RemoveClientIDFromOpenIDConnectProvider(params)
@ -2662,8 +2662,8 @@ func ExampleIAM_SetDefaultPolicyVersion() {
svc := iam.New(nil)
params := &iam.SetDefaultPolicyVersionInput{
PolicyARN: aws.String("arnType"), // Required
VersionID: aws.String("policyVersionIdType"), // Required
PolicyArn: aws.String("arnType"), // Required
VersionId: aws.String("policyVersionIdType"), // Required
}
resp, err := svc.SetDefaultPolicyVersion(params)
@ -2690,7 +2690,7 @@ func ExampleIAM_UpdateAccessKey() {
svc := iam.New(nil)
params := &iam.UpdateAccessKeyInput{
AccessKeyID: aws.String("accessKeyIdType"), // Required
AccessKeyId: aws.String("accessKeyIdType"), // Required
Status: aws.String("statusType"), // Required
UserName: aws.String("existingUserNameType"),
}
@ -2840,7 +2840,7 @@ func ExampleIAM_UpdateOpenIDConnectProviderThumbprint() {
svc := iam.New(nil)
params := &iam.UpdateOpenIDConnectProviderThumbprintInput{
OpenIDConnectProviderARN: aws.String("arnType"), // Required
OpenIDConnectProviderArn: aws.String("arnType"), // Required
ThumbprintList: []*string{ // Required
aws.String("thumbprintType"), // Required
// More values...
@ -2872,7 +2872,7 @@ func ExampleIAM_UpdateSAMLProvider() {
params := &iam.UpdateSAMLProviderInput{
SAMLMetadataDocument: aws.String("SAMLMetadataDocumentType"), // Required
SAMLProviderARN: aws.String("arnType"), // Required
SAMLProviderArn: aws.String("arnType"), // Required
}
resp, err := svc.UpdateSAMLProvider(params)
@ -2899,7 +2899,7 @@ func ExampleIAM_UpdateSSHPublicKey() {
svc := iam.New(nil)
params := &iam.UpdateSSHPublicKeyInput{
SSHPublicKeyID: aws.String("publicKeyIdType"), // Required
SSHPublicKeyId: aws.String("publicKeyIdType"), // Required
Status: aws.String("statusType"), // Required
UserName: aws.String("userNameType"), // Required
}
@ -2957,7 +2957,7 @@ func ExampleIAM_UpdateSigningCertificate() {
svc := iam.New(nil)
params := &iam.UpdateSigningCertificateInput{
CertificateID: aws.String("certificateIdType"), // Required
CertificateId: aws.String("certificateIdType"), // Required
Status: aws.String("statusType"), // Required
UserName: aws.String("existingUserNameType"),
}

View File

@ -4,489 +4,489 @@
package iamiface
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/service/iam"
)
// IAMAPI is the interface type for iam.IAM.
type IAMAPI interface {
AddClientIDToOpenIDConnectProviderRequest(*iam.AddClientIDToOpenIDConnectProviderInput) (*aws.Request, *iam.AddClientIDToOpenIDConnectProviderOutput)
AddClientIDToOpenIDConnectProviderRequest(*iam.AddClientIDToOpenIDConnectProviderInput) (*service.Request, *iam.AddClientIDToOpenIDConnectProviderOutput)
AddClientIDToOpenIDConnectProvider(*iam.AddClientIDToOpenIDConnectProviderInput) (*iam.AddClientIDToOpenIDConnectProviderOutput, error)
AddRoleToInstanceProfileRequest(*iam.AddRoleToInstanceProfileInput) (*aws.Request, *iam.AddRoleToInstanceProfileOutput)
AddRoleToInstanceProfileRequest(*iam.AddRoleToInstanceProfileInput) (*service.Request, *iam.AddRoleToInstanceProfileOutput)
AddRoleToInstanceProfile(*iam.AddRoleToInstanceProfileInput) (*iam.AddRoleToInstanceProfileOutput, error)
AddUserToGroupRequest(*iam.AddUserToGroupInput) (*aws.Request, *iam.AddUserToGroupOutput)
AddUserToGroupRequest(*iam.AddUserToGroupInput) (*service.Request, *iam.AddUserToGroupOutput)
AddUserToGroup(*iam.AddUserToGroupInput) (*iam.AddUserToGroupOutput, error)
AttachGroupPolicyRequest(*iam.AttachGroupPolicyInput) (*aws.Request, *iam.AttachGroupPolicyOutput)
AttachGroupPolicyRequest(*iam.AttachGroupPolicyInput) (*service.Request, *iam.AttachGroupPolicyOutput)
AttachGroupPolicy(*iam.AttachGroupPolicyInput) (*iam.AttachGroupPolicyOutput, error)
AttachRolePolicyRequest(*iam.AttachRolePolicyInput) (*aws.Request, *iam.AttachRolePolicyOutput)
AttachRolePolicyRequest(*iam.AttachRolePolicyInput) (*service.Request, *iam.AttachRolePolicyOutput)
AttachRolePolicy(*iam.AttachRolePolicyInput) (*iam.AttachRolePolicyOutput, error)
AttachUserPolicyRequest(*iam.AttachUserPolicyInput) (*aws.Request, *iam.AttachUserPolicyOutput)
AttachUserPolicyRequest(*iam.AttachUserPolicyInput) (*service.Request, *iam.AttachUserPolicyOutput)
AttachUserPolicy(*iam.AttachUserPolicyInput) (*iam.AttachUserPolicyOutput, error)
ChangePasswordRequest(*iam.ChangePasswordInput) (*aws.Request, *iam.ChangePasswordOutput)
ChangePasswordRequest(*iam.ChangePasswordInput) (*service.Request, *iam.ChangePasswordOutput)
ChangePassword(*iam.ChangePasswordInput) (*iam.ChangePasswordOutput, error)
CreateAccessKeyRequest(*iam.CreateAccessKeyInput) (*aws.Request, *iam.CreateAccessKeyOutput)
CreateAccessKeyRequest(*iam.CreateAccessKeyInput) (*service.Request, *iam.CreateAccessKeyOutput)
CreateAccessKey(*iam.CreateAccessKeyInput) (*iam.CreateAccessKeyOutput, error)
CreateAccountAliasRequest(*iam.CreateAccountAliasInput) (*aws.Request, *iam.CreateAccountAliasOutput)
CreateAccountAliasRequest(*iam.CreateAccountAliasInput) (*service.Request, *iam.CreateAccountAliasOutput)
CreateAccountAlias(*iam.CreateAccountAliasInput) (*iam.CreateAccountAliasOutput, error)
CreateGroupRequest(*iam.CreateGroupInput) (*aws.Request, *iam.CreateGroupOutput)
CreateGroupRequest(*iam.CreateGroupInput) (*service.Request, *iam.CreateGroupOutput)
CreateGroup(*iam.CreateGroupInput) (*iam.CreateGroupOutput, error)
CreateInstanceProfileRequest(*iam.CreateInstanceProfileInput) (*aws.Request, *iam.CreateInstanceProfileOutput)
CreateInstanceProfileRequest(*iam.CreateInstanceProfileInput) (*service.Request, *iam.CreateInstanceProfileOutput)
CreateInstanceProfile(*iam.CreateInstanceProfileInput) (*iam.CreateInstanceProfileOutput, error)
CreateLoginProfileRequest(*iam.CreateLoginProfileInput) (*aws.Request, *iam.CreateLoginProfileOutput)
CreateLoginProfileRequest(*iam.CreateLoginProfileInput) (*service.Request, *iam.CreateLoginProfileOutput)
CreateLoginProfile(*iam.CreateLoginProfileInput) (*iam.CreateLoginProfileOutput, error)
CreateOpenIDConnectProviderRequest(*iam.CreateOpenIDConnectProviderInput) (*aws.Request, *iam.CreateOpenIDConnectProviderOutput)
CreateOpenIDConnectProviderRequest(*iam.CreateOpenIDConnectProviderInput) (*service.Request, *iam.CreateOpenIDConnectProviderOutput)
CreateOpenIDConnectProvider(*iam.CreateOpenIDConnectProviderInput) (*iam.CreateOpenIDConnectProviderOutput, error)
CreatePolicyRequest(*iam.CreatePolicyInput) (*aws.Request, *iam.CreatePolicyOutput)
CreatePolicyRequest(*iam.CreatePolicyInput) (*service.Request, *iam.CreatePolicyOutput)
CreatePolicy(*iam.CreatePolicyInput) (*iam.CreatePolicyOutput, error)
CreatePolicyVersionRequest(*iam.CreatePolicyVersionInput) (*aws.Request, *iam.CreatePolicyVersionOutput)
CreatePolicyVersionRequest(*iam.CreatePolicyVersionInput) (*service.Request, *iam.CreatePolicyVersionOutput)
CreatePolicyVersion(*iam.CreatePolicyVersionInput) (*iam.CreatePolicyVersionOutput, error)
CreateRoleRequest(*iam.CreateRoleInput) (*aws.Request, *iam.CreateRoleOutput)
CreateRoleRequest(*iam.CreateRoleInput) (*service.Request, *iam.CreateRoleOutput)
CreateRole(*iam.CreateRoleInput) (*iam.CreateRoleOutput, error)
CreateSAMLProviderRequest(*iam.CreateSAMLProviderInput) (*aws.Request, *iam.CreateSAMLProviderOutput)
CreateSAMLProviderRequest(*iam.CreateSAMLProviderInput) (*service.Request, *iam.CreateSAMLProviderOutput)
CreateSAMLProvider(*iam.CreateSAMLProviderInput) (*iam.CreateSAMLProviderOutput, error)
CreateUserRequest(*iam.CreateUserInput) (*aws.Request, *iam.CreateUserOutput)
CreateUserRequest(*iam.CreateUserInput) (*service.Request, *iam.CreateUserOutput)
CreateUser(*iam.CreateUserInput) (*iam.CreateUserOutput, error)
CreateVirtualMFADeviceRequest(*iam.CreateVirtualMFADeviceInput) (*aws.Request, *iam.CreateVirtualMFADeviceOutput)
CreateVirtualMFADeviceRequest(*iam.CreateVirtualMFADeviceInput) (*service.Request, *iam.CreateVirtualMFADeviceOutput)
CreateVirtualMFADevice(*iam.CreateVirtualMFADeviceInput) (*iam.CreateVirtualMFADeviceOutput, error)
DeactivateMFADeviceRequest(*iam.DeactivateMFADeviceInput) (*aws.Request, *iam.DeactivateMFADeviceOutput)
DeactivateMFADeviceRequest(*iam.DeactivateMFADeviceInput) (*service.Request, *iam.DeactivateMFADeviceOutput)
DeactivateMFADevice(*iam.DeactivateMFADeviceInput) (*iam.DeactivateMFADeviceOutput, error)
DeleteAccessKeyRequest(*iam.DeleteAccessKeyInput) (*aws.Request, *iam.DeleteAccessKeyOutput)
DeleteAccessKeyRequest(*iam.DeleteAccessKeyInput) (*service.Request, *iam.DeleteAccessKeyOutput)
DeleteAccessKey(*iam.DeleteAccessKeyInput) (*iam.DeleteAccessKeyOutput, error)
DeleteAccountAliasRequest(*iam.DeleteAccountAliasInput) (*aws.Request, *iam.DeleteAccountAliasOutput)
DeleteAccountAliasRequest(*iam.DeleteAccountAliasInput) (*service.Request, *iam.DeleteAccountAliasOutput)
DeleteAccountAlias(*iam.DeleteAccountAliasInput) (*iam.DeleteAccountAliasOutput, error)
DeleteAccountPasswordPolicyRequest(*iam.DeleteAccountPasswordPolicyInput) (*aws.Request, *iam.DeleteAccountPasswordPolicyOutput)
DeleteAccountPasswordPolicyRequest(*iam.DeleteAccountPasswordPolicyInput) (*service.Request, *iam.DeleteAccountPasswordPolicyOutput)
DeleteAccountPasswordPolicy(*iam.DeleteAccountPasswordPolicyInput) (*iam.DeleteAccountPasswordPolicyOutput, error)
DeleteGroupRequest(*iam.DeleteGroupInput) (*aws.Request, *iam.DeleteGroupOutput)
DeleteGroupRequest(*iam.DeleteGroupInput) (*service.Request, *iam.DeleteGroupOutput)
DeleteGroup(*iam.DeleteGroupInput) (*iam.DeleteGroupOutput, error)
DeleteGroupPolicyRequest(*iam.DeleteGroupPolicyInput) (*aws.Request, *iam.DeleteGroupPolicyOutput)
DeleteGroupPolicyRequest(*iam.DeleteGroupPolicyInput) (*service.Request, *iam.DeleteGroupPolicyOutput)
DeleteGroupPolicy(*iam.DeleteGroupPolicyInput) (*iam.DeleteGroupPolicyOutput, error)
DeleteInstanceProfileRequest(*iam.DeleteInstanceProfileInput) (*aws.Request, *iam.DeleteInstanceProfileOutput)
DeleteInstanceProfileRequest(*iam.DeleteInstanceProfileInput) (*service.Request, *iam.DeleteInstanceProfileOutput)
DeleteInstanceProfile(*iam.DeleteInstanceProfileInput) (*iam.DeleteInstanceProfileOutput, error)
DeleteLoginProfileRequest(*iam.DeleteLoginProfileInput) (*aws.Request, *iam.DeleteLoginProfileOutput)
DeleteLoginProfileRequest(*iam.DeleteLoginProfileInput) (*service.Request, *iam.DeleteLoginProfileOutput)
DeleteLoginProfile(*iam.DeleteLoginProfileInput) (*iam.DeleteLoginProfileOutput, error)
DeleteOpenIDConnectProviderRequest(*iam.DeleteOpenIDConnectProviderInput) (*aws.Request, *iam.DeleteOpenIDConnectProviderOutput)
DeleteOpenIDConnectProviderRequest(*iam.DeleteOpenIDConnectProviderInput) (*service.Request, *iam.DeleteOpenIDConnectProviderOutput)
DeleteOpenIDConnectProvider(*iam.DeleteOpenIDConnectProviderInput) (*iam.DeleteOpenIDConnectProviderOutput, error)
DeletePolicyRequest(*iam.DeletePolicyInput) (*aws.Request, *iam.DeletePolicyOutput)
DeletePolicyRequest(*iam.DeletePolicyInput) (*service.Request, *iam.DeletePolicyOutput)
DeletePolicy(*iam.DeletePolicyInput) (*iam.DeletePolicyOutput, error)
DeletePolicyVersionRequest(*iam.DeletePolicyVersionInput) (*aws.Request, *iam.DeletePolicyVersionOutput)
DeletePolicyVersionRequest(*iam.DeletePolicyVersionInput) (*service.Request, *iam.DeletePolicyVersionOutput)
DeletePolicyVersion(*iam.DeletePolicyVersionInput) (*iam.DeletePolicyVersionOutput, error)
DeleteRoleRequest(*iam.DeleteRoleInput) (*aws.Request, *iam.DeleteRoleOutput)
DeleteRoleRequest(*iam.DeleteRoleInput) (*service.Request, *iam.DeleteRoleOutput)
DeleteRole(*iam.DeleteRoleInput) (*iam.DeleteRoleOutput, error)
DeleteRolePolicyRequest(*iam.DeleteRolePolicyInput) (*aws.Request, *iam.DeleteRolePolicyOutput)
DeleteRolePolicyRequest(*iam.DeleteRolePolicyInput) (*service.Request, *iam.DeleteRolePolicyOutput)
DeleteRolePolicy(*iam.DeleteRolePolicyInput) (*iam.DeleteRolePolicyOutput, error)
DeleteSAMLProviderRequest(*iam.DeleteSAMLProviderInput) (*aws.Request, *iam.DeleteSAMLProviderOutput)
DeleteSAMLProviderRequest(*iam.DeleteSAMLProviderInput) (*service.Request, *iam.DeleteSAMLProviderOutput)
DeleteSAMLProvider(*iam.DeleteSAMLProviderInput) (*iam.DeleteSAMLProviderOutput, error)
DeleteSSHPublicKeyRequest(*iam.DeleteSSHPublicKeyInput) (*aws.Request, *iam.DeleteSSHPublicKeyOutput)
DeleteSSHPublicKeyRequest(*iam.DeleteSSHPublicKeyInput) (*service.Request, *iam.DeleteSSHPublicKeyOutput)
DeleteSSHPublicKey(*iam.DeleteSSHPublicKeyInput) (*iam.DeleteSSHPublicKeyOutput, error)
DeleteServerCertificateRequest(*iam.DeleteServerCertificateInput) (*aws.Request, *iam.DeleteServerCertificateOutput)
DeleteServerCertificateRequest(*iam.DeleteServerCertificateInput) (*service.Request, *iam.DeleteServerCertificateOutput)
DeleteServerCertificate(*iam.DeleteServerCertificateInput) (*iam.DeleteServerCertificateOutput, error)
DeleteSigningCertificateRequest(*iam.DeleteSigningCertificateInput) (*aws.Request, *iam.DeleteSigningCertificateOutput)
DeleteSigningCertificateRequest(*iam.DeleteSigningCertificateInput) (*service.Request, *iam.DeleteSigningCertificateOutput)
DeleteSigningCertificate(*iam.DeleteSigningCertificateInput) (*iam.DeleteSigningCertificateOutput, error)
DeleteUserRequest(*iam.DeleteUserInput) (*aws.Request, *iam.DeleteUserOutput)
DeleteUserRequest(*iam.DeleteUserInput) (*service.Request, *iam.DeleteUserOutput)
DeleteUser(*iam.DeleteUserInput) (*iam.DeleteUserOutput, error)
DeleteUserPolicyRequest(*iam.DeleteUserPolicyInput) (*aws.Request, *iam.DeleteUserPolicyOutput)
DeleteUserPolicyRequest(*iam.DeleteUserPolicyInput) (*service.Request, *iam.DeleteUserPolicyOutput)
DeleteUserPolicy(*iam.DeleteUserPolicyInput) (*iam.DeleteUserPolicyOutput, error)
DeleteVirtualMFADeviceRequest(*iam.DeleteVirtualMFADeviceInput) (*aws.Request, *iam.DeleteVirtualMFADeviceOutput)
DeleteVirtualMFADeviceRequest(*iam.DeleteVirtualMFADeviceInput) (*service.Request, *iam.DeleteVirtualMFADeviceOutput)
DeleteVirtualMFADevice(*iam.DeleteVirtualMFADeviceInput) (*iam.DeleteVirtualMFADeviceOutput, error)
DetachGroupPolicyRequest(*iam.DetachGroupPolicyInput) (*aws.Request, *iam.DetachGroupPolicyOutput)
DetachGroupPolicyRequest(*iam.DetachGroupPolicyInput) (*service.Request, *iam.DetachGroupPolicyOutput)
DetachGroupPolicy(*iam.DetachGroupPolicyInput) (*iam.DetachGroupPolicyOutput, error)
DetachRolePolicyRequest(*iam.DetachRolePolicyInput) (*aws.Request, *iam.DetachRolePolicyOutput)
DetachRolePolicyRequest(*iam.DetachRolePolicyInput) (*service.Request, *iam.DetachRolePolicyOutput)
DetachRolePolicy(*iam.DetachRolePolicyInput) (*iam.DetachRolePolicyOutput, error)
DetachUserPolicyRequest(*iam.DetachUserPolicyInput) (*aws.Request, *iam.DetachUserPolicyOutput)
DetachUserPolicyRequest(*iam.DetachUserPolicyInput) (*service.Request, *iam.DetachUserPolicyOutput)
DetachUserPolicy(*iam.DetachUserPolicyInput) (*iam.DetachUserPolicyOutput, error)
EnableMFADeviceRequest(*iam.EnableMFADeviceInput) (*aws.Request, *iam.EnableMFADeviceOutput)
EnableMFADeviceRequest(*iam.EnableMFADeviceInput) (*service.Request, *iam.EnableMFADeviceOutput)
EnableMFADevice(*iam.EnableMFADeviceInput) (*iam.EnableMFADeviceOutput, error)
GenerateCredentialReportRequest(*iam.GenerateCredentialReportInput) (*aws.Request, *iam.GenerateCredentialReportOutput)
GenerateCredentialReportRequest(*iam.GenerateCredentialReportInput) (*service.Request, *iam.GenerateCredentialReportOutput)
GenerateCredentialReport(*iam.GenerateCredentialReportInput) (*iam.GenerateCredentialReportOutput, error)
GetAccessKeyLastUsedRequest(*iam.GetAccessKeyLastUsedInput) (*aws.Request, *iam.GetAccessKeyLastUsedOutput)
GetAccessKeyLastUsedRequest(*iam.GetAccessKeyLastUsedInput) (*service.Request, *iam.GetAccessKeyLastUsedOutput)
GetAccessKeyLastUsed(*iam.GetAccessKeyLastUsedInput) (*iam.GetAccessKeyLastUsedOutput, error)
GetAccountAuthorizationDetailsRequest(*iam.GetAccountAuthorizationDetailsInput) (*aws.Request, *iam.GetAccountAuthorizationDetailsOutput)
GetAccountAuthorizationDetailsRequest(*iam.GetAccountAuthorizationDetailsInput) (*service.Request, *iam.GetAccountAuthorizationDetailsOutput)
GetAccountAuthorizationDetails(*iam.GetAccountAuthorizationDetailsInput) (*iam.GetAccountAuthorizationDetailsOutput, error)
GetAccountAuthorizationDetailsPages(*iam.GetAccountAuthorizationDetailsInput, func(*iam.GetAccountAuthorizationDetailsOutput, bool) bool) error
GetAccountPasswordPolicyRequest(*iam.GetAccountPasswordPolicyInput) (*aws.Request, *iam.GetAccountPasswordPolicyOutput)
GetAccountPasswordPolicyRequest(*iam.GetAccountPasswordPolicyInput) (*service.Request, *iam.GetAccountPasswordPolicyOutput)
GetAccountPasswordPolicy(*iam.GetAccountPasswordPolicyInput) (*iam.GetAccountPasswordPolicyOutput, error)
GetAccountSummaryRequest(*iam.GetAccountSummaryInput) (*aws.Request, *iam.GetAccountSummaryOutput)
GetAccountSummaryRequest(*iam.GetAccountSummaryInput) (*service.Request, *iam.GetAccountSummaryOutput)
GetAccountSummary(*iam.GetAccountSummaryInput) (*iam.GetAccountSummaryOutput, error)
GetCredentialReportRequest(*iam.GetCredentialReportInput) (*aws.Request, *iam.GetCredentialReportOutput)
GetCredentialReportRequest(*iam.GetCredentialReportInput) (*service.Request, *iam.GetCredentialReportOutput)
GetCredentialReport(*iam.GetCredentialReportInput) (*iam.GetCredentialReportOutput, error)
GetGroupRequest(*iam.GetGroupInput) (*aws.Request, *iam.GetGroupOutput)
GetGroupRequest(*iam.GetGroupInput) (*service.Request, *iam.GetGroupOutput)
GetGroup(*iam.GetGroupInput) (*iam.GetGroupOutput, error)
GetGroupPages(*iam.GetGroupInput, func(*iam.GetGroupOutput, bool) bool) error
GetGroupPolicyRequest(*iam.GetGroupPolicyInput) (*aws.Request, *iam.GetGroupPolicyOutput)
GetGroupPolicyRequest(*iam.GetGroupPolicyInput) (*service.Request, *iam.GetGroupPolicyOutput)
GetGroupPolicy(*iam.GetGroupPolicyInput) (*iam.GetGroupPolicyOutput, error)
GetInstanceProfileRequest(*iam.GetInstanceProfileInput) (*aws.Request, *iam.GetInstanceProfileOutput)
GetInstanceProfileRequest(*iam.GetInstanceProfileInput) (*service.Request, *iam.GetInstanceProfileOutput)
GetInstanceProfile(*iam.GetInstanceProfileInput) (*iam.GetInstanceProfileOutput, error)
GetLoginProfileRequest(*iam.GetLoginProfileInput) (*aws.Request, *iam.GetLoginProfileOutput)
GetLoginProfileRequest(*iam.GetLoginProfileInput) (*service.Request, *iam.GetLoginProfileOutput)
GetLoginProfile(*iam.GetLoginProfileInput) (*iam.GetLoginProfileOutput, error)
GetOpenIDConnectProviderRequest(*iam.GetOpenIDConnectProviderInput) (*aws.Request, *iam.GetOpenIDConnectProviderOutput)
GetOpenIDConnectProviderRequest(*iam.GetOpenIDConnectProviderInput) (*service.Request, *iam.GetOpenIDConnectProviderOutput)
GetOpenIDConnectProvider(*iam.GetOpenIDConnectProviderInput) (*iam.GetOpenIDConnectProviderOutput, error)
GetPolicyRequest(*iam.GetPolicyInput) (*aws.Request, *iam.GetPolicyOutput)
GetPolicyRequest(*iam.GetPolicyInput) (*service.Request, *iam.GetPolicyOutput)
GetPolicy(*iam.GetPolicyInput) (*iam.GetPolicyOutput, error)
GetPolicyVersionRequest(*iam.GetPolicyVersionInput) (*aws.Request, *iam.GetPolicyVersionOutput)
GetPolicyVersionRequest(*iam.GetPolicyVersionInput) (*service.Request, *iam.GetPolicyVersionOutput)
GetPolicyVersion(*iam.GetPolicyVersionInput) (*iam.GetPolicyVersionOutput, error)
GetRoleRequest(*iam.GetRoleInput) (*aws.Request, *iam.GetRoleOutput)
GetRoleRequest(*iam.GetRoleInput) (*service.Request, *iam.GetRoleOutput)
GetRole(*iam.GetRoleInput) (*iam.GetRoleOutput, error)
GetRolePolicyRequest(*iam.GetRolePolicyInput) (*aws.Request, *iam.GetRolePolicyOutput)
GetRolePolicyRequest(*iam.GetRolePolicyInput) (*service.Request, *iam.GetRolePolicyOutput)
GetRolePolicy(*iam.GetRolePolicyInput) (*iam.GetRolePolicyOutput, error)
GetSAMLProviderRequest(*iam.GetSAMLProviderInput) (*aws.Request, *iam.GetSAMLProviderOutput)
GetSAMLProviderRequest(*iam.GetSAMLProviderInput) (*service.Request, *iam.GetSAMLProviderOutput)
GetSAMLProvider(*iam.GetSAMLProviderInput) (*iam.GetSAMLProviderOutput, error)
GetSSHPublicKeyRequest(*iam.GetSSHPublicKeyInput) (*aws.Request, *iam.GetSSHPublicKeyOutput)
GetSSHPublicKeyRequest(*iam.GetSSHPublicKeyInput) (*service.Request, *iam.GetSSHPublicKeyOutput)
GetSSHPublicKey(*iam.GetSSHPublicKeyInput) (*iam.GetSSHPublicKeyOutput, error)
GetServerCertificateRequest(*iam.GetServerCertificateInput) (*aws.Request, *iam.GetServerCertificateOutput)
GetServerCertificateRequest(*iam.GetServerCertificateInput) (*service.Request, *iam.GetServerCertificateOutput)
GetServerCertificate(*iam.GetServerCertificateInput) (*iam.GetServerCertificateOutput, error)
GetUserRequest(*iam.GetUserInput) (*aws.Request, *iam.GetUserOutput)
GetUserRequest(*iam.GetUserInput) (*service.Request, *iam.GetUserOutput)
GetUser(*iam.GetUserInput) (*iam.GetUserOutput, error)
GetUserPolicyRequest(*iam.GetUserPolicyInput) (*aws.Request, *iam.GetUserPolicyOutput)
GetUserPolicyRequest(*iam.GetUserPolicyInput) (*service.Request, *iam.GetUserPolicyOutput)
GetUserPolicy(*iam.GetUserPolicyInput) (*iam.GetUserPolicyOutput, error)
ListAccessKeysRequest(*iam.ListAccessKeysInput) (*aws.Request, *iam.ListAccessKeysOutput)
ListAccessKeysRequest(*iam.ListAccessKeysInput) (*service.Request, *iam.ListAccessKeysOutput)
ListAccessKeys(*iam.ListAccessKeysInput) (*iam.ListAccessKeysOutput, error)
ListAccessKeysPages(*iam.ListAccessKeysInput, func(*iam.ListAccessKeysOutput, bool) bool) error
ListAccountAliasesRequest(*iam.ListAccountAliasesInput) (*aws.Request, *iam.ListAccountAliasesOutput)
ListAccountAliasesRequest(*iam.ListAccountAliasesInput) (*service.Request, *iam.ListAccountAliasesOutput)
ListAccountAliases(*iam.ListAccountAliasesInput) (*iam.ListAccountAliasesOutput, error)
ListAccountAliasesPages(*iam.ListAccountAliasesInput, func(*iam.ListAccountAliasesOutput, bool) bool) error
ListAttachedGroupPoliciesRequest(*iam.ListAttachedGroupPoliciesInput) (*aws.Request, *iam.ListAttachedGroupPoliciesOutput)
ListAttachedGroupPoliciesRequest(*iam.ListAttachedGroupPoliciesInput) (*service.Request, *iam.ListAttachedGroupPoliciesOutput)
ListAttachedGroupPolicies(*iam.ListAttachedGroupPoliciesInput) (*iam.ListAttachedGroupPoliciesOutput, error)
ListAttachedGroupPoliciesPages(*iam.ListAttachedGroupPoliciesInput, func(*iam.ListAttachedGroupPoliciesOutput, bool) bool) error
ListAttachedRolePoliciesRequest(*iam.ListAttachedRolePoliciesInput) (*aws.Request, *iam.ListAttachedRolePoliciesOutput)
ListAttachedRolePoliciesRequest(*iam.ListAttachedRolePoliciesInput) (*service.Request, *iam.ListAttachedRolePoliciesOutput)
ListAttachedRolePolicies(*iam.ListAttachedRolePoliciesInput) (*iam.ListAttachedRolePoliciesOutput, error)
ListAttachedRolePoliciesPages(*iam.ListAttachedRolePoliciesInput, func(*iam.ListAttachedRolePoliciesOutput, bool) bool) error
ListAttachedUserPoliciesRequest(*iam.ListAttachedUserPoliciesInput) (*aws.Request, *iam.ListAttachedUserPoliciesOutput)
ListAttachedUserPoliciesRequest(*iam.ListAttachedUserPoliciesInput) (*service.Request, *iam.ListAttachedUserPoliciesOutput)
ListAttachedUserPolicies(*iam.ListAttachedUserPoliciesInput) (*iam.ListAttachedUserPoliciesOutput, error)
ListAttachedUserPoliciesPages(*iam.ListAttachedUserPoliciesInput, func(*iam.ListAttachedUserPoliciesOutput, bool) bool) error
ListEntitiesForPolicyRequest(*iam.ListEntitiesForPolicyInput) (*aws.Request, *iam.ListEntitiesForPolicyOutput)
ListEntitiesForPolicyRequest(*iam.ListEntitiesForPolicyInput) (*service.Request, *iam.ListEntitiesForPolicyOutput)
ListEntitiesForPolicy(*iam.ListEntitiesForPolicyInput) (*iam.ListEntitiesForPolicyOutput, error)
ListEntitiesForPolicyPages(*iam.ListEntitiesForPolicyInput, func(*iam.ListEntitiesForPolicyOutput, bool) bool) error
ListGroupPoliciesRequest(*iam.ListGroupPoliciesInput) (*aws.Request, *iam.ListGroupPoliciesOutput)
ListGroupPoliciesRequest(*iam.ListGroupPoliciesInput) (*service.Request, *iam.ListGroupPoliciesOutput)
ListGroupPolicies(*iam.ListGroupPoliciesInput) (*iam.ListGroupPoliciesOutput, error)
ListGroupPoliciesPages(*iam.ListGroupPoliciesInput, func(*iam.ListGroupPoliciesOutput, bool) bool) error
ListGroupsRequest(*iam.ListGroupsInput) (*aws.Request, *iam.ListGroupsOutput)
ListGroupsRequest(*iam.ListGroupsInput) (*service.Request, *iam.ListGroupsOutput)
ListGroups(*iam.ListGroupsInput) (*iam.ListGroupsOutput, error)
ListGroupsPages(*iam.ListGroupsInput, func(*iam.ListGroupsOutput, bool) bool) error
ListGroupsForUserRequest(*iam.ListGroupsForUserInput) (*aws.Request, *iam.ListGroupsForUserOutput)
ListGroupsForUserRequest(*iam.ListGroupsForUserInput) (*service.Request, *iam.ListGroupsForUserOutput)
ListGroupsForUser(*iam.ListGroupsForUserInput) (*iam.ListGroupsForUserOutput, error)
ListGroupsForUserPages(*iam.ListGroupsForUserInput, func(*iam.ListGroupsForUserOutput, bool) bool) error
ListInstanceProfilesRequest(*iam.ListInstanceProfilesInput) (*aws.Request, *iam.ListInstanceProfilesOutput)
ListInstanceProfilesRequest(*iam.ListInstanceProfilesInput) (*service.Request, *iam.ListInstanceProfilesOutput)
ListInstanceProfiles(*iam.ListInstanceProfilesInput) (*iam.ListInstanceProfilesOutput, error)
ListInstanceProfilesPages(*iam.ListInstanceProfilesInput, func(*iam.ListInstanceProfilesOutput, bool) bool) error
ListInstanceProfilesForRoleRequest(*iam.ListInstanceProfilesForRoleInput) (*aws.Request, *iam.ListInstanceProfilesForRoleOutput)
ListInstanceProfilesForRoleRequest(*iam.ListInstanceProfilesForRoleInput) (*service.Request, *iam.ListInstanceProfilesForRoleOutput)
ListInstanceProfilesForRole(*iam.ListInstanceProfilesForRoleInput) (*iam.ListInstanceProfilesForRoleOutput, error)
ListInstanceProfilesForRolePages(*iam.ListInstanceProfilesForRoleInput, func(*iam.ListInstanceProfilesForRoleOutput, bool) bool) error
ListMFADevicesRequest(*iam.ListMFADevicesInput) (*aws.Request, *iam.ListMFADevicesOutput)
ListMFADevicesRequest(*iam.ListMFADevicesInput) (*service.Request, *iam.ListMFADevicesOutput)
ListMFADevices(*iam.ListMFADevicesInput) (*iam.ListMFADevicesOutput, error)
ListMFADevicesPages(*iam.ListMFADevicesInput, func(*iam.ListMFADevicesOutput, bool) bool) error
ListOpenIDConnectProvidersRequest(*iam.ListOpenIDConnectProvidersInput) (*aws.Request, *iam.ListOpenIDConnectProvidersOutput)
ListOpenIDConnectProvidersRequest(*iam.ListOpenIDConnectProvidersInput) (*service.Request, *iam.ListOpenIDConnectProvidersOutput)
ListOpenIDConnectProviders(*iam.ListOpenIDConnectProvidersInput) (*iam.ListOpenIDConnectProvidersOutput, error)
ListPoliciesRequest(*iam.ListPoliciesInput) (*aws.Request, *iam.ListPoliciesOutput)
ListPoliciesRequest(*iam.ListPoliciesInput) (*service.Request, *iam.ListPoliciesOutput)
ListPolicies(*iam.ListPoliciesInput) (*iam.ListPoliciesOutput, error)
ListPoliciesPages(*iam.ListPoliciesInput, func(*iam.ListPoliciesOutput, bool) bool) error
ListPolicyVersionsRequest(*iam.ListPolicyVersionsInput) (*aws.Request, *iam.ListPolicyVersionsOutput)
ListPolicyVersionsRequest(*iam.ListPolicyVersionsInput) (*service.Request, *iam.ListPolicyVersionsOutput)
ListPolicyVersions(*iam.ListPolicyVersionsInput) (*iam.ListPolicyVersionsOutput, error)
ListRolePoliciesRequest(*iam.ListRolePoliciesInput) (*aws.Request, *iam.ListRolePoliciesOutput)
ListRolePoliciesRequest(*iam.ListRolePoliciesInput) (*service.Request, *iam.ListRolePoliciesOutput)
ListRolePolicies(*iam.ListRolePoliciesInput) (*iam.ListRolePoliciesOutput, error)
ListRolePoliciesPages(*iam.ListRolePoliciesInput, func(*iam.ListRolePoliciesOutput, bool) bool) error
ListRolesRequest(*iam.ListRolesInput) (*aws.Request, *iam.ListRolesOutput)
ListRolesRequest(*iam.ListRolesInput) (*service.Request, *iam.ListRolesOutput)
ListRoles(*iam.ListRolesInput) (*iam.ListRolesOutput, error)
ListRolesPages(*iam.ListRolesInput, func(*iam.ListRolesOutput, bool) bool) error
ListSAMLProvidersRequest(*iam.ListSAMLProvidersInput) (*aws.Request, *iam.ListSAMLProvidersOutput)
ListSAMLProvidersRequest(*iam.ListSAMLProvidersInput) (*service.Request, *iam.ListSAMLProvidersOutput)
ListSAMLProviders(*iam.ListSAMLProvidersInput) (*iam.ListSAMLProvidersOutput, error)
ListSSHPublicKeysRequest(*iam.ListSSHPublicKeysInput) (*aws.Request, *iam.ListSSHPublicKeysOutput)
ListSSHPublicKeysRequest(*iam.ListSSHPublicKeysInput) (*service.Request, *iam.ListSSHPublicKeysOutput)
ListSSHPublicKeys(*iam.ListSSHPublicKeysInput) (*iam.ListSSHPublicKeysOutput, error)
ListServerCertificatesRequest(*iam.ListServerCertificatesInput) (*aws.Request, *iam.ListServerCertificatesOutput)
ListServerCertificatesRequest(*iam.ListServerCertificatesInput) (*service.Request, *iam.ListServerCertificatesOutput)
ListServerCertificates(*iam.ListServerCertificatesInput) (*iam.ListServerCertificatesOutput, error)
ListServerCertificatesPages(*iam.ListServerCertificatesInput, func(*iam.ListServerCertificatesOutput, bool) bool) error
ListSigningCertificatesRequest(*iam.ListSigningCertificatesInput) (*aws.Request, *iam.ListSigningCertificatesOutput)
ListSigningCertificatesRequest(*iam.ListSigningCertificatesInput) (*service.Request, *iam.ListSigningCertificatesOutput)
ListSigningCertificates(*iam.ListSigningCertificatesInput) (*iam.ListSigningCertificatesOutput, error)
ListSigningCertificatesPages(*iam.ListSigningCertificatesInput, func(*iam.ListSigningCertificatesOutput, bool) bool) error
ListUserPoliciesRequest(*iam.ListUserPoliciesInput) (*aws.Request, *iam.ListUserPoliciesOutput)
ListUserPoliciesRequest(*iam.ListUserPoliciesInput) (*service.Request, *iam.ListUserPoliciesOutput)
ListUserPolicies(*iam.ListUserPoliciesInput) (*iam.ListUserPoliciesOutput, error)
ListUserPoliciesPages(*iam.ListUserPoliciesInput, func(*iam.ListUserPoliciesOutput, bool) bool) error
ListUsersRequest(*iam.ListUsersInput) (*aws.Request, *iam.ListUsersOutput)
ListUsersRequest(*iam.ListUsersInput) (*service.Request, *iam.ListUsersOutput)
ListUsers(*iam.ListUsersInput) (*iam.ListUsersOutput, error)
ListUsersPages(*iam.ListUsersInput, func(*iam.ListUsersOutput, bool) bool) error
ListVirtualMFADevicesRequest(*iam.ListVirtualMFADevicesInput) (*aws.Request, *iam.ListVirtualMFADevicesOutput)
ListVirtualMFADevicesRequest(*iam.ListVirtualMFADevicesInput) (*service.Request, *iam.ListVirtualMFADevicesOutput)
ListVirtualMFADevices(*iam.ListVirtualMFADevicesInput) (*iam.ListVirtualMFADevicesOutput, error)
ListVirtualMFADevicesPages(*iam.ListVirtualMFADevicesInput, func(*iam.ListVirtualMFADevicesOutput, bool) bool) error
PutGroupPolicyRequest(*iam.PutGroupPolicyInput) (*aws.Request, *iam.PutGroupPolicyOutput)
PutGroupPolicyRequest(*iam.PutGroupPolicyInput) (*service.Request, *iam.PutGroupPolicyOutput)
PutGroupPolicy(*iam.PutGroupPolicyInput) (*iam.PutGroupPolicyOutput, error)
PutRolePolicyRequest(*iam.PutRolePolicyInput) (*aws.Request, *iam.PutRolePolicyOutput)
PutRolePolicyRequest(*iam.PutRolePolicyInput) (*service.Request, *iam.PutRolePolicyOutput)
PutRolePolicy(*iam.PutRolePolicyInput) (*iam.PutRolePolicyOutput, error)
PutUserPolicyRequest(*iam.PutUserPolicyInput) (*aws.Request, *iam.PutUserPolicyOutput)
PutUserPolicyRequest(*iam.PutUserPolicyInput) (*service.Request, *iam.PutUserPolicyOutput)
PutUserPolicy(*iam.PutUserPolicyInput) (*iam.PutUserPolicyOutput, error)
RemoveClientIDFromOpenIDConnectProviderRequest(*iam.RemoveClientIDFromOpenIDConnectProviderInput) (*aws.Request, *iam.RemoveClientIDFromOpenIDConnectProviderOutput)
RemoveClientIDFromOpenIDConnectProviderRequest(*iam.RemoveClientIDFromOpenIDConnectProviderInput) (*service.Request, *iam.RemoveClientIDFromOpenIDConnectProviderOutput)
RemoveClientIDFromOpenIDConnectProvider(*iam.RemoveClientIDFromOpenIDConnectProviderInput) (*iam.RemoveClientIDFromOpenIDConnectProviderOutput, error)
RemoveRoleFromInstanceProfileRequest(*iam.RemoveRoleFromInstanceProfileInput) (*aws.Request, *iam.RemoveRoleFromInstanceProfileOutput)
RemoveRoleFromInstanceProfileRequest(*iam.RemoveRoleFromInstanceProfileInput) (*service.Request, *iam.RemoveRoleFromInstanceProfileOutput)
RemoveRoleFromInstanceProfile(*iam.RemoveRoleFromInstanceProfileInput) (*iam.RemoveRoleFromInstanceProfileOutput, error)
RemoveUserFromGroupRequest(*iam.RemoveUserFromGroupInput) (*aws.Request, *iam.RemoveUserFromGroupOutput)
RemoveUserFromGroupRequest(*iam.RemoveUserFromGroupInput) (*service.Request, *iam.RemoveUserFromGroupOutput)
RemoveUserFromGroup(*iam.RemoveUserFromGroupInput) (*iam.RemoveUserFromGroupOutput, error)
ResyncMFADeviceRequest(*iam.ResyncMFADeviceInput) (*aws.Request, *iam.ResyncMFADeviceOutput)
ResyncMFADeviceRequest(*iam.ResyncMFADeviceInput) (*service.Request, *iam.ResyncMFADeviceOutput)
ResyncMFADevice(*iam.ResyncMFADeviceInput) (*iam.ResyncMFADeviceOutput, error)
SetDefaultPolicyVersionRequest(*iam.SetDefaultPolicyVersionInput) (*aws.Request, *iam.SetDefaultPolicyVersionOutput)
SetDefaultPolicyVersionRequest(*iam.SetDefaultPolicyVersionInput) (*service.Request, *iam.SetDefaultPolicyVersionOutput)
SetDefaultPolicyVersion(*iam.SetDefaultPolicyVersionInput) (*iam.SetDefaultPolicyVersionOutput, error)
UpdateAccessKeyRequest(*iam.UpdateAccessKeyInput) (*aws.Request, *iam.UpdateAccessKeyOutput)
UpdateAccessKeyRequest(*iam.UpdateAccessKeyInput) (*service.Request, *iam.UpdateAccessKeyOutput)
UpdateAccessKey(*iam.UpdateAccessKeyInput) (*iam.UpdateAccessKeyOutput, error)
UpdateAccountPasswordPolicyRequest(*iam.UpdateAccountPasswordPolicyInput) (*aws.Request, *iam.UpdateAccountPasswordPolicyOutput)
UpdateAccountPasswordPolicyRequest(*iam.UpdateAccountPasswordPolicyInput) (*service.Request, *iam.UpdateAccountPasswordPolicyOutput)
UpdateAccountPasswordPolicy(*iam.UpdateAccountPasswordPolicyInput) (*iam.UpdateAccountPasswordPolicyOutput, error)
UpdateAssumeRolePolicyRequest(*iam.UpdateAssumeRolePolicyInput) (*aws.Request, *iam.UpdateAssumeRolePolicyOutput)
UpdateAssumeRolePolicyRequest(*iam.UpdateAssumeRolePolicyInput) (*service.Request, *iam.UpdateAssumeRolePolicyOutput)
UpdateAssumeRolePolicy(*iam.UpdateAssumeRolePolicyInput) (*iam.UpdateAssumeRolePolicyOutput, error)
UpdateGroupRequest(*iam.UpdateGroupInput) (*aws.Request, *iam.UpdateGroupOutput)
UpdateGroupRequest(*iam.UpdateGroupInput) (*service.Request, *iam.UpdateGroupOutput)
UpdateGroup(*iam.UpdateGroupInput) (*iam.UpdateGroupOutput, error)
UpdateLoginProfileRequest(*iam.UpdateLoginProfileInput) (*aws.Request, *iam.UpdateLoginProfileOutput)
UpdateLoginProfileRequest(*iam.UpdateLoginProfileInput) (*service.Request, *iam.UpdateLoginProfileOutput)
UpdateLoginProfile(*iam.UpdateLoginProfileInput) (*iam.UpdateLoginProfileOutput, error)
UpdateOpenIDConnectProviderThumbprintRequest(*iam.UpdateOpenIDConnectProviderThumbprintInput) (*aws.Request, *iam.UpdateOpenIDConnectProviderThumbprintOutput)
UpdateOpenIDConnectProviderThumbprintRequest(*iam.UpdateOpenIDConnectProviderThumbprintInput) (*service.Request, *iam.UpdateOpenIDConnectProviderThumbprintOutput)
UpdateOpenIDConnectProviderThumbprint(*iam.UpdateOpenIDConnectProviderThumbprintInput) (*iam.UpdateOpenIDConnectProviderThumbprintOutput, error)
UpdateSAMLProviderRequest(*iam.UpdateSAMLProviderInput) (*aws.Request, *iam.UpdateSAMLProviderOutput)
UpdateSAMLProviderRequest(*iam.UpdateSAMLProviderInput) (*service.Request, *iam.UpdateSAMLProviderOutput)
UpdateSAMLProvider(*iam.UpdateSAMLProviderInput) (*iam.UpdateSAMLProviderOutput, error)
UpdateSSHPublicKeyRequest(*iam.UpdateSSHPublicKeyInput) (*aws.Request, *iam.UpdateSSHPublicKeyOutput)
UpdateSSHPublicKeyRequest(*iam.UpdateSSHPublicKeyInput) (*service.Request, *iam.UpdateSSHPublicKeyOutput)
UpdateSSHPublicKey(*iam.UpdateSSHPublicKeyInput) (*iam.UpdateSSHPublicKeyOutput, error)
UpdateServerCertificateRequest(*iam.UpdateServerCertificateInput) (*aws.Request, *iam.UpdateServerCertificateOutput)
UpdateServerCertificateRequest(*iam.UpdateServerCertificateInput) (*service.Request, *iam.UpdateServerCertificateOutput)
UpdateServerCertificate(*iam.UpdateServerCertificateInput) (*iam.UpdateServerCertificateOutput, error)
UpdateSigningCertificateRequest(*iam.UpdateSigningCertificateInput) (*aws.Request, *iam.UpdateSigningCertificateOutput)
UpdateSigningCertificateRequest(*iam.UpdateSigningCertificateInput) (*service.Request, *iam.UpdateSigningCertificateOutput)
UpdateSigningCertificate(*iam.UpdateSigningCertificateInput) (*iam.UpdateSigningCertificateOutput, error)
UpdateUserRequest(*iam.UpdateUserInput) (*aws.Request, *iam.UpdateUserOutput)
UpdateUserRequest(*iam.UpdateUserInput) (*service.Request, *iam.UpdateUserOutput)
UpdateUser(*iam.UpdateUserInput) (*iam.UpdateUserOutput, error)
UploadSSHPublicKeyRequest(*iam.UploadSSHPublicKeyInput) (*aws.Request, *iam.UploadSSHPublicKeyOutput)
UploadSSHPublicKeyRequest(*iam.UploadSSHPublicKeyInput) (*service.Request, *iam.UploadSSHPublicKeyOutput)
UploadSSHPublicKey(*iam.UploadSSHPublicKeyInput) (*iam.UploadSSHPublicKeyOutput, error)
UploadServerCertificateRequest(*iam.UploadServerCertificateInput) (*aws.Request, *iam.UploadServerCertificateOutput)
UploadServerCertificateRequest(*iam.UploadServerCertificateInput) (*service.Request, *iam.UploadServerCertificateOutput)
UploadServerCertificate(*iam.UploadServerCertificateInput) (*iam.UploadServerCertificateOutput, error)
UploadSigningCertificateRequest(*iam.UploadSigningCertificateInput) (*aws.Request, *iam.UploadSigningCertificateOutput)
UploadSigningCertificateRequest(*iam.UploadSigningCertificateInput) (*service.Request, *iam.UploadSigningCertificateOutput)
UploadSigningCertificate(*iam.UploadSigningCertificateInput) (*iam.UploadSigningCertificateOutput, error)
}

View File

@ -4,6 +4,8 @@ package iam
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/defaults"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/internal/protocol/query"
"github.com/aws/aws-sdk-go/internal/signer/v4"
)
@ -59,19 +61,19 @@ import (
// This set of topics walk you through the process of signing a request using
// an access key ID and secret access key.
type IAM struct {
*aws.Service
*service.Service
}
// Used for custom service initialization logic
var initService func(*aws.Service)
var initService func(*service.Service)
// Used for custom request initialization logic
var initRequest func(*aws.Request)
var initRequest func(*service.Request)
// New returns a new IAM client.
func New(config *aws.Config) *IAM {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "iam",
APIVersion: "2010-05-08",
}
@ -94,8 +96,8 @@ func New(config *aws.Config) *IAM {
// newRequest creates a new request for a IAM operation and runs any
// custom request initialization.
func (c *IAM) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {
req := aws.NewRequest(c.Service, op, params, data)
func (c *IAM) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
// Run custom request initialization if present
if initRequest != nil {

File diff suppressed because it is too large Load Diff

View File

@ -7,11 +7,12 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/awsutil"
"github.com/aws/aws-sdk-go/aws/service"
)
var reBucketLocation = regexp.MustCompile(`>([^<>]+)<\/Location`)
func buildGetBucketLocation(r *aws.Request) {
func buildGetBucketLocation(r *service.Request) {
if r.DataFilled() {
out := r.Data.(*GetBucketLocationOutput)
b, err := ioutil.ReadAll(r.HTTPResponse.Body)
@ -28,7 +29,7 @@ func buildGetBucketLocation(r *aws.Request) {
}
}
func populateLocationConstraint(r *aws.Request) {
func populateLocationConstraint(r *service.Request) {
if r.ParamsFilled() && aws.StringValue(r.Config.Region) != "us-east-1" {
in := r.Params.(*CreateBucketInput)
if in.CreateBucketConfiguration == nil {

View File

@ -8,6 +8,7 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awsutil"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/internal/test/unit"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/stretchr/testify/assert"
@ -26,7 +27,7 @@ func TestGetBucketLocation(t *testing.T) {
for _, test := range s3LocationTests {
s := s3.New(nil)
s.Handlers.Send.Clear()
s.Handlers.Send.PushBack(func(r *aws.Request) {
s.Handlers.Send.PushBack(func(r *service.Request) {
reader := ioutil.NopCloser(bytes.NewReader([]byte(test.body)))
r.HTTPResponse = &http.Response{StatusCode: 200, Body: reader}
})

View File

@ -5,13 +5,13 @@ import (
"encoding/base64"
"io"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/service"
)
// contentMD5 computes and sets the HTTP Content-MD5 header for requests that
// require it.
func contentMD5(r *aws.Request) {
func contentMD5(r *service.Request) {
h := md5.New()
// hash the body. seek back to the first position after reading to reset

View File

@ -1,9 +1,9 @@
package s3
import "github.com/aws/aws-sdk-go/aws"
import "github.com/aws/aws-sdk-go/aws/service"
func init() {
initService = func(s *aws.Service) {
initService = func(s *service.Service) {
// Support building custom host-style bucket endpoints
s.Handlers.Build.PushFront(updateHostWithBucket)
@ -16,9 +16,9 @@ func init() {
s.Handlers.UnmarshalError.PushBack(unmarshalError)
}
initRequest = func(r *aws.Request) {
initRequest = func(r *service.Request) {
switch r.Operation.Name {
case opPutBucketCORS, opPutBucketLifecycle, opPutBucketPolicy, opPutBucketTagging, opDeleteObjects:
case opPutBucketCors, opPutBucketLifecycle, opPutBucketPolicy, opPutBucketTagging, opDeleteObjects:
// These S3 operations require Content-MD5 to be set
r.Handlers.Build.PushBack(contentMD5)
case opGetBucketLocation:

View File

@ -7,6 +7,7 @@ import (
"testing"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/internal/test/unit"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/stretchr/testify/assert"
@ -14,7 +15,7 @@ import (
var _ = unit.Imported
func assertMD5(t *testing.T, req *aws.Request) {
func assertMD5(t *testing.T, req *service.Request) {
err := req.Build()
assert.NoError(t, err)
@ -24,9 +25,9 @@ func assertMD5(t *testing.T, req *aws.Request) {
assert.Equal(t, base64.StdEncoding.EncodeToString(out[:]), req.HTTPRequest.Header.Get("Content-MD5"))
}
func TestMD5InPutBucketCORS(t *testing.T) {
func TestMD5InPutBucketCors(t *testing.T) {
svc := s3.New(nil)
req, _ := svc.PutBucketCORSRequest(&s3.PutBucketCORSInput{
req, _ := svc.PutBucketCorsRequest(&s3.PutBucketCorsInput{
Bucket: aws.String("bucketname"),
CORSConfiguration: &s3.CORSConfiguration{
CORSRules: []*s3.CORSRule{

View File

@ -22,7 +22,7 @@ func ExampleS3_AbortMultipartUpload() {
params := &s3.AbortMultipartUploadInput{
Bucket: aws.String("BucketName"), // Required
Key: aws.String("ObjectKey"), // Required
UploadID: aws.String("MultipartUploadId"), // Required
UploadId: aws.String("MultipartUploadId"), // Required
RequestPayer: aws.String("RequestPayer"),
}
resp, err := svc.AbortMultipartUpload(params)
@ -52,7 +52,7 @@ func ExampleS3_CompleteMultipartUpload() {
params := &s3.CompleteMultipartUploadInput{
Bucket: aws.String("BucketName"), // Required
Key: aws.String("ObjectKey"), // Required
UploadID: aws.String("MultipartUploadId"), // Required
UploadId: aws.String("MultipartUploadId"), // Required
MultipartUpload: &s3.CompletedMultipartUpload{
Parts: []*s3.CompletedPart{
{ // Required
@ -119,7 +119,7 @@ func ExampleS3_CopyObject() {
SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"),
SSECustomerKey: aws.String("SSECustomerKey"),
SSECustomerKeyMD5: aws.String("SSECustomerKeyMD5"),
SSEKMSKeyID: aws.String("SSEKMSKeyId"),
SSEKMSKeyId: aws.String("SSEKMSKeyId"),
ServerSideEncryption: aws.String("ServerSideEncryption"),
StorageClass: aws.String("StorageClass"),
WebsiteRedirectLocation: aws.String("WebsiteRedirectLocation"),
@ -206,7 +206,7 @@ func ExampleS3_CreateMultipartUpload() {
SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"),
SSECustomerKey: aws.String("SSECustomerKey"),
SSECustomerKeyMD5: aws.String("SSECustomerKeyMD5"),
SSEKMSKeyID: aws.String("SSEKMSKeyId"),
SSEKMSKeyId: aws.String("SSEKMSKeyId"),
ServerSideEncryption: aws.String("ServerSideEncryption"),
StorageClass: aws.String("StorageClass"),
WebsiteRedirectLocation: aws.String("WebsiteRedirectLocation"),
@ -259,13 +259,13 @@ func ExampleS3_DeleteBucket() {
fmt.Println(awsutil.Prettify(resp))
}
func ExampleS3_DeleteBucketCORS() {
func ExampleS3_DeleteBucketCors() {
svc := s3.New(nil)
params := &s3.DeleteBucketCORSInput{
params := &s3.DeleteBucketCorsInput{
Bucket: aws.String("BucketName"), // Required
}
resp, err := svc.DeleteBucketCORS(params)
resp, err := svc.DeleteBucketCors(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
@ -429,7 +429,7 @@ func ExampleS3_DeleteObject() {
Key: aws.String("ObjectKey"), // Required
MFA: aws.String("MFA"),
RequestPayer: aws.String("RequestPayer"),
VersionID: aws.String("ObjectVersionId"),
VersionId: aws.String("ObjectVersionId"),
}
resp, err := svc.DeleteObject(params)
@ -461,7 +461,7 @@ func ExampleS3_DeleteObjects() {
Objects: []*s3.ObjectIdentifier{ // Required
{ // Required
Key: aws.String("ObjectKey"), // Required
VersionID: aws.String("ObjectVersionId"),
VersionId: aws.String("ObjectVersionId"),
},
// More values...
},
@ -491,13 +491,13 @@ func ExampleS3_DeleteObjects() {
fmt.Println(awsutil.Prettify(resp))
}
func ExampleS3_GetBucketACL() {
func ExampleS3_GetBucketAcl() {
svc := s3.New(nil)
params := &s3.GetBucketACLInput{
params := &s3.GetBucketAclInput{
Bucket: aws.String("BucketName"), // Required
}
resp, err := svc.GetBucketACL(params)
resp, err := svc.GetBucketAcl(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
@ -518,13 +518,13 @@ func ExampleS3_GetBucketACL() {
fmt.Println(awsutil.Prettify(resp))
}
func ExampleS3_GetBucketCORS() {
func ExampleS3_GetBucketCors() {
svc := s3.New(nil)
params := &s3.GetBucketCORSInput{
params := &s3.GetBucketCorsInput{
Bucket: aws.String("BucketName"), // Required
}
resp, err := svc.GetBucketCORS(params)
resp, err := svc.GetBucketCors(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
@ -863,7 +863,7 @@ func ExampleS3_GetObject() {
SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"),
SSECustomerKey: aws.String("SSECustomerKey"),
SSECustomerKeyMD5: aws.String("SSECustomerKeyMD5"),
VersionID: aws.String("ObjectVersionId"),
VersionId: aws.String("ObjectVersionId"),
}
resp, err := svc.GetObject(params)
@ -886,16 +886,16 @@ func ExampleS3_GetObject() {
fmt.Println(awsutil.Prettify(resp))
}
func ExampleS3_GetObjectACL() {
func ExampleS3_GetObjectAcl() {
svc := s3.New(nil)
params := &s3.GetObjectACLInput{
params := &s3.GetObjectAclInput{
Bucket: aws.String("BucketName"), // Required
Key: aws.String("ObjectKey"), // Required
RequestPayer: aws.String("RequestPayer"),
VersionID: aws.String("ObjectVersionId"),
VersionId: aws.String("ObjectVersionId"),
}
resp, err := svc.GetObjectACL(params)
resp, err := svc.GetObjectAcl(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
@ -987,7 +987,7 @@ func ExampleS3_HeadObject() {
SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"),
SSECustomerKey: aws.String("SSECustomerKey"),
SSECustomerKeyMD5: aws.String("SSECustomerKeyMD5"),
VersionID: aws.String("ObjectVersionId"),
VersionId: aws.String("ObjectVersionId"),
}
resp, err := svc.HeadObject(params)
@ -1045,7 +1045,7 @@ func ExampleS3_ListMultipartUploads() {
KeyMarker: aws.String("KeyMarker"),
MaxUploads: aws.Int64(1),
Prefix: aws.String("Prefix"),
UploadIDMarker: aws.String("UploadIdMarker"),
UploadIdMarker: aws.String("UploadIdMarker"),
}
resp, err := svc.ListMultipartUploads(params)
@ -1078,7 +1078,7 @@ func ExampleS3_ListObjectVersions() {
KeyMarker: aws.String("KeyMarker"),
MaxKeys: aws.Int64(1),
Prefix: aws.String("Prefix"),
VersionIDMarker: aws.String("VersionIdMarker"),
VersionIdMarker: aws.String("VersionIdMarker"),
}
resp, err := svc.ListObjectVersions(params)
@ -1139,7 +1139,7 @@ func ExampleS3_ListParts() {
params := &s3.ListPartsInput{
Bucket: aws.String("BucketName"), // Required
Key: aws.String("ObjectKey"), // Required
UploadID: aws.String("MultipartUploadId"), // Required
UploadId: aws.String("MultipartUploadId"), // Required
MaxParts: aws.Int64(1),
PartNumberMarker: aws.Int64(1),
RequestPayer: aws.String("RequestPayer"),
@ -1165,10 +1165,10 @@ func ExampleS3_ListParts() {
fmt.Println(awsutil.Prettify(resp))
}
func ExampleS3_PutBucketACL() {
func ExampleS3_PutBucketAcl() {
svc := s3.New(nil)
params := &s3.PutBucketACLInput{
params := &s3.PutBucketAclInput{
Bucket: aws.String("BucketName"), // Required
ACL: aws.String("BucketCannedACL"),
AccessControlPolicy: &s3.AccessControlPolicy{
@ -1196,7 +1196,7 @@ func ExampleS3_PutBucketACL() {
GrantWrite: aws.String("GrantWrite"),
GrantWriteACP: aws.String("GrantWriteACP"),
}
resp, err := svc.PutBucketACL(params)
resp, err := svc.PutBucketAcl(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
@ -1217,10 +1217,10 @@ func ExampleS3_PutBucketACL() {
fmt.Println(awsutil.Prettify(resp))
}
func ExampleS3_PutBucketCORS() {
func ExampleS3_PutBucketCors() {
svc := s3.New(nil)
params := &s3.PutBucketCORSInput{
params := &s3.PutBucketCorsInput{
Bucket: aws.String("BucketName"), // Required
CORSConfiguration: &s3.CORSConfiguration{
CORSRules: []*s3.CORSRule{
@ -1247,7 +1247,7 @@ func ExampleS3_PutBucketCORS() {
},
},
}
resp, err := svc.PutBucketCORS(params)
resp, err := svc.PutBucketCors(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
@ -1380,7 +1380,7 @@ func ExampleS3_PutBucketNotification() {
aws.String("Event"), // Required
// More values...
},
ID: aws.String("NotificationId"),
Id: aws.String("NotificationId"),
InvocationRole: aws.String("CloudFunctionInvocationRole"),
},
QueueConfiguration: &s3.QueueConfigurationDeprecated{
@ -1389,7 +1389,7 @@ func ExampleS3_PutBucketNotification() {
aws.String("Event"), // Required
// More values...
},
ID: aws.String("NotificationId"),
Id: aws.String("NotificationId"),
Queue: aws.String("QueueArn"),
},
TopicConfiguration: &s3.TopicConfigurationDeprecated{
@ -1398,7 +1398,7 @@ func ExampleS3_PutBucketNotification() {
aws.String("Event"), // Required
// More values...
},
ID: aws.String("NotificationId"),
Id: aws.String("NotificationId"),
Topic: aws.String("TopicArn"),
},
},
@ -1436,8 +1436,8 @@ func ExampleS3_PutBucketNotificationConfiguration() {
aws.String("Event"), // Required
// More values...
},
LambdaFunctionARN: aws.String("LambdaFunctionArn"), // Required
ID: aws.String("NotificationId"),
LambdaFunctionArn: aws.String("LambdaFunctionArn"), // Required
Id: aws.String("NotificationId"),
},
// More values...
},
@ -1447,8 +1447,8 @@ func ExampleS3_PutBucketNotificationConfiguration() {
aws.String("Event"), // Required
// More values...
},
QueueARN: aws.String("QueueArn"), // Required
ID: aws.String("NotificationId"),
QueueArn: aws.String("QueueArn"), // Required
Id: aws.String("NotificationId"),
},
// More values...
},
@ -1458,8 +1458,8 @@ func ExampleS3_PutBucketNotificationConfiguration() {
aws.String("Event"), // Required
// More values...
},
TopicARN: aws.String("TopicArn"), // Required
ID: aws.String("NotificationId"),
TopicArn: aws.String("TopicArn"), // Required
Id: aws.String("NotificationId"),
},
// More values...
},
@ -1672,14 +1672,14 @@ func ExampleS3_PutBucketWebsite() {
RoutingRules: []*s3.RoutingRule{
{ // Required
Redirect: &s3.Redirect{ // Required
HTTPRedirectCode: aws.String("HttpRedirectCode"),
HostName: aws.String("HostName"),
HttpRedirectCode: aws.String("HttpRedirectCode"),
Protocol: aws.String("Protocol"),
ReplaceKeyPrefixWith: aws.String("ReplaceKeyPrefixWith"),
ReplaceKeyWith: aws.String("ReplaceKeyWith"),
},
Condition: &s3.Condition{
HTTPErrorCodeReturnedEquals: aws.String("HttpErrorCodeReturnedEquals"),
HttpErrorCodeReturnedEquals: aws.String("HttpErrorCodeReturnedEquals"),
KeyPrefixEquals: aws.String("KeyPrefixEquals"),
},
},
@ -1735,7 +1735,7 @@ func ExampleS3_PutObject() {
SSECustomerAlgorithm: aws.String("SSECustomerAlgorithm"),
SSECustomerKey: aws.String("SSECustomerKey"),
SSECustomerKeyMD5: aws.String("SSECustomerKeyMD5"),
SSEKMSKeyID: aws.String("SSEKMSKeyId"),
SSEKMSKeyId: aws.String("SSEKMSKeyId"),
ServerSideEncryption: aws.String("ServerSideEncryption"),
StorageClass: aws.String("StorageClass"),
WebsiteRedirectLocation: aws.String("WebsiteRedirectLocation"),
@ -1761,10 +1761,10 @@ func ExampleS3_PutObject() {
fmt.Println(awsutil.Prettify(resp))
}
func ExampleS3_PutObjectACL() {
func ExampleS3_PutObjectAcl() {
svc := s3.New(nil)
params := &s3.PutObjectACLInput{
params := &s3.PutObjectAclInput{
Bucket: aws.String("BucketName"), // Required
Key: aws.String("ObjectKey"), // Required
ACL: aws.String("ObjectCannedACL"),
@ -1794,7 +1794,7 @@ func ExampleS3_PutObjectACL() {
GrantWriteACP: aws.String("GrantWriteACP"),
RequestPayer: aws.String("RequestPayer"),
}
resp, err := svc.PutObjectACL(params)
resp, err := svc.PutObjectAcl(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
@ -1825,7 +1825,7 @@ func ExampleS3_RestoreObject() {
RestoreRequest: &s3.RestoreRequest{
Days: aws.Int64(1), // Required
},
VersionID: aws.String("ObjectVersionId"),
VersionId: aws.String("ObjectVersionId"),
}
resp, err := svc.RestoreObject(params)
@ -1855,7 +1855,7 @@ func ExampleS3_UploadPart() {
Bucket: aws.String("BucketName"), // Required
Key: aws.String("ObjectKey"), // Required
PartNumber: aws.Int64(1), // Required
UploadID: aws.String("MultipartUploadId"), // Required
UploadId: aws.String("MultipartUploadId"), // Required
Body: bytes.NewReader([]byte("PAYLOAD")),
ContentLength: aws.Int64(1),
RequestPayer: aws.String("RequestPayer"),
@ -1892,7 +1892,7 @@ func ExampleS3_UploadPartCopy() {
CopySource: aws.String("CopySource"), // Required
Key: aws.String("ObjectKey"), // Required
PartNumber: aws.Int64(1), // Required
UploadID: aws.String("MultipartUploadId"), // Required
UploadId: aws.String("MultipartUploadId"), // Required
CopySourceIfMatch: aws.String("CopySourceIfMatch"),
CopySourceIfModifiedSince: aws.Time(time.Now()),
CopySourceIfNoneMatch: aws.String("CopySourceIfNoneMatch"),

View File

@ -6,6 +6,7 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awsutil"
"github.com/aws/aws-sdk-go/aws/service"
)
var reDomain = regexp.MustCompile(`^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$`)
@ -22,7 +23,7 @@ func dnsCompatibleBucketName(bucket string) bool {
// 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 {
func hostStyleBucketName(r *service.Request, bucket string) bool {
if aws.BoolValue(r.Config.S3ForcePathStyle) {
return false
}
@ -37,7 +38,7 @@ func hostStyleBucketName(r *aws.Request, bucket string) bool {
return dnsCompatibleBucketName(bucket)
}
func updateHostWithBucket(r *aws.Request) {
func updateHostWithBucket(r *service.Request) {
b := awsutil.ValuesAtPath(r.Params, "Bucket")
if len(b) == 0 {
return

View File

@ -4,233 +4,233 @@
package s3iface
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/service/s3"
)
// S3API is the interface type for s3.S3.
type S3API interface {
AbortMultipartUploadRequest(*s3.AbortMultipartUploadInput) (*aws.Request, *s3.AbortMultipartUploadOutput)
AbortMultipartUploadRequest(*s3.AbortMultipartUploadInput) (*service.Request, *s3.AbortMultipartUploadOutput)
AbortMultipartUpload(*s3.AbortMultipartUploadInput) (*s3.AbortMultipartUploadOutput, error)
CompleteMultipartUploadRequest(*s3.CompleteMultipartUploadInput) (*aws.Request, *s3.CompleteMultipartUploadOutput)
CompleteMultipartUploadRequest(*s3.CompleteMultipartUploadInput) (*service.Request, *s3.CompleteMultipartUploadOutput)
CompleteMultipartUpload(*s3.CompleteMultipartUploadInput) (*s3.CompleteMultipartUploadOutput, error)
CopyObjectRequest(*s3.CopyObjectInput) (*aws.Request, *s3.CopyObjectOutput)
CopyObjectRequest(*s3.CopyObjectInput) (*service.Request, *s3.CopyObjectOutput)
CopyObject(*s3.CopyObjectInput) (*s3.CopyObjectOutput, error)
CreateBucketRequest(*s3.CreateBucketInput) (*aws.Request, *s3.CreateBucketOutput)
CreateBucketRequest(*s3.CreateBucketInput) (*service.Request, *s3.CreateBucketOutput)
CreateBucket(*s3.CreateBucketInput) (*s3.CreateBucketOutput, error)
CreateMultipartUploadRequest(*s3.CreateMultipartUploadInput) (*aws.Request, *s3.CreateMultipartUploadOutput)
CreateMultipartUploadRequest(*s3.CreateMultipartUploadInput) (*service.Request, *s3.CreateMultipartUploadOutput)
CreateMultipartUpload(*s3.CreateMultipartUploadInput) (*s3.CreateMultipartUploadOutput, error)
DeleteBucketRequest(*s3.DeleteBucketInput) (*aws.Request, *s3.DeleteBucketOutput)
DeleteBucketRequest(*s3.DeleteBucketInput) (*service.Request, *s3.DeleteBucketOutput)
DeleteBucket(*s3.DeleteBucketInput) (*s3.DeleteBucketOutput, error)
DeleteBucketCORSRequest(*s3.DeleteBucketCORSInput) (*aws.Request, *s3.DeleteBucketCORSOutput)
DeleteBucketCorsRequest(*s3.DeleteBucketCorsInput) (*service.Request, *s3.DeleteBucketCorsOutput)
DeleteBucketCORS(*s3.DeleteBucketCORSInput) (*s3.DeleteBucketCORSOutput, error)
DeleteBucketCors(*s3.DeleteBucketCorsInput) (*s3.DeleteBucketCorsOutput, error)
DeleteBucketLifecycleRequest(*s3.DeleteBucketLifecycleInput) (*aws.Request, *s3.DeleteBucketLifecycleOutput)
DeleteBucketLifecycleRequest(*s3.DeleteBucketLifecycleInput) (*service.Request, *s3.DeleteBucketLifecycleOutput)
DeleteBucketLifecycle(*s3.DeleteBucketLifecycleInput) (*s3.DeleteBucketLifecycleOutput, error)
DeleteBucketPolicyRequest(*s3.DeleteBucketPolicyInput) (*aws.Request, *s3.DeleteBucketPolicyOutput)
DeleteBucketPolicyRequest(*s3.DeleteBucketPolicyInput) (*service.Request, *s3.DeleteBucketPolicyOutput)
DeleteBucketPolicy(*s3.DeleteBucketPolicyInput) (*s3.DeleteBucketPolicyOutput, error)
DeleteBucketReplicationRequest(*s3.DeleteBucketReplicationInput) (*aws.Request, *s3.DeleteBucketReplicationOutput)
DeleteBucketReplicationRequest(*s3.DeleteBucketReplicationInput) (*service.Request, *s3.DeleteBucketReplicationOutput)
DeleteBucketReplication(*s3.DeleteBucketReplicationInput) (*s3.DeleteBucketReplicationOutput, error)
DeleteBucketTaggingRequest(*s3.DeleteBucketTaggingInput) (*aws.Request, *s3.DeleteBucketTaggingOutput)
DeleteBucketTaggingRequest(*s3.DeleteBucketTaggingInput) (*service.Request, *s3.DeleteBucketTaggingOutput)
DeleteBucketTagging(*s3.DeleteBucketTaggingInput) (*s3.DeleteBucketTaggingOutput, error)
DeleteBucketWebsiteRequest(*s3.DeleteBucketWebsiteInput) (*aws.Request, *s3.DeleteBucketWebsiteOutput)
DeleteBucketWebsiteRequest(*s3.DeleteBucketWebsiteInput) (*service.Request, *s3.DeleteBucketWebsiteOutput)
DeleteBucketWebsite(*s3.DeleteBucketWebsiteInput) (*s3.DeleteBucketWebsiteOutput, error)
DeleteObjectRequest(*s3.DeleteObjectInput) (*aws.Request, *s3.DeleteObjectOutput)
DeleteObjectRequest(*s3.DeleteObjectInput) (*service.Request, *s3.DeleteObjectOutput)
DeleteObject(*s3.DeleteObjectInput) (*s3.DeleteObjectOutput, error)
DeleteObjectsRequest(*s3.DeleteObjectsInput) (*aws.Request, *s3.DeleteObjectsOutput)
DeleteObjectsRequest(*s3.DeleteObjectsInput) (*service.Request, *s3.DeleteObjectsOutput)
DeleteObjects(*s3.DeleteObjectsInput) (*s3.DeleteObjectsOutput, error)
GetBucketACLRequest(*s3.GetBucketACLInput) (*aws.Request, *s3.GetBucketACLOutput)
GetBucketAclRequest(*s3.GetBucketAclInput) (*service.Request, *s3.GetBucketAclOutput)
GetBucketACL(*s3.GetBucketACLInput) (*s3.GetBucketACLOutput, error)
GetBucketAcl(*s3.GetBucketAclInput) (*s3.GetBucketAclOutput, error)
GetBucketCORSRequest(*s3.GetBucketCORSInput) (*aws.Request, *s3.GetBucketCORSOutput)
GetBucketCorsRequest(*s3.GetBucketCorsInput) (*service.Request, *s3.GetBucketCorsOutput)
GetBucketCORS(*s3.GetBucketCORSInput) (*s3.GetBucketCORSOutput, error)
GetBucketCors(*s3.GetBucketCorsInput) (*s3.GetBucketCorsOutput, error)
GetBucketLifecycleRequest(*s3.GetBucketLifecycleInput) (*aws.Request, *s3.GetBucketLifecycleOutput)
GetBucketLifecycleRequest(*s3.GetBucketLifecycleInput) (*service.Request, *s3.GetBucketLifecycleOutput)
GetBucketLifecycle(*s3.GetBucketLifecycleInput) (*s3.GetBucketLifecycleOutput, error)
GetBucketLocationRequest(*s3.GetBucketLocationInput) (*aws.Request, *s3.GetBucketLocationOutput)
GetBucketLocationRequest(*s3.GetBucketLocationInput) (*service.Request, *s3.GetBucketLocationOutput)
GetBucketLocation(*s3.GetBucketLocationInput) (*s3.GetBucketLocationOutput, error)
GetBucketLoggingRequest(*s3.GetBucketLoggingInput) (*aws.Request, *s3.GetBucketLoggingOutput)
GetBucketLoggingRequest(*s3.GetBucketLoggingInput) (*service.Request, *s3.GetBucketLoggingOutput)
GetBucketLogging(*s3.GetBucketLoggingInput) (*s3.GetBucketLoggingOutput, error)
GetBucketNotificationRequest(*s3.GetBucketNotificationConfigurationRequest) (*aws.Request, *s3.NotificationConfigurationDeprecated)
GetBucketNotificationRequest(*s3.GetBucketNotificationConfigurationRequest) (*service.Request, *s3.NotificationConfigurationDeprecated)
GetBucketNotification(*s3.GetBucketNotificationConfigurationRequest) (*s3.NotificationConfigurationDeprecated, error)
GetBucketNotificationConfigurationRequest(*s3.GetBucketNotificationConfigurationRequest) (*aws.Request, *s3.NotificationConfiguration)
GetBucketNotificationConfigurationRequest(*s3.GetBucketNotificationConfigurationRequest) (*service.Request, *s3.NotificationConfiguration)
GetBucketNotificationConfiguration(*s3.GetBucketNotificationConfigurationRequest) (*s3.NotificationConfiguration, error)
GetBucketPolicyRequest(*s3.GetBucketPolicyInput) (*aws.Request, *s3.GetBucketPolicyOutput)
GetBucketPolicyRequest(*s3.GetBucketPolicyInput) (*service.Request, *s3.GetBucketPolicyOutput)
GetBucketPolicy(*s3.GetBucketPolicyInput) (*s3.GetBucketPolicyOutput, error)
GetBucketReplicationRequest(*s3.GetBucketReplicationInput) (*aws.Request, *s3.GetBucketReplicationOutput)
GetBucketReplicationRequest(*s3.GetBucketReplicationInput) (*service.Request, *s3.GetBucketReplicationOutput)
GetBucketReplication(*s3.GetBucketReplicationInput) (*s3.GetBucketReplicationOutput, error)
GetBucketRequestPaymentRequest(*s3.GetBucketRequestPaymentInput) (*aws.Request, *s3.GetBucketRequestPaymentOutput)
GetBucketRequestPaymentRequest(*s3.GetBucketRequestPaymentInput) (*service.Request, *s3.GetBucketRequestPaymentOutput)
GetBucketRequestPayment(*s3.GetBucketRequestPaymentInput) (*s3.GetBucketRequestPaymentOutput, error)
GetBucketTaggingRequest(*s3.GetBucketTaggingInput) (*aws.Request, *s3.GetBucketTaggingOutput)
GetBucketTaggingRequest(*s3.GetBucketTaggingInput) (*service.Request, *s3.GetBucketTaggingOutput)
GetBucketTagging(*s3.GetBucketTaggingInput) (*s3.GetBucketTaggingOutput, error)
GetBucketVersioningRequest(*s3.GetBucketVersioningInput) (*aws.Request, *s3.GetBucketVersioningOutput)
GetBucketVersioningRequest(*s3.GetBucketVersioningInput) (*service.Request, *s3.GetBucketVersioningOutput)
GetBucketVersioning(*s3.GetBucketVersioningInput) (*s3.GetBucketVersioningOutput, error)
GetBucketWebsiteRequest(*s3.GetBucketWebsiteInput) (*aws.Request, *s3.GetBucketWebsiteOutput)
GetBucketWebsiteRequest(*s3.GetBucketWebsiteInput) (*service.Request, *s3.GetBucketWebsiteOutput)
GetBucketWebsite(*s3.GetBucketWebsiteInput) (*s3.GetBucketWebsiteOutput, error)
GetObjectRequest(*s3.GetObjectInput) (*aws.Request, *s3.GetObjectOutput)
GetObjectRequest(*s3.GetObjectInput) (*service.Request, *s3.GetObjectOutput)
GetObject(*s3.GetObjectInput) (*s3.GetObjectOutput, error)
GetObjectACLRequest(*s3.GetObjectACLInput) (*aws.Request, *s3.GetObjectACLOutput)
GetObjectAclRequest(*s3.GetObjectAclInput) (*service.Request, *s3.GetObjectAclOutput)
GetObjectACL(*s3.GetObjectACLInput) (*s3.GetObjectACLOutput, error)
GetObjectAcl(*s3.GetObjectAclInput) (*s3.GetObjectAclOutput, error)
GetObjectTorrentRequest(*s3.GetObjectTorrentInput) (*aws.Request, *s3.GetObjectTorrentOutput)
GetObjectTorrentRequest(*s3.GetObjectTorrentInput) (*service.Request, *s3.GetObjectTorrentOutput)
GetObjectTorrent(*s3.GetObjectTorrentInput) (*s3.GetObjectTorrentOutput, error)
HeadBucketRequest(*s3.HeadBucketInput) (*aws.Request, *s3.HeadBucketOutput)
HeadBucketRequest(*s3.HeadBucketInput) (*service.Request, *s3.HeadBucketOutput)
HeadBucket(*s3.HeadBucketInput) (*s3.HeadBucketOutput, error)
HeadObjectRequest(*s3.HeadObjectInput) (*aws.Request, *s3.HeadObjectOutput)
HeadObjectRequest(*s3.HeadObjectInput) (*service.Request, *s3.HeadObjectOutput)
HeadObject(*s3.HeadObjectInput) (*s3.HeadObjectOutput, error)
ListBucketsRequest(*s3.ListBucketsInput) (*aws.Request, *s3.ListBucketsOutput)
ListBucketsRequest(*s3.ListBucketsInput) (*service.Request, *s3.ListBucketsOutput)
ListBuckets(*s3.ListBucketsInput) (*s3.ListBucketsOutput, error)
ListMultipartUploadsRequest(*s3.ListMultipartUploadsInput) (*aws.Request, *s3.ListMultipartUploadsOutput)
ListMultipartUploadsRequest(*s3.ListMultipartUploadsInput) (*service.Request, *s3.ListMultipartUploadsOutput)
ListMultipartUploads(*s3.ListMultipartUploadsInput) (*s3.ListMultipartUploadsOutput, error)
ListMultipartUploadsPages(*s3.ListMultipartUploadsInput, func(*s3.ListMultipartUploadsOutput, bool) bool) error
ListObjectVersionsRequest(*s3.ListObjectVersionsInput) (*aws.Request, *s3.ListObjectVersionsOutput)
ListObjectVersionsRequest(*s3.ListObjectVersionsInput) (*service.Request, *s3.ListObjectVersionsOutput)
ListObjectVersions(*s3.ListObjectVersionsInput) (*s3.ListObjectVersionsOutput, error)
ListObjectVersionsPages(*s3.ListObjectVersionsInput, func(*s3.ListObjectVersionsOutput, bool) bool) error
ListObjectsRequest(*s3.ListObjectsInput) (*aws.Request, *s3.ListObjectsOutput)
ListObjectsRequest(*s3.ListObjectsInput) (*service.Request, *s3.ListObjectsOutput)
ListObjects(*s3.ListObjectsInput) (*s3.ListObjectsOutput, error)
ListObjectsPages(*s3.ListObjectsInput, func(*s3.ListObjectsOutput, bool) bool) error
ListPartsRequest(*s3.ListPartsInput) (*aws.Request, *s3.ListPartsOutput)
ListPartsRequest(*s3.ListPartsInput) (*service.Request, *s3.ListPartsOutput)
ListParts(*s3.ListPartsInput) (*s3.ListPartsOutput, error)
ListPartsPages(*s3.ListPartsInput, func(*s3.ListPartsOutput, bool) bool) error
PutBucketACLRequest(*s3.PutBucketACLInput) (*aws.Request, *s3.PutBucketACLOutput)
PutBucketAclRequest(*s3.PutBucketAclInput) (*service.Request, *s3.PutBucketAclOutput)
PutBucketACL(*s3.PutBucketACLInput) (*s3.PutBucketACLOutput, error)
PutBucketAcl(*s3.PutBucketAclInput) (*s3.PutBucketAclOutput, error)
PutBucketCORSRequest(*s3.PutBucketCORSInput) (*aws.Request, *s3.PutBucketCORSOutput)
PutBucketCorsRequest(*s3.PutBucketCorsInput) (*service.Request, *s3.PutBucketCorsOutput)
PutBucketCORS(*s3.PutBucketCORSInput) (*s3.PutBucketCORSOutput, error)
PutBucketCors(*s3.PutBucketCorsInput) (*s3.PutBucketCorsOutput, error)
PutBucketLifecycleRequest(*s3.PutBucketLifecycleInput) (*aws.Request, *s3.PutBucketLifecycleOutput)
PutBucketLifecycleRequest(*s3.PutBucketLifecycleInput) (*service.Request, *s3.PutBucketLifecycleOutput)
PutBucketLifecycle(*s3.PutBucketLifecycleInput) (*s3.PutBucketLifecycleOutput, error)
PutBucketLoggingRequest(*s3.PutBucketLoggingInput) (*aws.Request, *s3.PutBucketLoggingOutput)
PutBucketLoggingRequest(*s3.PutBucketLoggingInput) (*service.Request, *s3.PutBucketLoggingOutput)
PutBucketLogging(*s3.PutBucketLoggingInput) (*s3.PutBucketLoggingOutput, error)
PutBucketNotificationRequest(*s3.PutBucketNotificationInput) (*aws.Request, *s3.PutBucketNotificationOutput)
PutBucketNotificationRequest(*s3.PutBucketNotificationInput) (*service.Request, *s3.PutBucketNotificationOutput)
PutBucketNotification(*s3.PutBucketNotificationInput) (*s3.PutBucketNotificationOutput, error)
PutBucketNotificationConfigurationRequest(*s3.PutBucketNotificationConfigurationInput) (*aws.Request, *s3.PutBucketNotificationConfigurationOutput)
PutBucketNotificationConfigurationRequest(*s3.PutBucketNotificationConfigurationInput) (*service.Request, *s3.PutBucketNotificationConfigurationOutput)
PutBucketNotificationConfiguration(*s3.PutBucketNotificationConfigurationInput) (*s3.PutBucketNotificationConfigurationOutput, error)
PutBucketPolicyRequest(*s3.PutBucketPolicyInput) (*aws.Request, *s3.PutBucketPolicyOutput)
PutBucketPolicyRequest(*s3.PutBucketPolicyInput) (*service.Request, *s3.PutBucketPolicyOutput)
PutBucketPolicy(*s3.PutBucketPolicyInput) (*s3.PutBucketPolicyOutput, error)
PutBucketReplicationRequest(*s3.PutBucketReplicationInput) (*aws.Request, *s3.PutBucketReplicationOutput)
PutBucketReplicationRequest(*s3.PutBucketReplicationInput) (*service.Request, *s3.PutBucketReplicationOutput)
PutBucketReplication(*s3.PutBucketReplicationInput) (*s3.PutBucketReplicationOutput, error)
PutBucketRequestPaymentRequest(*s3.PutBucketRequestPaymentInput) (*aws.Request, *s3.PutBucketRequestPaymentOutput)
PutBucketRequestPaymentRequest(*s3.PutBucketRequestPaymentInput) (*service.Request, *s3.PutBucketRequestPaymentOutput)
PutBucketRequestPayment(*s3.PutBucketRequestPaymentInput) (*s3.PutBucketRequestPaymentOutput, error)
PutBucketTaggingRequest(*s3.PutBucketTaggingInput) (*aws.Request, *s3.PutBucketTaggingOutput)
PutBucketTaggingRequest(*s3.PutBucketTaggingInput) (*service.Request, *s3.PutBucketTaggingOutput)
PutBucketTagging(*s3.PutBucketTaggingInput) (*s3.PutBucketTaggingOutput, error)
PutBucketVersioningRequest(*s3.PutBucketVersioningInput) (*aws.Request, *s3.PutBucketVersioningOutput)
PutBucketVersioningRequest(*s3.PutBucketVersioningInput) (*service.Request, *s3.PutBucketVersioningOutput)
PutBucketVersioning(*s3.PutBucketVersioningInput) (*s3.PutBucketVersioningOutput, error)
PutBucketWebsiteRequest(*s3.PutBucketWebsiteInput) (*aws.Request, *s3.PutBucketWebsiteOutput)
PutBucketWebsiteRequest(*s3.PutBucketWebsiteInput) (*service.Request, *s3.PutBucketWebsiteOutput)
PutBucketWebsite(*s3.PutBucketWebsiteInput) (*s3.PutBucketWebsiteOutput, error)
PutObjectRequest(*s3.PutObjectInput) (*aws.Request, *s3.PutObjectOutput)
PutObjectRequest(*s3.PutObjectInput) (*service.Request, *s3.PutObjectOutput)
PutObject(*s3.PutObjectInput) (*s3.PutObjectOutput, error)
PutObjectACLRequest(*s3.PutObjectACLInput) (*aws.Request, *s3.PutObjectACLOutput)
PutObjectAclRequest(*s3.PutObjectAclInput) (*service.Request, *s3.PutObjectAclOutput)
PutObjectACL(*s3.PutObjectACLInput) (*s3.PutObjectACLOutput, error)
PutObjectAcl(*s3.PutObjectAclInput) (*s3.PutObjectAclOutput, error)
RestoreObjectRequest(*s3.RestoreObjectInput) (*aws.Request, *s3.RestoreObjectOutput)
RestoreObjectRequest(*s3.RestoreObjectInput) (*service.Request, *s3.RestoreObjectOutput)
RestoreObject(*s3.RestoreObjectInput) (*s3.RestoreObjectOutput, error)
UploadPartRequest(*s3.UploadPartInput) (*aws.Request, *s3.UploadPartOutput)
UploadPartRequest(*s3.UploadPartInput) (*service.Request, *s3.UploadPartOutput)
UploadPart(*s3.UploadPartInput) (*s3.UploadPartOutput, error)
UploadPartCopyRequest(*s3.UploadPartCopyInput) (*aws.Request, *s3.UploadPartCopyOutput)
UploadPartCopyRequest(*s3.UploadPartCopyInput) (*service.Request, *s3.UploadPartCopyOutput)
UploadPartCopy(*s3.UploadPartCopyInput) (*s3.UploadPartCopyOutput, error)
}

View File

@ -61,6 +61,9 @@ type Downloader struct {
//
// It is safe to call this method for multiple objects and across concurrent
// goroutines.
//
// The w io.WriterAt can be satisfied by an os.File to do multipart concurrent
// downloads, or in memory []byte wrapper using aws.WriteAtBuffer.
func (d *Downloader) Download(w io.WriterAt, input *s3.GetObjectInput) (n int64, err error) {
impl := downloader{w: w, in: input, opts: *d.opts}
return impl.download()

View File

@ -3,7 +3,6 @@ package s3manager_test
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"net/http"
"regexp"
@ -12,6 +11,7 @@ import (
"testing"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/internal/test/unit"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
@ -27,7 +27,7 @@ func dlLoggingSvc(data []byte) (*s3.S3, *[]string, *[]string) {
svc := s3.New(nil)
svc.Handlers.Send.Clear()
svc.Handlers.Send.PushBack(func(r *aws.Request) {
svc.Handlers.Send.PushBack(func(r *service.Request) {
m.Lock()
defer m.Unlock()
@ -56,36 +56,12 @@ func dlLoggingSvc(data []byte) (*s3.S3, *[]string, *[]string) {
return svc, &names, &ranges
}
type dlwriter struct {
buf []byte
}
func newDLWriter(size int) *dlwriter {
return &dlwriter{buf: make([]byte, size)}
}
func (d dlwriter) WriteAt(p []byte, pos int64) (n int, err error) {
if pos > int64(len(d.buf)) {
return 0, io.EOF
}
written := 0
for i, b := range p {
if i >= len(d.buf) {
break
}
d.buf[pos+int64(i)] = b
written++
}
return written, nil
}
func TestDownloadOrder(t *testing.T) {
s, names, ranges := dlLoggingSvc(buf12MB)
opts := &s3manager.DownloadOptions{S3: s, Concurrency: 1}
d := s3manager.NewDownloader(opts)
w := newDLWriter(len(buf12MB))
w := &aws.WriteAtBuffer{}
n, err := d.Download(w, &s3.GetObjectInput{
Bucket: aws.String("bucket"),
Key: aws.String("key"),
@ -97,7 +73,7 @@ func TestDownloadOrder(t *testing.T) {
assert.Equal(t, []string{"bytes=0-5242879", "bytes=5242880-10485759", "bytes=10485760-15728639"}, *ranges)
count := 0
for _, b := range w.buf {
for _, b := range w.Bytes() {
count += int(b)
}
assert.Equal(t, 0, count)
@ -108,7 +84,7 @@ func TestDownloadZero(t *testing.T) {
opts := &s3manager.DownloadOptions{S3: s}
d := s3manager.NewDownloader(opts)
w := newDLWriter(0)
w := &aws.WriteAtBuffer{}
n, err := d.Download(w, &s3.GetObjectInput{
Bucket: aws.String("bucket"),
Key: aws.String("key"),
@ -125,7 +101,7 @@ func TestDownloadSetPartSize(t *testing.T) {
opts := &s3manager.DownloadOptions{S3: s, PartSize: 1, Concurrency: 1}
d := s3manager.NewDownloader(opts)
w := newDLWriter(3)
w := &aws.WriteAtBuffer{}
n, err := d.Download(w, &s3.GetObjectInput{
Bucket: aws.String("bucket"),
Key: aws.String("key"),
@ -135,7 +111,7 @@ func TestDownloadSetPartSize(t *testing.T) {
assert.Equal(t, int64(3), n)
assert.Equal(t, []string{"GetObject", "GetObject", "GetObject"}, *names)
assert.Equal(t, []string{"bytes=0-0", "bytes=1-1", "bytes=2-2"}, *ranges)
assert.Equal(t, []byte{1, 2, 3}, w.buf)
assert.Equal(t, []byte{1, 2, 3}, w.Bytes())
}
func TestDownloadError(t *testing.T) {
@ -143,7 +119,7 @@ func TestDownloadError(t *testing.T) {
opts := &s3manager.DownloadOptions{S3: s, PartSize: 1, Concurrency: 1}
num := 0
s.Handlers.Send.PushBack(func(r *aws.Request) {
s.Handlers.Send.PushBack(func(r *service.Request) {
num++
if num > 1 {
r.HTTPResponse.StatusCode = 400
@ -152,7 +128,7 @@ func TestDownloadError(t *testing.T) {
})
d := s3manager.NewDownloader(opts)
w := newDLWriter(3)
w := &aws.WriteAtBuffer{}
n, err := d.Download(w, &s3.GetObjectInput{
Bucket: aws.String("bucket"),
Key: aws.String("key"),
@ -161,5 +137,5 @@ func TestDownloadError(t *testing.T) {
assert.NotNil(t, err)
assert.Equal(t, int64(1), n)
assert.Equal(t, []string{"GetObject", "GetObject"}, *names)
assert.Equal(t, []byte{1, 0, 0}, w.buf)
assert.Equal(t, []byte{1}, w.Bytes())
}

View File

@ -331,6 +331,7 @@ func (u *uploader) nextReader() (io.ReadSeeker, error) {
if bytesLeft == 0 {
err = io.EOF
n = bytesLeft
} else if bytesLeft <= u.opts.PartSize {
err = io.ErrUnexpectedEOF
n = bytesLeft
@ -403,7 +404,7 @@ func (u *multiuploader) upload(firstBuf io.ReadSeeker) (*UploadOutput, error) {
if err != nil {
return nil, err
}
u.uploadID = *resp.UploadID
u.uploadID = *resp.UploadId
// Create the workers
ch := make(chan chunk, u.opts.Concurrency)
@ -490,7 +491,7 @@ func (u *multiuploader) send(c chunk) error {
Bucket: u.in.Bucket,
Key: u.in.Key,
Body: c.buf,
UploadID: &u.uploadID,
UploadId: &u.uploadID,
PartNumber: &c.num,
})
@ -533,7 +534,7 @@ func (u *multiuploader) fail() {
u.opts.S3.AbortMultipartUpload(&s3.AbortMultipartUploadInput{
Bucket: u.in.Bucket,
Key: u.in.Key,
UploadID: &u.uploadID,
UploadId: &u.uploadID,
})
}
@ -550,7 +551,7 @@ func (u *multiuploader) complete() *s3.CompleteMultipartUploadOutput {
resp, err := u.opts.S3.CompleteMultipartUpload(&s3.CompleteMultipartUploadInput{
Bucket: u.in.Bucket,
Key: u.in.Key,
UploadID: &u.uploadID,
UploadId: &u.uploadID,
MultipartUpload: &s3.CompletedMultipartUpload{Parts: u.parts},
})
if err != nil {

View File

@ -9,10 +9,13 @@ import (
"sort"
"sync"
"testing"
"strings"
"net/http/httptest"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/awsutil"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/internal/test/unit"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
@ -48,7 +51,7 @@ func loggingSvc(ignoreOps []string) (*s3.S3, *[]string, *[]interface{}) {
svc.Handlers.UnmarshalMeta.Clear()
svc.Handlers.UnmarshalError.Clear()
svc.Handlers.Send.Clear()
svc.Handlers.Send.PushBack(func(r *aws.Request) {
svc.Handlers.Send.PushBack(func(r *service.Request) {
m.Lock()
defer m.Unlock()
@ -64,7 +67,7 @@ func loggingSvc(ignoreOps []string) (*s3.S3, *[]string, *[]interface{}) {
switch data := r.Data.(type) {
case *s3.CreateMultipartUploadOutput:
data.UploadID = aws.String("UPLOAD-ID")
data.UploadId = aws.String("UPLOAD-ID")
case *s3.UploadPartOutput:
partNum++
data.ETag = aws.String(fmt.Sprintf("ETAG%d", partNum))
@ -101,12 +104,12 @@ func TestUploadOrderMulti(t *testing.T) {
// Validate input values
// UploadPart
assert.Equal(t, "UPLOAD-ID", val((*args)[1], "UploadID"))
assert.Equal(t, "UPLOAD-ID", val((*args)[2], "UploadID"))
assert.Equal(t, "UPLOAD-ID", val((*args)[3], "UploadID"))
assert.Equal(t, "UPLOAD-ID", val((*args)[1], "UploadId"))
assert.Equal(t, "UPLOAD-ID", val((*args)[2], "UploadId"))
assert.Equal(t, "UPLOAD-ID", val((*args)[3], "UploadId"))
// CompleteMultipartUpload
assert.Equal(t, "UPLOAD-ID", val((*args)[4], "UploadID"))
assert.Equal(t, "UPLOAD-ID", val((*args)[4], "UploadId"))
assert.Equal(t, int64(1), val((*args)[4], "MultipartUpload.Parts[0].PartNumber"))
assert.Equal(t, int64(2), val((*args)[4], "MultipartUpload.Parts[1].PartNumber"))
assert.Equal(t, int64(3), val((*args)[4], "MultipartUpload.Parts[2].PartNumber"))
@ -200,7 +203,7 @@ func TestUploadOrderSingle(t *testing.T) {
func TestUploadOrderSingleFailure(t *testing.T) {
s, ops, _ := loggingSvc(emptyList)
s.Handlers.Send.PushBack(func(r *aws.Request) {
s.Handlers.Send.PushBack(func(r *service.Request) {
r.HTTPResponse.StatusCode = 400
})
mgr := s3manager.NewUploader(&s3manager.UploadOptions{S3: s})
@ -233,7 +236,7 @@ func TestUploadOrderZero(t *testing.T) {
func TestUploadOrderMultiFailure(t *testing.T) {
s, ops, _ := loggingSvc(emptyList)
s.Handlers.Send.PushBack(func(r *aws.Request) {
s.Handlers.Send.PushBack(func(r *service.Request) {
switch t := r.Data.(type) {
case *s3.UploadPartOutput:
if *t.ETag == "ETAG2" {
@ -255,7 +258,7 @@ func TestUploadOrderMultiFailure(t *testing.T) {
func TestUploadOrderMultiFailureOnComplete(t *testing.T) {
s, ops, _ := loggingSvc(emptyList)
s.Handlers.Send.PushBack(func(r *aws.Request) {
s.Handlers.Send.PushBack(func(r *service.Request) {
switch r.Data.(type) {
case *s3.CompleteMultipartUploadOutput:
r.HTTPResponse.StatusCode = 400
@ -276,7 +279,7 @@ func TestUploadOrderMultiFailureOnComplete(t *testing.T) {
func TestUploadOrderMultiFailureOnCreate(t *testing.T) {
s, ops, _ := loggingSvc(emptyList)
s.Handlers.Send.PushBack(func(r *aws.Request) {
s.Handlers.Send.PushBack(func(r *service.Request) {
switch r.Data.(type) {
case *s3.CreateMultipartUploadOutput:
r.HTTPResponse.StatusCode = 400
@ -296,7 +299,7 @@ func TestUploadOrderMultiFailureOnCreate(t *testing.T) {
func TestUploadOrderMultiFailureLeaveParts(t *testing.T) {
s, ops, _ := loggingSvc(emptyList)
s.Handlers.Send.PushBack(func(r *aws.Request) {
s.Handlers.Send.PushBack(func(r *service.Request) {
switch data := r.Data.(type) {
case *s3.UploadPartOutput:
if *data.ETag == "ETAG2" {
@ -436,3 +439,25 @@ func TestUploadOrderSingleBufferedReader(t *testing.T) {
assert.NotEqual(t, "", resp.Location)
assert.Equal(t, "", resp.UploadID)
}
func TestUploadZeroLenObject(t *testing.T) {
requestMade := false
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request){
requestMade = true
w.WriteHeader(http.StatusOK)
}))
svc := s3.New(&aws.Config{
Endpoint: aws.String(server.URL),
})
mgr := s3manager.NewUploader(&s3manager.UploadOptions{S3: svc})
resp, err := mgr.Upload(&s3manager.UploadInput{
Bucket: aws.String("Bucket"),
Key: aws.String("Key"),
Body: strings.NewReader(""),
})
assert.NoError(t, err)
assert.True(t, requestMade)
assert.NotEqual(t, "", resp.Location)
assert.Equal(t, "", resp.UploadID)
}

View File

@ -4,25 +4,27 @@ package s3
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/defaults"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/internal/protocol/restxml"
"github.com/aws/aws-sdk-go/internal/signer/v4"
)
// S3 is a client for Amazon S3.
type S3 struct {
*aws.Service
*service.Service
}
// Used for custom service initialization logic
var initService func(*aws.Service)
var initService func(*service.Service)
// Used for custom request initialization logic
var initRequest func(*aws.Request)
var initRequest func(*service.Request)
// New returns a new S3 client.
func New(config *aws.Config) *S3 {
service := &aws.Service{
Config: aws.DefaultConfig.Merge(config),
service := &service.Service{
Config: defaults.DefaultConfig.Merge(config),
ServiceName: "s3",
APIVersion: "2006-03-01",
}
@ -45,8 +47,8 @@ func New(config *aws.Config) *S3 {
// 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)
func (c *S3) newRequest(op *service.Operation, params, data interface{}) *service.Request {
req := service.NewRequest(c.Service, op, params, data)
// Run custom request initialization if present
if initRequest != nil {

View File

@ -4,14 +4,14 @@ import (
"crypto/md5"
"encoding/base64"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/awsutil"
"github.com/aws/aws-sdk-go/aws/service"
)
var errSSERequiresSSL = awserr.New("ConfigError", "cannot send SSE keys over HTTP.", nil)
func validateSSERequiresSSL(r *aws.Request) {
func validateSSERequiresSSL(r *service.Request) {
if r.HTTPRequest.URL.Scheme != "https" {
p := awsutil.ValuesAtPath(r.Params, "SSECustomerKey||CopySourceSSECustomerKey")
if len(p) > 0 {
@ -20,7 +20,7 @@ func validateSSERequiresSSL(r *aws.Request) {
}
}
func computeSSEKeys(r *aws.Request) {
func computeSSEKeys(r *service.Request) {
headers := []string{
"x-amz-server-side-encryption-customer-key",
"x-amz-copy-source-server-side-encryption-customer-key",

View File

@ -5,8 +5,8 @@ import (
"io"
"strings"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/service"
)
type xmlErrorResponse struct {
@ -15,7 +15,7 @@ type xmlErrorResponse struct {
Message string `xml:"Message"`
}
func unmarshalError(r *aws.Request) {
func unmarshalError(r *service.Request) {
defer r.HTTPResponse.Body.Close()
if r.HTTPResponse.ContentLength == int64(0) {

View File

@ -8,6 +8,7 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/service"
"github.com/aws/aws-sdk-go/internal/test/unit"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/stretchr/testify/assert"
@ -33,7 +34,7 @@ func TestStatusCodeError(t *testing.T) {
for _, test := range s3StatusCodeErrorTests {
s := s3.New(nil)
s.Handlers.Send.Clear()
s.Handlers.Send.PushBack(func(r *aws.Request) {
s.Handlers.Send.PushBack(func(r *service.Request) {
body := ioutil.NopCloser(bytes.NewReader([]byte(test.body)))
r.HTTPResponse = &http.Response{
ContentLength: int64(len(test.body)),
@ -42,7 +43,7 @@ func TestStatusCodeError(t *testing.T) {
Body: body,
}
})
_, err := s.PutBucketACL(&s3.PutBucketACLInput{
_, err := s.PutBucketAcl(&s3.PutBucketAclInput{
Bucket: aws.String("bucket"), ACL: aws.String("public-read"),
})

View File

@ -216,12 +216,12 @@ func (c *Client) initHTTPSClient(cert, key string) error {
InsecureSkipVerify: true,
}
tr := &http.Transport{
c.transport = &http.Transport{
TLSClientConfig: tlsConfig,
Dial: c.DefaultDial,
}
c.httpClient = &http.Client{Transport: tr}
c.httpClient = &http.Client{Transport: c.transport}
return nil
}
@ -394,26 +394,12 @@ func (c *Client) createHttpPath(serverName string, _path string) string {
// DefaultDial attempts to open a TCP connection to the provided address, explicitly
// enabling keep-alives with a one-second interval.
func (c *Client) DefaultDial(network, addr string) (net.Conn, error) {
conn, err := net.DialTimeout(network, addr, c.config.DialTimeout)
if err != nil {
return nil, err
dialer := net.Dialer{
Timeout: c.config.DialTimeout,
KeepAlive: time.Second,
}
tcpConn, ok := conn.(*net.TCPConn)
if !ok {
return nil, errors.New("Failed type-assertion of net.Conn as *net.TCPConn")
}
// Keep TCP alive to check whether or not the remote machine is down
if err = tcpConn.SetKeepAlive(true); err != nil {
return nil, err
}
if err = tcpConn.SetKeepAlivePeriod(time.Second); err != nil {
return nil, err
}
return tcpConn, nil
return dialer.Dial(network, addr)
}
func (c *Client) OpenCURL() {

View File

@ -19,6 +19,8 @@ func NewCluster(machines []string) *Cluster {
machines = []string{"http://127.0.0.1:4001"}
}
machines = shuffleStringSlice(machines)
logger.Debug("Shuffle cluster machines", machines)
// default leader and machines
return &Cluster{
Leader: "",
@ -30,7 +32,7 @@ func NewCluster(machines []string) *Cluster {
func (cl *Cluster) failure() {
cl.mu.Lock()
defer cl.mu.Unlock()
cl.picked = rand.Intn(len(cl.Machines))
cl.picked = (cl.picked + 1) % len(cl.Machines)
}
func (cl *Cluster) pick() string {
@ -47,5 +49,6 @@ func (cl *Cluster) updateFromStr(machines string) {
for i := range cl.Machines {
cl.Machines[i] = strings.TrimSpace(cl.Machines[i])
}
cl.Machines = shuffleStringSlice(cl.Machines)
cl.picked = rand.Intn(len(cl.Machines))
}

View File

@ -348,7 +348,7 @@ func DefaultCheckRetry(cluster *Cluster, numReqs int, lastResp http.Response,
}
// sleep some time and expect leader election finish
time.Sleep(time.Millisecond * 200)
logger.Warning("bad response status code", lastResp.StatusCode)
logger.Warning("bad response status code ", lastResp.StatusCode)
return nil
}

View File

@ -0,0 +1,19 @@
package etcd
import (
"math/rand"
)
func shuffleStringSlice(cards []string) []string {
size := len(cards)
//Do not need to copy if nothing changed
if size <= 1 {
return cards
}
shuffled := make([]string, size)
index := rand.Perm(size)
for i := range cards {
shuffled[index[i]] = cards[i]
}
return shuffled
}

View File

@ -0,0 +1,4 @@
.DS_Store
bin

View File

@ -1,4 +0,0 @@
examples/modify
examples/search
examples/searchSSL
examples/searchTLS

View File

@ -82,6 +82,8 @@ func DialTLS(network, addr string, config *tls.Config) (*Conn, error) {
c := tls.Client(dc, config)
err = c.Handshake()
if err != nil {
// Handshake error, close the established connection before we return an error
dc.Close()
return nil, NewError(ErrorNetwork, err)
}
conn := NewConn(c, true)
@ -174,7 +176,7 @@ func (l *Conn) StartTLS(config *tls.Config) error {
ber.PrintPacket(packet)
}
if packet.Children[1].Children[0].Value.(int64) == 0 {
if packet.Children[1].Children[0].Value.(int64) == LDAPResultSuccess {
conn := tls.Client(l.conn, config)
if err := conn.Handshake(); err != nil {
@ -184,6 +186,12 @@ func (l *Conn) StartTLS(config *tls.Config) error {
l.isTLS = true
l.conn = conn
} else {
// https://tools.ietf.org/html/rfc4511#section-4.1.9
// Children[1].Children[2] is the diagnosticMessage which is guaranteed to exist.
return NewError(
uint8(packet.Children[1].Children[0].Value.(int64)),
fmt.Errorf("ldap: cannot StartTLS (%s)", packet.Children[1].Children[2].Value.(string)))
}
go l.reader()

4
Godeps/_workspace/src/github.com/go-ldap/ldap/doc.go generated vendored Normal file
View File

@ -0,0 +1,4 @@
/*
Package ldap provides basic LDAP v3 functionality.
*/
package ldap

View File

@ -0,0 +1,305 @@
package ldap_test
import (
"crypto/tls"
"fmt"
"log"
"github.com/go-ldap/ldap"
)
// ExampleConn_Bind demonstrats how to bind a connection to an ldap user
// allowing access to restricted attrabutes that user has access to
func ExampleConn_Bind() {
l, err := ldap.Dial("tcp", fmt.Sprintf("%s:%d", "ldap.example.com", 389))
if err != nil {
log.Fatal(err)
}
defer l.Close()
err = l.Bind("cn=read-only-admin,dc=example,dc=com", "password")
if err != nil {
log.Fatal(err)
}
}
// ExampleConn_Search demonstrates how to use the search interface
func ExampleConn_Search() {
l, err := ldap.Dial("tcp", fmt.Sprintf("%s:%d", "ldap.example.com", 389))
if err != nil {
log.Fatal(err)
}
defer l.Close()
searchRequest := ldap.NewSearchRequest(
"dc=example,dc=com", // The base dn to search
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
"(&(objectClass=organizationalPerson))", // The filter to apply
[]string{"dn", "cn"}, // A list attributes to retrieve
nil,
)
sr, err := l.Search(searchRequest)
if err != nil {
log.Fatal(err)
}
for _, entry := range sr.Entries {
fmt.Printf("%s: %v\n", entry.DN, entry.GetAttributeValue("cn"))
}
}
// ExampleStartTLS demonstrates how to start a TLS connection
func ExampleConn_StartTLS() {
l, err := ldap.Dial("tcp", fmt.Sprintf("%s:%d", "ldap.example.com", 389))
if err != nil {
log.Fatal(err)
}
defer l.Close()
// Reconnect with TLS
err = l.StartTLS(&tls.Config{InsecureSkipVerify: true})
if err != nil {
log.Fatal(err)
}
// Opertations via l are now encrypted
}
// ExampleConn_Compare demonstrates how to comapre an attribute with a value
func ExampleConn_Compare() {
l, err := ldap.Dial("tcp", fmt.Sprintf("%s:%d", "ldap.example.com", 389))
if err != nil {
log.Fatal(err)
}
defer l.Close()
matched, err := l.Compare("cn=user,dc=example,dc=com", "uid", "someuserid")
if err != nil {
log.Fatal(err)
}
fmt.Println(matched)
}
func ExampleConn_PasswordModify_admin() {
l, err := ldap.Dial("tcp", fmt.Sprintf("%s:%d", "ldap.example.com", 389))
if err != nil {
log.Fatal(err)
}
defer l.Close()
err = l.Bind("cn=admin,dc=example,dc=com", "password")
if err != nil {
log.Fatal(err)
}
passwordModifyRequest := ldap.NewPasswordModifyRequest("cn=user,dc=example,dc=com", "", "NewPassword")
_, err = l.PasswordModify(passwordModifyRequest)
if err != nil {
log.Fatalf("Password could not be changed: %s", err.Error())
}
}
func ExampleConn_PasswordModify_generatedPassword() {
l, err := ldap.Dial("tcp", fmt.Sprintf("%s:%d", "ldap.example.com", 389))
if err != nil {
log.Fatal(err)
}
defer l.Close()
err = l.Bind("cn=user,dc=example,dc=com", "password")
if err != nil {
log.Fatal(err)
}
passwordModifyRequest := ldap.NewPasswordModifyRequest("", "OldPassword", "")
passwordModifyResponse, err := l.PasswordModify(passwordModifyRequest)
if err != nil {
log.Fatalf("Password could not be changed: %s", err.Error())
}
generatedPassword := passwordModifyResponse.GeneratedPassword
log.Printf("Generated password: %s\n", generatedPassword)
}
func ExampleConn_PasswordModify_setNewPassword() {
l, err := ldap.Dial("tcp", fmt.Sprintf("%s:%d", "ldap.example.com", 389))
if err != nil {
log.Fatal(err)
}
defer l.Close()
err = l.Bind("cn=user,dc=example,dc=com", "password")
if err != nil {
log.Fatal(err)
}
passwordModifyRequest := ldap.NewPasswordModifyRequest("", "OldPassword", "NewPassword")
_, err = l.PasswordModify(passwordModifyRequest)
if err != nil {
log.Fatalf("Password could not be changed: %s", err.Error())
}
}
func ExampleConn_Modify() {
l, err := ldap.Dial("tcp", fmt.Sprintf("%s:%d", "ldap.example.com", 389))
if err != nil {
log.Fatal(err)
}
defer l.Close()
// Add a description, and replace the mail attributes
modify := ldap.NewModifyRequest("cn=user,dc=example,dc=com")
modify.Add("description", []string{"An example user"})
modify.Replace("mail", []string{"user@example.org"})
err = l.Modify(modify)
if err != nil {
log.Fatal(err)
}
}
// Example User Authentication shows how a typical application can verify a login attempt
func Example_userAuthentication() {
// The username and password we want to check
username := "someuser"
password := "userpassword"
bindusername := "readonly"
bindpassword := "password"
l, err := ldap.Dial("tcp", fmt.Sprintf("%s:%d", "ldap.example.com", 389))
if err != nil {
log.Fatal(err)
}
defer l.Close()
// Reconnect with TLS
err = l.StartTLS(&tls.Config{InsecureSkipVerify: true})
if err != nil {
log.Fatal(err)
}
// First bind with a read only user
err = l.Bind(bindusername, bindpassword)
if err != nil {
log.Fatal(err)
}
// Search for the given username
searchRequest := ldap.NewSearchRequest(
"dc=example,dc=com",
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
fmt.Sprintf("(&(objectClass=organizationalPerson)&(uid=%s))", username),
[]string{"dn"},
nil,
)
sr, err := l.Search(searchRequest)
if err != nil {
log.Fatal(err)
}
if len(sr.Entries) != 1 {
log.Fatal("User does not exist or too many entries returned")
}
userdn := sr.Entries[0].DN
// Bind as the user to verify their password
err = l.Bind(userdn, password)
if err != nil {
log.Fatal(err)
}
// Rebind as the read only user for any futher queries
err = l.Bind(bindusername, bindpassword)
if err != nil {
log.Fatal(err)
}
}
func Example_beherappolicy() {
l, err := ldap.Dial("tcp", fmt.Sprintf("%s:%d", "ldap.example.com", 389))
if err != nil {
log.Fatal(err)
}
defer l.Close()
controls := []ldap.Control{}
controls = append(controls, ldap.NewControlBeheraPasswordPolicy())
bindRequest := ldap.NewSimpleBindRequest("cn=admin,dc=example,dc=com", "password", controls)
r, err := l.SimpleBind(bindRequest)
ppolicyControl := ldap.FindControl(r.Controls, ldap.ControlTypeBeheraPasswordPolicy)
var ppolicy *ldap.ControlBeheraPasswordPolicy
if ppolicyControl != nil {
ppolicy = ppolicyControl.(*ldap.ControlBeheraPasswordPolicy)
} else {
log.Printf("ppolicyControl response not avaliable.\n")
}
if err != nil {
errStr := "ERROR: Cannot bind: " + err.Error()
if ppolicy != nil && ppolicy.Error >= 0 {
errStr += ":" + ppolicy.ErrorString
}
log.Print(errStr)
} else {
logStr := "Login Ok"
if ppolicy != nil {
if ppolicy.Expire >= 0 {
logStr += fmt.Sprintf(". Password expires in %d seconds\n", ppolicy.Expire)
} else if ppolicy.Grace >= 0 {
logStr += fmt.Sprintf(". Password expired, %d grace logins remain\n", ppolicy.Grace)
}
}
log.Print(logStr)
}
}
func Example_vchuppolicy() {
l, err := ldap.Dial("tcp", fmt.Sprintf("%s:%d", "ldap.example.com", 389))
if err != nil {
log.Fatal(err)
}
defer l.Close()
l.Debug = true
bindRequest := ldap.NewSimpleBindRequest("cn=admin,dc=example,dc=com", "password", nil)
r, err := l.SimpleBind(bindRequest)
passwordMustChangeControl := ldap.FindControl(r.Controls, ldap.ControlTypeVChuPasswordMustChange)
var passwordMustChange *ldap.ControlVChuPasswordMustChange
if passwordMustChangeControl != nil {
passwordMustChange = passwordMustChangeControl.(*ldap.ControlVChuPasswordMustChange)
}
if passwordMustChange != nil && passwordMustChange.MustChange {
log.Printf("Password Must be changed.\n")
}
passwordWarningControl := ldap.FindControl(r.Controls, ldap.ControlTypeVChuPasswordWarning)
var passwordWarning *ldap.ControlVChuPasswordWarning
if passwordWarningControl != nil {
passwordWarning = passwordWarningControl.(*ldap.ControlVChuPasswordWarning)
} else {
log.Printf("ppolicyControl response not available.\n")
}
if err != nil {
log.Print("ERROR: Cannot bind: " + err.Error())
} else {
logStr := "Login Ok"
if passwordWarning != nil {
if passwordWarning.Expire >= 0 {
logStr += fmt.Sprintf(". Password expires in %d seconds\n", passwordWarning.Expire)
}
}
log.Print(logStr)
}
}

View File

@ -1,60 +0,0 @@
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"fmt"
"log"
"github.com/go-ldap/ldap"
)
var (
ldapServer string = "localhost"
ldapPort uint16 = 389
baseDN string = "dc=enterprise,dc=org"
user string = "cn=kirkj,ou=crew,dc=enterprise,dc=org"
passwd string = "*"
)
func main() {
l, err := ldap.Dial("tcp", fmt.Sprintf("%s:%d", ldapServer, ldapPort))
if err != nil {
log.Fatalf("ERROR: %s\n", err.Error())
}
defer l.Close()
l.Debug = true
controls := []ldap.Control{}
controls = append(controls, ldap.NewControlBeheraPasswordPolicy())
bindRequest := ldap.NewSimpleBindRequest(user, passwd, controls)
r, err := l.SimpleBind(bindRequest)
ppolicyControl := ldap.FindControl(r.Controls, ldap.ControlTypeBeheraPasswordPolicy)
var ppolicy *ldap.ControlBeheraPasswordPolicy
if ppolicyControl != nil {
ppolicy = ppolicyControl.(*ldap.ControlBeheraPasswordPolicy)
} else {
log.Printf("ppolicyControl response not avaliable.\n")
}
if err != nil {
errStr := "ERROR: Cannot bind: " + err.Error()
if ppolicy != nil && ppolicy.Error >= 0 {
errStr += ":" + ppolicy.ErrorString
}
log.Print(errStr)
} else {
logStr := "Login Ok"
if ppolicy != nil {
if ppolicy.Expire >= 0 {
logStr += fmt.Sprintf(". Password expires in %d seconds\n", ppolicy.Expire)
} else if ppolicy.Grace >= 0 {
logStr += fmt.Sprintf(". Password expired, %d grace logins remain\n", ppolicy.Grace)
}
}
log.Print(logStr)
}
}

View File

@ -1,39 +0,0 @@
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"fmt"
"log"
"github.com/go-ldap/ldap"
)
var (
ldapServer string = "localhost"
ldapPort uint16 = 389
user string = "*"
passwd string = "*"
dn string = "uid=*,cn=*,dc=*,dc=*"
attribute string = "uid"
value string = "username"
)
func main() {
l, err := ldap.Dial("tcp", fmt.Sprintf("%s:%d", ldapServer, ldapPort))
if err != nil {
log.Fatalf("ERROR: %s\n", err.Error())
}
defer l.Close()
// l.Debug = true
err = l.Bind(user, passwd)
if err != nil {
log.Printf("ERROR: Cannot bind: %s\n", err.Error())
return
}
fmt.Println(l.Compare(dn, attribute, value))
}

View File

@ -1,63 +0,0 @@
dn: dc=enterprise,dc=org
objectClass: dcObject
objectClass: organization
o: acme
dn: cn=admin,dc=enterprise,dc=org
objectClass: person
cn: admin
sn: admin
description: "LDAP Admin"
dn: ou=crew,dc=enterprise,dc=org
ou: crew
objectClass: organizationalUnit
dn: cn=kirkj,ou=crew,dc=enterprise,dc=org
cn: kirkj
sn: Kirk
gn: James Tiberius
mail: james.kirk@enterprise.org
objectClass: inetOrgPerson
dn: cn=spock,ou=crew,dc=enterprise,dc=org
cn: spock
sn: Spock
mail: spock@enterprise.org
objectClass: inetOrgPerson
dn: cn=mccoyl,ou=crew,dc=enterprise,dc=org
cn: mccoyl
sn: McCoy
gn: Leonard
mail: leonard.mccoy@enterprise.org
objectClass: inetOrgPerson
dn: cn=scottm,ou=crew,dc=enterprise,dc=org
cn: scottm
sn: Scott
gn: Montgomery
mail: Montgomery.scott@enterprise.org
objectClass: inetOrgPerson
dn: cn=uhuran,ou=crew,dc=enterprise,dc=org
cn: uhuran
sn: Uhura
gn: Nyota
mail: nyota.uhura@enterprise.org
objectClass: inetOrgPerson
dn: cn=suluh,ou=crew,dc=enterprise,dc=org
cn: suluh
sn: Sulu
gn: Hikaru
mail: hikaru.sulu@enterprise.org
objectClass: inetOrgPerson
dn: cn=chekovp,ou=crew,dc=enterprise,dc=org
cn: chekovp
sn: Chekov
gn: pavel
mail: pavel.chekov@enterprise.org
objectClass: inetOrgPerson

View File

@ -1,125 +0,0 @@
package main
import (
"fmt"
"log"
"github.com/go-ldap/ldap"
)
// Example password policy. For this test pwdMinAge is 0 or subsequent password
// changes will fail.
//
// dn: cn=default,ou=policies,dc=enterprise,dc=org
// objectClass: pwdPolicy
// objectClass: person
// objectClass: top
// cn: default
// pwdAllowUserChange: TRUE
// pwdAttribute: userPassword
// pwdCheckQuality: 2
// pwdExpireWarning: 300
// pwdFailureCountInterval: 30
// pwdGraceAuthNLimit: 5
// pwdInHistory: 0
// pwdLockout: TRUE
// pwdLockoutDuration: 0
// pwdMaxAge: 300
// pwdMaxFailure: 0
// pwdMinAge: 0
// pwdMinLength: 5
// pwdMustChange: TRUE
// pwdSafeModify: TRUE
// sn: dummy value
var (
ldapServer string = "localhost"
ldapPort uint16 = 389
baseDN string = "dc=enterprise,dc=org"
adminUser string = "cn=admin,dc=enterprise,dc=org"
adminPassword string = "*"
user string = "cn=kirkj,ou=crew,dc=enterprise,dc=org"
oldPassword string = "*"
password1 string = "password123"
password2 string = "password1234"
)
const (
debug = false
)
func login(user string, password string) (*ldap.Conn, error) {
l, err := ldap.Dial("tcp", fmt.Sprintf("%s:%d", ldapServer, ldapPort))
if err != nil {
return nil, err
}
l.Debug = debug
bindRequest := ldap.NewSimpleBindRequest(user, password, nil)
_, err = l.SimpleBind(bindRequest)
if err != nil {
return nil, err
}
return l, nil
}
func main() {
// Login as the admin and change the password of an user (without providing the old password)
log.Printf("Logging in as the admin and changing the password of user (without providing the old password")
l, err := login(adminUser, adminPassword)
if err != nil {
log.Fatalf("ERROR: %s\n", err.Error())
}
passwordModifyRequest := ldap.NewPasswordModifyRequest(user, "", password1)
_, err = l.PasswordModify(passwordModifyRequest)
if err != nil {
l.Close()
log.Fatalf("ERROR: Cannot change password: %s\n", err)
}
log.Printf("Done")
l.Close()
// Login as the user and change the password without providing a new password.
log.Printf("Logging in as the user and changing the password without providing a new one")
l, err = login(user, password1)
if err != nil {
log.Fatalf("ERROR: %s\n", err.Error())
}
passwordModifyRequest = ldap.NewPasswordModifyRequest("", password1, "")
passwordModifyResponse, err := l.PasswordModify(passwordModifyRequest)
if err != nil {
l.Close()
log.Fatalf("ERROR: Cannot change password: %s\n", err)
}
generatedPassword := passwordModifyResponse.GeneratedPassword
log.Printf("Done. Generated password: %s\n", generatedPassword)
l.Close()
// Login as the user with the generated password and change it to another one
log.Printf("Logging in as the user and changing the password")
l, err = login(user, generatedPassword)
if err != nil {
log.Fatalf("ERROR: %s\n", err.Error())
}
passwordModifyRequest = ldap.NewPasswordModifyRequest("", generatedPassword, password2)
_, err = l.PasswordModify(passwordModifyRequest)
if err != nil {
l.Close()
log.Fatalf("ERROR: Cannot change password: %s\n", err)
}
log.Printf("Done")
l.Close()
}

View File

@ -1,60 +0,0 @@
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"crypto/tls"
"fmt"
"log"
"gopkg.in/ldap.v1"
)
var (
LdapServer string = "localhost"
LdapPort uint16 = 389
BaseDN string = "dc=enterprise,dc=org"
Filter string = "(cn=kirkj)"
Attributes []string = []string{"mail"}
)
func main() {
l, err := ldap.Dial("tcp", fmt.Sprintf("%s:%d", LdapServer, LdapPort))
if err != nil {
log.Fatalf("ERROR: %s\n", err)
}
defer l.Close()
l.Debug = true
search := ldap.NewSearchRequest(
BaseDN,
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
Filter,
Attributes,
nil)
// First search without tls.
sr, err := l.Search(search)
if err != nil {
log.Printf("ERROR: %s\n", err)
}
log.Printf("Search: %s -> num of entries = %d\n", search.Filter, len(sr.Entries))
sr.PrettyPrint(0)
// Then startTLS
err = l.StartTLS(&tls.Config{InsecureSkipVerify: true})
if err != nil {
log.Fatalf("ERROR: %s\n", err)
}
sr, err = l.Search(search)
if err != nil {
log.Printf("ERROR: %s\n", err)
}
log.Printf("Search: %s -> num of entries = %d\n", search.Filter, len(sr.Entries))
sr.PrettyPrint(0)
}

View File

@ -1,67 +0,0 @@
#
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#
include /private/etc/openldap/schema/core.schema
include /private/etc/openldap/schema/cosine.schema
include /private/etc/openldap/schema/inetorgperson.schema
# Define global ACLs to disable default read access.
# Do not enable referrals until AFTER you have a working directory
# service AND an understanding of referrals.
#referral ldap://root.openldap.org
pidfile /private/var/db/openldap/run/slapd.pid
argsfile /private/var/db/openldap/run/slapd.args
# Load dynamic backend modules:
# modulepath /usr/libexec/openldap
# moduleload back_bdb.la
# moduleload back_hdb.la
# moduleload back_ldap.la
# Sample security restrictions
# Require integrity protection (prevent hijacking)
# Require 112-bit (3DES or better) encryption for updates
# Require 63-bit encryption for simple bind
# security ssf=1 update_ssf=112 simple_bind=64
# Sample access control policy:
# Root DSE: allow anyone to read it
# Subschema (sub)entry DSE: allow anyone to read it
# Other DSEs:
# Allow self write access
# Allow authenticated users read access
# Allow anonymous users to authenticate
# Directives needed to implement policy:
# access to dn.base="" by * read
# access to dn.base="cn=Subschema" by * read
# access to *
# by self write
# by users read
# by anonymous auth
#
# if no access controls are present, the default policy
# allows anyone and everyone to read anything but restricts
# updates to rootdn. (e.g., "access to * by * read")
#
# rootdn can always read and write EVERYTHING!
#######################################################################
# BDB database definitions
#######################################################################
database bdb
suffix "dc=enterprise,dc=org"
rootdn "cn=admin,dc=enterprise,dc=org"
# Cleartext passwords, especially for the rootdn, should
# be avoid. See slappasswd(8) and slapd.conf(5) for details.
# Use of strong authentication encouraged.
rootpw {SSHA}laO00HsgszhK1O0Z5qR0/i/US69Osfeu
# The database directory MUST exist prior to running slapd AND
# should only be accessible by the slapd and slap tools.
# Mode 700 recommended.
directory /private/var/db/openldap/openldap-data
# Indices to maintain
index objectClass eq

View File

@ -1,63 +0,0 @@
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"fmt"
"log"
"gopkg.in/ldap.v1"
)
var (
ldapServer string = "localhost"
ldapPort uint16 = 389
baseDN string = "dc=enterprise,dc=org"
user string = "uid=kirkj,ou=crew,dc=enterprise,dc=org"
passwd string = "*"
)
func main() {
l, err := ldap.Dial("tcp", fmt.Sprintf("%s:%d", ldapServer, ldapPort))
if err != nil {
log.Fatalf("ERROR: %s\n", err.Error())
}
defer l.Close()
l.Debug = true
bindRequest := ldap.NewSimpleBindRequest(user, passwd, nil)
r, err := l.SimpleBind(bindRequest)
passwordMustChangeControl := ldap.FindControl(r.Controls, ldap.ControlTypeVChuPasswordMustChange)
var passwordMustChange *ldap.ControlVChuPasswordMustChange
if passwordMustChangeControl != nil {
passwordMustChange = passwordMustChangeControl.(*ldap.ControlVChuPasswordMustChange)
}
if passwordMustChange != nil && passwordMustChange.MustChange {
log.Printf("Password Must be changed.\n")
}
passwordWarningControl := ldap.FindControl(r.Controls, ldap.ControlTypeVChuPasswordWarning)
var passwordWarning *ldap.ControlVChuPasswordWarning
if passwordWarningControl != nil {
passwordWarning = passwordWarningControl.(*ldap.ControlVChuPasswordWarning)
} else {
log.Printf("ppolicyControl response not available.\n")
}
if err != nil {
log.Print("ERROR: Cannot bind: " + err.Error())
} else {
logStr := "Login Ok"
if passwordWarning != nil {
if passwordWarning.Expire >= 0 {
logStr += fmt.Sprintf(". Password expires in %d seconds\n", passwordWarning.Expire)
}
}
log.Print(logStr)
}
}

View File

@ -5,6 +5,8 @@
package ldap
import (
"bytes"
hexpac "encoding/hex"
"errors"
"fmt"
"strings"
@ -116,22 +118,22 @@ func DecompileFilter(packet *ber.Packet) (ret string, err error) {
case FilterEqualityMatch:
ret += ber.DecodeString(packet.Children[0].Data.Bytes())
ret += "="
ret += ber.DecodeString(packet.Children[1].Data.Bytes())
ret += EscapeFilter(ber.DecodeString(packet.Children[1].Data.Bytes()))
case FilterGreaterOrEqual:
ret += ber.DecodeString(packet.Children[0].Data.Bytes())
ret += ">="
ret += ber.DecodeString(packet.Children[1].Data.Bytes())
ret += EscapeFilter(ber.DecodeString(packet.Children[1].Data.Bytes()))
case FilterLessOrEqual:
ret += ber.DecodeString(packet.Children[0].Data.Bytes())
ret += "<="
ret += ber.DecodeString(packet.Children[1].Data.Bytes())
ret += EscapeFilter(ber.DecodeString(packet.Children[1].Data.Bytes()))
case FilterPresent:
ret += ber.DecodeString(packet.Data.Bytes())
ret += "=*"
case FilterApproxMatch:
ret += ber.DecodeString(packet.Children[0].Data.Bytes())
ret += "~="
ret += ber.DecodeString(packet.Children[1].Data.Bytes())
ret += EscapeFilter(ber.DecodeString(packet.Children[1].Data.Bytes()))
}
ret += ")"
@ -242,8 +244,31 @@ func compileFilter(filter string, pos int) (*ber.Packet, int, error) {
}
packet.AppendChild(seq)
default:
var buffer bytes.Buffer
for i := 0; i < len(condition); i++ {
// Check for escaped hex characters and convert them to their literal value for transport.
if condition[i] == '\\' {
// http://tools.ietf.org/search/rfc4515
// \ (%x5C) is not a valid character unless it is followed by two HEX characters due to not
// being a member of UTF1SUBSET.
if i+2 > len(condition) {
err = NewError(ErrorFilterCompile, errors.New("ldap: missing characters for escape in filter"))
return packet, newPos, err
}
if escByte, decodeErr := hexpac.DecodeString(condition[i+1:i+3]); decodeErr != nil {
err = NewError(ErrorFilterCompile, errors.New("ldap: invalid characters for escape in filter"))
return packet, newPos, err
} else {
buffer.WriteByte(escByte[0])
i += 2 // +1 from end of loop, so 3 total for \xx.
}
} else {
buffer.WriteString(string(condition[i]))
}
}
packet.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, attribute, "Attribute"))
packet.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, condition, "Condition"))
packet.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, buffer.String(), "Condition"))
}
newPos++

View File

@ -27,9 +27,15 @@ var testFilters = []compileTest{
compileTest{filterStr: "(sn<=Miller)", filterType: FilterLessOrEqual},
compileTest{filterStr: "(sn=*)", filterType: FilterPresent},
compileTest{filterStr: "(sn~=Miller)", filterType: FilterApproxMatch},
compileTest{filterStr: `(objectGUID='\fc\fe\a3\ab\f9\90N\aaGm\d5I~\d12)`, filterType: FilterEqualityMatch},
// compileTest{ filterStr: "()", filterType: FilterExtensibleMatch },
}
var testInvalidFilters = []string{
`(objectGUID=\zz)`,
`(objectGUID=\a)`,
}
func TestFilter(t *testing.T) {
// Test Compiler and Decompiler
for _, i := range testFilters {
@ -49,6 +55,14 @@ func TestFilter(t *testing.T) {
}
}
func TestInvalidFilter(t *testing.T) {
for _, filterStr := range testInvalidFilters {
if _, err := CompileFilter(filterStr); err == nil {
t.Errorf("Problem compiling %s - expected err", filterStr)
}
}
}
func BenchmarkFilterCompile(b *testing.B) {
b.StopTimer()
filters := make([]string, len(testFilters))

View File

@ -1246,6 +1246,30 @@ func TestCollation(t *testing.T) {
}
}
func TestColumnsWithAlias(t *testing.T) {
runTests(t, dsn+"&columnsWithAlias=true", func(dbt *DBTest) {
rows := dbt.mustQuery("SELECT 1 AS A")
defer rows.Close()
cols, _ := rows.Columns()
if len(cols) != 1 {
t.Fatalf("expected 1 column, got %d", len(cols))
}
if cols[0] != "A" {
t.Fatalf("expected column name \"A\", got \"%s\"", cols[0])
}
rows.Close()
rows = dbt.mustQuery("SELECT * FROM (SELECT 1 AS one) AS A")
cols, _ = rows.Columns()
if len(cols) != 1 {
t.Fatalf("expected 1 column, got %d", len(cols))
}
if cols[0] != "A.one" {
t.Fatalf("expected column name \"A.one\", got \"%s\"", cols[0])
}
})
}
func TestRawBytesResultExceedsBuffer(t *testing.T) {
runTests(t, dsn, func(dbt *DBTest) {
// defaultBufSize from buffer.go

View File

@ -86,8 +86,10 @@ func (mc *mysqlConn) handleInFileRequest(name string) (err error) {
var rdr io.Reader
var data []byte
if strings.HasPrefix(name, "Reader::") { // io.Reader
name = name[8:]
if idx := strings.Index(name, "Reader::"); idx == 0 || (idx > 0 && name[idx-1] == '/') { // io.Reader
// The server might return an an absolute path. See issue #355.
name = name[idx+8:]
if handler, inMap := readerRegister[name]; inMap {
rdr = handler()
if rdr != nil {

View File

@ -40,7 +40,11 @@ func (rows *mysqlRows) Columns() []string {
columns := make([]string, len(rows.columns))
if rows.mc.cfg.columnsWithAlias {
for i := range columns {
columns[i] = rows.columns[i].tableName + "." + rows.columns[i].name
if tableName := rows.columns[i].tableName; len(tableName) > 0 {
columns[i] = tableName + "." + rows.columns[i].name
} else {
columns[i] = rows.columns[i].name
}
}
} else {
for i := range columns {

View File

@ -52,3 +52,4 @@ Baptiste Fontaine <b@ptistefontaine.fr>
Matt Heath <matt@mattheath.com>
Jamie Cuthill <jamie.cuthill@gmail.com>
Adrian Casajus <adriancasajus@gmail.com>
John Weldon <johnweldon4@gmail.com>

View File

@ -434,6 +434,11 @@ type Query struct {
defaultTimestamp bool
}
// String implements the stringer interface.
func (q Query) String() string {
return fmt.Sprintf("[query statement=%q values=%+v consistency=%s]", q.stmt, q.values, q.cons)
}
//Attempts returns the number of times the query was executed.
func (q *Query) Attempts() int {
return q.attempts

0
Godeps/_workspace/src/github.com/golang/snappy/AUTHORS generated vendored Executable file → Normal file
View File

0
Godeps/_workspace/src/github.com/golang/snappy/CONTRIBUTORS generated vendored Executable file → Normal file
View File

0
Godeps/_workspace/src/github.com/golang/snappy/LICENSE generated vendored Executable file → Normal file
View File

0
Godeps/_workspace/src/github.com/golang/snappy/README generated vendored Executable file → Normal file
View File

0
Godeps/_workspace/src/github.com/golang/snappy/decode.go generated vendored Executable file → Normal file
View File

0
Godeps/_workspace/src/github.com/golang/snappy/encode.go generated vendored Executable file → Normal file
View File

2
Godeps/_workspace/src/github.com/golang/snappy/snappy.go generated vendored Executable file → Normal file
View File

@ -6,7 +6,7 @@
// It aims for very high speeds and reasonable compression.
//
// The C++ snappy implementation is at https://github.com/google/snappy
package snappy // import "github.com/golang/snappy"
package snappy
import (
"hash/crc32"

0
Godeps/_workspace/src/github.com/golang/snappy/snappy_test.go generated vendored Executable file → Normal file
View File

View File

@ -157,7 +157,7 @@ func (s *GistsService) Get(id string) (*Gist, *Response, error) {
return gist, resp, err
}
// Get a specific revision of a gist.
// GetRevision gets a specific revision of a gist.
//
// GitHub API docs: https://developer.github.com/v3/gists/#get-a-specific-revision-of-a-gist
func (s *GistsService) GetRevision(id, sha string) (*Gist, *Response, error) {

Some files were not shown because too many files have changed in this diff Show More