Update vendored deps, including AWS SDK, openpgp, ftp, ...

This commit is contained in:
Andrey Smirnov
2018-04-05 17:46:45 +03:00
parent cef4fefc40
commit 0e6ee35942
1497 changed files with 450721 additions and 68034 deletions
+459 -67
View File
@@ -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
View File
@@ -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)
}
}