(cloudwatch) update aws-sdk-go to v1.5.8 (#6658)
* (cloudwatch) upgrade aws-sdk-go v1.5.8 * (cloudwatch) remove non-required aws-sdk-go part * add go-ini
This commit is contained in:
committed by
Torkel Ödegaard
parent
50811c80ea
commit
51f80affe3
+1
-1
@@ -1,7 +1,7 @@
|
||||
// Package ec2query provides serialization of AWS EC2 requests and responses.
|
||||
package ec2query
|
||||
|
||||
//go:generate go run ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/ec2.json build_test.go
|
||||
//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/ec2.json build_test.go
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
|
||||
-85
@@ -1,85 +0,0 @@
|
||||
// +build bench
|
||||
|
||||
package ec2query_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/awstesting"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/ec2query"
|
||||
"github.com/aws/aws-sdk-go/service/ec2"
|
||||
)
|
||||
|
||||
func BenchmarkEC2QueryBuild_Complex_ec2AuthorizeSecurityGroupEgress(b *testing.B) {
|
||||
params := &ec2.AuthorizeSecurityGroupEgressInput{
|
||||
GroupId: aws.String("String"), // Required
|
||||
CidrIp: aws.String("String"),
|
||||
DryRun: aws.Bool(true),
|
||||
FromPort: aws.Int64(1),
|
||||
IpPermissions: []*ec2.IpPermission{
|
||||
{ // Required
|
||||
FromPort: aws.Int64(1),
|
||||
IpProtocol: aws.String("String"),
|
||||
IpRanges: []*ec2.IpRange{
|
||||
{ // Required
|
||||
CidrIp: aws.String("String"),
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
PrefixListIds: []*ec2.PrefixListId{
|
||||
{ // Required
|
||||
PrefixListId: aws.String("String"),
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
ToPort: aws.Int64(1),
|
||||
UserIdGroupPairs: []*ec2.UserIdGroupPair{
|
||||
{ // Required
|
||||
GroupId: aws.String("String"),
|
||||
GroupName: aws.String("String"),
|
||||
UserId: aws.String("String"),
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
IpProtocol: aws.String("String"),
|
||||
SourceSecurityGroupName: aws.String("String"),
|
||||
SourceSecurityGroupOwnerId: aws.String("String"),
|
||||
ToPort: aws.Int64(1),
|
||||
}
|
||||
|
||||
benchEC2QueryBuild(b, "AuthorizeSecurityGroupEgress", params)
|
||||
}
|
||||
|
||||
func BenchmarkEC2QueryBuild_Simple_ec2AttachNetworkInterface(b *testing.B) {
|
||||
params := &ec2.AttachNetworkInterfaceInput{
|
||||
DeviceIndex: aws.Int64(1), // Required
|
||||
InstanceId: aws.String("String"), // Required
|
||||
NetworkInterfaceId: aws.String("String"), // Required
|
||||
DryRun: aws.Bool(true),
|
||||
}
|
||||
|
||||
benchEC2QueryBuild(b, "AttachNetworkInterface", params)
|
||||
}
|
||||
|
||||
func benchEC2QueryBuild(b *testing.B, opName string, params interface{}) {
|
||||
svc := awstesting.NewClient()
|
||||
svc.ServiceName = "ec2"
|
||||
svc.APIVersion = "2015-04-15"
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
r := svc.NewRequest(&request.Operation{
|
||||
Name: opName,
|
||||
HTTPMethod: "POST",
|
||||
HTTPPath: "/",
|
||||
}, params, nil)
|
||||
ec2query.Build(r)
|
||||
if r.Error != nil {
|
||||
b.Fatal("Unexpected error", r.Error)
|
||||
}
|
||||
}
|
||||
}
|
||||
-1378
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -1,6 +1,6 @@
|
||||
package ec2query
|
||||
|
||||
//go:generate go run ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/ec2.json unmarshal_test.go
|
||||
//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/ec2.json unmarshal_test.go
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
|
||||
-1252
File diff suppressed because it is too large
Load Diff
-106
@@ -1,106 +0,0 @@
|
||||
package protocol_test
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/aws/aws-sdk-go/private/protocol"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestCanSetIdempotencyToken(t *testing.T) {
|
||||
cases := []struct {
|
||||
CanSet bool
|
||||
Case interface{}
|
||||
}{
|
||||
{
|
||||
true,
|
||||
struct {
|
||||
Field *string `idempotencyToken:"true"`
|
||||
}{},
|
||||
},
|
||||
{
|
||||
true,
|
||||
struct {
|
||||
Field string `idempotencyToken:"true"`
|
||||
}{},
|
||||
},
|
||||
{
|
||||
false,
|
||||
struct {
|
||||
Field *string `idempotencyToken:"true"`
|
||||
}{Field: new(string)},
|
||||
},
|
||||
{
|
||||
false,
|
||||
struct {
|
||||
Field string `idempotencyToken:"true"`
|
||||
}{Field: "value"},
|
||||
},
|
||||
{
|
||||
false,
|
||||
struct {
|
||||
Field *int `idempotencyToken:"true"`
|
||||
}{},
|
||||
},
|
||||
{
|
||||
false,
|
||||
struct {
|
||||
Field *string
|
||||
}{},
|
||||
},
|
||||
}
|
||||
|
||||
for i, c := range cases {
|
||||
v := reflect.Indirect(reflect.ValueOf(c.Case))
|
||||
ty := v.Type()
|
||||
canSet := protocol.CanSetIdempotencyToken(v.Field(0), ty.Field(0))
|
||||
assert.Equal(t, c.CanSet, canSet, "Expect case %d can set to match", i)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetIdempotencyToken(t *testing.T) {
|
||||
cases := []struct {
|
||||
Case interface{}
|
||||
}{
|
||||
{
|
||||
&struct {
|
||||
Field *string `idempotencyToken:"true"`
|
||||
}{},
|
||||
},
|
||||
{
|
||||
&struct {
|
||||
Field string `idempotencyToken:"true"`
|
||||
}{},
|
||||
},
|
||||
{
|
||||
&struct {
|
||||
Field *string `idempotencyToken:"true"`
|
||||
}{Field: new(string)},
|
||||
},
|
||||
{
|
||||
&struct {
|
||||
Field string `idempotencyToken:"true"`
|
||||
}{Field: ""},
|
||||
},
|
||||
}
|
||||
|
||||
for i, c := range cases {
|
||||
v := reflect.Indirect(reflect.ValueOf(c.Case))
|
||||
|
||||
protocol.SetIdempotencyToken(v.Field(0))
|
||||
assert.NotEmpty(t, v.Field(0).Interface(), "Expect case %d to be set", i)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUUIDVersion4(t *testing.T) {
|
||||
uuid := protocol.UUIDVersion4(make([]byte, 16))
|
||||
assert.Equal(t, `00000000-0000-4000-8000-000000000000`, uuid)
|
||||
|
||||
b := make([]byte, 16)
|
||||
for i := 0; i < len(b); i++ {
|
||||
b[i] = 1
|
||||
}
|
||||
uuid = protocol.UUIDVersion4(b)
|
||||
assert.Equal(t, `01010101-0101-4101-8101-010101010101`, uuid)
|
||||
}
|
||||
+1
-1
@@ -160,7 +160,7 @@ func (sv sortedValues) Less(i, j int) bool { return sv[i].String() < sv[j].Strin
|
||||
func buildMap(value reflect.Value, buf *bytes.Buffer, tag reflect.StructTag) error {
|
||||
buf.WriteString("{")
|
||||
|
||||
var sv sortedValues = value.MapKeys()
|
||||
sv := sortedValues(value.MapKeys())
|
||||
sort.Sort(sv)
|
||||
|
||||
for i, k := range sv {
|
||||
|
||||
-100
@@ -1,100 +0,0 @@
|
||||
package jsonutil_test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/private/protocol/json/jsonutil"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func S(s string) *string {
|
||||
return &s
|
||||
}
|
||||
|
||||
func D(s int64) *int64 {
|
||||
return &s
|
||||
}
|
||||
|
||||
func F(s float64) *float64 {
|
||||
return &s
|
||||
}
|
||||
|
||||
func T(s time.Time) *time.Time {
|
||||
return &s
|
||||
}
|
||||
|
||||
type J struct {
|
||||
S *string
|
||||
SS []string
|
||||
D *int64
|
||||
F *float64
|
||||
T *time.Time
|
||||
}
|
||||
|
||||
var jsonTests = []struct {
|
||||
in interface{}
|
||||
out string
|
||||
err string
|
||||
}{
|
||||
{
|
||||
J{},
|
||||
`{}`,
|
||||
``,
|
||||
},
|
||||
{
|
||||
J{
|
||||
S: S("str"),
|
||||
SS: []string{"A", "B", "C"},
|
||||
D: D(123),
|
||||
F: F(4.56),
|
||||
T: T(time.Unix(987, 0)),
|
||||
},
|
||||
`{"S":"str","SS":["A","B","C"],"D":123,"F":4.56,"T":987}`,
|
||||
``,
|
||||
},
|
||||
{
|
||||
J{
|
||||
S: S(`"''"`),
|
||||
},
|
||||
`{"S":"\"''\""}`,
|
||||
``,
|
||||
},
|
||||
{
|
||||
J{
|
||||
S: S("\x00føø\u00FF\n\\\"\r\t\b\f"),
|
||||
},
|
||||
`{"S":"\u0000føøÿ\n\\\"\r\t\b\f"}`,
|
||||
``,
|
||||
},
|
||||
}
|
||||
|
||||
func TestBuildJSON(t *testing.T) {
|
||||
for _, test := range jsonTests {
|
||||
out, err := jsonutil.BuildJSON(test.in)
|
||||
if test.err != "" {
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), test.err)
|
||||
} else {
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, string(out), test.out)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkBuildJSON(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
for _, test := range jsonTests {
|
||||
jsonutil.BuildJSON(test.in)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkStdlibJSON(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
for _, test := range jsonTests {
|
||||
json.Marshal(test.in)
|
||||
}
|
||||
}
|
||||
}
|
||||
-71
@@ -1,71 +0,0 @@
|
||||
// +build bench
|
||||
|
||||
package jsonrpc_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/awstesting"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/json/jsonutil"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
|
||||
"github.com/aws/aws-sdk-go/service/dynamodb"
|
||||
"github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute"
|
||||
)
|
||||
|
||||
func BenchmarkJSONRPCBuild_Simple_dynamodbPutItem(b *testing.B) {
|
||||
svc := awstesting.NewClient()
|
||||
|
||||
params := getDynamodbPutItemParams(b)
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
r := svc.NewRequest(&request.Operation{Name: "Operation"}, params, nil)
|
||||
jsonrpc.Build(r)
|
||||
if r.Error != nil {
|
||||
b.Fatal("Unexpected error", r.Error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkJSONUtilBuild_Simple_dynamodbPutItem(b *testing.B) {
|
||||
svc := awstesting.NewClient()
|
||||
|
||||
params := getDynamodbPutItemParams(b)
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
r := svc.NewRequest(&request.Operation{Name: "Operation"}, params, nil)
|
||||
_, err := jsonutil.BuildJSON(r.Params)
|
||||
if err != nil {
|
||||
b.Fatal("Unexpected error", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkEncodingJSONMarshal_Simple_dynamodbPutItem(b *testing.B) {
|
||||
params := getDynamodbPutItemParams(b)
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
buf := &bytes.Buffer{}
|
||||
encoder := json.NewEncoder(buf)
|
||||
if err := encoder.Encode(params); err != nil {
|
||||
b.Fatal("Unexpected error", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func getDynamodbPutItemParams(b *testing.B) *dynamodb.PutItemInput {
|
||||
av, err := dynamodbattribute.ConvertToMap(struct {
|
||||
Key string
|
||||
Data string
|
||||
}{Key: "MyKey", Data: "MyData"})
|
||||
if err != nil {
|
||||
b.Fatal("benchPutItem, expect no ConvertToMap errors", err)
|
||||
}
|
||||
return &dynamodb.PutItemInput{
|
||||
Item: av,
|
||||
TableName: aws.String("tablename"),
|
||||
}
|
||||
}
|
||||
-1637
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -2,8 +2,8 @@
|
||||
// requests and responses.
|
||||
package jsonrpc
|
||||
|
||||
//go:generate go run ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/json.json build_test.go
|
||||
//go:generate go run ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/json.json unmarshal_test.go
|
||||
//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/json.json build_test.go
|
||||
//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/json.json unmarshal_test.go
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
-967
@@ -1,967 +0,0 @@
|
||||
package jsonrpc_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/client"
|
||||
"github.com/aws/aws-sdk-go/aws/client/metadata"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/aws/signer/v4"
|
||||
"github.com/aws/aws-sdk-go/awstesting"
|
||||
"github.com/aws/aws-sdk-go/awstesting/unit"
|
||||
"github.com/aws/aws-sdk-go/private/protocol"
|
||||
"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
|
||||
var _ http.Request
|
||||
var _ json.Marshaler
|
||||
var _ time.Time
|
||||
var _ xmlutil.XMLNode
|
||||
var _ xml.Attr
|
||||
var _ = ioutil.Discard
|
||||
var _ = util.Trim("")
|
||||
var _ = url.Values{}
|
||||
var _ = io.EOF
|
||||
var _ = aws.String
|
||||
var _ = fmt.Println
|
||||
|
||||
func init() {
|
||||
protocol.RandReader = &awstesting.ZeroReader{}
|
||||
}
|
||||
|
||||
//The service client's operations are safe to be used concurrently.
|
||||
// It is not safe to mutate any of the client's properties though.
|
||||
type OutputService1ProtocolTest struct {
|
||||
*client.Client
|
||||
}
|
||||
|
||||
// New creates a new instance of the OutputService1ProtocolTest 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 OutputService1ProtocolTest client from just a session.
|
||||
// svc := outputservice1protocoltest.New(mySession)
|
||||
//
|
||||
// // Create a OutputService1ProtocolTest client with additional configuration
|
||||
// svc := outputservice1protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
|
||||
func NewOutputService1ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService1ProtocolTest {
|
||||
c := p.ClientConfig("outputservice1protocoltest", cfgs...)
|
||||
return newOutputService1ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
|
||||
}
|
||||
|
||||
// newClient creates, initializes and returns a new service client instance.
|
||||
func newOutputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService1ProtocolTest {
|
||||
svc := &OutputService1ProtocolTest{
|
||||
Client: client.New(
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: "outputservice1protocoltest",
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
APIVersion: "",
|
||||
JSONVersion: "",
|
||||
TargetPrefix: "",
|
||||
},
|
||||
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 OutputService1ProtocolTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *OutputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
|
||||
req := c.NewRequest(op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
const opOutputService1TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService1TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService1TestCaseOperation1 operation. The "output" return
|
||||
// value can be used to capture response data after the request's "Send" method
|
||||
// is called.
|
||||
//
|
||||
// Creating a request object using this method should be used when you want to inject
|
||||
// custom logic into the request's lifecycle using a custom handler, or if you want to
|
||||
// access properties on the request object before or after sending the request. If
|
||||
// you just want the service response, call the OutputService1TestCaseOperation1 method directly
|
||||
// instead.
|
||||
//
|
||||
// Note: You must call the "Send" method on the returned request object in order
|
||||
// to execute the request.
|
||||
//
|
||||
// // Example sending a request using the OutputService1TestCaseOperation1Request method.
|
||||
// req, resp := client.OutputService1TestCaseOperation1Request(params)
|
||||
//
|
||||
// err := req.Send()
|
||||
// if err == nil { // resp is now filled
|
||||
// fmt.Println(resp)
|
||||
// }
|
||||
//
|
||||
func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1Request(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (req *request.Request, output *OutputService1TestShapeOutputService1TestCaseOperation1Output) {
|
||||
op := &request.Operation{
|
||||
Name: opOutputService1TestCaseOperation1,
|
||||
HTTPPath: "/",
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &OutputService1TestShapeOutputService1TestCaseOperation1Input{}
|
||||
}
|
||||
|
||||
req = c.newRequest(op, input, output)
|
||||
output = &OutputService1TestShapeOutputService1TestCaseOperation1Output{}
|
||||
req.Data = output
|
||||
return
|
||||
}
|
||||
|
||||
func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (*OutputService1TestShapeOutputService1TestCaseOperation1Output, error) {
|
||||
req, out := c.OutputService1TestCaseOperation1Request(input)
|
||||
err := req.Send()
|
||||
return out, err
|
||||
}
|
||||
|
||||
type OutputService1TestShapeOutputService1TestCaseOperation1Input struct {
|
||||
_ struct{} `type:"structure"`
|
||||
}
|
||||
|
||||
type OutputService1TestShapeOutputService1TestCaseOperation1Output struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
Char *string `type:"character"`
|
||||
|
||||
Double *float64 `type:"double"`
|
||||
|
||||
FalseBool *bool `type:"boolean"`
|
||||
|
||||
Float *float64 `type:"float"`
|
||||
|
||||
Long *int64 `type:"long"`
|
||||
|
||||
Num *int64 `type:"integer"`
|
||||
|
||||
Str *string `type:"string"`
|
||||
|
||||
TrueBool *bool `type:"boolean"`
|
||||
}
|
||||
|
||||
//The service client's operations are safe to be used concurrently.
|
||||
// It is not safe to mutate any of the client's properties though.
|
||||
type OutputService2ProtocolTest struct {
|
||||
*client.Client
|
||||
}
|
||||
|
||||
// New creates a new instance of the OutputService2ProtocolTest 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 OutputService2ProtocolTest client from just a session.
|
||||
// svc := outputservice2protocoltest.New(mySession)
|
||||
//
|
||||
// // Create a OutputService2ProtocolTest client with additional configuration
|
||||
// svc := outputservice2protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
|
||||
func NewOutputService2ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService2ProtocolTest {
|
||||
c := p.ClientConfig("outputservice2protocoltest", cfgs...)
|
||||
return newOutputService2ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
|
||||
}
|
||||
|
||||
// newClient creates, initializes and returns a new service client instance.
|
||||
func newOutputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService2ProtocolTest {
|
||||
svc := &OutputService2ProtocolTest{
|
||||
Client: client.New(
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: "outputservice2protocoltest",
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
APIVersion: "",
|
||||
JSONVersion: "",
|
||||
TargetPrefix: "",
|
||||
},
|
||||
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 OutputService2ProtocolTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *OutputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
|
||||
req := c.NewRequest(op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
const opOutputService2TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService2TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService2TestCaseOperation1 operation. The "output" return
|
||||
// value can be used to capture response data after the request's "Send" method
|
||||
// is called.
|
||||
//
|
||||
// Creating a request object using this method should be used when you want to inject
|
||||
// custom logic into the request's lifecycle using a custom handler, or if you want to
|
||||
// access properties on the request object before or after sending the request. If
|
||||
// you just want the service response, call the OutputService2TestCaseOperation1 method directly
|
||||
// instead.
|
||||
//
|
||||
// Note: You must call the "Send" method on the returned request object in order
|
||||
// to execute the request.
|
||||
//
|
||||
// // Example sending a request using the OutputService2TestCaseOperation1Request method.
|
||||
// req, resp := client.OutputService2TestCaseOperation1Request(params)
|
||||
//
|
||||
// err := req.Send()
|
||||
// if err == nil { // resp is now filled
|
||||
// fmt.Println(resp)
|
||||
// }
|
||||
//
|
||||
func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1Request(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (req *request.Request, output *OutputService2TestShapeOutputService2TestCaseOperation1Output) {
|
||||
op := &request.Operation{
|
||||
Name: opOutputService2TestCaseOperation1,
|
||||
HTTPPath: "/",
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &OutputService2TestShapeOutputService2TestCaseOperation1Input{}
|
||||
}
|
||||
|
||||
req = c.newRequest(op, input, output)
|
||||
output = &OutputService2TestShapeOutputService2TestCaseOperation1Output{}
|
||||
req.Data = output
|
||||
return
|
||||
}
|
||||
|
||||
func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (*OutputService2TestShapeOutputService2TestCaseOperation1Output, error) {
|
||||
req, out := c.OutputService2TestCaseOperation1Request(input)
|
||||
err := req.Send()
|
||||
return out, err
|
||||
}
|
||||
|
||||
type OutputService2TestShapeBlobContainer struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
// Foo is automatically base64 encoded/decoded by the SDK.
|
||||
Foo []byte `locationName:"foo" type:"blob"`
|
||||
}
|
||||
|
||||
type OutputService2TestShapeOutputService2TestCaseOperation1Input struct {
|
||||
_ struct{} `type:"structure"`
|
||||
}
|
||||
|
||||
type OutputService2TestShapeOutputService2TestCaseOperation1Output struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
// BlobMember is automatically base64 encoded/decoded by the SDK.
|
||||
BlobMember []byte `type:"blob"`
|
||||
|
||||
StructMember *OutputService2TestShapeBlobContainer `type:"structure"`
|
||||
}
|
||||
|
||||
//The service client's operations are safe to be used concurrently.
|
||||
// It is not safe to mutate any of the client's properties though.
|
||||
type OutputService3ProtocolTest struct {
|
||||
*client.Client
|
||||
}
|
||||
|
||||
// New creates a new instance of the OutputService3ProtocolTest 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 OutputService3ProtocolTest client from just a session.
|
||||
// svc := outputservice3protocoltest.New(mySession)
|
||||
//
|
||||
// // Create a OutputService3ProtocolTest client with additional configuration
|
||||
// svc := outputservice3protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
|
||||
func NewOutputService3ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService3ProtocolTest {
|
||||
c := p.ClientConfig("outputservice3protocoltest", cfgs...)
|
||||
return newOutputService3ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
|
||||
}
|
||||
|
||||
// newClient creates, initializes and returns a new service client instance.
|
||||
func newOutputService3ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService3ProtocolTest {
|
||||
svc := &OutputService3ProtocolTest{
|
||||
Client: client.New(
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: "outputservice3protocoltest",
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
APIVersion: "",
|
||||
JSONVersion: "",
|
||||
TargetPrefix: "",
|
||||
},
|
||||
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 OutputService3ProtocolTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *OutputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
|
||||
req := c.NewRequest(op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
const opOutputService3TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService3TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService3TestCaseOperation1 operation. The "output" return
|
||||
// value can be used to capture response data after the request's "Send" method
|
||||
// is called.
|
||||
//
|
||||
// Creating a request object using this method should be used when you want to inject
|
||||
// custom logic into the request's lifecycle using a custom handler, or if you want to
|
||||
// access properties on the request object before or after sending the request. If
|
||||
// you just want the service response, call the OutputService3TestCaseOperation1 method directly
|
||||
// instead.
|
||||
//
|
||||
// Note: You must call the "Send" method on the returned request object in order
|
||||
// to execute the request.
|
||||
//
|
||||
// // Example sending a request using the OutputService3TestCaseOperation1Request method.
|
||||
// req, resp := client.OutputService3TestCaseOperation1Request(params)
|
||||
//
|
||||
// err := req.Send()
|
||||
// if err == nil { // resp is now filled
|
||||
// fmt.Println(resp)
|
||||
// }
|
||||
//
|
||||
func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1Request(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (req *request.Request, output *OutputService3TestShapeOutputService3TestCaseOperation1Output) {
|
||||
op := &request.Operation{
|
||||
Name: opOutputService3TestCaseOperation1,
|
||||
HTTPPath: "/",
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &OutputService3TestShapeOutputService3TestCaseOperation1Input{}
|
||||
}
|
||||
|
||||
req = c.newRequest(op, input, output)
|
||||
output = &OutputService3TestShapeOutputService3TestCaseOperation1Output{}
|
||||
req.Data = output
|
||||
return
|
||||
}
|
||||
|
||||
func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (*OutputService3TestShapeOutputService3TestCaseOperation1Output, error) {
|
||||
req, out := c.OutputService3TestCaseOperation1Request(input)
|
||||
err := req.Send()
|
||||
return out, err
|
||||
}
|
||||
|
||||
type OutputService3TestShapeOutputService3TestCaseOperation1Input struct {
|
||||
_ struct{} `type:"structure"`
|
||||
}
|
||||
|
||||
type OutputService3TestShapeOutputService3TestCaseOperation1Output struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
StructMember *OutputService3TestShapeTimeContainer `type:"structure"`
|
||||
|
||||
TimeMember *time.Time `type:"timestamp" timestampFormat:"unix"`
|
||||
}
|
||||
|
||||
type OutputService3TestShapeTimeContainer struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
Foo *time.Time `locationName:"foo" type:"timestamp" timestampFormat:"unix"`
|
||||
}
|
||||
|
||||
//The service client's operations are safe to be used concurrently.
|
||||
// It is not safe to mutate any of the client's properties though.
|
||||
type OutputService4ProtocolTest struct {
|
||||
*client.Client
|
||||
}
|
||||
|
||||
// New creates a new instance of the OutputService4ProtocolTest 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 OutputService4ProtocolTest client from just a session.
|
||||
// svc := outputservice4protocoltest.New(mySession)
|
||||
//
|
||||
// // Create a OutputService4ProtocolTest client with additional configuration
|
||||
// svc := outputservice4protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
|
||||
func NewOutputService4ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService4ProtocolTest {
|
||||
c := p.ClientConfig("outputservice4protocoltest", cfgs...)
|
||||
return newOutputService4ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
|
||||
}
|
||||
|
||||
// newClient creates, initializes and returns a new service client instance.
|
||||
func newOutputService4ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService4ProtocolTest {
|
||||
svc := &OutputService4ProtocolTest{
|
||||
Client: client.New(
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: "outputservice4protocoltest",
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
APIVersion: "",
|
||||
JSONVersion: "",
|
||||
TargetPrefix: "",
|
||||
},
|
||||
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 OutputService4ProtocolTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *OutputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
|
||||
req := c.NewRequest(op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
const opOutputService4TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService4TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService4TestCaseOperation1 operation. The "output" return
|
||||
// value can be used to capture response data after the request's "Send" method
|
||||
// is called.
|
||||
//
|
||||
// Creating a request object using this method should be used when you want to inject
|
||||
// custom logic into the request's lifecycle using a custom handler, or if you want to
|
||||
// access properties on the request object before or after sending the request. If
|
||||
// you just want the service response, call the OutputService4TestCaseOperation1 method directly
|
||||
// instead.
|
||||
//
|
||||
// Note: You must call the "Send" method on the returned request object in order
|
||||
// to execute the request.
|
||||
//
|
||||
// // Example sending a request using the OutputService4TestCaseOperation1Request method.
|
||||
// req, resp := client.OutputService4TestCaseOperation1Request(params)
|
||||
//
|
||||
// err := req.Send()
|
||||
// if err == nil { // resp is now filled
|
||||
// fmt.Println(resp)
|
||||
// }
|
||||
//
|
||||
func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1Request(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (req *request.Request, output *OutputService4TestShapeOutputShape) {
|
||||
op := &request.Operation{
|
||||
Name: opOutputService4TestCaseOperation1,
|
||||
HTTPPath: "/",
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &OutputService4TestShapeOutputService4TestCaseOperation1Input{}
|
||||
}
|
||||
|
||||
req = c.newRequest(op, input, output)
|
||||
output = &OutputService4TestShapeOutputShape{}
|
||||
req.Data = output
|
||||
return
|
||||
}
|
||||
|
||||
func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (*OutputService4TestShapeOutputShape, error) {
|
||||
req, out := c.OutputService4TestCaseOperation1Request(input)
|
||||
err := req.Send()
|
||||
return out, err
|
||||
}
|
||||
|
||||
const opOutputService4TestCaseOperation2 = "OperationName"
|
||||
|
||||
// OutputService4TestCaseOperation2Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService4TestCaseOperation2 operation. The "output" return
|
||||
// value can be used to capture response data after the request's "Send" method
|
||||
// is called.
|
||||
//
|
||||
// Creating a request object using this method should be used when you want to inject
|
||||
// custom logic into the request's lifecycle using a custom handler, or if you want to
|
||||
// access properties on the request object before or after sending the request. If
|
||||
// you just want the service response, call the OutputService4TestCaseOperation2 method directly
|
||||
// instead.
|
||||
//
|
||||
// Note: You must call the "Send" method on the returned request object in order
|
||||
// to execute the request.
|
||||
//
|
||||
// // Example sending a request using the OutputService4TestCaseOperation2Request method.
|
||||
// req, resp := client.OutputService4TestCaseOperation2Request(params)
|
||||
//
|
||||
// err := req.Send()
|
||||
// if err == nil { // resp is now filled
|
||||
// fmt.Println(resp)
|
||||
// }
|
||||
//
|
||||
func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation2Request(input *OutputService4TestShapeOutputService4TestCaseOperation2Input) (req *request.Request, output *OutputService4TestShapeOutputShape) {
|
||||
op := &request.Operation{
|
||||
Name: opOutputService4TestCaseOperation2,
|
||||
HTTPPath: "/",
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &OutputService4TestShapeOutputService4TestCaseOperation2Input{}
|
||||
}
|
||||
|
||||
req = c.newRequest(op, input, output)
|
||||
output = &OutputService4TestShapeOutputShape{}
|
||||
req.Data = output
|
||||
return
|
||||
}
|
||||
|
||||
func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation2(input *OutputService4TestShapeOutputService4TestCaseOperation2Input) (*OutputService4TestShapeOutputShape, error) {
|
||||
req, out := c.OutputService4TestCaseOperation2Request(input)
|
||||
err := req.Send()
|
||||
return out, err
|
||||
}
|
||||
|
||||
type OutputService4TestShapeOutputService4TestCaseOperation1Input struct {
|
||||
_ struct{} `type:"structure"`
|
||||
}
|
||||
|
||||
type OutputService4TestShapeOutputService4TestCaseOperation2Input struct {
|
||||
_ struct{} `type:"structure"`
|
||||
}
|
||||
|
||||
type OutputService4TestShapeOutputShape struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
ListMember []*string `type:"list"`
|
||||
|
||||
ListMemberMap []map[string]*string `type:"list"`
|
||||
|
||||
ListMemberStruct []*OutputService4TestShapeStructType `type:"list"`
|
||||
}
|
||||
|
||||
type OutputService4TestShapeStructType struct {
|
||||
_ struct{} `type:"structure"`
|
||||
}
|
||||
|
||||
//The service client's operations are safe to be used concurrently.
|
||||
// It is not safe to mutate any of the client's properties though.
|
||||
type OutputService5ProtocolTest struct {
|
||||
*client.Client
|
||||
}
|
||||
|
||||
// New creates a new instance of the OutputService5ProtocolTest 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 OutputService5ProtocolTest client from just a session.
|
||||
// svc := outputservice5protocoltest.New(mySession)
|
||||
//
|
||||
// // Create a OutputService5ProtocolTest client with additional configuration
|
||||
// svc := outputservice5protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
|
||||
func NewOutputService5ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService5ProtocolTest {
|
||||
c := p.ClientConfig("outputservice5protocoltest", cfgs...)
|
||||
return newOutputService5ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
|
||||
}
|
||||
|
||||
// newClient creates, initializes and returns a new service client instance.
|
||||
func newOutputService5ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService5ProtocolTest {
|
||||
svc := &OutputService5ProtocolTest{
|
||||
Client: client.New(
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: "outputservice5protocoltest",
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
APIVersion: "",
|
||||
JSONVersion: "",
|
||||
TargetPrefix: "",
|
||||
},
|
||||
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 OutputService5ProtocolTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *OutputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
|
||||
req := c.NewRequest(op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
const opOutputService5TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService5TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService5TestCaseOperation1 operation. The "output" return
|
||||
// value can be used to capture response data after the request's "Send" method
|
||||
// is called.
|
||||
//
|
||||
// Creating a request object using this method should be used when you want to inject
|
||||
// custom logic into the request's lifecycle using a custom handler, or if you want to
|
||||
// access properties on the request object before or after sending the request. If
|
||||
// you just want the service response, call the OutputService5TestCaseOperation1 method directly
|
||||
// instead.
|
||||
//
|
||||
// Note: You must call the "Send" method on the returned request object in order
|
||||
// to execute the request.
|
||||
//
|
||||
// // Example sending a request using the OutputService5TestCaseOperation1Request method.
|
||||
// req, resp := client.OutputService5TestCaseOperation1Request(params)
|
||||
//
|
||||
// err := req.Send()
|
||||
// if err == nil { // resp is now filled
|
||||
// fmt.Println(resp)
|
||||
// }
|
||||
//
|
||||
func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1Request(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (req *request.Request, output *OutputService5TestShapeOutputService5TestCaseOperation1Output) {
|
||||
op := &request.Operation{
|
||||
Name: opOutputService5TestCaseOperation1,
|
||||
HTTPPath: "/",
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &OutputService5TestShapeOutputService5TestCaseOperation1Input{}
|
||||
}
|
||||
|
||||
req = c.newRequest(op, input, output)
|
||||
output = &OutputService5TestShapeOutputService5TestCaseOperation1Output{}
|
||||
req.Data = output
|
||||
return
|
||||
}
|
||||
|
||||
func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (*OutputService5TestShapeOutputService5TestCaseOperation1Output, error) {
|
||||
req, out := c.OutputService5TestCaseOperation1Request(input)
|
||||
err := req.Send()
|
||||
return out, err
|
||||
}
|
||||
|
||||
type OutputService5TestShapeOutputService5TestCaseOperation1Input struct {
|
||||
_ struct{} `type:"structure"`
|
||||
}
|
||||
|
||||
type OutputService5TestShapeOutputService5TestCaseOperation1Output struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
MapMember map[string][]*int64 `type:"map"`
|
||||
}
|
||||
|
||||
//The service client's operations are safe to be used concurrently.
|
||||
// It is not safe to mutate any of the client's properties though.
|
||||
type OutputService6ProtocolTest struct {
|
||||
*client.Client
|
||||
}
|
||||
|
||||
// New creates a new instance of the OutputService6ProtocolTest 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 OutputService6ProtocolTest client from just a session.
|
||||
// svc := outputservice6protocoltest.New(mySession)
|
||||
//
|
||||
// // Create a OutputService6ProtocolTest client with additional configuration
|
||||
// svc := outputservice6protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
|
||||
func NewOutputService6ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService6ProtocolTest {
|
||||
c := p.ClientConfig("outputservice6protocoltest", cfgs...)
|
||||
return newOutputService6ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
|
||||
}
|
||||
|
||||
// newClient creates, initializes and returns a new service client instance.
|
||||
func newOutputService6ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService6ProtocolTest {
|
||||
svc := &OutputService6ProtocolTest{
|
||||
Client: client.New(
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: "outputservice6protocoltest",
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
APIVersion: "",
|
||||
JSONVersion: "",
|
||||
TargetPrefix: "",
|
||||
},
|
||||
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 OutputService6ProtocolTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *OutputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
|
||||
req := c.NewRequest(op, params, data)
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
const opOutputService6TestCaseOperation1 = "OperationName"
|
||||
|
||||
// OutputService6TestCaseOperation1Request generates a "aws/request.Request" representing the
|
||||
// client's request for the OutputService6TestCaseOperation1 operation. The "output" return
|
||||
// value can be used to capture response data after the request's "Send" method
|
||||
// is called.
|
||||
//
|
||||
// Creating a request object using this method should be used when you want to inject
|
||||
// custom logic into the request's lifecycle using a custom handler, or if you want to
|
||||
// access properties on the request object before or after sending the request. If
|
||||
// you just want the service response, call the OutputService6TestCaseOperation1 method directly
|
||||
// instead.
|
||||
//
|
||||
// Note: You must call the "Send" method on the returned request object in order
|
||||
// to execute the request.
|
||||
//
|
||||
// // Example sending a request using the OutputService6TestCaseOperation1Request method.
|
||||
// req, resp := client.OutputService6TestCaseOperation1Request(params)
|
||||
//
|
||||
// err := req.Send()
|
||||
// if err == nil { // resp is now filled
|
||||
// fmt.Println(resp)
|
||||
// }
|
||||
//
|
||||
func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1Request(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (req *request.Request, output *OutputService6TestShapeOutputService6TestCaseOperation1Output) {
|
||||
op := &request.Operation{
|
||||
Name: opOutputService6TestCaseOperation1,
|
||||
HTTPPath: "/",
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &OutputService6TestShapeOutputService6TestCaseOperation1Input{}
|
||||
}
|
||||
|
||||
req = c.newRequest(op, input, output)
|
||||
output = &OutputService6TestShapeOutputService6TestCaseOperation1Output{}
|
||||
req.Data = output
|
||||
return
|
||||
}
|
||||
|
||||
func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (*OutputService6TestShapeOutputService6TestCaseOperation1Output, error) {
|
||||
req, out := c.OutputService6TestCaseOperation1Request(input)
|
||||
err := req.Send()
|
||||
return out, err
|
||||
}
|
||||
|
||||
type OutputService6TestShapeOutputService6TestCaseOperation1Input struct {
|
||||
_ struct{} `type:"structure"`
|
||||
}
|
||||
|
||||
type OutputService6TestShapeOutputService6TestCaseOperation1Output struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
StrType *string `type:"string"`
|
||||
}
|
||||
|
||||
//
|
||||
// Tests begin here
|
||||
//
|
||||
|
||||
func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) {
|
||||
svc := NewOutputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
|
||||
|
||||
buf := bytes.NewReader([]byte("{\"Str\": \"myname\", \"Num\": 123, \"FalseBool\": false, \"TrueBool\": true, \"Float\": 1.2, \"Double\": 1.3, \"Long\": 200, \"Char\": \"a\"}"))
|
||||
req, out := svc.OutputService1TestCaseOperation1Request(nil)
|
||||
req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
|
||||
|
||||
// set headers
|
||||
|
||||
// unmarshal response
|
||||
jsonrpc.UnmarshalMeta(req)
|
||||
jsonrpc.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
assert.Equal(t, "a", *out.Char)
|
||||
assert.Equal(t, 1.3, *out.Double)
|
||||
assert.Equal(t, false, *out.FalseBool)
|
||||
assert.Equal(t, 1.2, *out.Float)
|
||||
assert.Equal(t, int64(200), *out.Long)
|
||||
assert.Equal(t, int64(123), *out.Num)
|
||||
assert.Equal(t, "myname", *out.Str)
|
||||
assert.Equal(t, true, *out.TrueBool)
|
||||
|
||||
}
|
||||
|
||||
func TestOutputService2ProtocolTestBlobMembersCase1(t *testing.T) {
|
||||
svc := NewOutputService2ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
|
||||
|
||||
buf := bytes.NewReader([]byte("{\"BlobMember\": \"aGkh\", \"StructMember\": {\"foo\": \"dGhlcmUh\"}}"))
|
||||
req, out := svc.OutputService2TestCaseOperation1Request(nil)
|
||||
req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
|
||||
|
||||
// set headers
|
||||
|
||||
// unmarshal response
|
||||
jsonrpc.UnmarshalMeta(req)
|
||||
jsonrpc.Unmarshal(req)
|
||||
assert.NoError(t, 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))
|
||||
|
||||
}
|
||||
|
||||
func TestOutputService3ProtocolTestTimestampMembersCase1(t *testing.T) {
|
||||
svc := NewOutputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
|
||||
|
||||
buf := bytes.NewReader([]byte("{\"TimeMember\": 1398796238, \"StructMember\": {\"foo\": 1398796238}}"))
|
||||
req, out := svc.OutputService3TestCaseOperation1Request(nil)
|
||||
req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
|
||||
|
||||
// set headers
|
||||
|
||||
// unmarshal response
|
||||
jsonrpc.UnmarshalMeta(req)
|
||||
jsonrpc.Unmarshal(req)
|
||||
assert.NoError(t, 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())
|
||||
|
||||
}
|
||||
|
||||
func TestOutputService4ProtocolTestListsCase1(t *testing.T) {
|
||||
svc := NewOutputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
|
||||
|
||||
buf := bytes.NewReader([]byte("{\"ListMember\": [\"a\", \"b\"]}"))
|
||||
req, out := svc.OutputService4TestCaseOperation1Request(nil)
|
||||
req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
|
||||
|
||||
// set headers
|
||||
|
||||
// unmarshal response
|
||||
jsonrpc.UnmarshalMeta(req)
|
||||
jsonrpc.Unmarshal(req)
|
||||
assert.NoError(t, 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])
|
||||
|
||||
}
|
||||
|
||||
func TestOutputService4ProtocolTestListsCase2(t *testing.T) {
|
||||
svc := NewOutputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
|
||||
|
||||
buf := bytes.NewReader([]byte("{\"ListMember\": [\"a\", null], \"ListMemberMap\": [{}, null, null, {}], \"ListMemberStruct\": [{}, null, null, {}]}"))
|
||||
req, out := svc.OutputService4TestCaseOperation2Request(nil)
|
||||
req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
|
||||
|
||||
// set headers
|
||||
|
||||
// unmarshal response
|
||||
jsonrpc.UnmarshalMeta(req)
|
||||
jsonrpc.Unmarshal(req)
|
||||
assert.NoError(t, 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])
|
||||
|
||||
}
|
||||
|
||||
func TestOutputService5ProtocolTestMapsCase1(t *testing.T) {
|
||||
svc := NewOutputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
|
||||
|
||||
buf := bytes.NewReader([]byte("{\"MapMember\": {\"a\": [1, 2], \"b\": [3, 4]}}"))
|
||||
req, out := svc.OutputService5TestCaseOperation1Request(nil)
|
||||
req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
|
||||
|
||||
// set headers
|
||||
|
||||
// unmarshal response
|
||||
jsonrpc.UnmarshalMeta(req)
|
||||
jsonrpc.Unmarshal(req)
|
||||
assert.NoError(t, 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])
|
||||
|
||||
}
|
||||
|
||||
func TestOutputService6ProtocolTestIgnoresExtraDataCase1(t *testing.T) {
|
||||
svc := NewOutputService6ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
|
||||
|
||||
buf := bytes.NewReader([]byte("{\"foo\": \"bar\"}"))
|
||||
req, out := svc.OutputService6TestCaseOperation1Request(nil)
|
||||
req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
|
||||
|
||||
// set headers
|
||||
|
||||
// unmarshal response
|
||||
jsonrpc.UnmarshalMeta(req)
|
||||
jsonrpc.Unmarshal(req)
|
||||
assert.NoError(t, req.Error)
|
||||
|
||||
// assert response
|
||||
assert.NotNil(t, out) // ensure out variable is used
|
||||
|
||||
}
|
||||
-203
@@ -1,203 +0,0 @@
|
||||
package protocol_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws/client/metadata"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/awstesting"
|
||||
"github.com/aws/aws-sdk-go/private/protocol"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/ec2query"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/query"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/rest"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/restjson"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/restxml"
|
||||
)
|
||||
|
||||
func xmlData(set bool, b []byte, size, delta int) {
|
||||
if !set {
|
||||
copy(b, []byte("<B><A>"))
|
||||
}
|
||||
if size == 0 {
|
||||
copy(b[delta-len("</B></A>"):], []byte("</B></A>"))
|
||||
}
|
||||
}
|
||||
|
||||
func jsonData(set bool, b []byte, size, delta int) {
|
||||
if !set {
|
||||
copy(b, []byte("{\"A\": \""))
|
||||
}
|
||||
if size == 0 {
|
||||
copy(b[delta-len("\"}"):], []byte("\"}"))
|
||||
}
|
||||
}
|
||||
|
||||
func buildNewRequest(data interface{}) *request.Request {
|
||||
v := url.Values{}
|
||||
v.Set("test", "TEST")
|
||||
v.Add("test1", "TEST1")
|
||||
|
||||
req := &request.Request{
|
||||
HTTPRequest: &http.Request{
|
||||
Header: make(http.Header),
|
||||
Body: &awstesting.ReadCloser{Size: 2048},
|
||||
URL: &url.URL{
|
||||
RawQuery: v.Encode(),
|
||||
},
|
||||
},
|
||||
Params: &struct {
|
||||
LocationName string `locationName:"test"`
|
||||
}{
|
||||
"Test",
|
||||
},
|
||||
ClientInfo: metadata.ClientInfo{
|
||||
ServiceName: "test",
|
||||
TargetPrefix: "test",
|
||||
JSONVersion: "test",
|
||||
APIVersion: "test",
|
||||
Endpoint: "test",
|
||||
SigningName: "test",
|
||||
SigningRegion: "test",
|
||||
},
|
||||
Operation: &request.Operation{
|
||||
Name: "test",
|
||||
},
|
||||
}
|
||||
req.HTTPResponse = &http.Response{
|
||||
Body: &awstesting.ReadCloser{Size: 2048},
|
||||
Header: http.Header{
|
||||
"X-Amzn-Requestid": []string{"1"},
|
||||
},
|
||||
StatusCode: http.StatusOK,
|
||||
}
|
||||
|
||||
if data == nil {
|
||||
data = &struct {
|
||||
_ struct{} `type:"structure"`
|
||||
LocationName *string `locationName:"testName"`
|
||||
Location *string `location:"statusCode"`
|
||||
A *string `type:"string"`
|
||||
}{}
|
||||
}
|
||||
|
||||
req.Data = data
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
type expected struct {
|
||||
dataType int
|
||||
closed bool
|
||||
size int
|
||||
errExists bool
|
||||
}
|
||||
|
||||
const (
|
||||
jsonType = iota
|
||||
xmlType
|
||||
)
|
||||
|
||||
func checkForLeak(data interface{}, build, fn func(*request.Request), t *testing.T, result expected) {
|
||||
req := buildNewRequest(data)
|
||||
reader := req.HTTPResponse.Body.(*awstesting.ReadCloser)
|
||||
switch result.dataType {
|
||||
case jsonType:
|
||||
reader.FillData = jsonData
|
||||
case xmlType:
|
||||
reader.FillData = xmlData
|
||||
}
|
||||
build(req)
|
||||
fn(req)
|
||||
|
||||
if result.errExists {
|
||||
assert.NotNil(t, req.Error)
|
||||
} else {
|
||||
fmt.Println(req.Error)
|
||||
assert.Nil(t, req.Error)
|
||||
}
|
||||
|
||||
assert.Equal(t, reader.Closed, result.closed)
|
||||
assert.Equal(t, reader.Size, result.size)
|
||||
}
|
||||
|
||||
func TestJSONRpc(t *testing.T) {
|
||||
checkForLeak(nil, jsonrpc.Build, jsonrpc.Unmarshal, t, expected{jsonType, true, 0, false})
|
||||
checkForLeak(nil, jsonrpc.Build, jsonrpc.UnmarshalMeta, t, expected{jsonType, false, 2048, false})
|
||||
checkForLeak(nil, jsonrpc.Build, jsonrpc.UnmarshalError, t, expected{jsonType, true, 0, true})
|
||||
}
|
||||
|
||||
func TestQuery(t *testing.T) {
|
||||
checkForLeak(nil, query.Build, query.Unmarshal, t, expected{jsonType, true, 0, false})
|
||||
checkForLeak(nil, query.Build, query.UnmarshalMeta, t, expected{jsonType, false, 2048, false})
|
||||
checkForLeak(nil, query.Build, query.UnmarshalError, t, expected{jsonType, true, 0, true})
|
||||
}
|
||||
|
||||
func TestRest(t *testing.T) {
|
||||
// case 1: Payload io.ReadSeeker
|
||||
checkForLeak(nil, rest.Build, rest.Unmarshal, t, expected{jsonType, false, 2048, false})
|
||||
checkForLeak(nil, query.Build, query.UnmarshalMeta, t, expected{jsonType, false, 2048, false})
|
||||
|
||||
// case 2: Payload *string
|
||||
// should close the body
|
||||
dataStr := struct {
|
||||
_ struct{} `type:"structure" payload:"Payload"`
|
||||
LocationName *string `locationName:"testName"`
|
||||
Location *string `location:"statusCode"`
|
||||
A *string `type:"string"`
|
||||
Payload *string `locationName:"payload" type:"blob" required:"true"`
|
||||
}{}
|
||||
checkForLeak(&dataStr, rest.Build, rest.Unmarshal, t, expected{jsonType, true, 0, false})
|
||||
checkForLeak(&dataStr, query.Build, query.UnmarshalMeta, t, expected{jsonType, false, 2048, false})
|
||||
|
||||
// case 3: Payload []byte
|
||||
// should close the body
|
||||
dataBytes := struct {
|
||||
_ struct{} `type:"structure" payload:"Payload"`
|
||||
LocationName *string `locationName:"testName"`
|
||||
Location *string `location:"statusCode"`
|
||||
A *string `type:"string"`
|
||||
Payload []byte `locationName:"payload" type:"blob" required:"true"`
|
||||
}{}
|
||||
checkForLeak(&dataBytes, rest.Build, rest.Unmarshal, t, expected{jsonType, true, 0, false})
|
||||
checkForLeak(&dataBytes, query.Build, query.UnmarshalMeta, t, expected{jsonType, false, 2048, false})
|
||||
|
||||
// case 4: Payload unsupported type
|
||||
// should close the body
|
||||
dataUnsupported := struct {
|
||||
_ struct{} `type:"structure" payload:"Payload"`
|
||||
LocationName *string `locationName:"testName"`
|
||||
Location *string `location:"statusCode"`
|
||||
A *string `type:"string"`
|
||||
Payload string `locationName:"payload" type:"blob" required:"true"`
|
||||
}{}
|
||||
checkForLeak(&dataUnsupported, rest.Build, rest.Unmarshal, t, expected{jsonType, true, 0, true})
|
||||
checkForLeak(&dataUnsupported, query.Build, query.UnmarshalMeta, t, expected{jsonType, false, 2048, false})
|
||||
}
|
||||
|
||||
func TestRestJSON(t *testing.T) {
|
||||
checkForLeak(nil, restjson.Build, restjson.Unmarshal, t, expected{jsonType, true, 0, false})
|
||||
checkForLeak(nil, restjson.Build, restjson.UnmarshalMeta, t, expected{jsonType, false, 2048, false})
|
||||
checkForLeak(nil, restjson.Build, restjson.UnmarshalError, t, expected{jsonType, true, 0, true})
|
||||
}
|
||||
|
||||
func TestRestXML(t *testing.T) {
|
||||
checkForLeak(nil, restxml.Build, restxml.Unmarshal, t, expected{xmlType, true, 0, false})
|
||||
checkForLeak(nil, restxml.Build, restxml.UnmarshalMeta, t, expected{xmlType, false, 2048, false})
|
||||
checkForLeak(nil, restxml.Build, restxml.UnmarshalError, t, expected{xmlType, true, 0, true})
|
||||
}
|
||||
|
||||
func TestXML(t *testing.T) {
|
||||
checkForLeak(nil, ec2query.Build, ec2query.Unmarshal, t, expected{jsonType, true, 0, false})
|
||||
checkForLeak(nil, ec2query.Build, ec2query.UnmarshalMeta, t, expected{jsonType, false, 2048, false})
|
||||
checkForLeak(nil, ec2query.Build, ec2query.UnmarshalError, t, expected{jsonType, true, 0, true})
|
||||
}
|
||||
|
||||
func TestProtocol(t *testing.T) {
|
||||
checkForLeak(nil, restxml.Build, protocol.UnmarshalDiscardBody, t, expected{xmlType, true, 0, false})
|
||||
}
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// Package query provides serialization of AWS query requests, and responses.
|
||||
package query
|
||||
|
||||
//go:generate go run ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/query.json build_test.go
|
||||
//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/query.json build_test.go
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
|
||||
-2680
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -1,6 +1,6 @@
|
||||
package query
|
||||
|
||||
//go:generate go run ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/query.json unmarshal_test.go
|
||||
//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/query.json unmarshal_test.go
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
|
||||
-2068
File diff suppressed because it is too large
Load Diff
+6
-3
@@ -14,6 +14,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
)
|
||||
@@ -92,7 +93,7 @@ func buildLocationElements(r *request.Request, v reflect.Value) {
|
||||
}
|
||||
|
||||
r.HTTPRequest.URL.RawQuery = query.Encode()
|
||||
updatePath(r.HTTPRequest.URL, r.HTTPRequest.URL.Path)
|
||||
updatePath(r.HTTPRequest.URL, r.HTTPRequest.URL.Path, aws.BoolValue(r.Config.DisableRestProtocolURICleaning))
|
||||
}
|
||||
|
||||
func buildBody(r *request.Request, v reflect.Value) {
|
||||
@@ -193,13 +194,15 @@ func buildQueryString(query url.Values, v reflect.Value, name string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func updatePath(url *url.URL, urlPath string) {
|
||||
func updatePath(url *url.URL, urlPath string, disableRestProtocolURICleaning bool) {
|
||||
scheme, query := url.Scheme, url.RawQuery
|
||||
|
||||
hasSlash := strings.HasSuffix(urlPath, "/")
|
||||
|
||||
// clean up path
|
||||
urlPath = path.Clean(urlPath)
|
||||
if !disableRestProtocolURICleaning {
|
||||
urlPath = path.Clean(urlPath)
|
||||
}
|
||||
if hasSlash && !strings.HasSuffix(urlPath, "/") {
|
||||
urlPath += "/"
|
||||
}
|
||||
|
||||
-356
@@ -1,356 +0,0 @@
|
||||
// +build bench
|
||||
|
||||
package restjson_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/awstesting"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/rest"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/restjson"
|
||||
"github.com/aws/aws-sdk-go/service/elastictranscoder"
|
||||
)
|
||||
|
||||
func BenchmarkRESTJSONBuild_Complex_elastictranscoderCreateJobInput(b *testing.B) {
|
||||
svc := awstesting.NewClient()
|
||||
svc.ServiceName = "elastictranscoder"
|
||||
svc.APIVersion = "2012-09-25"
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
r := svc.NewRequest(&request.Operation{Name: "CreateJobInput"}, restjsonBuildParms, nil)
|
||||
restjson.Build(r)
|
||||
if r.Error != nil {
|
||||
b.Fatal("Unexpected error", r.Error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkRESTBuild_Complex_elastictranscoderCreateJobInput(b *testing.B) {
|
||||
svc := awstesting.NewClient()
|
||||
svc.ServiceName = "elastictranscoder"
|
||||
svc.APIVersion = "2012-09-25"
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
r := svc.NewRequest(&request.Operation{Name: "CreateJobInput"}, restjsonBuildParms, nil)
|
||||
rest.Build(r)
|
||||
if r.Error != nil {
|
||||
b.Fatal("Unexpected error", r.Error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkEncodingJSONMarshal_Complex_elastictranscoderCreateJobInput(b *testing.B) {
|
||||
params := restjsonBuildParms
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
buf := &bytes.Buffer{}
|
||||
encoder := json.NewEncoder(buf)
|
||||
if err := encoder.Encode(params); err != nil {
|
||||
b.Fatal("Unexpected error", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkRESTJSONBuild_Simple_elastictranscoderListJobsByPipeline(b *testing.B) {
|
||||
svc := awstesting.NewClient()
|
||||
svc.ServiceName = "elastictranscoder"
|
||||
svc.APIVersion = "2012-09-25"
|
||||
|
||||
params := &elastictranscoder.ListJobsByPipelineInput{
|
||||
PipelineId: aws.String("Id"), // Required
|
||||
Ascending: aws.String("Ascending"),
|
||||
PageToken: aws.String("Id"),
|
||||
}
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
r := svc.NewRequest(&request.Operation{Name: "ListJobsByPipeline"}, params, nil)
|
||||
restjson.Build(r)
|
||||
if r.Error != nil {
|
||||
b.Fatal("Unexpected error", r.Error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkRESTBuild_Simple_elastictranscoderListJobsByPipeline(b *testing.B) {
|
||||
svc := awstesting.NewClient()
|
||||
svc.ServiceName = "elastictranscoder"
|
||||
svc.APIVersion = "2012-09-25"
|
||||
|
||||
params := &elastictranscoder.ListJobsByPipelineInput{
|
||||
PipelineId: aws.String("Id"), // Required
|
||||
Ascending: aws.String("Ascending"),
|
||||
PageToken: aws.String("Id"),
|
||||
}
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
r := svc.NewRequest(&request.Operation{Name: "ListJobsByPipeline"}, params, nil)
|
||||
rest.Build(r)
|
||||
if r.Error != nil {
|
||||
b.Fatal("Unexpected error", r.Error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkEncodingJSONMarshal_Simple_elastictranscoderListJobsByPipeline(b *testing.B) {
|
||||
params := &elastictranscoder.ListJobsByPipelineInput{
|
||||
PipelineId: aws.String("Id"), // Required
|
||||
Ascending: aws.String("Ascending"),
|
||||
PageToken: aws.String("Id"),
|
||||
}
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
buf := &bytes.Buffer{}
|
||||
encoder := json.NewEncoder(buf)
|
||||
if err := encoder.Encode(params); err != nil {
|
||||
b.Fatal("Unexpected error", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var restjsonBuildParms = &elastictranscoder.CreateJobInput{
|
||||
Input: &elastictranscoder.JobInput{ // Required
|
||||
AspectRatio: aws.String("AspectRatio"),
|
||||
Container: aws.String("JobContainer"),
|
||||
DetectedProperties: &elastictranscoder.DetectedProperties{
|
||||
DurationMillis: aws.Int64(1),
|
||||
FileSize: aws.Int64(1),
|
||||
FrameRate: aws.String("FloatString"),
|
||||
Height: aws.Int64(1),
|
||||
Width: aws.Int64(1),
|
||||
},
|
||||
Encryption: &elastictranscoder.Encryption{
|
||||
InitializationVector: aws.String("ZeroTo255String"),
|
||||
Key: aws.String("Base64EncodedString"),
|
||||
KeyMd5: aws.String("Base64EncodedString"),
|
||||
Mode: aws.String("EncryptionMode"),
|
||||
},
|
||||
FrameRate: aws.String("FrameRate"),
|
||||
Interlaced: aws.String("Interlaced"),
|
||||
Key: aws.String("Key"),
|
||||
Resolution: aws.String("Resolution"),
|
||||
},
|
||||
PipelineId: aws.String("Id"), // Required
|
||||
Output: &elastictranscoder.CreateJobOutput{
|
||||
AlbumArt: &elastictranscoder.JobAlbumArt{
|
||||
Artwork: []*elastictranscoder.Artwork{
|
||||
{ // Required
|
||||
AlbumArtFormat: aws.String("JpgOrPng"),
|
||||
Encryption: &elastictranscoder.Encryption{
|
||||
InitializationVector: aws.String("ZeroTo255String"),
|
||||
Key: aws.String("Base64EncodedString"),
|
||||
KeyMd5: aws.String("Base64EncodedString"),
|
||||
Mode: aws.String("EncryptionMode"),
|
||||
},
|
||||
InputKey: aws.String("WatermarkKey"),
|
||||
MaxHeight: aws.String("DigitsOrAuto"),
|
||||
MaxWidth: aws.String("DigitsOrAuto"),
|
||||
PaddingPolicy: aws.String("PaddingPolicy"),
|
||||
SizingPolicy: aws.String("SizingPolicy"),
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
MergePolicy: aws.String("MergePolicy"),
|
||||
},
|
||||
Captions: &elastictranscoder.Captions{
|
||||
CaptionFormats: []*elastictranscoder.CaptionFormat{
|
||||
{ // Required
|
||||
Encryption: &elastictranscoder.Encryption{
|
||||
InitializationVector: aws.String("ZeroTo255String"),
|
||||
Key: aws.String("Base64EncodedString"),
|
||||
KeyMd5: aws.String("Base64EncodedString"),
|
||||
Mode: aws.String("EncryptionMode"),
|
||||
},
|
||||
Format: aws.String("CaptionFormatFormat"),
|
||||
Pattern: aws.String("CaptionFormatPattern"),
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
CaptionSources: []*elastictranscoder.CaptionSource{
|
||||
{ // Required
|
||||
Encryption: &elastictranscoder.Encryption{
|
||||
InitializationVector: aws.String("ZeroTo255String"),
|
||||
Key: aws.String("Base64EncodedString"),
|
||||
KeyMd5: aws.String("Base64EncodedString"),
|
||||
Mode: aws.String("EncryptionMode"),
|
||||
},
|
||||
Key: aws.String("Key"),
|
||||
Label: aws.String("Name"),
|
||||
Language: aws.String("Key"),
|
||||
TimeOffset: aws.String("TimeOffset"),
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
MergePolicy: aws.String("CaptionMergePolicy"),
|
||||
},
|
||||
Composition: []*elastictranscoder.Clip{
|
||||
{ // Required
|
||||
TimeSpan: &elastictranscoder.TimeSpan{
|
||||
Duration: aws.String("Time"),
|
||||
StartTime: aws.String("Time"),
|
||||
},
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
Encryption: &elastictranscoder.Encryption{
|
||||
InitializationVector: aws.String("ZeroTo255String"),
|
||||
Key: aws.String("Base64EncodedString"),
|
||||
KeyMd5: aws.String("Base64EncodedString"),
|
||||
Mode: aws.String("EncryptionMode"),
|
||||
},
|
||||
Key: aws.String("Key"),
|
||||
PresetId: aws.String("Id"),
|
||||
Rotate: aws.String("Rotate"),
|
||||
SegmentDuration: aws.String("FloatString"),
|
||||
ThumbnailEncryption: &elastictranscoder.Encryption{
|
||||
InitializationVector: aws.String("ZeroTo255String"),
|
||||
Key: aws.String("Base64EncodedString"),
|
||||
KeyMd5: aws.String("Base64EncodedString"),
|
||||
Mode: aws.String("EncryptionMode"),
|
||||
},
|
||||
ThumbnailPattern: aws.String("ThumbnailPattern"),
|
||||
Watermarks: []*elastictranscoder.JobWatermark{
|
||||
{ // Required
|
||||
Encryption: &elastictranscoder.Encryption{
|
||||
InitializationVector: aws.String("ZeroTo255String"),
|
||||
Key: aws.String("Base64EncodedString"),
|
||||
KeyMd5: aws.String("Base64EncodedString"),
|
||||
Mode: aws.String("EncryptionMode"),
|
||||
},
|
||||
InputKey: aws.String("WatermarkKey"),
|
||||
PresetWatermarkId: aws.String("PresetWatermarkId"),
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
},
|
||||
OutputKeyPrefix: aws.String("Key"),
|
||||
Outputs: []*elastictranscoder.CreateJobOutput{
|
||||
{ // Required
|
||||
AlbumArt: &elastictranscoder.JobAlbumArt{
|
||||
Artwork: []*elastictranscoder.Artwork{
|
||||
{ // Required
|
||||
AlbumArtFormat: aws.String("JpgOrPng"),
|
||||
Encryption: &elastictranscoder.Encryption{
|
||||
InitializationVector: aws.String("ZeroTo255String"),
|
||||
Key: aws.String("Base64EncodedString"),
|
||||
KeyMd5: aws.String("Base64EncodedString"),
|
||||
Mode: aws.String("EncryptionMode"),
|
||||
},
|
||||
InputKey: aws.String("WatermarkKey"),
|
||||
MaxHeight: aws.String("DigitsOrAuto"),
|
||||
MaxWidth: aws.String("DigitsOrAuto"),
|
||||
PaddingPolicy: aws.String("PaddingPolicy"),
|
||||
SizingPolicy: aws.String("SizingPolicy"),
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
MergePolicy: aws.String("MergePolicy"),
|
||||
},
|
||||
Captions: &elastictranscoder.Captions{
|
||||
CaptionFormats: []*elastictranscoder.CaptionFormat{
|
||||
{ // Required
|
||||
Encryption: &elastictranscoder.Encryption{
|
||||
InitializationVector: aws.String("ZeroTo255String"),
|
||||
Key: aws.String("Base64EncodedString"),
|
||||
KeyMd5: aws.String("Base64EncodedString"),
|
||||
Mode: aws.String("EncryptionMode"),
|
||||
},
|
||||
Format: aws.String("CaptionFormatFormat"),
|
||||
Pattern: aws.String("CaptionFormatPattern"),
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
CaptionSources: []*elastictranscoder.CaptionSource{
|
||||
{ // Required
|
||||
Encryption: &elastictranscoder.Encryption{
|
||||
InitializationVector: aws.String("ZeroTo255String"),
|
||||
Key: aws.String("Base64EncodedString"),
|
||||
KeyMd5: aws.String("Base64EncodedString"),
|
||||
Mode: aws.String("EncryptionMode"),
|
||||
},
|
||||
Key: aws.String("Key"),
|
||||
Label: aws.String("Name"),
|
||||
Language: aws.String("Key"),
|
||||
TimeOffset: aws.String("TimeOffset"),
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
MergePolicy: aws.String("CaptionMergePolicy"),
|
||||
},
|
||||
Composition: []*elastictranscoder.Clip{
|
||||
{ // Required
|
||||
TimeSpan: &elastictranscoder.TimeSpan{
|
||||
Duration: aws.String("Time"),
|
||||
StartTime: aws.String("Time"),
|
||||
},
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
Encryption: &elastictranscoder.Encryption{
|
||||
InitializationVector: aws.String("ZeroTo255String"),
|
||||
Key: aws.String("Base64EncodedString"),
|
||||
KeyMd5: aws.String("Base64EncodedString"),
|
||||
Mode: aws.String("EncryptionMode"),
|
||||
},
|
||||
Key: aws.String("Key"),
|
||||
PresetId: aws.String("Id"),
|
||||
Rotate: aws.String("Rotate"),
|
||||
SegmentDuration: aws.String("FloatString"),
|
||||
ThumbnailEncryption: &elastictranscoder.Encryption{
|
||||
InitializationVector: aws.String("ZeroTo255String"),
|
||||
Key: aws.String("Base64EncodedString"),
|
||||
KeyMd5: aws.String("Base64EncodedString"),
|
||||
Mode: aws.String("EncryptionMode"),
|
||||
},
|
||||
ThumbnailPattern: aws.String("ThumbnailPattern"),
|
||||
Watermarks: []*elastictranscoder.JobWatermark{
|
||||
{ // Required
|
||||
Encryption: &elastictranscoder.Encryption{
|
||||
InitializationVector: aws.String("ZeroTo255String"),
|
||||
Key: aws.String("Base64EncodedString"),
|
||||
KeyMd5: aws.String("Base64EncodedString"),
|
||||
Mode: aws.String("EncryptionMode"),
|
||||
},
|
||||
InputKey: aws.String("WatermarkKey"),
|
||||
PresetWatermarkId: aws.String("PresetWatermarkId"),
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
Playlists: []*elastictranscoder.CreateJobPlaylist{
|
||||
{ // Required
|
||||
Format: aws.String("PlaylistFormat"),
|
||||
HlsContentProtection: &elastictranscoder.HlsContentProtection{
|
||||
InitializationVector: aws.String("ZeroTo255String"),
|
||||
Key: aws.String("Base64EncodedString"),
|
||||
KeyMd5: aws.String("Base64EncodedString"),
|
||||
KeyStoragePolicy: aws.String("KeyStoragePolicy"),
|
||||
LicenseAcquisitionUrl: aws.String("ZeroTo512String"),
|
||||
Method: aws.String("HlsContentProtectionMethod"),
|
||||
},
|
||||
Name: aws.String("Filename"),
|
||||
OutputKeys: []*string{
|
||||
aws.String("Key"), // Required
|
||||
// More values...
|
||||
},
|
||||
PlayReadyDrm: &elastictranscoder.PlayReadyDrm{
|
||||
Format: aws.String("PlayReadyDrmFormatString"),
|
||||
InitializationVector: aws.String("ZeroTo255String"),
|
||||
Key: aws.String("NonEmptyBase64EncodedString"),
|
||||
KeyId: aws.String("KeyIdGuid"),
|
||||
KeyMd5: aws.String("NonEmptyBase64EncodedString"),
|
||||
LicenseAcquisitionUrl: aws.String("OneTo512String"),
|
||||
},
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
UserMetadata: map[string]*string{
|
||||
"Key": aws.String("String"), // Required
|
||||
// More values...
|
||||
},
|
||||
}
|
||||
-3522
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -2,8 +2,8 @@
|
||||
// requests and responses.
|
||||
package restjson
|
||||
|
||||
//go:generate go run ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/rest-json.json build_test.go
|
||||
//go:generate go run ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/rest-json.json unmarshal_test.go
|
||||
//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/rest-json.json build_test.go
|
||||
//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/rest-json.json unmarshal_test.go
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
-1560
File diff suppressed because it is too large
Load Diff
-246
@@ -1,246 +0,0 @@
|
||||
// +build bench
|
||||
|
||||
package restxml_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"bytes"
|
||||
"encoding/xml"
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/awstesting"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/restxml"
|
||||
"github.com/aws/aws-sdk-go/service/cloudfront"
|
||||
)
|
||||
|
||||
func BenchmarkRESTXMLBuild_Complex_cloudfrontCreateDistribution(b *testing.B) {
|
||||
params := restxmlBuildCreateDistroParms
|
||||
|
||||
op := &request.Operation{
|
||||
Name: "CreateDistribution",
|
||||
HTTPMethod: "POST",
|
||||
HTTPPath: "/2015-04-17/distribution/{DistributionId}/invalidation",
|
||||
}
|
||||
|
||||
benchRESTXMLBuild(b, op, params)
|
||||
}
|
||||
|
||||
func BenchmarkRESTXMLBuild_Simple_cloudfrontDeleteStreamingDistribution(b *testing.B) {
|
||||
params := &cloudfront.DeleteDistributionInput{
|
||||
Id: aws.String("string"), // Required
|
||||
IfMatch: aws.String("string"),
|
||||
}
|
||||
op := &request.Operation{
|
||||
Name: "DeleteStreamingDistribution",
|
||||
HTTPMethod: "DELETE",
|
||||
HTTPPath: "/2015-04-17/streaming-distribution/{Id}",
|
||||
}
|
||||
benchRESTXMLBuild(b, op, params)
|
||||
}
|
||||
|
||||
func BenchmarkEncodingXMLMarshal_Simple_cloudfrontDeleteStreamingDistribution(b *testing.B) {
|
||||
params := &cloudfront.DeleteDistributionInput{
|
||||
Id: aws.String("string"), // Required
|
||||
IfMatch: aws.String("string"),
|
||||
}
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
buf := &bytes.Buffer{}
|
||||
encoder := xml.NewEncoder(buf)
|
||||
if err := encoder.Encode(params); err != nil {
|
||||
b.Fatal("Unexpected error", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func benchRESTXMLBuild(b *testing.B, op *request.Operation, params interface{}) {
|
||||
svc := awstesting.NewClient()
|
||||
svc.ServiceName = "cloudfront"
|
||||
svc.APIVersion = "2015-04-17"
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
r := svc.NewRequest(op, params, nil)
|
||||
restxml.Build(r)
|
||||
if r.Error != nil {
|
||||
b.Fatal("Unexpected error", r.Error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var restxmlBuildCreateDistroParms = &cloudfront.CreateDistributionInput{
|
||||
DistributionConfig: &cloudfront.DistributionConfig{ // Required
|
||||
CallerReference: aws.String("string"), // Required
|
||||
Comment: aws.String("string"), // Required
|
||||
DefaultCacheBehavior: &cloudfront.DefaultCacheBehavior{ // Required
|
||||
ForwardedValues: &cloudfront.ForwardedValues{ // Required
|
||||
Cookies: &cloudfront.CookiePreference{ // Required
|
||||
Forward: aws.String("ItemSelection"), // Required
|
||||
WhitelistedNames: &cloudfront.CookieNames{
|
||||
Quantity: aws.Int64(1), // Required
|
||||
Items: []*string{
|
||||
aws.String("string"), // Required
|
||||
// More values...
|
||||
},
|
||||
},
|
||||
},
|
||||
QueryString: aws.Bool(true), // Required
|
||||
Headers: &cloudfront.Headers{
|
||||
Quantity: aws.Int64(1), // Required
|
||||
Items: []*string{
|
||||
aws.String("string"), // Required
|
||||
// More values...
|
||||
},
|
||||
},
|
||||
},
|
||||
MinTTL: aws.Int64(1), // Required
|
||||
TargetOriginId: aws.String("string"), // Required
|
||||
TrustedSigners: &cloudfront.TrustedSigners{ // Required
|
||||
Enabled: aws.Bool(true), // Required
|
||||
Quantity: aws.Int64(1), // Required
|
||||
Items: []*string{
|
||||
aws.String("string"), // Required
|
||||
// More values...
|
||||
},
|
||||
},
|
||||
ViewerProtocolPolicy: aws.String("ViewerProtocolPolicy"), // Required
|
||||
AllowedMethods: &cloudfront.AllowedMethods{
|
||||
Items: []*string{ // Required
|
||||
aws.String("Method"), // Required
|
||||
// More values...
|
||||
},
|
||||
Quantity: aws.Int64(1), // Required
|
||||
CachedMethods: &cloudfront.CachedMethods{
|
||||
Items: []*string{ // Required
|
||||
aws.String("Method"), // Required
|
||||
// More values...
|
||||
},
|
||||
Quantity: aws.Int64(1), // Required
|
||||
},
|
||||
},
|
||||
DefaultTTL: aws.Int64(1),
|
||||
MaxTTL: aws.Int64(1),
|
||||
SmoothStreaming: aws.Bool(true),
|
||||
},
|
||||
Enabled: aws.Bool(true), // Required
|
||||
Origins: &cloudfront.Origins{ // Required
|
||||
Quantity: aws.Int64(1), // Required
|
||||
Items: []*cloudfront.Origin{
|
||||
{ // Required
|
||||
DomainName: aws.String("string"), // Required
|
||||
Id: aws.String("string"), // Required
|
||||
CustomOriginConfig: &cloudfront.CustomOriginConfig{
|
||||
HTTPPort: aws.Int64(1), // Required
|
||||
HTTPSPort: aws.Int64(1), // Required
|
||||
OriginProtocolPolicy: aws.String("OriginProtocolPolicy"), // Required
|
||||
},
|
||||
OriginPath: aws.String("string"),
|
||||
S3OriginConfig: &cloudfront.S3OriginConfig{
|
||||
OriginAccessIdentity: aws.String("string"), // Required
|
||||
},
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
},
|
||||
Aliases: &cloudfront.Aliases{
|
||||
Quantity: aws.Int64(1), // Required
|
||||
Items: []*string{
|
||||
aws.String("string"), // Required
|
||||
// More values...
|
||||
},
|
||||
},
|
||||
CacheBehaviors: &cloudfront.CacheBehaviors{
|
||||
Quantity: aws.Int64(1), // Required
|
||||
Items: []*cloudfront.CacheBehavior{
|
||||
{ // Required
|
||||
ForwardedValues: &cloudfront.ForwardedValues{ // Required
|
||||
Cookies: &cloudfront.CookiePreference{ // Required
|
||||
Forward: aws.String("ItemSelection"), // Required
|
||||
WhitelistedNames: &cloudfront.CookieNames{
|
||||
Quantity: aws.Int64(1), // Required
|
||||
Items: []*string{
|
||||
aws.String("string"), // Required
|
||||
// More values...
|
||||
},
|
||||
},
|
||||
},
|
||||
QueryString: aws.Bool(true), // Required
|
||||
Headers: &cloudfront.Headers{
|
||||
Quantity: aws.Int64(1), // Required
|
||||
Items: []*string{
|
||||
aws.String("string"), // Required
|
||||
// More values...
|
||||
},
|
||||
},
|
||||
},
|
||||
MinTTL: aws.Int64(1), // Required
|
||||
PathPattern: aws.String("string"), // Required
|
||||
TargetOriginId: aws.String("string"), // Required
|
||||
TrustedSigners: &cloudfront.TrustedSigners{ // Required
|
||||
Enabled: aws.Bool(true), // Required
|
||||
Quantity: aws.Int64(1), // Required
|
||||
Items: []*string{
|
||||
aws.String("string"), // Required
|
||||
// More values...
|
||||
},
|
||||
},
|
||||
ViewerProtocolPolicy: aws.String("ViewerProtocolPolicy"), // Required
|
||||
AllowedMethods: &cloudfront.AllowedMethods{
|
||||
Items: []*string{ // Required
|
||||
aws.String("Method"), // Required
|
||||
// More values...
|
||||
},
|
||||
Quantity: aws.Int64(1), // Required
|
||||
CachedMethods: &cloudfront.CachedMethods{
|
||||
Items: []*string{ // Required
|
||||
aws.String("Method"), // Required
|
||||
// More values...
|
||||
},
|
||||
Quantity: aws.Int64(1), // Required
|
||||
},
|
||||
},
|
||||
DefaultTTL: aws.Int64(1),
|
||||
MaxTTL: aws.Int64(1),
|
||||
SmoothStreaming: aws.Bool(true),
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
},
|
||||
CustomErrorResponses: &cloudfront.CustomErrorResponses{
|
||||
Quantity: aws.Int64(1), // Required
|
||||
Items: []*cloudfront.CustomErrorResponse{
|
||||
{ // Required
|
||||
ErrorCode: aws.Int64(1), // Required
|
||||
ErrorCachingMinTTL: aws.Int64(1),
|
||||
ResponseCode: aws.String("string"),
|
||||
ResponsePagePath: aws.String("string"),
|
||||
},
|
||||
// More values...
|
||||
},
|
||||
},
|
||||
DefaultRootObject: aws.String("string"),
|
||||
Logging: &cloudfront.LoggingConfig{
|
||||
Bucket: aws.String("string"), // Required
|
||||
Enabled: aws.Bool(true), // Required
|
||||
IncludeCookies: aws.Bool(true), // Required
|
||||
Prefix: aws.String("string"), // Required
|
||||
},
|
||||
PriceClass: aws.String("PriceClass"),
|
||||
Restrictions: &cloudfront.Restrictions{
|
||||
GeoRestriction: &cloudfront.GeoRestriction{ // Required
|
||||
Quantity: aws.Int64(1), // Required
|
||||
RestrictionType: aws.String("GeoRestrictionType"), // Required
|
||||
Items: []*string{
|
||||
aws.String("string"), // Required
|
||||
// More values...
|
||||
},
|
||||
},
|
||||
},
|
||||
ViewerCertificate: &cloudfront.ViewerCertificate{
|
||||
CloudFrontDefaultCertificate: aws.Bool(true),
|
||||
IAMCertificateId: aws.String("string"),
|
||||
MinimumProtocolVersion: aws.String("MinimumProtocolVersion"),
|
||||
SSLSupportMethod: aws.String("SSLSupportMethod"),
|
||||
},
|
||||
},
|
||||
}
|
||||
-4406
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -2,8 +2,8 @@
|
||||
// requests and responses.
|
||||
package restxml
|
||||
|
||||
//go:generate go run ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/rest-xml.json build_test.go
|
||||
//go:generate go run ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/rest-xml.json unmarshal_test.go
|
||||
//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/rest-xml.json build_test.go
|
||||
//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/rest-xml.json unmarshal_test.go
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
-1778
File diff suppressed because it is too large
Load Diff
-40
@@ -1,40 +0,0 @@
|
||||
package protocol_test
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/private/protocol"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
type mockCloser struct {
|
||||
*strings.Reader
|
||||
Closed bool
|
||||
}
|
||||
|
||||
func (m *mockCloser) Close() error {
|
||||
m.Closed = true
|
||||
return nil
|
||||
}
|
||||
|
||||
func TestUnmarshalDrainBody(t *testing.T) {
|
||||
b := &mockCloser{Reader: strings.NewReader("example body")}
|
||||
r := &request.Request{HTTPResponse: &http.Response{
|
||||
Body: b,
|
||||
}}
|
||||
|
||||
protocol.UnmarshalDiscardBody(r)
|
||||
assert.NoError(t, r.Error)
|
||||
assert.Equal(t, 0, b.Len())
|
||||
assert.True(t, b.Closed)
|
||||
}
|
||||
|
||||
func TestUnmarshalDrainBodyNoBody(t *testing.T) {
|
||||
r := &request.Request{HTTPResponse: &http.Response{}}
|
||||
|
||||
protocol.UnmarshalDiscardBody(r)
|
||||
assert.NoError(t, r.Error)
|
||||
}
|
||||
Reference in New Issue
Block a user