mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-08 22:30:41 +00:00
Update vendored deps, including AWS SDK, openpgp, ftp, ...
This commit is contained in:
+1
-1
@@ -24,7 +24,7 @@ func Build(r *request.Request) {
|
||||
r.Error = awserr.New("SerializationError", "failed encoding EC2 Query request", err)
|
||||
}
|
||||
|
||||
if r.ExpireTime == 0 {
|
||||
if !r.IsPresigned() {
|
||||
r.HTTPRequest.Method = "POST"
|
||||
r.HTTPRequest.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=utf-8")
|
||||
r.SetBufferBody([]byte(body.Encode()))
|
||||
|
||||
+408
-37
@@ -24,7 +24,6 @@ import (
|
||||
"github.com/aws/aws-sdk-go/private/protocol/ec2query"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil"
|
||||
"github.com/aws/aws-sdk-go/private/util"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var _ bytes.Buffer // always import bytes
|
||||
@@ -108,7 +107,7 @@ const opInputService1TestCaseOperation1 = "OperationName"
|
||||
|
||||
// InputService1TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService1TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -261,7 +260,7 @@ const opInputService2TestCaseOperation1 = "OperationName"
|
||||
|
||||
// InputService2TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService2TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -422,7 +421,7 @@ const opInputService3TestCaseOperation1 = "OperationName"
|
||||
|
||||
// InputService3TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService3TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -579,7 +578,7 @@ const opInputService4TestCaseOperation1 = "OperationName"
|
||||
|
||||
// InputService4TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService4TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -648,12 +647,36 @@ func (c *InputService4ProtocolTest) InputService4TestCaseOperation1WithContext(c
|
||||
type InputService4TestShapeInputService4TestCaseOperation1Input struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
ListArg []*string `type:"list"`
|
||||
ListBools []*bool `type:"list"`
|
||||
|
||||
ListFloats []*float64 `type:"list"`
|
||||
|
||||
ListIntegers []*int64 `type:"list"`
|
||||
|
||||
ListStrings []*string `type:"list"`
|
||||
}
|
||||
|
||||
// SetListArg sets the ListArg field's value.
|
||||
func (s *InputService4TestShapeInputService4TestCaseOperation1Input) SetListArg(v []*string) *InputService4TestShapeInputService4TestCaseOperation1Input {
|
||||
s.ListArg = v
|
||||
// SetListBools sets the ListBools field's value.
|
||||
func (s *InputService4TestShapeInputService4TestCaseOperation1Input) SetListBools(v []*bool) *InputService4TestShapeInputService4TestCaseOperation1Input {
|
||||
s.ListBools = v
|
||||
return s
|
||||
}
|
||||
|
||||
// SetListFloats sets the ListFloats field's value.
|
||||
func (s *InputService4TestShapeInputService4TestCaseOperation1Input) SetListFloats(v []*float64) *InputService4TestShapeInputService4TestCaseOperation1Input {
|
||||
s.ListFloats = v
|
||||
return s
|
||||
}
|
||||
|
||||
// SetListIntegers sets the ListIntegers field's value.
|
||||
func (s *InputService4TestShapeInputService4TestCaseOperation1Input) SetListIntegers(v []*int64) *InputService4TestShapeInputService4TestCaseOperation1Input {
|
||||
s.ListIntegers = v
|
||||
return s
|
||||
}
|
||||
|
||||
// SetListStrings sets the ListStrings field's value.
|
||||
func (s *InputService4TestShapeInputService4TestCaseOperation1Input) SetListStrings(v []*string) *InputService4TestShapeInputService4TestCaseOperation1Input {
|
||||
s.ListStrings = v
|
||||
return s
|
||||
}
|
||||
|
||||
@@ -724,7 +747,7 @@ const opInputService5TestCaseOperation1 = "OperationName"
|
||||
|
||||
// InputService5TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService5TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -869,7 +892,7 @@ const opInputService6TestCaseOperation1 = "OperationName"
|
||||
|
||||
// InputService6TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService6TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -1014,7 +1037,7 @@ const opInputService7TestCaseOperation1 = "OperationName"
|
||||
|
||||
// InputService7TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService7TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -1160,7 +1183,7 @@ const opInputService8TestCaseOperation1 = "OperationName"
|
||||
|
||||
// InputService8TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService8TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -1305,7 +1328,7 @@ const opInputService9TestCaseOperation1 = "OperationName"
|
||||
|
||||
// InputService9TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService9TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -1375,7 +1398,7 @@ const opInputService9TestCaseOperation2 = "OperationName"
|
||||
|
||||
// InputService9TestCaseOperation2Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService9TestCaseOperation2 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -1461,6 +1484,241 @@ type InputService9TestShapeInputService9TestCaseOperation2Output struct {
|
||||
_ struct{} `type:"structure"`
|
||||
}
|
||||
|
||||
// InputService10ProtocolTest provides the API operation methods for making requests to
|
||||
// . See this package's package overview docs
|
||||
// for details on the service.
|
||||
//
|
||||
// InputService10ProtocolTest methods are safe to use concurrently. It is not safe to
|
||||
// modify mutate any of the struct's properties though.
|
||||
type InputService10ProtocolTest struct {
|
||||
*client.Client
|
||||
}
|
||||
|
||||
// New creates a new instance of the InputService10ProtocolTest client with a session.
|
||||
// If additional configuration is needed for the client instance use the optional
|
||||
// aws.Config parameter to add your extra config.
|
||||
//
|
||||
// Example:
|
||||
// // Create a InputService10ProtocolTest client from just a session.
|
||||
// svc := inputservice10protocoltest.New(mySession)
|
||||
//
|
||||
// // Create a InputService10ProtocolTest client with additional configuration
|
||||
// svc := inputservice10protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
|
||||
func NewInputService10ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService10ProtocolTest {
|
||||
c := p.ClientConfig("inputservice10protocoltest", cfgs...)
|
||||
return newInputService10ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
|
||||
}
|
||||
|
||||
// newClient creates, initializes and returns a new service client instance.
|
||||
func newInputService10ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService10ProtocolTest {
|
||||
svc := &InputService10ProtocolTest{
|
||||
Client: client.New(
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: "inputservice10protocoltest",
|
||||
SigningName: signingName,
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
APIVersion: "2014-01-01",
|
||||
},
|
||||
handlers,
|
||||
),
|
||||
}
|
||||
|
||||
// Handlers
|
||||
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
|
||||
svc.Handlers.Build.PushBackNamed(ec2query.BuildHandler)
|
||||
svc.Handlers.Unmarshal.PushBackNamed(ec2query.UnmarshalHandler)
|
||||
svc.Handlers.UnmarshalMeta.PushBackNamed(ec2query.UnmarshalMetaHandler)
|
||||
svc.Handlers.UnmarshalError.PushBackNamed(ec2query.UnmarshalErrorHandler)
|
||||
|
||||
return svc
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a InputService10ProtocolTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *InputService10ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
|
||||
req := c.NewRequest(op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
const opInputService10TestCaseOperation1 = "OperationName"
|
||||
|
||||
// InputService10TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService10TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
// the "output" return value is not valid until after Send returns without error.
|
||||
//
|
||||
// See InputService10TestCaseOperation1 for more information on using the InputService10TestCaseOperation1
|
||||
// API call, and error handling.
|
||||
//
|
||||
// This method is useful when you want to inject custom logic or configuration
|
||||
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
|
||||
//
|
||||
//
|
||||
// // Example sending a request using the InputService10TestCaseOperation1Request method.
|
||||
// req, resp := client.InputService10TestCaseOperation1Request(params)
|
||||
//
|
||||
// err := req.Send()
|
||||
// if err == nil { // resp is now filled
|
||||
// fmt.Println(resp)
|
||||
// }
|
||||
func (c *InputService10ProtocolTest) InputService10TestCaseOperation1Request(input *InputService10TestShapeInputService10TestCaseOperation2Input) (req *request.Request, output *InputService10TestShapeInputService10TestCaseOperation1Output) {
|
||||
op := &request.Operation{
|
||||
Name: opInputService10TestCaseOperation1,
|
||||
HTTPPath: "/",
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &InputService10TestShapeInputService10TestCaseOperation2Input{}
|
||||
}
|
||||
|
||||
output = &InputService10TestShapeInputService10TestCaseOperation1Output{}
|
||||
req = c.newRequest(op, input, output)
|
||||
req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler)
|
||||
req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
|
||||
return
|
||||
}
|
||||
|
||||
// InputService10TestCaseOperation1 API operation for .
|
||||
//
|
||||
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
|
||||
// with awserr.Error's Code and Message methods to get detailed information about
|
||||
// the error.
|
||||
//
|
||||
// See the AWS API reference guide for 's
|
||||
// API operation InputService10TestCaseOperation1 for usage and error information.
|
||||
func (c *InputService10ProtocolTest) InputService10TestCaseOperation1(input *InputService10TestShapeInputService10TestCaseOperation2Input) (*InputService10TestShapeInputService10TestCaseOperation1Output, error) {
|
||||
req, out := c.InputService10TestCaseOperation1Request(input)
|
||||
return out, req.Send()
|
||||
}
|
||||
|
||||
// InputService10TestCaseOperation1WithContext is the same as InputService10TestCaseOperation1 with the addition of
|
||||
// the ability to pass a context and additional request options.
|
||||
//
|
||||
// See InputService10TestCaseOperation1 for details on how to use this API operation.
|
||||
//
|
||||
// The context must be non-nil and will be used for request cancellation. If
|
||||
// the context is nil a panic will occur. In the future the SDK may create
|
||||
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
|
||||
// for more information on using Contexts.
|
||||
func (c *InputService10ProtocolTest) InputService10TestCaseOperation1WithContext(ctx aws.Context, input *InputService10TestShapeInputService10TestCaseOperation2Input, opts ...request.Option) (*InputService10TestShapeInputService10TestCaseOperation1Output, error) {
|
||||
req, out := c.InputService10TestCaseOperation1Request(input)
|
||||
req.SetContext(ctx)
|
||||
req.ApplyOptions(opts...)
|
||||
return out, req.Send()
|
||||
}
|
||||
|
||||
const opInputService10TestCaseOperation2 = "OperationName"
|
||||
|
||||
// InputService10TestCaseOperation2Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService10TestCaseOperation2 operation. The "output" return
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
// the "output" return value is not valid until after Send returns without error.
|
||||
//
|
||||
// See InputService10TestCaseOperation2 for more information on using the InputService10TestCaseOperation2
|
||||
// API call, and error handling.
|
||||
//
|
||||
// This method is useful when you want to inject custom logic or configuration
|
||||
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
|
||||
//
|
||||
//
|
||||
// // Example sending a request using the InputService10TestCaseOperation2Request method.
|
||||
// req, resp := client.InputService10TestCaseOperation2Request(params)
|
||||
//
|
||||
// err := req.Send()
|
||||
// if err == nil { // resp is now filled
|
||||
// fmt.Println(resp)
|
||||
// }
|
||||
func (c *InputService10ProtocolTest) InputService10TestCaseOperation2Request(input *InputService10TestShapeInputService10TestCaseOperation2Input) (req *request.Request, output *InputService10TestShapeInputService10TestCaseOperation2Output) {
|
||||
op := &request.Operation{
|
||||
Name: opInputService10TestCaseOperation2,
|
||||
HTTPPath: "/",
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &InputService10TestShapeInputService10TestCaseOperation2Input{}
|
||||
}
|
||||
|
||||
output = &InputService10TestShapeInputService10TestCaseOperation2Output{}
|
||||
req = c.newRequest(op, input, output)
|
||||
req.Handlers.Unmarshal.Remove(ec2query.UnmarshalHandler)
|
||||
req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
|
||||
return
|
||||
}
|
||||
|
||||
// InputService10TestCaseOperation2 API operation for .
|
||||
//
|
||||
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
|
||||
// with awserr.Error's Code and Message methods to get detailed information about
|
||||
// the error.
|
||||
//
|
||||
// See the AWS API reference guide for 's
|
||||
// API operation InputService10TestCaseOperation2 for usage and error information.
|
||||
func (c *InputService10ProtocolTest) InputService10TestCaseOperation2(input *InputService10TestShapeInputService10TestCaseOperation2Input) (*InputService10TestShapeInputService10TestCaseOperation2Output, error) {
|
||||
req, out := c.InputService10TestCaseOperation2Request(input)
|
||||
return out, req.Send()
|
||||
}
|
||||
|
||||
// InputService10TestCaseOperation2WithContext is the same as InputService10TestCaseOperation2 with the addition of
|
||||
// the ability to pass a context and additional request options.
|
||||
//
|
||||
// See InputService10TestCaseOperation2 for details on how to use this API operation.
|
||||
//
|
||||
// The context must be non-nil and will be used for request cancellation. If
|
||||
// the context is nil a panic will occur. In the future the SDK may create
|
||||
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
|
||||
// for more information on using Contexts.
|
||||
func (c *InputService10ProtocolTest) InputService10TestCaseOperation2WithContext(ctx aws.Context, input *InputService10TestShapeInputService10TestCaseOperation2Input, opts ...request.Option) (*InputService10TestShapeInputService10TestCaseOperation2Output, error) {
|
||||
req, out := c.InputService10TestCaseOperation2Request(input)
|
||||
req.SetContext(ctx)
|
||||
req.ApplyOptions(opts...)
|
||||
return out, req.Send()
|
||||
}
|
||||
|
||||
type InputService10TestShapeInputService10TestCaseOperation1Output struct {
|
||||
_ struct{} `type:"structure"`
|
||||
}
|
||||
|
||||
type InputService10TestShapeInputService10TestCaseOperation2Input struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
FooEnum *string `type:"string" enum:"InputService10TestShapeEnumType"`
|
||||
|
||||
ListEnums []*string `type:"list"`
|
||||
}
|
||||
|
||||
// SetFooEnum sets the FooEnum field's value.
|
||||
func (s *InputService10TestShapeInputService10TestCaseOperation2Input) SetFooEnum(v string) *InputService10TestShapeInputService10TestCaseOperation2Input {
|
||||
s.FooEnum = &v
|
||||
return s
|
||||
}
|
||||
|
||||
// SetListEnums sets the ListEnums field's value.
|
||||
func (s *InputService10TestShapeInputService10TestCaseOperation2Input) SetListEnums(v []*string) *InputService10TestShapeInputService10TestCaseOperation2Input {
|
||||
s.ListEnums = v
|
||||
return s
|
||||
}
|
||||
|
||||
type InputService10TestShapeInputService10TestCaseOperation2Output struct {
|
||||
_ struct{} `type:"structure"`
|
||||
}
|
||||
|
||||
const (
|
||||
// EnumTypeFoo is a InputService10TestShapeEnumType enum value
|
||||
EnumTypeFoo = "foo"
|
||||
|
||||
// EnumTypeBar is a InputService10TestShapeEnumType enum value
|
||||
EnumTypeBar = "bar"
|
||||
)
|
||||
|
||||
//
|
||||
// Tests begin here
|
||||
//
|
||||
@@ -1476,10 +1734,14 @@ func TestInputService1ProtocolTestScalarMembersCase1(t *testing.T) {
|
||||
|
||||
// build request
|
||||
ec2query.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
awstesting.AssertQuery(t, `Action=OperationName&Bar=val2&Foo=val1&Version=2014-01-01`, util.Trim(string(body)))
|
||||
|
||||
@@ -1502,10 +1764,14 @@ func TestInputService2ProtocolTestStructureWithLocationNameAndQueryNameAppliedTo
|
||||
|
||||
// build request
|
||||
ec2query.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
awstesting.AssertQuery(t, `Action=OperationName&BarLocationName=val2&Foo=val1&Version=2014-01-01&yuckQueryName=val3`, util.Trim(string(body)))
|
||||
|
||||
@@ -1528,10 +1794,14 @@ func TestInputService3ProtocolTestNestedStructureMembersCase1(t *testing.T) {
|
||||
|
||||
// build request
|
||||
ec2query.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
awstesting.AssertQuery(t, `Action=OperationName&Struct.Scalar=foo&Version=2014-01-01`, util.Trim(string(body)))
|
||||
|
||||
@@ -1545,7 +1815,22 @@ func TestInputService3ProtocolTestNestedStructureMembersCase1(t *testing.T) {
|
||||
func TestInputService4ProtocolTestListTypesCase1(t *testing.T) {
|
||||
svc := NewInputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
|
||||
input := &InputService4TestShapeInputService4TestCaseOperation1Input{
|
||||
ListArg: []*string{
|
||||
ListBools: []*bool{
|
||||
aws.Bool(true),
|
||||
aws.Bool(false),
|
||||
aws.Bool(false),
|
||||
},
|
||||
ListFloats: []*float64{
|
||||
aws.Float64(1.1),
|
||||
aws.Float64(2.718),
|
||||
aws.Float64(3.14),
|
||||
},
|
||||
ListIntegers: []*int64{
|
||||
aws.Int64(0),
|
||||
aws.Int64(1),
|
||||
aws.Int64(2),
|
||||
},
|
||||
ListStrings: []*string{
|
||||
aws.String("foo"),
|
||||
aws.String("bar"),
|
||||
aws.String("baz"),
|
||||
@@ -1556,12 +1841,16 @@ func TestInputService4ProtocolTestListTypesCase1(t *testing.T) {
|
||||
|
||||
// build request
|
||||
ec2query.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
awstesting.AssertQuery(t, `Action=OperationName&ListArg.1=foo&ListArg.2=bar&ListArg.3=baz&Version=2014-01-01`, util.Trim(string(body)))
|
||||
awstesting.AssertQuery(t, `Action=OperationName&ListBools.1=true&ListBools.2=false&ListBools.3=false&ListFloats.1=1.1&ListFloats.2=2.718&ListFloats.3=3.14&ListIntegers.1=0&ListIntegers.2=1&ListIntegers.3=2&ListStrings.1=foo&ListStrings.2=bar&ListStrings.3=baz&Version=2014-01-01`, util.Trim(string(body)))
|
||||
|
||||
// assert URL
|
||||
awstesting.AssertURL(t, "https://test/", r.URL.String())
|
||||
@@ -1584,10 +1873,14 @@ func TestInputService5ProtocolTestListWithLocationNameAppliedToMemberCase1(t *te
|
||||
|
||||
// build request
|
||||
ec2query.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
awstesting.AssertQuery(t, `Action=OperationName&ListMemberName.1=a&ListMemberName.2=b&ListMemberName.3=c&Version=2014-01-01`, util.Trim(string(body)))
|
||||
|
||||
@@ -1612,10 +1905,14 @@ func TestInputService6ProtocolTestListWithLocationNameAndQueryNameCase1(t *testi
|
||||
|
||||
// build request
|
||||
ec2query.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
awstesting.AssertQuery(t, `Action=OperationName&ListQueryName.1=a&ListQueryName.2=b&ListQueryName.3=c&Version=2014-01-01`, util.Trim(string(body)))
|
||||
|
||||
@@ -1636,10 +1933,14 @@ func TestInputService7ProtocolTestBase64EncodedBlobsCase1(t *testing.T) {
|
||||
|
||||
// build request
|
||||
ec2query.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
awstesting.AssertQuery(t, `Action=OperationName&BlobArg=Zm9v&Version=2014-01-01`, util.Trim(string(body)))
|
||||
|
||||
@@ -1660,10 +1961,14 @@ func TestInputService8ProtocolTestTimestampValuesCase1(t *testing.T) {
|
||||
|
||||
// build request
|
||||
ec2query.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
awstesting.AssertQuery(t, `Action=OperationName&TimeArg=2015-01-25T08%3A00%3A00Z&Version=2014-01-01`, util.Trim(string(body)))
|
||||
|
||||
@@ -1684,10 +1989,14 @@ func TestInputService9ProtocolTestIdempotencyTokenAutoFillCase1(t *testing.T) {
|
||||
|
||||
// build request
|
||||
ec2query.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
awstesting.AssertQuery(t, `Action=OperationName&Token=abc123&Version=2014-01-01`, util.Trim(string(body)))
|
||||
|
||||
@@ -1706,10 +2015,14 @@ func TestInputService9ProtocolTestIdempotencyTokenAutoFillCase2(t *testing.T) {
|
||||
|
||||
// build request
|
||||
ec2query.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
awstesting.AssertQuery(t, `Action=OperationName&Token=00000000-0000-4000-8000-000000000000&Version=2014-01-01`, util.Trim(string(body)))
|
||||
|
||||
@@ -1719,3 +2032,61 @@ func TestInputService9ProtocolTestIdempotencyTokenAutoFillCase2(t *testing.T) {
|
||||
// assert headers
|
||||
|
||||
}
|
||||
|
||||
func TestInputService10ProtocolTestEnumCase1(t *testing.T) {
|
||||
svc := NewInputService10ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
|
||||
input := &InputService10TestShapeInputService10TestCaseOperation2Input{
|
||||
ListEnums: []*string{
|
||||
aws.String("foo"),
|
||||
aws.String(""),
|
||||
aws.String("bar"),
|
||||
},
|
||||
}
|
||||
req, _ := svc.InputService10TestCaseOperation1Request(input)
|
||||
r := req.HTTPRequest
|
||||
|
||||
// build request
|
||||
ec2query.Build(req)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert body
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
awstesting.AssertQuery(t, `Action=OperationName&ListEnums.1=foo&ListEnums.2=&ListEnums.3=bar&Version=2014-01-01`, util.Trim(string(body)))
|
||||
|
||||
// assert URL
|
||||
awstesting.AssertURL(t, "https://test/", r.URL.String())
|
||||
|
||||
// assert headers
|
||||
|
||||
}
|
||||
|
||||
func TestInputService10ProtocolTestEnumCase2(t *testing.T) {
|
||||
svc := NewInputService10ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
|
||||
input := &InputService10TestShapeInputService10TestCaseOperation2Input{}
|
||||
req, _ := svc.InputService10TestCaseOperation2Request(input)
|
||||
r := req.HTTPRequest
|
||||
|
||||
// build request
|
||||
ec2query.Build(req)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert body
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
awstesting.AssertQuery(t, `Action=OperationName&Version=2014-01-01`, util.Trim(string(body)))
|
||||
|
||||
// assert URL
|
||||
awstesting.AssertURL(t, "https://test/", r.URL.String())
|
||||
|
||||
// assert headers
|
||||
|
||||
}
|
||||
|
||||
+320
-50
@@ -24,7 +24,6 @@ import (
|
||||
"github.com/aws/aws-sdk-go/private/protocol/ec2query"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil"
|
||||
"github.com/aws/aws-sdk-go/private/util"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var _ bytes.Buffer // always import bytes
|
||||
@@ -108,7 +107,7 @@ const opOutputService1TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService1TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService1TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -307,7 +306,7 @@ const opOutputService2TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService2TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService2TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -451,7 +450,7 @@ const opOutputService3TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService3TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService3TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -594,7 +593,7 @@ const opOutputService4TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService4TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService4TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -737,7 +736,7 @@ const opOutputService5TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService5TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService5TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -880,7 +879,7 @@ const opOutputService6TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService6TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService6TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -1035,7 +1034,7 @@ const opOutputService7TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService7TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService7TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -1178,7 +1177,7 @@ const opOutputService8TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService8TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService8TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -1321,7 +1320,7 @@ const opOutputService9TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService9TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService9TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -1401,6 +1400,165 @@ func (s *OutputService9TestShapeOutputService9TestCaseOperation1Output) SetFoo(v
|
||||
return s
|
||||
}
|
||||
|
||||
// OutputService10ProtocolTest provides the API operation methods for making requests to
|
||||
// . See this package's package overview docs
|
||||
// for details on the service.
|
||||
//
|
||||
// OutputService10ProtocolTest methods are safe to use concurrently. It is not safe to
|
||||
// modify mutate any of the struct's properties though.
|
||||
type OutputService10ProtocolTest struct {
|
||||
*client.Client
|
||||
}
|
||||
|
||||
// New creates a new instance of the OutputService10ProtocolTest client with a session.
|
||||
// If additional configuration is needed for the client instance use the optional
|
||||
// aws.Config parameter to add your extra config.
|
||||
//
|
||||
// Example:
|
||||
// // Create a OutputService10ProtocolTest client from just a session.
|
||||
// svc := outputservice10protocoltest.New(mySession)
|
||||
//
|
||||
// // Create a OutputService10ProtocolTest client with additional configuration
|
||||
// svc := outputservice10protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
|
||||
func NewOutputService10ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService10ProtocolTest {
|
||||
c := p.ClientConfig("outputservice10protocoltest", cfgs...)
|
||||
return newOutputService10ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
|
||||
}
|
||||
|
||||
// newClient creates, initializes and returns a new service client instance.
|
||||
func newOutputService10ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService10ProtocolTest {
|
||||
svc := &OutputService10ProtocolTest{
|
||||
Client: client.New(
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: "outputservice10protocoltest",
|
||||
SigningName: signingName,
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
APIVersion: "",
|
||||
},
|
||||
handlers,
|
||||
),
|
||||
}
|
||||
|
||||
// Handlers
|
||||
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
|
||||
svc.Handlers.Build.PushBackNamed(ec2query.BuildHandler)
|
||||
svc.Handlers.Unmarshal.PushBackNamed(ec2query.UnmarshalHandler)
|
||||
svc.Handlers.UnmarshalMeta.PushBackNamed(ec2query.UnmarshalMetaHandler)
|
||||
svc.Handlers.UnmarshalError.PushBackNamed(ec2query.UnmarshalErrorHandler)
|
||||
|
||||
return svc
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a OutputService10ProtocolTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *OutputService10ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
|
||||
req := c.NewRequest(op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
const opOutputService10TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService10TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService10TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
// the "output" return value is not valid until after Send returns without error.
|
||||
//
|
||||
// See OutputService10TestCaseOperation1 for more information on using the OutputService10TestCaseOperation1
|
||||
// API call, and error handling.
|
||||
//
|
||||
// This method is useful when you want to inject custom logic or configuration
|
||||
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
|
||||
//
|
||||
//
|
||||
// // Example sending a request using the OutputService10TestCaseOperation1Request method.
|
||||
// req, resp := client.OutputService10TestCaseOperation1Request(params)
|
||||
//
|
||||
// err := req.Send()
|
||||
// if err == nil { // resp is now filled
|
||||
// fmt.Println(resp)
|
||||
// }
|
||||
func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1Request(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (req *request.Request, output *OutputService10TestShapeOutputService10TestCaseOperation1Output) {
|
||||
op := &request.Operation{
|
||||
Name: opOutputService10TestCaseOperation1,
|
||||
HTTPPath: "/",
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &OutputService10TestShapeOutputService10TestCaseOperation1Input{}
|
||||
}
|
||||
|
||||
output = &OutputService10TestShapeOutputService10TestCaseOperation1Output{}
|
||||
req = c.newRequest(op, input, output)
|
||||
return
|
||||
}
|
||||
|
||||
// OutputService10TestCaseOperation1 API operation for .
|
||||
//
|
||||
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
|
||||
// with awserr.Error's Code and Message methods to get detailed information about
|
||||
// the error.
|
||||
//
|
||||
// See the AWS API reference guide for 's
|
||||
// API operation OutputService10TestCaseOperation1 for usage and error information.
|
||||
func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1(input *OutputService10TestShapeOutputService10TestCaseOperation1Input) (*OutputService10TestShapeOutputService10TestCaseOperation1Output, error) {
|
||||
req, out := c.OutputService10TestCaseOperation1Request(input)
|
||||
return out, req.Send()
|
||||
}
|
||||
|
||||
// OutputService10TestCaseOperation1WithContext is the same as OutputService10TestCaseOperation1 with the addition of
|
||||
// the ability to pass a context and additional request options.
|
||||
//
|
||||
// See OutputService10TestCaseOperation1 for details on how to use this API operation.
|
||||
//
|
||||
// The context must be non-nil and will be used for request cancellation. If
|
||||
// the context is nil a panic will occur. In the future the SDK may create
|
||||
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
|
||||
// for more information on using Contexts.
|
||||
func (c *OutputService10ProtocolTest) OutputService10TestCaseOperation1WithContext(ctx aws.Context, input *OutputService10TestShapeOutputService10TestCaseOperation1Input, opts ...request.Option) (*OutputService10TestShapeOutputService10TestCaseOperation1Output, error) {
|
||||
req, out := c.OutputService10TestCaseOperation1Request(input)
|
||||
req.SetContext(ctx)
|
||||
req.ApplyOptions(opts...)
|
||||
return out, req.Send()
|
||||
}
|
||||
|
||||
type OutputService10TestShapeOutputService10TestCaseOperation1Input struct {
|
||||
_ struct{} `type:"structure"`
|
||||
}
|
||||
|
||||
type OutputService10TestShapeOutputService10TestCaseOperation1Output struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
FooEnum *string `type:"string" enum:"OutputService10TestShapeEC2EnumType"`
|
||||
|
||||
ListEnums []*string `type:"list"`
|
||||
}
|
||||
|
||||
// SetFooEnum sets the FooEnum field's value.
|
||||
func (s *OutputService10TestShapeOutputService10TestCaseOperation1Output) SetFooEnum(v string) *OutputService10TestShapeOutputService10TestCaseOperation1Output {
|
||||
s.FooEnum = &v
|
||||
return s
|
||||
}
|
||||
|
||||
// SetListEnums sets the ListEnums field's value.
|
||||
func (s *OutputService10TestShapeOutputService10TestCaseOperation1Output) SetListEnums(v []*string) *OutputService10TestShapeOutputService10TestCaseOperation1Output {
|
||||
s.ListEnums = v
|
||||
return s
|
||||
}
|
||||
|
||||
const (
|
||||
// EC2EnumTypeFoo is a OutputService10TestShapeEC2EnumType enum value
|
||||
EC2EnumTypeFoo = "foo"
|
||||
|
||||
// EC2EnumTypeBar is a OutputService10TestShapeEC2EnumType enum value
|
||||
EC2EnumTypeBar = "bar"
|
||||
)
|
||||
|
||||
//
|
||||
// Tests begin here
|
||||
//
|
||||
@@ -1417,18 +1575,38 @@ func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) {
|
||||
// unmarshal response
|
||||
ec2query.UnmarshalMeta(req)
|
||||
ec2query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "a", *out.Char)
|
||||
assert.Equal(t, 1.3, *out.Double)
|
||||
assert.Equal(t, false, *out.FalseBool)
|
||||
assert.Equal(t, 1.2, *out.Float)
|
||||
assert.Equal(t, int64(200), *out.Long)
|
||||
assert.Equal(t, int64(123), *out.Num)
|
||||
assert.Equal(t, "myname", *out.Str)
|
||||
assert.Equal(t, true, *out.TrueBool)
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "a", *out.Char; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := 1.3, *out.Double; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := false, *out.FalseBool; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := 1.2, *out.Float; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := int64(200), *out.Long; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := int64(123), *out.Num; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "myname", *out.Str; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := true, *out.TrueBool; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1444,11 +1622,17 @@ func TestOutputService2ProtocolTestBlobCase1(t *testing.T) {
|
||||
// unmarshal response
|
||||
ec2query.UnmarshalMeta(req)
|
||||
ec2query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "value", string(out.Blob))
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "value", string(out.Blob); e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1464,12 +1648,20 @@ func TestOutputService3ProtocolTestListsCase1(t *testing.T) {
|
||||
// unmarshal response
|
||||
ec2query.UnmarshalMeta(req)
|
||||
ec2query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "abc", *out.ListMember[0])
|
||||
assert.Equal(t, "123", *out.ListMember[1])
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "abc", *out.ListMember[0]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "123", *out.ListMember[1]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1485,12 +1677,20 @@ func TestOutputService4ProtocolTestListWithCustomMemberNameCase1(t *testing.T) {
|
||||
// unmarshal response
|
||||
ec2query.UnmarshalMeta(req)
|
||||
ec2query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "abc", *out.ListMember[0])
|
||||
assert.Equal(t, "123", *out.ListMember[1])
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "abc", *out.ListMember[0]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "123", *out.ListMember[1]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1506,12 +1706,20 @@ func TestOutputService5ProtocolTestFlattenedListCase1(t *testing.T) {
|
||||
// unmarshal response
|
||||
ec2query.UnmarshalMeta(req)
|
||||
ec2query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "abc", *out.ListMember[0])
|
||||
assert.Equal(t, "123", *out.ListMember[1])
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "abc", *out.ListMember[0]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "123", *out.ListMember[1]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1527,12 +1735,20 @@ func TestOutputService6ProtocolTestNormalMapCase1(t *testing.T) {
|
||||
// unmarshal response
|
||||
ec2query.UnmarshalMeta(req)
|
||||
ec2query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "bam", *out.Map["baz"].Foo)
|
||||
assert.Equal(t, "bar", *out.Map["qux"].Foo)
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "bam", *out.Map["baz"].Foo; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "bar", *out.Map["qux"].Foo; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1548,12 +1764,20 @@ func TestOutputService7ProtocolTestFlattenedMapCase1(t *testing.T) {
|
||||
// unmarshal response
|
||||
ec2query.UnmarshalMeta(req)
|
||||
ec2query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "bam", *out.Map["baz"])
|
||||
assert.Equal(t, "bar", *out.Map["qux"])
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "bam", *out.Map["baz"]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "bar", *out.Map["qux"]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1569,12 +1793,20 @@ func TestOutputService8ProtocolTestNamedMapCase1(t *testing.T) {
|
||||
// unmarshal response
|
||||
ec2query.UnmarshalMeta(req)
|
||||
ec2query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "bam", *out.Map["baz"])
|
||||
assert.Equal(t, "bar", *out.Map["qux"])
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "bam", *out.Map["baz"]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "bar", *out.Map["qux"]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1590,10 +1822,48 @@ func TestOutputService9ProtocolTestEmptyStringCase1(t *testing.T) {
|
||||
// unmarshal response
|
||||
ec2query.UnmarshalMeta(req)
|
||||
ec2query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "", *out.Foo)
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "", *out.Foo; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestOutputService10ProtocolTestEnumOutputCase1(t *testing.T) {
|
||||
svc := NewOutputService10ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
|
||||
|
||||
buf := bytes.NewReader([]byte("<OperationNameResponse><FooEnum>foo</FooEnum><ListEnums><member>foo</member><member>bar</member></ListEnums></OperationNameResponse>"))
|
||||
req, out := svc.OutputService10TestCaseOperation1Request(nil)
|
||||
req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
|
||||
|
||||
// set headers
|
||||
|
||||
// unmarshal response
|
||||
ec2query.UnmarshalMeta(req)
|
||||
ec2query.Unmarshal(req)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "foo", *out.FooEnum; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "foo", *out.ListEnums[0]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "bar", *out.ListEnums[1]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+14
-7
@@ -12,6 +12,7 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/private/protocol"
|
||||
)
|
||||
|
||||
@@ -49,7 +50,10 @@ func buildAny(value reflect.Value, buf *bytes.Buffer, tag reflect.StructTag) err
|
||||
t = "list"
|
||||
}
|
||||
case reflect.Map:
|
||||
t = "map"
|
||||
// cannot be a JSONValue map
|
||||
if _, ok := value.Interface().(aws.JSONValue); !ok {
|
||||
t = "map"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,14 +214,11 @@ func buildScalar(v reflect.Value, buf *bytes.Buffer, tag reflect.StructTag) erro
|
||||
}
|
||||
buf.Write(strconv.AppendFloat(scratch[:0], f, 'f', -1, 64))
|
||||
default:
|
||||
switch value.Type() {
|
||||
case timeType:
|
||||
converted := v.Interface().(*time.Time)
|
||||
|
||||
switch converted := value.Interface().(type) {
|
||||
case time.Time:
|
||||
buf.Write(strconv.AppendInt(scratch[:0], converted.UTC().Unix(), 10))
|
||||
case byteSliceType:
|
||||
case []byte:
|
||||
if !value.IsNil() {
|
||||
converted := value.Interface().([]byte)
|
||||
buf.WriteByte('"')
|
||||
if len(converted) < 1024 {
|
||||
// for small buffers, using Encode directly is much faster.
|
||||
@@ -233,6 +234,12 @@ func buildScalar(v reflect.Value, buf *bytes.Buffer, tag reflect.StructTag) erro
|
||||
}
|
||||
buf.WriteByte('"')
|
||||
}
|
||||
case aws.JSONValue:
|
||||
str, err := protocol.EncodeJSONValue(converted, protocol.QuotedEscape)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to encode JSONValue, %v", err)
|
||||
}
|
||||
buf.WriteString(str)
|
||||
default:
|
||||
return fmt.Errorf("unsupported JSON value %v (%s)", value.Interface(), value.Type())
|
||||
}
|
||||
|
||||
+14
-1
@@ -8,6 +8,9 @@ import (
|
||||
"io/ioutil"
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/private/protocol"
|
||||
)
|
||||
|
||||
// UnmarshalJSON reads a stream and unmarshals the results in object v.
|
||||
@@ -50,7 +53,10 @@ func unmarshalAny(value reflect.Value, data interface{}, tag reflect.StructTag)
|
||||
t = "list"
|
||||
}
|
||||
case reflect.Map:
|
||||
t = "map"
|
||||
// cannot be a JSONValue map
|
||||
if _, ok := value.Interface().(aws.JSONValue); !ok {
|
||||
t = "map"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,6 +189,13 @@ func unmarshalScalar(value reflect.Value, data interface{}, tag reflect.StructTa
|
||||
return err
|
||||
}
|
||||
value.Set(reflect.ValueOf(b))
|
||||
case aws.JSONValue:
|
||||
// No need to use escaping as the value is a non-quoted string.
|
||||
v, err := protocol.DecodeJSONValue(d, protocol.NoEscape)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
value.Set(reflect.ValueOf(v))
|
||||
default:
|
||||
return errf()
|
||||
}
|
||||
|
||||
+459
-67
@@ -24,7 +24,6 @@ import (
|
||||
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil"
|
||||
"github.com/aws/aws-sdk-go/private/util"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var _ bytes.Buffer // always import bytes
|
||||
@@ -110,7 +109,7 @@ const opInputService1TestCaseOperation1 = "OperationName"
|
||||
|
||||
// InputService1TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService1TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -258,7 +257,7 @@ const opInputService2TestCaseOperation1 = "OperationName"
|
||||
|
||||
// InputService2TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService2TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -405,7 +404,7 @@ const opInputService3TestCaseOperation1 = "OperationName"
|
||||
|
||||
// InputService3TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService3TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -475,7 +474,7 @@ const opInputService3TestCaseOperation2 = "OperationName"
|
||||
|
||||
// InputService3TestCaseOperation2Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService3TestCaseOperation2 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -635,7 +634,7 @@ const opInputService4TestCaseOperation1 = "OperationName"
|
||||
|
||||
// InputService4TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService4TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -783,7 +782,7 @@ const opInputService5TestCaseOperation1 = "OperationName"
|
||||
|
||||
// InputService5TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService5TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -853,7 +852,7 @@ const opInputService5TestCaseOperation2 = "OperationName"
|
||||
|
||||
// InputService5TestCaseOperation2Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService5TestCaseOperation2 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -923,7 +922,7 @@ const opInputService5TestCaseOperation3 = "OperationName"
|
||||
|
||||
// InputService5TestCaseOperation3Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService5TestCaseOperation3 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -993,7 +992,7 @@ const opInputService5TestCaseOperation4 = "OperationName"
|
||||
|
||||
// InputService5TestCaseOperation4Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService5TestCaseOperation4 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -1063,7 +1062,7 @@ const opInputService5TestCaseOperation5 = "OperationName"
|
||||
|
||||
// InputService5TestCaseOperation5Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService5TestCaseOperation5 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -1133,7 +1132,7 @@ const opInputService5TestCaseOperation6 = "OperationName"
|
||||
|
||||
// InputService5TestCaseOperation6Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService5TestCaseOperation6 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -1336,7 +1335,7 @@ const opInputService6TestCaseOperation1 = "OperationName"
|
||||
|
||||
// InputService6TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService6TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -1482,7 +1481,7 @@ const opInputService7TestCaseOperation1 = "OperationName"
|
||||
|
||||
// InputService7TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService7TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -1553,7 +1552,7 @@ const opInputService7TestCaseOperation2 = "OperationName"
|
||||
|
||||
// InputService7TestCaseOperation2Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService7TestCaseOperation2 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -1640,6 +1639,243 @@ type InputService7TestShapeInputService7TestCaseOperation2Output struct {
|
||||
_ struct{} `type:"structure"`
|
||||
}
|
||||
|
||||
// InputService8ProtocolTest provides the API operation methods for making requests to
|
||||
// . See this package's package overview docs
|
||||
// for details on the service.
|
||||
//
|
||||
// InputService8ProtocolTest methods are safe to use concurrently. It is not safe to
|
||||
// modify mutate any of the struct's properties though.
|
||||
type InputService8ProtocolTest struct {
|
||||
*client.Client
|
||||
}
|
||||
|
||||
// New creates a new instance of the InputService8ProtocolTest client with a session.
|
||||
// If additional configuration is needed for the client instance use the optional
|
||||
// aws.Config parameter to add your extra config.
|
||||
//
|
||||
// Example:
|
||||
// // Create a InputService8ProtocolTest client from just a session.
|
||||
// svc := inputservice8protocoltest.New(mySession)
|
||||
//
|
||||
// // Create a InputService8ProtocolTest client with additional configuration
|
||||
// svc := inputservice8protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
|
||||
func NewInputService8ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService8ProtocolTest {
|
||||
c := p.ClientConfig("inputservice8protocoltest", cfgs...)
|
||||
return newInputService8ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
|
||||
}
|
||||
|
||||
// newClient creates, initializes and returns a new service client instance.
|
||||
func newInputService8ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService8ProtocolTest {
|
||||
svc := &InputService8ProtocolTest{
|
||||
Client: client.New(
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: "inputservice8protocoltest",
|
||||
SigningName: signingName,
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
APIVersion: "2014-01-01",
|
||||
},
|
||||
handlers,
|
||||
),
|
||||
}
|
||||
|
||||
// Handlers
|
||||
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
|
||||
svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
|
||||
svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
|
||||
svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
|
||||
svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
|
||||
|
||||
return svc
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a InputService8ProtocolTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *InputService8ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
|
||||
req := c.NewRequest(op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
const opInputService8TestCaseOperation1 = "OperationName"
|
||||
|
||||
// InputService8TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService8TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
// the "output" return value is not valid until after Send returns without error.
|
||||
//
|
||||
// See InputService8TestCaseOperation1 for more information on using the InputService8TestCaseOperation1
|
||||
// API call, and error handling.
|
||||
//
|
||||
// This method is useful when you want to inject custom logic or configuration
|
||||
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
|
||||
//
|
||||
//
|
||||
// // Example sending a request using the InputService8TestCaseOperation1Request method.
|
||||
// req, resp := client.InputService8TestCaseOperation1Request(params)
|
||||
//
|
||||
// err := req.Send()
|
||||
// if err == nil { // resp is now filled
|
||||
// fmt.Println(resp)
|
||||
// }
|
||||
func (c *InputService8ProtocolTest) InputService8TestCaseOperation1Request(input *InputService8TestShapeInputService8TestCaseOperation2Input) (req *request.Request, output *InputService8TestShapeInputService8TestCaseOperation1Output) {
|
||||
op := &request.Operation{
|
||||
Name: opInputService8TestCaseOperation1,
|
||||
HTTPMethod: "POST",
|
||||
HTTPPath: "/",
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &InputService8TestShapeInputService8TestCaseOperation2Input{}
|
||||
}
|
||||
|
||||
output = &InputService8TestShapeInputService8TestCaseOperation1Output{}
|
||||
req = c.newRequest(op, input, output)
|
||||
req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler)
|
||||
req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
|
||||
return
|
||||
}
|
||||
|
||||
// InputService8TestCaseOperation1 API operation for .
|
||||
//
|
||||
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
|
||||
// with awserr.Error's Code and Message methods to get detailed information about
|
||||
// the error.
|
||||
//
|
||||
// See the AWS API reference guide for 's
|
||||
// API operation InputService8TestCaseOperation1 for usage and error information.
|
||||
func (c *InputService8ProtocolTest) InputService8TestCaseOperation1(input *InputService8TestShapeInputService8TestCaseOperation2Input) (*InputService8TestShapeInputService8TestCaseOperation1Output, error) {
|
||||
req, out := c.InputService8TestCaseOperation1Request(input)
|
||||
return out, req.Send()
|
||||
}
|
||||
|
||||
// InputService8TestCaseOperation1WithContext is the same as InputService8TestCaseOperation1 with the addition of
|
||||
// the ability to pass a context and additional request options.
|
||||
//
|
||||
// See InputService8TestCaseOperation1 for details on how to use this API operation.
|
||||
//
|
||||
// The context must be non-nil and will be used for request cancellation. If
|
||||
// the context is nil a panic will occur. In the future the SDK may create
|
||||
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
|
||||
// for more information on using Contexts.
|
||||
func (c *InputService8ProtocolTest) InputService8TestCaseOperation1WithContext(ctx aws.Context, input *InputService8TestShapeInputService8TestCaseOperation2Input, opts ...request.Option) (*InputService8TestShapeInputService8TestCaseOperation1Output, error) {
|
||||
req, out := c.InputService8TestCaseOperation1Request(input)
|
||||
req.SetContext(ctx)
|
||||
req.ApplyOptions(opts...)
|
||||
return out, req.Send()
|
||||
}
|
||||
|
||||
const opInputService8TestCaseOperation2 = "OperationName"
|
||||
|
||||
// InputService8TestCaseOperation2Request generates a "aws/request.Request" representing the
|
||||
// client's request for the InputService8TestCaseOperation2 operation. The "output" return
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
// the "output" return value is not valid until after Send returns without error.
|
||||
//
|
||||
// See InputService8TestCaseOperation2 for more information on using the InputService8TestCaseOperation2
|
||||
// API call, and error handling.
|
||||
//
|
||||
// This method is useful when you want to inject custom logic or configuration
|
||||
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
|
||||
//
|
||||
//
|
||||
// // Example sending a request using the InputService8TestCaseOperation2Request method.
|
||||
// req, resp := client.InputService8TestCaseOperation2Request(params)
|
||||
//
|
||||
// err := req.Send()
|
||||
// if err == nil { // resp is now filled
|
||||
// fmt.Println(resp)
|
||||
// }
|
||||
func (c *InputService8ProtocolTest) InputService8TestCaseOperation2Request(input *InputService8TestShapeInputService8TestCaseOperation2Input) (req *request.Request, output *InputService8TestShapeInputService8TestCaseOperation2Output) {
|
||||
op := &request.Operation{
|
||||
Name: opInputService8TestCaseOperation2,
|
||||
HTTPMethod: "POST",
|
||||
HTTPPath: "/",
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &InputService8TestShapeInputService8TestCaseOperation2Input{}
|
||||
}
|
||||
|
||||
output = &InputService8TestShapeInputService8TestCaseOperation2Output{}
|
||||
req = c.newRequest(op, input, output)
|
||||
req.Handlers.Unmarshal.Remove(jsonrpc.UnmarshalHandler)
|
||||
req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler)
|
||||
return
|
||||
}
|
||||
|
||||
// InputService8TestCaseOperation2 API operation for .
|
||||
//
|
||||
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
|
||||
// with awserr.Error's Code and Message methods to get detailed information about
|
||||
// the error.
|
||||
//
|
||||
// See the AWS API reference guide for 's
|
||||
// API operation InputService8TestCaseOperation2 for usage and error information.
|
||||
func (c *InputService8ProtocolTest) InputService8TestCaseOperation2(input *InputService8TestShapeInputService8TestCaseOperation2Input) (*InputService8TestShapeInputService8TestCaseOperation2Output, error) {
|
||||
req, out := c.InputService8TestCaseOperation2Request(input)
|
||||
return out, req.Send()
|
||||
}
|
||||
|
||||
// InputService8TestCaseOperation2WithContext is the same as InputService8TestCaseOperation2 with the addition of
|
||||
// the ability to pass a context and additional request options.
|
||||
//
|
||||
// See InputService8TestCaseOperation2 for details on how to use this API operation.
|
||||
//
|
||||
// The context must be non-nil and will be used for request cancellation. If
|
||||
// the context is nil a panic will occur. In the future the SDK may create
|
||||
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
|
||||
// for more information on using Contexts.
|
||||
func (c *InputService8ProtocolTest) InputService8TestCaseOperation2WithContext(ctx aws.Context, input *InputService8TestShapeInputService8TestCaseOperation2Input, opts ...request.Option) (*InputService8TestShapeInputService8TestCaseOperation2Output, error) {
|
||||
req, out := c.InputService8TestCaseOperation2Request(input)
|
||||
req.SetContext(ctx)
|
||||
req.ApplyOptions(opts...)
|
||||
return out, req.Send()
|
||||
}
|
||||
|
||||
type InputService8TestShapeInputService8TestCaseOperation1Output struct {
|
||||
_ struct{} `type:"structure"`
|
||||
}
|
||||
|
||||
type InputService8TestShapeInputService8TestCaseOperation2Input struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
FooEnum *string `type:"string" enum:"InputService8TestShapeEnumType"`
|
||||
|
||||
ListEnums []*string `type:"list"`
|
||||
}
|
||||
|
||||
// SetFooEnum sets the FooEnum field's value.
|
||||
func (s *InputService8TestShapeInputService8TestCaseOperation2Input) SetFooEnum(v string) *InputService8TestShapeInputService8TestCaseOperation2Input {
|
||||
s.FooEnum = &v
|
||||
return s
|
||||
}
|
||||
|
||||
// SetListEnums sets the ListEnums field's value.
|
||||
func (s *InputService8TestShapeInputService8TestCaseOperation2Input) SetListEnums(v []*string) *InputService8TestShapeInputService8TestCaseOperation2Input {
|
||||
s.ListEnums = v
|
||||
return s
|
||||
}
|
||||
|
||||
type InputService8TestShapeInputService8TestCaseOperation2Output struct {
|
||||
_ struct{} `type:"structure"`
|
||||
}
|
||||
|
||||
const (
|
||||
// EnumTypeFoo is a InputService8TestShapeEnumType enum value
|
||||
EnumTypeFoo = "foo"
|
||||
|
||||
// EnumTypeBar is a InputService8TestShapeEnumType enum value
|
||||
EnumTypeBar = "bar"
|
||||
)
|
||||
|
||||
//
|
||||
// Tests begin here
|
||||
//
|
||||
@@ -1654,10 +1890,14 @@ func TestInputService1ProtocolTestScalarMembersCase1(t *testing.T) {
|
||||
|
||||
// build request
|
||||
jsonrpc.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
awstesting.AssertJSON(t, `{"Name":"myname"}`, util.Trim(string(body)))
|
||||
|
||||
@@ -1665,8 +1905,12 @@ func TestInputService1ProtocolTestScalarMembersCase1(t *testing.T) {
|
||||
awstesting.AssertURL(t, "https://test/", r.URL.String())
|
||||
|
||||
// assert headers
|
||||
assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type"))
|
||||
assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"))
|
||||
if e, a := "application/x-amz-json-1.1", r.Header.Get("Content-Type"); e != a {
|
||||
t.Errorf("expect %v to be %v", e, a)
|
||||
}
|
||||
if e, a := "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"); e != a {
|
||||
t.Errorf("expect %v to be %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1680,10 +1924,14 @@ func TestInputService2ProtocolTestTimestampValuesCase1(t *testing.T) {
|
||||
|
||||
// build request
|
||||
jsonrpc.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
awstesting.AssertJSON(t, `{"TimeArg":1422172800}`, util.Trim(string(body)))
|
||||
|
||||
@@ -1691,8 +1939,12 @@ func TestInputService2ProtocolTestTimestampValuesCase1(t *testing.T) {
|
||||
awstesting.AssertURL(t, "https://test/", r.URL.String())
|
||||
|
||||
// assert headers
|
||||
assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type"))
|
||||
assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"))
|
||||
if e, a := "application/x-amz-json-1.1", r.Header.Get("Content-Type"); e != a {
|
||||
t.Errorf("expect %v to be %v", e, a)
|
||||
}
|
||||
if e, a := "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"); e != a {
|
||||
t.Errorf("expect %v to be %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1706,10 +1958,14 @@ func TestInputService3ProtocolTestBase64EncodedBlobsCase1(t *testing.T) {
|
||||
|
||||
// build request
|
||||
jsonrpc.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
awstesting.AssertJSON(t, `{"BlobArg":"Zm9v"}`, util.Trim(string(body)))
|
||||
|
||||
@@ -1717,8 +1973,12 @@ func TestInputService3ProtocolTestBase64EncodedBlobsCase1(t *testing.T) {
|
||||
awstesting.AssertURL(t, "https://test/", r.URL.String())
|
||||
|
||||
// assert headers
|
||||
assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type"))
|
||||
assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"))
|
||||
if e, a := "application/x-amz-json-1.1", r.Header.Get("Content-Type"); e != a {
|
||||
t.Errorf("expect %v to be %v", e, a)
|
||||
}
|
||||
if e, a := "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"); e != a {
|
||||
t.Errorf("expect %v to be %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1735,10 +1995,14 @@ func TestInputService3ProtocolTestBase64EncodedBlobsCase2(t *testing.T) {
|
||||
|
||||
// build request
|
||||
jsonrpc.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
awstesting.AssertJSON(t, `{"BlobMap":{"key1":"Zm9v","key2":"YmFy"}}`, util.Trim(string(body)))
|
||||
|
||||
@@ -1746,8 +2010,12 @@ func TestInputService3ProtocolTestBase64EncodedBlobsCase2(t *testing.T) {
|
||||
awstesting.AssertURL(t, "https://test/", r.URL.String())
|
||||
|
||||
// assert headers
|
||||
assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type"))
|
||||
assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"))
|
||||
if e, a := "application/x-amz-json-1.1", r.Header.Get("Content-Type"); e != a {
|
||||
t.Errorf("expect %v to be %v", e, a)
|
||||
}
|
||||
if e, a := "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"); e != a {
|
||||
t.Errorf("expect %v to be %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1764,10 +2032,14 @@ func TestInputService4ProtocolTestNestedBlobsCase1(t *testing.T) {
|
||||
|
||||
// build request
|
||||
jsonrpc.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
awstesting.AssertJSON(t, `{"ListParam":["Zm9v","YmFy"]}`, util.Trim(string(body)))
|
||||
|
||||
@@ -1775,8 +2047,12 @@ func TestInputService4ProtocolTestNestedBlobsCase1(t *testing.T) {
|
||||
awstesting.AssertURL(t, "https://test/", r.URL.String())
|
||||
|
||||
// assert headers
|
||||
assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type"))
|
||||
assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"))
|
||||
if e, a := "application/x-amz-json-1.1", r.Header.Get("Content-Type"); e != a {
|
||||
t.Errorf("expect %v to be %v", e, a)
|
||||
}
|
||||
if e, a := "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"); e != a {
|
||||
t.Errorf("expect %v to be %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1792,10 +2068,14 @@ func TestInputService5ProtocolTestRecursiveShapesCase1(t *testing.T) {
|
||||
|
||||
// build request
|
||||
jsonrpc.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
awstesting.AssertJSON(t, `{"RecursiveStruct":{"NoRecurse":"foo"}}`, util.Trim(string(body)))
|
||||
|
||||
@@ -1803,8 +2083,12 @@ func TestInputService5ProtocolTestRecursiveShapesCase1(t *testing.T) {
|
||||
awstesting.AssertURL(t, "https://test/", r.URL.String())
|
||||
|
||||
// assert headers
|
||||
assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type"))
|
||||
assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"))
|
||||
if e, a := "application/x-amz-json-1.1", r.Header.Get("Content-Type"); e != a {
|
||||
t.Errorf("expect %v to be %v", e, a)
|
||||
}
|
||||
if e, a := "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"); e != a {
|
||||
t.Errorf("expect %v to be %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1822,10 +2106,14 @@ func TestInputService5ProtocolTestRecursiveShapesCase2(t *testing.T) {
|
||||
|
||||
// build request
|
||||
jsonrpc.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
awstesting.AssertJSON(t, `{"RecursiveStruct":{"RecursiveStruct":{"NoRecurse":"foo"}}}`, util.Trim(string(body)))
|
||||
|
||||
@@ -1833,8 +2121,12 @@ func TestInputService5ProtocolTestRecursiveShapesCase2(t *testing.T) {
|
||||
awstesting.AssertURL(t, "https://test/", r.URL.String())
|
||||
|
||||
// assert headers
|
||||
assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type"))
|
||||
assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"))
|
||||
if e, a := "application/x-amz-json-1.1", r.Header.Get("Content-Type"); e != a {
|
||||
t.Errorf("expect %v to be %v", e, a)
|
||||
}
|
||||
if e, a := "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"); e != a {
|
||||
t.Errorf("expect %v to be %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1856,10 +2148,14 @@ func TestInputService5ProtocolTestRecursiveShapesCase3(t *testing.T) {
|
||||
|
||||
// build request
|
||||
jsonrpc.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
awstesting.AssertJSON(t, `{"RecursiveStruct":{"RecursiveStruct":{"RecursiveStruct":{"RecursiveStruct":{"NoRecurse":"foo"}}}}}`, util.Trim(string(body)))
|
||||
|
||||
@@ -1867,8 +2163,12 @@ func TestInputService5ProtocolTestRecursiveShapesCase3(t *testing.T) {
|
||||
awstesting.AssertURL(t, "https://test/", r.URL.String())
|
||||
|
||||
// assert headers
|
||||
assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type"))
|
||||
assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"))
|
||||
if e, a := "application/x-amz-json-1.1", r.Header.Get("Content-Type"); e != a {
|
||||
t.Errorf("expect %v to be %v", e, a)
|
||||
}
|
||||
if e, a := "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"); e != a {
|
||||
t.Errorf("expect %v to be %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1891,10 +2191,14 @@ func TestInputService5ProtocolTestRecursiveShapesCase4(t *testing.T) {
|
||||
|
||||
// build request
|
||||
jsonrpc.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
awstesting.AssertJSON(t, `{"RecursiveStruct":{"RecursiveList":[{"NoRecurse":"foo"},{"NoRecurse":"bar"}]}}`, util.Trim(string(body)))
|
||||
|
||||
@@ -1902,8 +2206,12 @@ func TestInputService5ProtocolTestRecursiveShapesCase4(t *testing.T) {
|
||||
awstesting.AssertURL(t, "https://test/", r.URL.String())
|
||||
|
||||
// assert headers
|
||||
assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type"))
|
||||
assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"))
|
||||
if e, a := "application/x-amz-json-1.1", r.Header.Get("Content-Type"); e != a {
|
||||
t.Errorf("expect %v to be %v", e, a)
|
||||
}
|
||||
if e, a := "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"); e != a {
|
||||
t.Errorf("expect %v to be %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1928,10 +2236,14 @@ func TestInputService5ProtocolTestRecursiveShapesCase5(t *testing.T) {
|
||||
|
||||
// build request
|
||||
jsonrpc.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
awstesting.AssertJSON(t, `{"RecursiveStruct":{"RecursiveList":[{"NoRecurse":"foo"},{"RecursiveStruct":{"NoRecurse":"bar"}}]}}`, util.Trim(string(body)))
|
||||
|
||||
@@ -1939,8 +2251,12 @@ func TestInputService5ProtocolTestRecursiveShapesCase5(t *testing.T) {
|
||||
awstesting.AssertURL(t, "https://test/", r.URL.String())
|
||||
|
||||
// assert headers
|
||||
assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type"))
|
||||
assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"))
|
||||
if e, a := "application/x-amz-json-1.1", r.Header.Get("Content-Type"); e != a {
|
||||
t.Errorf("expect %v to be %v", e, a)
|
||||
}
|
||||
if e, a := "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"); e != a {
|
||||
t.Errorf("expect %v to be %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1963,10 +2279,14 @@ func TestInputService5ProtocolTestRecursiveShapesCase6(t *testing.T) {
|
||||
|
||||
// build request
|
||||
jsonrpc.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
awstesting.AssertJSON(t, `{"RecursiveStruct":{"RecursiveMap":{"foo":{"NoRecurse":"foo"},"bar":{"NoRecurse":"bar"}}}}`, util.Trim(string(body)))
|
||||
|
||||
@@ -1974,8 +2294,12 @@ func TestInputService5ProtocolTestRecursiveShapesCase6(t *testing.T) {
|
||||
awstesting.AssertURL(t, "https://test/", r.URL.String())
|
||||
|
||||
// assert headers
|
||||
assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type"))
|
||||
assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"))
|
||||
if e, a := "application/x-amz-json-1.1", r.Header.Get("Content-Type"); e != a {
|
||||
t.Errorf("expect %v to be %v", e, a)
|
||||
}
|
||||
if e, a := "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"); e != a {
|
||||
t.Errorf("expect %v to be %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1989,10 +2313,14 @@ func TestInputService6ProtocolTestEmptyMapsCase1(t *testing.T) {
|
||||
|
||||
// build request
|
||||
jsonrpc.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
awstesting.AssertJSON(t, `{"Map":{}}`, util.Trim(string(body)))
|
||||
|
||||
@@ -2000,8 +2328,12 @@ func TestInputService6ProtocolTestEmptyMapsCase1(t *testing.T) {
|
||||
awstesting.AssertURL(t, "https://test/", r.URL.String())
|
||||
|
||||
// assert headers
|
||||
assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type"))
|
||||
assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"))
|
||||
if e, a := "application/x-amz-json-1.1", r.Header.Get("Content-Type"); e != a {
|
||||
t.Errorf("expect %v to be %v", e, a)
|
||||
}
|
||||
if e, a := "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"); e != a {
|
||||
t.Errorf("expect %v to be %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2015,10 +2347,14 @@ func TestInputService7ProtocolTestIdempotencyTokenAutoFillCase1(t *testing.T) {
|
||||
|
||||
// build request
|
||||
jsonrpc.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
awstesting.AssertJSON(t, `{"Token":"abc123"}`, util.Trim(string(body)))
|
||||
|
||||
@@ -2037,10 +2373,14 @@ func TestInputService7ProtocolTestIdempotencyTokenAutoFillCase2(t *testing.T) {
|
||||
|
||||
// build request
|
||||
jsonrpc.Build(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert body
|
||||
assert.NotNil(t, r.Body)
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
awstesting.AssertJSON(t, `{"Token":"00000000-0000-4000-8000-000000000000"}`, util.Trim(string(body)))
|
||||
|
||||
@@ -2050,3 +2390,55 @@ func TestInputService7ProtocolTestIdempotencyTokenAutoFillCase2(t *testing.T) {
|
||||
// assert headers
|
||||
|
||||
}
|
||||
|
||||
func TestInputService8ProtocolTestEnumCase1(t *testing.T) {
|
||||
svc := NewInputService8ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
|
||||
input := &InputService8TestShapeInputService8TestCaseOperation2Input{
|
||||
FooEnum: aws.String("foo"),
|
||||
ListEnums: []*string{
|
||||
aws.String("foo"),
|
||||
aws.String(""),
|
||||
aws.String("bar"),
|
||||
},
|
||||
}
|
||||
req, _ := svc.InputService8TestCaseOperation1Request(input)
|
||||
r := req.HTTPRequest
|
||||
|
||||
// build request
|
||||
jsonrpc.Build(req)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert body
|
||||
if r.Body == nil {
|
||||
t.Errorf("expect body not to be nil")
|
||||
}
|
||||
body, _ := ioutil.ReadAll(r.Body)
|
||||
awstesting.AssertJSON(t, `{"FooEnum":"foo","ListEnums":["foo","","bar"]}`, util.Trim(string(body)))
|
||||
|
||||
// assert URL
|
||||
awstesting.AssertURL(t, "https://test/", r.URL.String())
|
||||
|
||||
// assert headers
|
||||
|
||||
}
|
||||
|
||||
func TestInputService8ProtocolTestEnumCase2(t *testing.T) {
|
||||
svc := NewInputService8ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
|
||||
input := &InputService8TestShapeInputService8TestCaseOperation2Input{}
|
||||
req, _ := svc.InputService8TestCaseOperation2Request(input)
|
||||
r := req.HTTPRequest
|
||||
|
||||
// build request
|
||||
jsonrpc.Build(req)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect no error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert URL
|
||||
awstesting.AssertURL(t, "https://test/", r.URL.String())
|
||||
|
||||
// assert headers
|
||||
|
||||
}
|
||||
|
||||
+312
-46
@@ -24,7 +24,6 @@ import (
|
||||
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil"
|
||||
"github.com/aws/aws-sdk-go/private/util"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var _ bytes.Buffer // always import bytes
|
||||
@@ -108,7 +107,7 @@ const opOutputService1TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService1TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService1TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -307,7 +306,7 @@ const opOutputService2TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService2TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService2TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -472,7 +471,7 @@ const opOutputService3TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService3TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService3TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -635,7 +634,7 @@ const opOutputService4TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService4TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService4TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -703,7 +702,7 @@ const opOutputService4TestCaseOperation2 = "OperationName"
|
||||
|
||||
// OutputService4TestCaseOperation2Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService4TestCaseOperation2 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -870,7 +869,7 @@ const opOutputService5TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService5TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService5TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -1013,7 +1012,7 @@ const opOutputService6TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService6TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService6TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -1093,6 +1092,165 @@ func (s *OutputService6TestShapeOutputService6TestCaseOperation1Output) SetStrTy
|
||||
return s
|
||||
}
|
||||
|
||||
// OutputService7ProtocolTest provides the API operation methods for making requests to
|
||||
// . See this package's package overview docs
|
||||
// for details on the service.
|
||||
//
|
||||
// OutputService7ProtocolTest methods are safe to use concurrently. It is not safe to
|
||||
// modify mutate any of the struct's properties though.
|
||||
type OutputService7ProtocolTest struct {
|
||||
*client.Client
|
||||
}
|
||||
|
||||
// New creates a new instance of the OutputService7ProtocolTest client with a session.
|
||||
// If additional configuration is needed for the client instance use the optional
|
||||
// aws.Config parameter to add your extra config.
|
||||
//
|
||||
// Example:
|
||||
// // Create a OutputService7ProtocolTest client from just a session.
|
||||
// svc := outputservice7protocoltest.New(mySession)
|
||||
//
|
||||
// // Create a OutputService7ProtocolTest client with additional configuration
|
||||
// svc := outputservice7protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
|
||||
func NewOutputService7ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService7ProtocolTest {
|
||||
c := p.ClientConfig("outputservice7protocoltest", cfgs...)
|
||||
return newOutputService7ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
|
||||
}
|
||||
|
||||
// newClient creates, initializes and returns a new service client instance.
|
||||
func newOutputService7ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService7ProtocolTest {
|
||||
svc := &OutputService7ProtocolTest{
|
||||
Client: client.New(
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: "outputservice7protocoltest",
|
||||
SigningName: signingName,
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
APIVersion: "",
|
||||
},
|
||||
handlers,
|
||||
),
|
||||
}
|
||||
|
||||
// Handlers
|
||||
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
|
||||
svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
|
||||
svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
|
||||
svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
|
||||
svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
|
||||
|
||||
return svc
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a OutputService7ProtocolTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *OutputService7ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
|
||||
req := c.NewRequest(op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
const opOutputService7TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService7TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService7TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
// the "output" return value is not valid until after Send returns without error.
|
||||
//
|
||||
// See OutputService7TestCaseOperation1 for more information on using the OutputService7TestCaseOperation1
|
||||
// API call, and error handling.
|
||||
//
|
||||
// This method is useful when you want to inject custom logic or configuration
|
||||
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
|
||||
//
|
||||
//
|
||||
// // Example sending a request using the OutputService7TestCaseOperation1Request method.
|
||||
// req, resp := client.OutputService7TestCaseOperation1Request(params)
|
||||
//
|
||||
// err := req.Send()
|
||||
// if err == nil { // resp is now filled
|
||||
// fmt.Println(resp)
|
||||
// }
|
||||
func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1Request(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (req *request.Request, output *OutputService7TestShapeOutputService7TestCaseOperation1Output) {
|
||||
op := &request.Operation{
|
||||
Name: opOutputService7TestCaseOperation1,
|
||||
HTTPPath: "/",
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &OutputService7TestShapeOutputService7TestCaseOperation1Input{}
|
||||
}
|
||||
|
||||
output = &OutputService7TestShapeOutputService7TestCaseOperation1Output{}
|
||||
req = c.newRequest(op, input, output)
|
||||
return
|
||||
}
|
||||
|
||||
// OutputService7TestCaseOperation1 API operation for .
|
||||
//
|
||||
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
|
||||
// with awserr.Error's Code and Message methods to get detailed information about
|
||||
// the error.
|
||||
//
|
||||
// See the AWS API reference guide for 's
|
||||
// API operation OutputService7TestCaseOperation1 for usage and error information.
|
||||
func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1(input *OutputService7TestShapeOutputService7TestCaseOperation1Input) (*OutputService7TestShapeOutputService7TestCaseOperation1Output, error) {
|
||||
req, out := c.OutputService7TestCaseOperation1Request(input)
|
||||
return out, req.Send()
|
||||
}
|
||||
|
||||
// OutputService7TestCaseOperation1WithContext is the same as OutputService7TestCaseOperation1 with the addition of
|
||||
// the ability to pass a context and additional request options.
|
||||
//
|
||||
// See OutputService7TestCaseOperation1 for details on how to use this API operation.
|
||||
//
|
||||
// The context must be non-nil and will be used for request cancellation. If
|
||||
// the context is nil a panic will occur. In the future the SDK may create
|
||||
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
|
||||
// for more information on using Contexts.
|
||||
func (c *OutputService7ProtocolTest) OutputService7TestCaseOperation1WithContext(ctx aws.Context, input *OutputService7TestShapeOutputService7TestCaseOperation1Input, opts ...request.Option) (*OutputService7TestShapeOutputService7TestCaseOperation1Output, error) {
|
||||
req, out := c.OutputService7TestCaseOperation1Request(input)
|
||||
req.SetContext(ctx)
|
||||
req.ApplyOptions(opts...)
|
||||
return out, req.Send()
|
||||
}
|
||||
|
||||
type OutputService7TestShapeOutputService7TestCaseOperation1Input struct {
|
||||
_ struct{} `type:"structure"`
|
||||
}
|
||||
|
||||
type OutputService7TestShapeOutputService7TestCaseOperation1Output struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
FooEnum *string `type:"string" enum:"OutputService7TestShapeJSONEnumType"`
|
||||
|
||||
ListEnums []*string `type:"list"`
|
||||
}
|
||||
|
||||
// SetFooEnum sets the FooEnum field's value.
|
||||
func (s *OutputService7TestShapeOutputService7TestCaseOperation1Output) SetFooEnum(v string) *OutputService7TestShapeOutputService7TestCaseOperation1Output {
|
||||
s.FooEnum = &v
|
||||
return s
|
||||
}
|
||||
|
||||
// SetListEnums sets the ListEnums field's value.
|
||||
func (s *OutputService7TestShapeOutputService7TestCaseOperation1Output) SetListEnums(v []*string) *OutputService7TestShapeOutputService7TestCaseOperation1Output {
|
||||
s.ListEnums = v
|
||||
return s
|
||||
}
|
||||
|
||||
const (
|
||||
// JSONEnumTypeFoo is a OutputService7TestShapeJSONEnumType enum value
|
||||
JSONEnumTypeFoo = "foo"
|
||||
|
||||
// JSONEnumTypeBar is a OutputService7TestShapeJSONEnumType enum value
|
||||
JSONEnumTypeBar = "bar"
|
||||
)
|
||||
|
||||
//
|
||||
// Tests begin here
|
||||
//
|
||||
@@ -1109,18 +1267,38 @@ func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) {
|
||||
// unmarshal response
|
||||
jsonrpc.UnmarshalMeta(req)
|
||||
jsonrpc.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "a", *out.Char)
|
||||
assert.Equal(t, 1.3, *out.Double)
|
||||
assert.Equal(t, false, *out.FalseBool)
|
||||
assert.Equal(t, 1.2, *out.Float)
|
||||
assert.Equal(t, int64(200), *out.Long)
|
||||
assert.Equal(t, int64(123), *out.Num)
|
||||
assert.Equal(t, "myname", *out.Str)
|
||||
assert.Equal(t, true, *out.TrueBool)
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "a", *out.Char; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := 1.3, *out.Double; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := false, *out.FalseBool; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := 1.2, *out.Float; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := int64(200), *out.Long; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := int64(123), *out.Num; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "myname", *out.Str; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := true, *out.TrueBool; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1136,12 +1314,20 @@ func TestOutputService2ProtocolTestBlobMembersCase1(t *testing.T) {
|
||||
// unmarshal response
|
||||
jsonrpc.UnmarshalMeta(req)
|
||||
jsonrpc.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "hi!", string(out.BlobMember))
|
||||
assert.Equal(t, "there!", string(out.StructMember.Foo))
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "hi!", string(out.BlobMember); e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "there!", string(out.StructMember.Foo); e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1157,12 +1343,20 @@ func TestOutputService3ProtocolTestTimestampMembersCase1(t *testing.T) {
|
||||
// unmarshal response
|
||||
jsonrpc.UnmarshalMeta(req)
|
||||
jsonrpc.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, time.Unix(1.398796238e+09, 0).UTC().String(), out.StructMember.Foo.String())
|
||||
assert.Equal(t, time.Unix(1.398796238e+09, 0).UTC().String(), out.TimeMember.String())
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := time.Unix(1.398796238e+09, 0).UTC().String(), out.StructMember.Foo.String(); e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := time.Unix(1.398796238e+09, 0).UTC().String(), out.TimeMember.String(); e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1178,12 +1372,20 @@ func TestOutputService4ProtocolTestListsCase1(t *testing.T) {
|
||||
// unmarshal response
|
||||
jsonrpc.UnmarshalMeta(req)
|
||||
jsonrpc.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "a", *out.ListMember[0])
|
||||
assert.Equal(t, "b", *out.ListMember[1])
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "a", *out.ListMember[0]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "b", *out.ListMember[1]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1199,16 +1401,32 @@ func TestOutputService4ProtocolTestListsCase2(t *testing.T) {
|
||||
// unmarshal response
|
||||
jsonrpc.UnmarshalMeta(req)
|
||||
jsonrpc.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "a", *out.ListMember[0])
|
||||
assert.Nil(t, out.ListMember[1])
|
||||
assert.Nil(t, out.ListMemberMap[1])
|
||||
assert.Nil(t, out.ListMemberMap[2])
|
||||
assert.Nil(t, out.ListMemberStruct[1])
|
||||
assert.Nil(t, out.ListMemberStruct[2])
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "a", *out.ListMember[0]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e := out.ListMember[1]; e != nil {
|
||||
t.Errorf("expect nil, got %v", e)
|
||||
}
|
||||
if e := out.ListMemberMap[1]; e != nil {
|
||||
t.Errorf("expect nil, got %v", e)
|
||||
}
|
||||
if e := out.ListMemberMap[2]; e != nil {
|
||||
t.Errorf("expect nil, got %v", e)
|
||||
}
|
||||
if e := out.ListMemberStruct[1]; e != nil {
|
||||
t.Errorf("expect nil, got %v", e)
|
||||
}
|
||||
if e := out.ListMemberStruct[2]; e != nil {
|
||||
t.Errorf("expect nil, got %v", e)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1224,14 +1442,26 @@ func TestOutputService5ProtocolTestMapsCase1(t *testing.T) {
|
||||
// unmarshal response
|
||||
jsonrpc.UnmarshalMeta(req)
|
||||
jsonrpc.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, int64(1), *out.MapMember["a"][0])
|
||||
assert.Equal(t, int64(2), *out.MapMember["a"][1])
|
||||
assert.Equal(t, int64(3), *out.MapMember["b"][0])
|
||||
assert.Equal(t, int64(4), *out.MapMember["b"][1])
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := int64(1), *out.MapMember["a"][0]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := int64(2), *out.MapMember["a"][1]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := int64(3), *out.MapMember["b"][0]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := int64(4), *out.MapMember["b"][1]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1247,9 +1477,45 @@ func TestOutputService6ProtocolTestIgnoresExtraDataCase1(t *testing.T) {
|
||||
// unmarshal response
|
||||
jsonrpc.UnmarshalMeta(req)
|
||||
jsonrpc.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestOutputService7ProtocolTestEnumOutputCase1(t *testing.T) {
|
||||
svc := NewOutputService7ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
|
||||
|
||||
buf := bytes.NewReader([]byte("{\"FooEnum\": \"foo\", \"ListEnums\": [\"foo\", \"bar\"]}"))
|
||||
req, out := svc.OutputService7TestCaseOperation1Request(nil)
|
||||
req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
|
||||
|
||||
// set headers
|
||||
|
||||
// unmarshal response
|
||||
jsonrpc.UnmarshalMeta(req)
|
||||
jsonrpc.Unmarshal(req)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "foo", *out.FooEnum; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "foo", *out.ListEnums[0]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "bar", *out.ListEnums[1]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package protocol
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
)
|
||||
|
||||
// EscapeMode is the mode that should be use for escaping a value
|
||||
type EscapeMode uint
|
||||
|
||||
// The modes for escaping a value before it is marshaled, and unmarshaled.
|
||||
const (
|
||||
NoEscape EscapeMode = iota
|
||||
Base64Escape
|
||||
QuotedEscape
|
||||
)
|
||||
|
||||
// EncodeJSONValue marshals the value into a JSON string, and optionally base64
|
||||
// encodes the string before returning it.
|
||||
//
|
||||
// Will panic if the escape mode is unknown.
|
||||
func EncodeJSONValue(v aws.JSONValue, escape EscapeMode) (string, error) {
|
||||
b, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
switch escape {
|
||||
case NoEscape:
|
||||
return string(b), nil
|
||||
case Base64Escape:
|
||||
return base64.StdEncoding.EncodeToString(b), nil
|
||||
case QuotedEscape:
|
||||
return strconv.Quote(string(b)), nil
|
||||
}
|
||||
|
||||
panic(fmt.Sprintf("EncodeJSONValue called with unknown EscapeMode, %v", escape))
|
||||
}
|
||||
|
||||
// DecodeJSONValue will attempt to decode the string input as a JSONValue.
|
||||
// Optionally decoding base64 the value first before JSON unmarshaling.
|
||||
//
|
||||
// Will panic if the escape mode is unknown.
|
||||
func DecodeJSONValue(v string, escape EscapeMode) (aws.JSONValue, error) {
|
||||
var b []byte
|
||||
var err error
|
||||
|
||||
switch escape {
|
||||
case NoEscape:
|
||||
b = []byte(v)
|
||||
case Base64Escape:
|
||||
b, err = base64.StdEncoding.DecodeString(v)
|
||||
case QuotedEscape:
|
||||
var u string
|
||||
u, err = strconv.Unquote(v)
|
||||
b = []byte(u)
|
||||
default:
|
||||
panic(fmt.Sprintf("DecodeJSONValue called with unknown EscapeMode, %v", escape))
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
m := aws.JSONValue{}
|
||||
err = json.Unmarshal(b, &m)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return m, nil
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
package protocol
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
)
|
||||
|
||||
var testJSONValueCases = []struct {
|
||||
Value aws.JSONValue
|
||||
Mode EscapeMode
|
||||
String string
|
||||
}{
|
||||
{
|
||||
Value: aws.JSONValue{
|
||||
"abc": 123.,
|
||||
},
|
||||
Mode: NoEscape,
|
||||
String: `{"abc":123}`,
|
||||
},
|
||||
{
|
||||
Value: aws.JSONValue{
|
||||
"abc": 123.,
|
||||
},
|
||||
Mode: Base64Escape,
|
||||
String: `eyJhYmMiOjEyM30=`,
|
||||
},
|
||||
{
|
||||
Value: aws.JSONValue{
|
||||
"abc": 123.,
|
||||
},
|
||||
Mode: QuotedEscape,
|
||||
String: `"{\"abc\":123}"`,
|
||||
},
|
||||
}
|
||||
|
||||
func TestEncodeJSONValue(t *testing.T) {
|
||||
for i, c := range testJSONValueCases {
|
||||
str, err := EncodeJSONValue(c.Value, c.Mode)
|
||||
if err != nil {
|
||||
t.Fatalf("%d, expect no error, got %v", i, err)
|
||||
}
|
||||
if e, a := c.String, str; e != a {
|
||||
t.Errorf("%d, expect %v encoded value, got %v", i, e, a)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecodeJSONValue(t *testing.T) {
|
||||
for i, c := range testJSONValueCases {
|
||||
val, err := DecodeJSONValue(c.String, c.Mode)
|
||||
if err != nil {
|
||||
t.Fatalf("%d, expect no error, got %v", i, err)
|
||||
}
|
||||
if e, a := c.Value, val; !reflect.DeepEqual(e, a) {
|
||||
t.Errorf("%d, expect %v encoded value, got %v", i, e, a)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestEncodeJSONValue_PanicUnkownMode(t *testing.T) {
|
||||
defer func() {
|
||||
if r := recover(); r == nil {
|
||||
t.Errorf("expect panic, got none")
|
||||
} else {
|
||||
reason := fmt.Sprintf("%v", r)
|
||||
if e, a := "unknown EscapeMode", reason; !strings.Contains(a, e) {
|
||||
t.Errorf("expect %q to be in %v", e, a)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
val := aws.JSONValue{}
|
||||
|
||||
EncodeJSONValue(val, 123456)
|
||||
}
|
||||
func TestDecodeJSONValue_PanicUnkownMode(t *testing.T) {
|
||||
defer func() {
|
||||
if r := recover(); r == nil {
|
||||
t.Errorf("expect panic, got none")
|
||||
} else {
|
||||
reason := fmt.Sprintf("%v", r)
|
||||
if e, a := "unknown EscapeMode", reason; !strings.Contains(a, e) {
|
||||
t.Errorf("expect %q to be in %v", e, a)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
DecodeJSONValue(`{"abc":123}`, 123456)
|
||||
}
|
||||
+1
-1
@@ -25,7 +25,7 @@ func Build(r *request.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if r.ExpireTime == 0 {
|
||||
if !r.IsPresigned() {
|
||||
r.HTTPRequest.Method = "POST"
|
||||
r.HTTPRequest.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=utf-8")
|
||||
r.SetBufferBody([]byte(body.Encode()))
|
||||
|
||||
+1216
-551
File diff suppressed because it is too large
Load Diff
+4
@@ -121,6 +121,10 @@ func (q *queryParser) parseList(v url.Values, value reflect.Value, prefix string
|
||||
return nil
|
||||
}
|
||||
|
||||
if _, ok := value.Interface().([]byte); ok {
|
||||
return q.parseScalar(v, value, prefix, tag)
|
||||
}
|
||||
|
||||
// check for unflattened list member
|
||||
if !q.isEC2 && tag.Get("flattened") == "" {
|
||||
if listName := tag.Get("locationNameList"); listName == "" {
|
||||
|
||||
+416
-86
@@ -24,7 +24,6 @@ import (
|
||||
"github.com/aws/aws-sdk-go/private/protocol/query"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil"
|
||||
"github.com/aws/aws-sdk-go/private/util"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var _ bytes.Buffer // always import bytes
|
||||
@@ -108,7 +107,7 @@ const opOutputService1TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService1TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService1TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -315,7 +314,7 @@ const opOutputService2TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService2TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService2TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -466,7 +465,7 @@ const opOutputService3TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService3TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService3TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -610,7 +609,7 @@ const opOutputService4TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService4TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService4TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -753,7 +752,7 @@ const opOutputService5TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService5TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService5TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -896,7 +895,7 @@ const opOutputService6TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService6TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService6TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -1039,7 +1038,7 @@ const opOutputService7TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService7TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService7TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -1182,7 +1181,7 @@ const opOutputService8TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService8TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService8TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -1353,7 +1352,7 @@ const opOutputService9TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService9TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService9TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -1524,7 +1523,7 @@ const opOutputService10TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService10TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService10TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -1667,7 +1666,7 @@ const opOutputService11TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService11TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService11TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -1822,7 +1821,7 @@ const opOutputService12TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService12TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService12TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -1965,7 +1964,7 @@ const opOutputService13TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService13TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService13TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -2108,7 +2107,7 @@ const opOutputService14TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService14TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService14TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -2251,7 +2250,7 @@ const opOutputService15TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService15TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService15TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request complets
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
@@ -2331,6 +2330,165 @@ func (s *OutputService15TestShapeOutputService15TestCaseOperation1Output) SetFoo
|
||||
return s
|
||||
}
|
||||
|
||||
// OutputService16ProtocolTest provides the API operation methods for making requests to
|
||||
// . See this package's package overview docs
|
||||
// for details on the service.
|
||||
//
|
||||
// OutputService16ProtocolTest methods are safe to use concurrently. It is not safe to
|
||||
// modify mutate any of the struct's properties though.
|
||||
type OutputService16ProtocolTest struct {
|
||||
*client.Client
|
||||
}
|
||||
|
||||
// New creates a new instance of the OutputService16ProtocolTest client with a session.
|
||||
// If additional configuration is needed for the client instance use the optional
|
||||
// aws.Config parameter to add your extra config.
|
||||
//
|
||||
// Example:
|
||||
// // Create a OutputService16ProtocolTest client from just a session.
|
||||
// svc := outputservice16protocoltest.New(mySession)
|
||||
//
|
||||
// // Create a OutputService16ProtocolTest client with additional configuration
|
||||
// svc := outputservice16protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
|
||||
func NewOutputService16ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService16ProtocolTest {
|
||||
c := p.ClientConfig("outputservice16protocoltest", cfgs...)
|
||||
return newOutputService16ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
|
||||
}
|
||||
|
||||
// newClient creates, initializes and returns a new service client instance.
|
||||
func newOutputService16ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService16ProtocolTest {
|
||||
svc := &OutputService16ProtocolTest{
|
||||
Client: client.New(
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: "outputservice16protocoltest",
|
||||
SigningName: signingName,
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
APIVersion: "",
|
||||
},
|
||||
handlers,
|
||||
),
|
||||
}
|
||||
|
||||
// Handlers
|
||||
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
|
||||
svc.Handlers.Build.PushBackNamed(query.BuildHandler)
|
||||
svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
|
||||
svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
|
||||
svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
|
||||
|
||||
return svc
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a OutputService16ProtocolTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *OutputService16ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
|
||||
req := c.NewRequest(op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
const opOutputService16TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService16TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService16TestCaseOperation1 operation. The "output" return
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfuly.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
// the "output" return value is not valid until after Send returns without error.
|
||||
//
|
||||
// See OutputService16TestCaseOperation1 for more information on using the OutputService16TestCaseOperation1
|
||||
// API call, and error handling.
|
||||
//
|
||||
// This method is useful when you want to inject custom logic or configuration
|
||||
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
|
||||
//
|
||||
//
|
||||
// // Example sending a request using the OutputService16TestCaseOperation1Request method.
|
||||
// req, resp := client.OutputService16TestCaseOperation1Request(params)
|
||||
//
|
||||
// err := req.Send()
|
||||
// if err == nil { // resp is now filled
|
||||
// fmt.Println(resp)
|
||||
// }
|
||||
func (c *OutputService16ProtocolTest) OutputService16TestCaseOperation1Request(input *OutputService16TestShapeOutputService16TestCaseOperation1Input) (req *request.Request, output *OutputService16TestShapeOutputService16TestCaseOperation1Output) {
|
||||
op := &request.Operation{
|
||||
Name: opOutputService16TestCaseOperation1,
|
||||
HTTPPath: "/",
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &OutputService16TestShapeOutputService16TestCaseOperation1Input{}
|
||||
}
|
||||
|
||||
output = &OutputService16TestShapeOutputService16TestCaseOperation1Output{}
|
||||
req = c.newRequest(op, input, output)
|
||||
return
|
||||
}
|
||||
|
||||
// OutputService16TestCaseOperation1 API operation for .
|
||||
//
|
||||
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
|
||||
// with awserr.Error's Code and Message methods to get detailed information about
|
||||
// the error.
|
||||
//
|
||||
// See the AWS API reference guide for 's
|
||||
// API operation OutputService16TestCaseOperation1 for usage and error information.
|
||||
func (c *OutputService16ProtocolTest) OutputService16TestCaseOperation1(input *OutputService16TestShapeOutputService16TestCaseOperation1Input) (*OutputService16TestShapeOutputService16TestCaseOperation1Output, error) {
|
||||
req, out := c.OutputService16TestCaseOperation1Request(input)
|
||||
return out, req.Send()
|
||||
}
|
||||
|
||||
// OutputService16TestCaseOperation1WithContext is the same as OutputService16TestCaseOperation1 with the addition of
|
||||
// the ability to pass a context and additional request options.
|
||||
//
|
||||
// See OutputService16TestCaseOperation1 for details on how to use this API operation.
|
||||
//
|
||||
// The context must be non-nil and will be used for request cancellation. If
|
||||
// the context is nil a panic will occur. In the future the SDK may create
|
||||
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
|
||||
// for more information on using Contexts.
|
||||
func (c *OutputService16ProtocolTest) OutputService16TestCaseOperation1WithContext(ctx aws.Context, input *OutputService16TestShapeOutputService16TestCaseOperation1Input, opts ...request.Option) (*OutputService16TestShapeOutputService16TestCaseOperation1Output, error) {
|
||||
req, out := c.OutputService16TestCaseOperation1Request(input)
|
||||
req.SetContext(ctx)
|
||||
req.ApplyOptions(opts...)
|
||||
return out, req.Send()
|
||||
}
|
||||
|
||||
type OutputService16TestShapeOutputService16TestCaseOperation1Input struct {
|
||||
_ struct{} `type:"structure"`
|
||||
}
|
||||
|
||||
type OutputService16TestShapeOutputService16TestCaseOperation1Output struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
FooEnum *string `type:"string" enum:"OutputService16TestShapeEC2EnumType"`
|
||||
|
||||
ListEnums []*string `type:"list"`
|
||||
}
|
||||
|
||||
// SetFooEnum sets the FooEnum field's value.
|
||||
func (s *OutputService16TestShapeOutputService16TestCaseOperation1Output) SetFooEnum(v string) *OutputService16TestShapeOutputService16TestCaseOperation1Output {
|
||||
s.FooEnum = &v
|
||||
return s
|
||||
}
|
||||
|
||||
// SetListEnums sets the ListEnums field's value.
|
||||
func (s *OutputService16TestShapeOutputService16TestCaseOperation1Output) SetListEnums(v []*string) *OutputService16TestShapeOutputService16TestCaseOperation1Output {
|
||||
s.ListEnums = v
|
||||
return s
|
||||
}
|
||||
|
||||
const (
|
||||
// EC2EnumTypeFoo is a OutputService16TestShapeEC2EnumType enum value
|
||||
EC2EnumTypeFoo = "foo"
|
||||
|
||||
// EC2EnumTypeBar is a OutputService16TestShapeEC2EnumType enum value
|
||||
EC2EnumTypeBar = "bar"
|
||||
)
|
||||
|
||||
//
|
||||
// Tests begin here
|
||||
//
|
||||
@@ -2347,19 +2505,41 @@ func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) {
|
||||
// unmarshal response
|
||||
query.UnmarshalMeta(req)
|
||||
query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "a", *out.Char)
|
||||
assert.Equal(t, 1.3, *out.Double)
|
||||
assert.Equal(t, false, *out.FalseBool)
|
||||
assert.Equal(t, 1.2, *out.Float)
|
||||
assert.Equal(t, int64(200), *out.Long)
|
||||
assert.Equal(t, int64(123), *out.Num)
|
||||
assert.Equal(t, "myname", *out.Str)
|
||||
assert.Equal(t, time.Unix(1.4221728e+09, 0).UTC().String(), out.Timestamp.String())
|
||||
assert.Equal(t, true, *out.TrueBool)
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "a", *out.Char; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := 1.3, *out.Double; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := false, *out.FalseBool; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := 1.2, *out.Float; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := int64(200), *out.Long; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := int64(123), *out.Num; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "myname", *out.Str; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := time.Unix(1.4221728e+09, 0).UTC().String(), out.Timestamp.String(); e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := true, *out.TrueBool; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2375,11 +2555,17 @@ func TestOutputService2ProtocolTestNotAllMembersInResponseCase1(t *testing.T) {
|
||||
// unmarshal response
|
||||
query.UnmarshalMeta(req)
|
||||
query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "myname", *out.Str)
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "myname", *out.Str; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2395,11 +2581,17 @@ func TestOutputService3ProtocolTestBlobCase1(t *testing.T) {
|
||||
// unmarshal response
|
||||
query.UnmarshalMeta(req)
|
||||
query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "value", string(out.Blob))
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "value", string(out.Blob); e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2415,12 +2607,20 @@ func TestOutputService4ProtocolTestListsCase1(t *testing.T) {
|
||||
// unmarshal response
|
||||
query.UnmarshalMeta(req)
|
||||
query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "abc", *out.ListMember[0])
|
||||
assert.Equal(t, "123", *out.ListMember[1])
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "abc", *out.ListMember[0]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "123", *out.ListMember[1]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2436,12 +2636,20 @@ func TestOutputService5ProtocolTestListWithCustomMemberNameCase1(t *testing.T) {
|
||||
// unmarshal response
|
||||
query.UnmarshalMeta(req)
|
||||
query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "abc", *out.ListMember[0])
|
||||
assert.Equal(t, "123", *out.ListMember[1])
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "abc", *out.ListMember[0]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "123", *out.ListMember[1]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2457,12 +2665,20 @@ func TestOutputService6ProtocolTestFlattenedListCase1(t *testing.T) {
|
||||
// unmarshal response
|
||||
query.UnmarshalMeta(req)
|
||||
query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "abc", *out.ListMember[0])
|
||||
assert.Equal(t, "123", *out.ListMember[1])
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "abc", *out.ListMember[0]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "123", *out.ListMember[1]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2478,11 +2694,17 @@ func TestOutputService7ProtocolTestFlattenedSingleElementListCase1(t *testing.T)
|
||||
// unmarshal response
|
||||
query.UnmarshalMeta(req)
|
||||
query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "abc", *out.ListMember[0])
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "abc", *out.ListMember[0]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2498,16 +2720,32 @@ func TestOutputService8ProtocolTestListOfStructuresCase1(t *testing.T) {
|
||||
// unmarshal response
|
||||
query.UnmarshalMeta(req)
|
||||
query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "firstbar", *out.List[0].Bar)
|
||||
assert.Equal(t, "firstbaz", *out.List[0].Baz)
|
||||
assert.Equal(t, "firstfoo", *out.List[0].Foo)
|
||||
assert.Equal(t, "secondbar", *out.List[1].Bar)
|
||||
assert.Equal(t, "secondbaz", *out.List[1].Baz)
|
||||
assert.Equal(t, "secondfoo", *out.List[1].Foo)
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "firstbar", *out.List[0].Bar; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "firstbaz", *out.List[0].Baz; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "firstfoo", *out.List[0].Foo; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "secondbar", *out.List[1].Bar; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "secondbaz", *out.List[1].Baz; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "secondfoo", *out.List[1].Foo; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2523,16 +2761,32 @@ func TestOutputService9ProtocolTestFlattenedListOfStructuresCase1(t *testing.T)
|
||||
// unmarshal response
|
||||
query.UnmarshalMeta(req)
|
||||
query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "firstbar", *out.List[0].Bar)
|
||||
assert.Equal(t, "firstbaz", *out.List[0].Baz)
|
||||
assert.Equal(t, "firstfoo", *out.List[0].Foo)
|
||||
assert.Equal(t, "secondbar", *out.List[1].Bar)
|
||||
assert.Equal(t, "secondbaz", *out.List[1].Baz)
|
||||
assert.Equal(t, "secondfoo", *out.List[1].Foo)
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "firstbar", *out.List[0].Bar; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "firstbaz", *out.List[0].Baz; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "firstfoo", *out.List[0].Foo; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "secondbar", *out.List[1].Bar; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "secondbaz", *out.List[1].Baz; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "secondfoo", *out.List[1].Foo; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2548,12 +2802,20 @@ func TestOutputService10ProtocolTestFlattenedListWithLocationNameCase1(t *testin
|
||||
// unmarshal response
|
||||
query.UnmarshalMeta(req)
|
||||
query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "a", *out.List[0])
|
||||
assert.Equal(t, "b", *out.List[1])
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "a", *out.List[0]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "b", *out.List[1]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2569,12 +2831,20 @@ func TestOutputService11ProtocolTestNormalMapCase1(t *testing.T) {
|
||||
// unmarshal response
|
||||
query.UnmarshalMeta(req)
|
||||
query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "bam", *out.Map["baz"].Foo)
|
||||
assert.Equal(t, "bar", *out.Map["qux"].Foo)
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "bam", *out.Map["baz"].Foo; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "bar", *out.Map["qux"].Foo; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2590,12 +2860,20 @@ func TestOutputService12ProtocolTestFlattenedMapCase1(t *testing.T) {
|
||||
// unmarshal response
|
||||
query.UnmarshalMeta(req)
|
||||
query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "bam", *out.Map["baz"])
|
||||
assert.Equal(t, "bar", *out.Map["qux"])
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "bam", *out.Map["baz"]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "bar", *out.Map["qux"]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2611,11 +2889,17 @@ func TestOutputService13ProtocolTestFlattenedMapInShapeDefinitionCase1(t *testin
|
||||
// unmarshal response
|
||||
query.UnmarshalMeta(req)
|
||||
query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "bar", *out.Map["qux"])
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "bar", *out.Map["qux"]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2631,12 +2915,20 @@ func TestOutputService14ProtocolTestNamedMapCase1(t *testing.T) {
|
||||
// unmarshal response
|
||||
query.UnmarshalMeta(req)
|
||||
query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "bam", *out.Map["baz"])
|
||||
assert.Equal(t, "bar", *out.Map["qux"])
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "bam", *out.Map["baz"]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "bar", *out.Map["qux"]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2652,10 +2944,48 @@ func TestOutputService15ProtocolTestEmptyStringCase1(t *testing.T) {
|
||||
// unmarshal response
|
||||
query.UnmarshalMeta(req)
|
||||
query.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "", *out.Foo)
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "", *out.Foo; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestOutputService16ProtocolTestEnumOutputCase1(t *testing.T) {
|
||||
svc := NewOutputService16ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
|
||||
|
||||
buf := bytes.NewReader([]byte("<OperationNameResponse><FooEnum>foo</FooEnum><ListEnums><member>foo</member><member>bar</member></ListEnums></OperationNameResponse>"))
|
||||
req, out := svc.OutputService16TestCaseOperation1Request(nil)
|
||||
req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
|
||||
|
||||
// set headers
|
||||
|
||||
// unmarshal response
|
||||
query.UnmarshalMeta(req)
|
||||
query.Unmarshal(req)
|
||||
if req.Error != nil {
|
||||
t.Errorf("expect not error, got %v", req.Error)
|
||||
}
|
||||
|
||||
// assert response
|
||||
if out == nil {
|
||||
t.Errorf("expect not to be nil")
|
||||
}
|
||||
if e, a := "foo", *out.FooEnum; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "foo", *out.ListEnums[0]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "bar", *out.ListEnums[1]; e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+11
-10
@@ -4,7 +4,6 @@ package rest
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
@@ -18,6 +17,7 @@ import (
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/private/protocol"
|
||||
)
|
||||
|
||||
// RFC822 returns an RFC822 formatted timestamp for AWS protocols
|
||||
@@ -252,13 +252,12 @@ func EscapePath(path string, encodeSep bool) string {
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
func convertType(v reflect.Value, tag reflect.StructTag) (string, error) {
|
||||
func convertType(v reflect.Value, tag reflect.StructTag) (str string, err error) {
|
||||
v = reflect.Indirect(v)
|
||||
if !v.IsValid() {
|
||||
return "", errValueNotSet
|
||||
}
|
||||
|
||||
var str string
|
||||
switch value := v.Interface().(type) {
|
||||
case string:
|
||||
str = value
|
||||
@@ -273,17 +272,19 @@ func convertType(v reflect.Value, tag reflect.StructTag) (string, error) {
|
||||
case time.Time:
|
||||
str = value.UTC().Format(RFC822)
|
||||
case aws.JSONValue:
|
||||
b, err := json.Marshal(value)
|
||||
if err != nil {
|
||||
return "", err
|
||||
if len(value) == 0 {
|
||||
return "", errValueNotSet
|
||||
}
|
||||
escaping := protocol.NoEscape
|
||||
if tag.Get("location") == "header" {
|
||||
str = base64.StdEncoding.EncodeToString(b)
|
||||
} else {
|
||||
str = string(b)
|
||||
escaping = protocol.Base64Escape
|
||||
}
|
||||
str, err = protocol.EncodeJSONValue(value, escaping)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("unable to encode JSONValue, %v", err)
|
||||
}
|
||||
default:
|
||||
err := fmt.Errorf("Unsupported value for param %v (%s)", v.Interface(), v.Type())
|
||||
err := fmt.Errorf("unsupported value for param %v (%s)", v.Interface(), v.Type())
|
||||
return "", err
|
||||
}
|
||||
return str, nil
|
||||
|
||||
+4
-10
@@ -3,7 +3,6 @@ package rest
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
@@ -16,6 +15,7 @@ import (
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/private/protocol"
|
||||
)
|
||||
|
||||
// UnmarshalHandler is a named request handler for unmarshaling rest protocol requests
|
||||
@@ -204,17 +204,11 @@ func unmarshalHeader(v reflect.Value, header string, tag reflect.StructTag) erro
|
||||
}
|
||||
v.Set(reflect.ValueOf(&t))
|
||||
case aws.JSONValue:
|
||||
b := []byte(header)
|
||||
var err error
|
||||
escaping := protocol.NoEscape
|
||||
if tag.Get("location") == "header" {
|
||||
b, err = base64.StdEncoding.DecodeString(header)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
escaping = protocol.Base64Escape
|
||||
}
|
||||
|
||||
m := aws.JSONValue{}
|
||||
err = json.Unmarshal(b, &m)
|
||||
m, err := protocol.DecodeJSONValue(header, escaping)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
+724
-115
File diff suppressed because it is too large
Load Diff
+711
-81
File diff suppressed because it is too large
Load Diff
+575
-109
File diff suppressed because it is too large
Load Diff
+772
-88
File diff suppressed because it is too large
Load Diff
Generated
Vendored
-66
@@ -1,66 +0,0 @@
|
||||
package xmlutil_test
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/awstesting/unit"
|
||||
"github.com/aws/aws-sdk-go/service/s3"
|
||||
)
|
||||
|
||||
func TestUnmarshal(t *testing.T) {
|
||||
xmlVal := []byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<AccessControlPolicy xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
||||
<Owner>
|
||||
<ID>foo-id</ID>
|
||||
<DisplayName>user</DisplayName>
|
||||
</Owner>
|
||||
<AccessControlList>
|
||||
<Grant>
|
||||
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="type">
|
||||
<ID>foo-id</ID>
|
||||
<DisplayName>user</DisplayName>
|
||||
</Grantee>
|
||||
<Permission>FULL_CONTROL</Permission>
|
||||
</Grant>
|
||||
</AccessControlList>
|
||||
</AccessControlPolicy>`)
|
||||
|
||||
var server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write(xmlVal)
|
||||
}))
|
||||
|
||||
sess := unit.Session
|
||||
sess.Config.Endpoint = &server.URL
|
||||
sess.Config.S3ForcePathStyle = aws.Bool(true)
|
||||
svc := s3.New(sess)
|
||||
|
||||
out, err := svc.GetBucketAcl(&s3.GetBucketAclInput{
|
||||
Bucket: aws.String("foo"),
|
||||
})
|
||||
|
||||
assert.NoError(t, err)
|
||||
|
||||
expected := &s3.GetBucketAclOutput{
|
||||
Grants: []*s3.Grant{
|
||||
{
|
||||
Grantee: &s3.Grantee{
|
||||
DisplayName: aws.String("user"),
|
||||
ID: aws.String("foo-id"),
|
||||
Type: aws.String("type"),
|
||||
},
|
||||
Permission: aws.String("FULL_CONTROL"),
|
||||
},
|
||||
},
|
||||
|
||||
Owner: &s3.Owner{
|
||||
DisplayName: aws.String("user"),
|
||||
ID: aws.String("foo-id"),
|
||||
},
|
||||
}
|
||||
assert.Equal(t, expected, out)
|
||||
}
|
||||
Reference in New Issue
Block a user