本文整理汇总了Golang中github.com/aws/aws-sdk-go/internal/protocol/restjson.Build函数的典型用法代码示例。如果您正苦于以下问题:Golang Build函数的具体用法?Golang Build怎么用?Golang Build使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Build函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestInputService8ProtocolTestRecursiveShapesCase6
func TestInputService8ProtocolTestRecursiveShapesCase6(t *testing.T) {
svc := NewInputService8ProtocolTest(nil)
svc.Endpoint = "https://test"
input := &InputService8TestShapeInputShape{
RecursiveStruct: &InputService8TestShapeRecursiveStructType{
RecursiveMap: map[string]*InputService8TestShapeRecursiveStructType{
"bar": {
NoRecurse: aws.String("bar"),
},
"foo": {
NoRecurse: aws.String("foo"),
},
},
},
}
req, _ := svc.InputService8TestCaseOperation6Request(input)
r := req.HTTPRequest
// build request
restjson.Build(req)
assert.NoError(t, req.Error)
// assert body
assert.NotNil(t, r.Body)
body, _ := ioutil.ReadAll(r.Body)
assert.Equal(t, util.Trim(`{"RecursiveStruct":{"RecursiveMap":{"bar":{"NoRecurse":"bar"},"foo":{"NoRecurse":"foo"}}}}`), util.Trim(string(body)))
// assert URL
assert.Equal(t, "https://test/path", r.URL.String())
// assert headers
}
开发者ID:jkakar,项目名称:aws-sdk-go,代码行数:34,代码来源:build_test.go
示例2: TestInputService9ProtocolTestTimestampValuesCase1
func TestInputService9ProtocolTestTimestampValuesCase1(t *testing.T) {
svc := NewInputService9ProtocolTest(nil)
svc.Endpoint = "https://test"
input := &InputService9TestShapeInputShape{
TimeArg: aws.Time(time.Unix(1422172800, 0)),
}
req, _ := svc.InputService9TestCaseOperation1Request(input)
r := req.HTTPRequest
// build request
restjson.Build(req)
assert.NoError(t, req.Error)
// assert body
assert.NotNil(t, r.Body)
body, _ := ioutil.ReadAll(r.Body)
assert.Equal(t, util.Trim(`{"TimeArg":1422172800}`), util.Trim(string(body)))
// assert URL
assert.Equal(t, "https://test/path", r.URL.String())
// assert headers
}
开发者ID:jkakar,项目名称:aws-sdk-go,代码行数:25,代码来源:build_test.go
示例3: TestInputService6ProtocolTestStreamingPayloadCase1
func TestInputService6ProtocolTestStreamingPayloadCase1(t *testing.T) {
svc := NewInputService6ProtocolTest(nil)
svc.Endpoint = "https://test"
input := &InputService6TestShapeInputShape{
Body: aws.ReadSeekCloser(bytes.NewBufferString("contents")),
Checksum: aws.String("foo"),
VaultName: aws.String("name"),
}
req, _ := svc.InputService6TestCaseOperation1Request(input)
r := req.HTTPRequest
// build request
restjson.Build(req)
assert.NoError(t, req.Error)
// assert body
assert.NotNil(t, r.Body)
body, _ := ioutil.ReadAll(r.Body)
assert.Equal(t, util.Trim(`contents`), util.Trim(string(body)))
// assert URL
assert.Equal(t, "https://test/2014-01-01/vaults/name/archives", r.URL.String())
// assert headers
assert.Equal(t, "foo", r.Header.Get("x-amz-sha256-tree-hash"))
}
开发者ID:jkakar,项目名称:aws-sdk-go,代码行数:28,代码来源:build_test.go
示例4: TestInputService5ProtocolTestURIParameterQuerystringParamsHeadersAndJSONBodyCase1
func TestInputService5ProtocolTestURIParameterQuerystringParamsHeadersAndJSONBodyCase1(t *testing.T) {
svc := NewInputService5ProtocolTest(nil)
svc.Endpoint = "https://test"
input := &InputService5TestShapeInputShape{
Ascending: aws.String("true"),
Checksum: aws.String("12345"),
Config: &InputService5TestShapeStructType{
A: aws.String("one"),
B: aws.String("two"),
},
PageToken: aws.String("bar"),
PipelineId: aws.String("foo"),
}
req, _ := svc.InputService5TestCaseOperation1Request(input)
r := req.HTTPRequest
// build request
restjson.Build(req)
assert.NoError(t, req.Error)
// assert body
assert.NotNil(t, r.Body)
body, _ := ioutil.ReadAll(r.Body)
assert.Equal(t, util.Trim(`{"Config":{"A":"one","B":"two"}}`), util.Trim(string(body)))
// assert URL
assert.Equal(t, "https://test/2014-01-01/jobsByPipeline/foo?Ascending=true&PageToken=bar", r.URL.String())
// assert headers
assert.Equal(t, "12345", r.Header.Get("x-amz-checksum"))
}
开发者ID:jkakar,项目名称:aws-sdk-go,代码行数:33,代码来源:build_test.go
示例5: BenchmarkRESTJSONBuild_Complex_elastictranscoderCreateJobInput
func BenchmarkRESTJSONBuild_Complex_elastictranscoderCreateJobInput(b *testing.B) {
svc := service.NewService(nil)
svc.ServiceName = "elastictranscoder"
svc.APIVersion = "2012-09-25"
for i := 0; i < b.N; i++ {
r := service.NewRequest(svc, &service.Operation{Name: "CreateJobInput"}, restjsonBuildParms, nil)
restjson.Build(r)
if r.Error != nil {
b.Fatal("Unexpected error", r.Error)
}
}
}
开发者ID:ahamilton55,项目名称:aws-sdk-go,代码行数:13,代码来源:restjson_build_test.go
示例6: TestInputService7ProtocolTestOmitsNullQueryParamsButSerializesEmptyStringsCase1
func TestInputService7ProtocolTestOmitsNullQueryParamsButSerializesEmptyStringsCase1(t *testing.T) {
svc := NewInputService7ProtocolTest(nil)
svc.Endpoint = "https://test"
input := &InputService7TestShapeInputShape{}
req, _ := svc.InputService7TestCaseOperation1Request(input)
r := req.HTTPRequest
// build request
restjson.Build(req)
assert.NoError(t, req.Error)
// assert URL
assert.Equal(t, "https://test/path", r.URL.String())
// assert headers
}
开发者ID:jkakar,项目名称:aws-sdk-go,代码行数:18,代码来源:build_test.go
示例7: BenchmarkRESTJSONBuild_Simple_elastictranscoderListJobsByPipeline
func BenchmarkRESTJSONBuild_Simple_elastictranscoderListJobsByPipeline(b *testing.B) {
svc := service.NewService(nil)
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 := service.NewRequest(svc, &service.Operation{Name: "ListJobsByPipeline"}, params, nil)
restjson.Build(r)
if r.Error != nil {
b.Fatal("Unexpected error", r.Error)
}
}
}
开发者ID:ahamilton55,项目名称:aws-sdk-go,代码行数:19,代码来源:restjson_build_test.go
示例8: TestInputService2ProtocolTestURIParameterOnlyWithLocationNameCase1
func TestInputService2ProtocolTestURIParameterOnlyWithLocationNameCase1(t *testing.T) {
svc := NewInputService2ProtocolTest(nil)
svc.Endpoint = "https://test"
input := &InputService2TestShapeInputShape{
Foo: aws.String("bar"),
}
req, _ := svc.InputService2TestCaseOperation1Request(input)
r := req.HTTPRequest
// build request
restjson.Build(req)
assert.NoError(t, req.Error)
// assert URL
assert.Equal(t, "https://test/2014-01-01/jobsByPipeline/bar", r.URL.String())
// assert headers
}
开发者ID:jkakar,项目名称:aws-sdk-go,代码行数:20,代码来源:build_test.go
示例9: TestInputService9ProtocolTestTimestampValuesCase2
func TestInputService9ProtocolTestTimestampValuesCase2(t *testing.T) {
svc := NewInputService9ProtocolTest(nil)
svc.Endpoint = "https://test"
input := &InputService9TestShapeInputShape{
TimeArgInHeader: aws.Time(time.Unix(1422172800, 0)),
}
req, _ := svc.InputService9TestCaseOperation2Request(input)
r := req.HTTPRequest
// build request
restjson.Build(req)
assert.NoError(t, req.Error)
// assert URL
assert.Equal(t, "https://test/path", r.URL.String())
// assert headers
assert.Equal(t, "Sun, 25 Jan 2015 08:00:00 GMT", r.Header.Get("x-amz-timearg"))
}
开发者ID:jkakar,项目名称:aws-sdk-go,代码行数:21,代码来源:build_test.go
示例10: TestInputService3ProtocolTestURIParameterAndQuerystringParamsCase1
func TestInputService3ProtocolTestURIParameterAndQuerystringParamsCase1(t *testing.T) {
svc := NewInputService3ProtocolTest(nil)
svc.Endpoint = "https://test"
input := &InputService3TestShapeInputShape{
Ascending: aws.String("true"),
PageToken: aws.String("bar"),
PipelineId: aws.String("foo"),
}
req, _ := svc.InputService3TestCaseOperation1Request(input)
r := req.HTTPRequest
// build request
restjson.Build(req)
assert.NoError(t, req.Error)
// assert URL
assert.Equal(t, "https://test/2014-01-01/jobsByPipeline/foo?Ascending=true&PageToken=bar", r.URL.String())
// assert headers
}
开发者ID:jkakar,项目名称:aws-sdk-go,代码行数:22,代码来源:build_test.go
注:本文中的github.com/aws/aws-sdk-go/internal/protocol/restjson.Build函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论