mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-07 22:20:24 +00:00
Update Go AWS SDK to the latest version
This commit is contained in:
committed by
Andrey Smirnov
parent
d08be990ef
commit
94a72b23ff
Generated
Vendored
+131
@@ -0,0 +1,131 @@
|
||||
{
|
||||
"version":"2.0",
|
||||
"metadata":{
|
||||
"apiVersion":"2018-08-31",
|
||||
"endpointPrefix":"awsendpointdiscoverytestservice",
|
||||
"jsonVersion":"1.1",
|
||||
"protocol":"json",
|
||||
"serviceAbbreviation":"AwsEndpointDiscoveryTest",
|
||||
"serviceFullName":"AwsEndpointDiscoveryTest",
|
||||
"signatureVersion":"v4",
|
||||
"signingName":"awsendpointdiscoverytestservice",
|
||||
"targetPrefix":"AwsEndpointDiscoveryTestService"
|
||||
},
|
||||
"operations":{
|
||||
"DescribeEndpoints":{
|
||||
"name":"DescribeEndpoints",
|
||||
"http":{
|
||||
"method":"POST",
|
||||
"requestUri":"/"
|
||||
},
|
||||
"input":{"shape":"DescribeEndpointsRequest"},
|
||||
"output":{"shape":"DescribeEndpointsResponse"},
|
||||
"endpointoperation":true
|
||||
},
|
||||
"TestDiscoveryIdentifiersRequired":{
|
||||
"name":"TestDiscoveryIdentifiersRequired",
|
||||
"http":{
|
||||
"method":"POST",
|
||||
"requestUri":"/"
|
||||
},
|
||||
"input":{"shape":"TestDiscoveryIdentifiersRequiredRequest"},
|
||||
"output":{"shape":"TestDiscoveryIdentifiersRequiredResponse"},
|
||||
"endpointdiscovery":{"required":true}
|
||||
},
|
||||
"TestDiscoveryOptional":{
|
||||
"name":"TestDiscoveryOptional",
|
||||
"http":{
|
||||
"method":"POST",
|
||||
"requestUri":"/"
|
||||
},
|
||||
"input":{"shape":"TestDiscoveryOptionalRequest"},
|
||||
"output":{"shape":"TestDiscoveryOptionalResponse"},
|
||||
"endpointdiscovery":{
|
||||
}
|
||||
},
|
||||
"TestDiscoveryRequired":{
|
||||
"name":"TestDiscoveryRequired",
|
||||
"http":{
|
||||
"method":"POST",
|
||||
"requestUri":"/"
|
||||
},
|
||||
"input":{"shape":"TestDiscoveryRequiredRequest"},
|
||||
"output":{"shape":"TestDiscoveryRequiredResponse"},
|
||||
"endpointdiscovery":{
|
||||
}
|
||||
}
|
||||
},
|
||||
"shapes":{
|
||||
"Boolean":{"type":"boolean"},
|
||||
"DescribeEndpointsRequest":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"Operation": {"shape":"String"}
|
||||
}
|
||||
},
|
||||
"DescribeEndpointsResponse":{
|
||||
"type":"structure",
|
||||
"required":["Endpoints"],
|
||||
"members":{
|
||||
"Endpoints":{"shape":"Endpoints"}
|
||||
}
|
||||
},
|
||||
"Endpoint":{
|
||||
"type":"structure",
|
||||
"required":[
|
||||
"Address",
|
||||
"CachePeriodInMinutes"
|
||||
],
|
||||
"members":{
|
||||
"Address":{"shape":"String"},
|
||||
"CachePeriodInMinutes":{"shape":"Long"}
|
||||
}
|
||||
},
|
||||
"Endpoints":{
|
||||
"type":"list",
|
||||
"member":{"shape":"Endpoint"}
|
||||
},
|
||||
"Long":{"type":"long"},
|
||||
"String":{"type":"string"},
|
||||
"TestDiscoveryIdentifiersRequiredRequest":{
|
||||
"type":"structure",
|
||||
"required":["Sdk"],
|
||||
"members":{
|
||||
"Sdk":{
|
||||
"shape":"String",
|
||||
"endpointdiscoveryid":true
|
||||
}
|
||||
}
|
||||
},
|
||||
"TestDiscoveryIdentifiersRequiredResponse":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"RequestSuccessful":{"shape":"Boolean"}
|
||||
}
|
||||
},
|
||||
"TestDiscoveryOptionalRequest":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"Sdk":{"shape":"String"}
|
||||
}
|
||||
},
|
||||
"TestDiscoveryOptionalResponse":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"RequestSuccessful":{"shape":"Boolean"}
|
||||
}
|
||||
},
|
||||
"TestDiscoveryRequiredRequest":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"Sdk":{"shape":"String"}
|
||||
}
|
||||
},
|
||||
"TestDiscoveryRequiredResponse":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"RequestSuccessful":{"shape":"Boolean"}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": "2.0",
|
||||
"service": null,
|
||||
"operations": {
|
||||
},
|
||||
"shapes":{}
|
||||
}
|
||||
Generated
Vendored
+228
@@ -0,0 +1,228 @@
|
||||
{
|
||||
"version":"2.0",
|
||||
"metadata":{
|
||||
"apiVersion":"0000-00-00",
|
||||
"endpointPrefix":"rpcservice",
|
||||
"jsonVersion":"1.1",
|
||||
"protocol":"json",
|
||||
"serviceAbbreviation":"RPCService",
|
||||
"serviceFullName":"RPC Service",
|
||||
"serviceId":"RPCService",
|
||||
"signatureVersion":"v4",
|
||||
"targetPrefix":"RPCService_00000000",
|
||||
"uid":"RPCService-0000-00-00"
|
||||
},
|
||||
"operations":{
|
||||
"GetEventStream":{
|
||||
"name":"GetEventStream",
|
||||
"http":{
|
||||
"method":"POST",
|
||||
"requestUri":"/"
|
||||
},
|
||||
"input":{"shape":"GetEventStreamRequest"},
|
||||
"output":{"shape":"GetEventStreamResponse"}
|
||||
},
|
||||
"EmptyStream":{
|
||||
"name":"EmptyStream",
|
||||
"http":{
|
||||
"method":"POST",
|
||||
"requestUri":"/"
|
||||
},
|
||||
"input":{"shape":"EmptyStreamRequest"},
|
||||
"output":{"shape":"EmptyStreamResponse"}
|
||||
},
|
||||
"OtherOperation":{
|
||||
"name":"OtherOperation",
|
||||
"http":{
|
||||
"method":"POST",
|
||||
"requestUri":"/"
|
||||
},
|
||||
"errors":[
|
||||
{"shape":"ExceptionEvent2"}
|
||||
]
|
||||
}
|
||||
},
|
||||
"shapes":{
|
||||
"Bool":{"type":"boolean"},
|
||||
"Byte":{"type":"byte"},
|
||||
"Short":{"type":"short"},
|
||||
"Integer":{"type":"integer"},
|
||||
"Long":{"type":"long"},
|
||||
"Blob":{"type":"blob"},
|
||||
"String":{"type":"string"},
|
||||
"Time":{"type":"timestamp"},
|
||||
"GetEventStreamRequest":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"InputVal":{"shape":"String"}
|
||||
}
|
||||
},
|
||||
"GetEventStreamResponse":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"StrVal":{"shape":"String"},
|
||||
"IntVal":{"shape":"Integer"},
|
||||
"EventStream":{"shape":"EventStream"}
|
||||
}
|
||||
},
|
||||
"EventStream":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"Headers":{"shape":"HeaderOnlyEvent"},
|
||||
"ImplicitPayload":{"shape":"ImplicitPayloadEvent"},
|
||||
"ExplicitPayload":{"shape":"ExplicitPayloadEvent"},
|
||||
"PayloadOnly":{"shape":"PayloadOnlyEvent"},
|
||||
"PayloadOnlyBlob":{"shape":"PayloadOnlyBlobEvent"},
|
||||
"PayloadOnlyString":{"shape":"PayloadOnlyStringEvent"},
|
||||
"Empty":{"shape":"EmptyEvent"},
|
||||
"Exception":{"shape":"ExceptionEvent"},
|
||||
"Exception2":{"shape":"ExceptionEvent2"}
|
||||
},
|
||||
"eventstream":true
|
||||
},
|
||||
"EmptyStreamRequest":{
|
||||
"type":"structure",
|
||||
"members":{}
|
||||
},
|
||||
"EmptyStreamResponse":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"EventStream":{"shape":"EmptyEventStream"}
|
||||
}
|
||||
},
|
||||
"EmptyEventStream":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
},
|
||||
"eventstream":true
|
||||
},
|
||||
"HeaderOnlyEvent":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"BoolVal":{
|
||||
"shape":"Bool",
|
||||
"eventheader":true
|
||||
},
|
||||
"ByteVal":{
|
||||
"shape":"Byte",
|
||||
"eventheader":true
|
||||
},
|
||||
"ShortVal":{
|
||||
"shape":"Short",
|
||||
"eventheader":true
|
||||
},
|
||||
"IntegerVal":{
|
||||
"shape":"Integer",
|
||||
"eventheader":true
|
||||
},
|
||||
"LongVal":{
|
||||
"shape":"Long",
|
||||
"eventheader":true
|
||||
},
|
||||
"StringVal":{
|
||||
"shape":"String",
|
||||
"eventheader":true
|
||||
},
|
||||
"BlobVal":{
|
||||
"shape":"Blob",
|
||||
"eventheader":true
|
||||
},
|
||||
"TimeVal":{
|
||||
"shape":"Time",
|
||||
"eventheader":true
|
||||
}
|
||||
},
|
||||
"event":true
|
||||
},
|
||||
"ImplicitPayloadEvent": {
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"ByteVal":{
|
||||
"shape":"Byte",
|
||||
"eventheader":true
|
||||
},
|
||||
"ShortVal":{
|
||||
"shape":"Short"
|
||||
},
|
||||
"IntegerVal":{
|
||||
"shape":"Integer"
|
||||
}
|
||||
},
|
||||
"event":true
|
||||
},
|
||||
"ExplicitPayloadEvent": {
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"LongVal":{
|
||||
"shape":"Long",
|
||||
"eventheader":true
|
||||
},
|
||||
"StringVal":{
|
||||
"shape":"String",
|
||||
"eventheader":true
|
||||
},
|
||||
"NestedVal":{
|
||||
"shape":"NestedShape",
|
||||
"eventpayload":true
|
||||
}
|
||||
},
|
||||
"event":true
|
||||
},
|
||||
"PayloadOnlyEvent":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"NestedVal":{
|
||||
"shape":"NestedShape",
|
||||
"eventpayload":true
|
||||
}
|
||||
},
|
||||
"event":true
|
||||
},
|
||||
"PayloadOnlyBlobEvent":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"BlobPayload":{
|
||||
"shape":"Blob",
|
||||
"eventpayload":true
|
||||
}
|
||||
},
|
||||
"event":true
|
||||
},
|
||||
"PayloadOnlyStringEvent":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"StringPayload":{
|
||||
"shape":"String",
|
||||
"eventpayload":true
|
||||
}
|
||||
},
|
||||
"event":true
|
||||
},
|
||||
"EmptyEvent": {
|
||||
"type":"structure",
|
||||
"members":{},
|
||||
"event": true
|
||||
},
|
||||
"NestedShape": {
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"IntVal":{"shape":"Integer"},
|
||||
"StrVal":{"shape":"String"}
|
||||
}
|
||||
},
|
||||
"ExceptionEvent":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"IntVal":{"shape":"Integer"},
|
||||
"message":{"shape":"String"}
|
||||
},
|
||||
"exception":true
|
||||
},
|
||||
"ExceptionEvent2":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
},
|
||||
"exception":true
|
||||
}
|
||||
}
|
||||
}
|
||||
vendor/github.com/aws/aws-sdk-go/private/model/api/codegentest/models/jsonrpc/0000-00-00/docs-2.json
Generated
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": "2.0",
|
||||
"service": null,
|
||||
"operations": {
|
||||
},
|
||||
"shapes":{}
|
||||
}
|
||||
vendor/github.com/aws/aws-sdk-go/private/model/api/codegentest/models/restjson/0000-00-00/api-2.json
Generated
Vendored
+226
@@ -0,0 +1,226 @@
|
||||
{
|
||||
"version":"2.0",
|
||||
"metadata":{
|
||||
"apiVersion":"0000-00-00",
|
||||
"endpointPrefix":"restjsonservice",
|
||||
"protocol":"rest-json",
|
||||
"serviceAbbreviation":"RESTJSONService",
|
||||
"serviceFullName":"REST JSON Service",
|
||||
"serviceId":"RESTJSONService",
|
||||
"signatureVersion":"v4",
|
||||
"uid":"RESTJSONService-0000-00-00"
|
||||
},
|
||||
"operations":{
|
||||
"GetEventStream":{
|
||||
"name":"GetEventStream",
|
||||
"http":{
|
||||
"method":"POST",
|
||||
"requestUri":"/"
|
||||
},
|
||||
"input":{"shape":"GetEventStreamRequest"},
|
||||
"output":{"shape":"GetEventStreamResponse"}
|
||||
},
|
||||
"EmptyStream":{
|
||||
"name":"EmptyStream",
|
||||
"http":{
|
||||
"method":"POST",
|
||||
"requestUri":"/"
|
||||
},
|
||||
"input":{"shape":"EmptyStreamRequest"},
|
||||
"output":{"shape":"EmptyStreamResponse"}
|
||||
},
|
||||
"OtherOperation":{
|
||||
"name":"OtherOperation",
|
||||
"http":{
|
||||
"method":"POST",
|
||||
"requestUri":"/"
|
||||
},
|
||||
"errors":[
|
||||
{"shape":"ExceptionEvent2"}
|
||||
]
|
||||
}
|
||||
},
|
||||
"shapes":{
|
||||
"Bool":{"type":"boolean"},
|
||||
"Byte":{"type":"byte"},
|
||||
"Short":{"type":"short"},
|
||||
"Integer":{"type":"integer"},
|
||||
"Long":{"type":"long"},
|
||||
"Blob":{"type":"blob"},
|
||||
"String":{"type":"string"},
|
||||
"Time":{"type":"timestamp"},
|
||||
"GetEventStreamRequest":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"InputVal":{"shape":"String"}
|
||||
}
|
||||
},
|
||||
"GetEventStreamResponse":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"StrVal":{"shape":"String"},
|
||||
"IntVal":{"shape":"Integer"},
|
||||
"EventStream":{"shape":"EventStream"}
|
||||
}
|
||||
},
|
||||
"EventStream":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"Headers":{"shape":"HeaderOnlyEvent"},
|
||||
"ImplicitPayload":{"shape":"ImplicitPayloadEvent"},
|
||||
"ExplicitPayload":{"shape":"ExplicitPayloadEvent"},
|
||||
"PayloadOnly":{"shape":"PayloadOnlyEvent"},
|
||||
"PayloadOnlyBlob":{"shape":"PayloadOnlyBlobEvent"},
|
||||
"PayloadOnlyString":{"shape":"PayloadOnlyStringEvent"},
|
||||
"Empty":{"shape":"EmptyEvent"},
|
||||
"Exception":{"shape":"ExceptionEvent"},
|
||||
"Exception2":{"shape":"ExceptionEvent2"}
|
||||
},
|
||||
"eventstream":true
|
||||
},
|
||||
"EmptyStreamRequest":{
|
||||
"type":"structure",
|
||||
"members":{}
|
||||
},
|
||||
"EmptyStreamResponse":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"EventStream":{"shape":"EmptyEventStream"}
|
||||
}
|
||||
},
|
||||
"EmptyEventStream":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
},
|
||||
"eventstream":true
|
||||
},
|
||||
"HeaderOnlyEvent":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"BoolVal":{
|
||||
"shape":"Bool",
|
||||
"eventheader":true
|
||||
},
|
||||
"ByteVal":{
|
||||
"shape":"Byte",
|
||||
"eventheader":true
|
||||
},
|
||||
"ShortVal":{
|
||||
"shape":"Short",
|
||||
"eventheader":true
|
||||
},
|
||||
"IntegerVal":{
|
||||
"shape":"Integer",
|
||||
"eventheader":true
|
||||
},
|
||||
"LongVal":{
|
||||
"shape":"Long",
|
||||
"eventheader":true
|
||||
},
|
||||
"StringVal":{
|
||||
"shape":"String",
|
||||
"eventheader":true
|
||||
},
|
||||
"BlobVal":{
|
||||
"shape":"Blob",
|
||||
"eventheader":true
|
||||
},
|
||||
"TimeVal":{
|
||||
"shape":"Time",
|
||||
"eventheader":true
|
||||
}
|
||||
},
|
||||
"event":true
|
||||
},
|
||||
"ImplicitPayloadEvent": {
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"ByteVal":{
|
||||
"shape":"Byte",
|
||||
"eventheader":true
|
||||
},
|
||||
"ShortVal":{
|
||||
"shape":"Short"
|
||||
},
|
||||
"IntegerVal":{
|
||||
"shape":"Integer"
|
||||
}
|
||||
},
|
||||
"event":true
|
||||
},
|
||||
"ExplicitPayloadEvent": {
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"LongVal":{
|
||||
"shape":"Long",
|
||||
"eventheader":true
|
||||
},
|
||||
"StringVal":{
|
||||
"shape":"String",
|
||||
"eventheader":true
|
||||
},
|
||||
"NestedVal":{
|
||||
"shape":"NestedShape",
|
||||
"eventpayload":true
|
||||
}
|
||||
},
|
||||
"event":true
|
||||
},
|
||||
"PayloadOnlyEvent":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"NestedVal":{
|
||||
"shape":"NestedShape",
|
||||
"eventpayload":true
|
||||
}
|
||||
},
|
||||
"event":true
|
||||
},
|
||||
"PayloadOnlyBlobEvent":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"BlobPayload":{
|
||||
"shape":"Blob",
|
||||
"eventpayload":true
|
||||
}
|
||||
},
|
||||
"event":true
|
||||
},
|
||||
"PayloadOnlyStringEvent":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"StringPayload":{
|
||||
"shape":"String",
|
||||
"eventpayload":true
|
||||
}
|
||||
},
|
||||
"event":true
|
||||
},
|
||||
"EmptyEvent": {
|
||||
"type":"structure",
|
||||
"members":{},
|
||||
"event": true
|
||||
},
|
||||
"NestedShape": {
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"IntVal":{"shape":"Integer"},
|
||||
"StrVal":{"shape":"String"}
|
||||
}
|
||||
},
|
||||
"ExceptionEvent":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"IntVal":{"shape":"Integer"},
|
||||
"message":{"shape":"String"}
|
||||
},
|
||||
"exception":true
|
||||
},
|
||||
"ExceptionEvent2":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
},
|
||||
"exception":true
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": "2.0",
|
||||
"service": null,
|
||||
"operations": {
|
||||
},
|
||||
"shapes":{}
|
||||
}
|
||||
Generated
Vendored
+226
@@ -0,0 +1,226 @@
|
||||
{
|
||||
"version":"2.0",
|
||||
"metadata":{
|
||||
"apiVersion":"0000-00-00",
|
||||
"endpointPrefix":"restxmlservice",
|
||||
"protocol":"rest-xml",
|
||||
"serviceAbbreviation":"RESTXMLService",
|
||||
"serviceFullName":"REST XML Service",
|
||||
"serviceId":"RESTXMLService",
|
||||
"signatureVersion":"v4",
|
||||
"uid":"RESTXMLService-0000-00-00"
|
||||
},
|
||||
"operations":{
|
||||
"GetEventStream":{
|
||||
"name":"GetEventStream",
|
||||
"http":{
|
||||
"method":"POST",
|
||||
"requestUri":"/"
|
||||
},
|
||||
"input":{"shape":"GetEventStreamRequest"},
|
||||
"output":{"shape":"GetEventStreamResponse"}
|
||||
},
|
||||
"EmptyStream":{
|
||||
"name":"EmptyStream",
|
||||
"http":{
|
||||
"method":"POST",
|
||||
"requestUri":"/"
|
||||
},
|
||||
"input":{"shape":"EmptyStreamRequest"},
|
||||
"output":{"shape":"EmptyStreamResponse"}
|
||||
},
|
||||
"OtherOperation":{
|
||||
"name":"OtherOperation",
|
||||
"http":{
|
||||
"method":"POST",
|
||||
"requestUri":"/"
|
||||
},
|
||||
"errors":[
|
||||
{"shape":"ExceptionEvent2"}
|
||||
]
|
||||
}
|
||||
},
|
||||
"shapes":{
|
||||
"Bool":{"type":"boolean"},
|
||||
"Byte":{"type":"byte"},
|
||||
"Short":{"type":"short"},
|
||||
"Integer":{"type":"integer"},
|
||||
"Long":{"type":"long"},
|
||||
"Blob":{"type":"blob"},
|
||||
"String":{"type":"string"},
|
||||
"Time":{"type":"timestamp"},
|
||||
"GetEventStreamRequest":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"InputVal":{"shape":"String"}
|
||||
}
|
||||
},
|
||||
"GetEventStreamResponse":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"StrVal":{"shape":"String"},
|
||||
"IntVal":{"shape":"Integer"},
|
||||
"EventStream":{"shape":"EventStream"}
|
||||
}
|
||||
},
|
||||
"EventStream":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"Headers":{"shape":"HeaderOnlyEvent"},
|
||||
"ImplicitPayload":{"shape":"ImplicitPayloadEvent"},
|
||||
"ExplicitPayload":{"shape":"ExplicitPayloadEvent"},
|
||||
"PayloadOnly":{"shape":"PayloadOnlyEvent"},
|
||||
"PayloadOnlyBlob":{"shape":"PayloadOnlyBlobEvent"},
|
||||
"PayloadOnlyString":{"shape":"PayloadOnlyStringEvent"},
|
||||
"Empty":{"shape":"EmptyEvent"},
|
||||
"Exception":{"shape":"ExceptionEvent"},
|
||||
"Exception2":{"shape":"ExceptionEvent2"}
|
||||
},
|
||||
"eventstream":true
|
||||
},
|
||||
"EmptyStreamRequest":{
|
||||
"type":"structure",
|
||||
"members":{}
|
||||
},
|
||||
"EmptyStreamResponse":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"EventStream":{"shape":"EmptyEventStream"}
|
||||
}
|
||||
},
|
||||
"EmptyEventStream":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
},
|
||||
"eventstream":true
|
||||
},
|
||||
"HeaderOnlyEvent":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"BoolVal":{
|
||||
"shape":"Bool",
|
||||
"eventheader":true
|
||||
},
|
||||
"ByteVal":{
|
||||
"shape":"Byte",
|
||||
"eventheader":true
|
||||
},
|
||||
"ShortVal":{
|
||||
"shape":"Short",
|
||||
"eventheader":true
|
||||
},
|
||||
"IntegerVal":{
|
||||
"shape":"Integer",
|
||||
"eventheader":true
|
||||
},
|
||||
"LongVal":{
|
||||
"shape":"Long",
|
||||
"eventheader":true
|
||||
},
|
||||
"StringVal":{
|
||||
"shape":"String",
|
||||
"eventheader":true
|
||||
},
|
||||
"BlobVal":{
|
||||
"shape":"Blob",
|
||||
"eventheader":true
|
||||
},
|
||||
"TimeVal":{
|
||||
"shape":"Time",
|
||||
"eventheader":true
|
||||
}
|
||||
},
|
||||
"event":true
|
||||
},
|
||||
"ImplicitPayloadEvent": {
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"ByteVal":{
|
||||
"shape":"Byte",
|
||||
"eventheader":true
|
||||
},
|
||||
"ShortVal":{
|
||||
"shape":"Short"
|
||||
},
|
||||
"IntegerVal":{
|
||||
"shape":"Integer"
|
||||
}
|
||||
},
|
||||
"event":true
|
||||
},
|
||||
"ExplicitPayloadEvent": {
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"LongVal":{
|
||||
"shape":"Long",
|
||||
"eventheader":true
|
||||
},
|
||||
"StringVal":{
|
||||
"shape":"String",
|
||||
"eventheader":true
|
||||
},
|
||||
"NestedVal":{
|
||||
"shape":"NestedShape",
|
||||
"eventpayload":true
|
||||
}
|
||||
},
|
||||
"event":true
|
||||
},
|
||||
"PayloadOnlyEvent":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"NestedVal":{
|
||||
"shape":"NestedShape",
|
||||
"eventpayload":true
|
||||
}
|
||||
},
|
||||
"event":true
|
||||
},
|
||||
"PayloadOnlyBlobEvent":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"BlobPayload":{
|
||||
"shape":"Blob",
|
||||
"eventpayload":true
|
||||
}
|
||||
},
|
||||
"event":true
|
||||
},
|
||||
"PayloadOnlyStringEvent":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"StringPayload":{
|
||||
"shape":"String",
|
||||
"eventpayload":true
|
||||
}
|
||||
},
|
||||
"event":true
|
||||
},
|
||||
"EmptyEvent": {
|
||||
"type":"structure",
|
||||
"members":{},
|
||||
"event": true
|
||||
},
|
||||
"NestedShape": {
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"IntVal":{"shape":"Integer"},
|
||||
"StrVal":{"shape":"String"}
|
||||
}
|
||||
},
|
||||
"ExceptionEvent":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
"IntVal":{"shape":"Integer"},
|
||||
"message":{"shape":"String"}
|
||||
},
|
||||
"exception":true
|
||||
},
|
||||
"ExceptionEvent2":{
|
||||
"type":"structure",
|
||||
"members":{
|
||||
},
|
||||
"exception":true
|
||||
}
|
||||
}
|
||||
}
|
||||
vendor/github.com/aws/aws-sdk-go/private/model/api/codegentest/models/restxml/0000-00-00/docs-2.json
Generated
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": "2.0",
|
||||
"service": null,
|
||||
"operations": {
|
||||
},
|
||||
"shapes":{}
|
||||
}
|
||||
Generated
Vendored
+635
@@ -0,0 +1,635 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
package awsendpointdiscoverytest
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/awsutil"
|
||||
"github.com/aws/aws-sdk-go/aws/crr"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
)
|
||||
|
||||
const opDescribeEndpoints = "DescribeEndpoints"
|
||||
|
||||
// DescribeEndpointsRequest generates a "aws/request.Request" representing the
|
||||
// client's request for the DescribeEndpoints operation. The "output" return
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfully.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
// the "output" return value is not valid until after Send returns without error.
|
||||
//
|
||||
// See DescribeEndpoints for more information on using the DescribeEndpoints
|
||||
// API call, and error handling.
|
||||
//
|
||||
// This method is useful when you want to inject custom logic or configuration
|
||||
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
|
||||
//
|
||||
//
|
||||
// // Example sending a request using the DescribeEndpointsRequest method.
|
||||
// req, resp := client.DescribeEndpointsRequest(params)
|
||||
//
|
||||
// err := req.Send()
|
||||
// if err == nil { // resp is now filled
|
||||
// fmt.Println(resp)
|
||||
// }
|
||||
func (c *AwsEndpointDiscoveryTest) DescribeEndpointsRequest(input *DescribeEndpointsInput) (req *request.Request, output *DescribeEndpointsOutput) {
|
||||
op := &request.Operation{
|
||||
Name: opDescribeEndpoints,
|
||||
HTTPMethod: "POST",
|
||||
HTTPPath: "/",
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &DescribeEndpointsInput{}
|
||||
}
|
||||
|
||||
output = &DescribeEndpointsOutput{}
|
||||
req = c.newRequest(op, input, output)
|
||||
return
|
||||
}
|
||||
|
||||
// DescribeEndpoints API operation for AwsEndpointDiscoveryTest.
|
||||
//
|
||||
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
|
||||
// with awserr.Error's Code and Message methods to get detailed information about
|
||||
// the error.
|
||||
//
|
||||
// See the AWS API reference guide for AwsEndpointDiscoveryTest's
|
||||
// API operation DescribeEndpoints for usage and error information.
|
||||
func (c *AwsEndpointDiscoveryTest) DescribeEndpoints(input *DescribeEndpointsInput) (*DescribeEndpointsOutput, error) {
|
||||
req, out := c.DescribeEndpointsRequest(input)
|
||||
return out, req.Send()
|
||||
}
|
||||
|
||||
// DescribeEndpointsWithContext is the same as DescribeEndpoints with the addition of
|
||||
// the ability to pass a context and additional request options.
|
||||
//
|
||||
// See DescribeEndpoints for details on how to use this API operation.
|
||||
//
|
||||
// The context must be non-nil and will be used for request cancellation. If
|
||||
// the context is nil a panic will occur. In the future the SDK may create
|
||||
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
|
||||
// for more information on using Contexts.
|
||||
func (c *AwsEndpointDiscoveryTest) DescribeEndpointsWithContext(ctx aws.Context, input *DescribeEndpointsInput, opts ...request.Option) (*DescribeEndpointsOutput, error) {
|
||||
req, out := c.DescribeEndpointsRequest(input)
|
||||
req.SetContext(ctx)
|
||||
req.ApplyOptions(opts...)
|
||||
return out, req.Send()
|
||||
}
|
||||
|
||||
type discovererDescribeEndpoints struct {
|
||||
Client *AwsEndpointDiscoveryTest
|
||||
Required bool
|
||||
EndpointCache *crr.EndpointCache
|
||||
Params map[string]*string
|
||||
Key string
|
||||
}
|
||||
|
||||
func (d *discovererDescribeEndpoints) Discover() (crr.Endpoint, error) {
|
||||
input := &DescribeEndpointsInput{
|
||||
Operation: d.Params["op"],
|
||||
}
|
||||
|
||||
resp, err := d.Client.DescribeEndpoints(input)
|
||||
if err != nil {
|
||||
return crr.Endpoint{}, err
|
||||
}
|
||||
|
||||
endpoint := crr.Endpoint{
|
||||
Key: d.Key,
|
||||
}
|
||||
|
||||
for _, e := range resp.Endpoints {
|
||||
if e.Address == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
cachedInMinutes := aws.Int64Value(e.CachePeriodInMinutes)
|
||||
u, err := url.Parse(*e.Address)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
addr := crr.WeightedAddress{
|
||||
URL: u,
|
||||
Expired: time.Now().Add(time.Duration(cachedInMinutes) * time.Minute),
|
||||
}
|
||||
|
||||
endpoint.Add(addr)
|
||||
}
|
||||
|
||||
d.EndpointCache.Add(endpoint)
|
||||
|
||||
return endpoint, nil
|
||||
}
|
||||
|
||||
func (d *discovererDescribeEndpoints) Handler(r *request.Request) {
|
||||
endpointKey := crr.BuildEndpointKey(d.Params)
|
||||
d.Key = endpointKey
|
||||
|
||||
endpoint, err := d.EndpointCache.Get(d, endpointKey, d.Required)
|
||||
if err != nil {
|
||||
r.Error = err
|
||||
return
|
||||
}
|
||||
|
||||
if endpoint.URL != nil && len(endpoint.URL.String()) > 0 {
|
||||
r.HTTPRequest.URL = endpoint.URL
|
||||
}
|
||||
}
|
||||
|
||||
const opTestDiscoveryIdentifiersRequired = "TestDiscoveryIdentifiersRequired"
|
||||
|
||||
// TestDiscoveryIdentifiersRequiredRequest generates a "aws/request.Request" representing the
|
||||
// client's request for the TestDiscoveryIdentifiersRequired operation. The "output" return
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfully.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
// the "output" return value is not valid until after Send returns without error.
|
||||
//
|
||||
// See TestDiscoveryIdentifiersRequired for more information on using the TestDiscoveryIdentifiersRequired
|
||||
// API call, and error handling.
|
||||
//
|
||||
// This method is useful when you want to inject custom logic or configuration
|
||||
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
|
||||
//
|
||||
//
|
||||
// // Example sending a request using the TestDiscoveryIdentifiersRequiredRequest method.
|
||||
// req, resp := client.TestDiscoveryIdentifiersRequiredRequest(params)
|
||||
//
|
||||
// err := req.Send()
|
||||
// if err == nil { // resp is now filled
|
||||
// fmt.Println(resp)
|
||||
// }
|
||||
func (c *AwsEndpointDiscoveryTest) TestDiscoveryIdentifiersRequiredRequest(input *TestDiscoveryIdentifiersRequiredInput) (req *request.Request, output *TestDiscoveryIdentifiersRequiredOutput) {
|
||||
op := &request.Operation{
|
||||
Name: opTestDiscoveryIdentifiersRequired,
|
||||
HTTPMethod: "POST",
|
||||
HTTPPath: "/",
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &TestDiscoveryIdentifiersRequiredInput{}
|
||||
}
|
||||
|
||||
output = &TestDiscoveryIdentifiersRequiredOutput{}
|
||||
req = c.newRequest(op, input, output)
|
||||
de := discovererDescribeEndpoints{
|
||||
Required: true,
|
||||
EndpointCache: c.endpointCache,
|
||||
Params: map[string]*string{
|
||||
"op": aws.String(req.Operation.Name),
|
||||
"Sdk": input.Sdk,
|
||||
},
|
||||
Client: c,
|
||||
}
|
||||
|
||||
for k, v := range de.Params {
|
||||
if v == nil {
|
||||
delete(de.Params, k)
|
||||
}
|
||||
}
|
||||
|
||||
req.Handlers.Build.PushFrontNamed(request.NamedHandler{
|
||||
Name: "crr.endpointdiscovery",
|
||||
Fn: de.Handler,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// TestDiscoveryIdentifiersRequired API operation for AwsEndpointDiscoveryTest.
|
||||
//
|
||||
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
|
||||
// with awserr.Error's Code and Message methods to get detailed information about
|
||||
// the error.
|
||||
//
|
||||
// See the AWS API reference guide for AwsEndpointDiscoveryTest's
|
||||
// API operation TestDiscoveryIdentifiersRequired for usage and error information.
|
||||
func (c *AwsEndpointDiscoveryTest) TestDiscoveryIdentifiersRequired(input *TestDiscoveryIdentifiersRequiredInput) (*TestDiscoveryIdentifiersRequiredOutput, error) {
|
||||
req, out := c.TestDiscoveryIdentifiersRequiredRequest(input)
|
||||
return out, req.Send()
|
||||
}
|
||||
|
||||
// TestDiscoveryIdentifiersRequiredWithContext is the same as TestDiscoveryIdentifiersRequired with the addition of
|
||||
// the ability to pass a context and additional request options.
|
||||
//
|
||||
// See TestDiscoveryIdentifiersRequired for details on how to use this API operation.
|
||||
//
|
||||
// The context must be non-nil and will be used for request cancellation. If
|
||||
// the context is nil a panic will occur. In the future the SDK may create
|
||||
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
|
||||
// for more information on using Contexts.
|
||||
func (c *AwsEndpointDiscoveryTest) TestDiscoveryIdentifiersRequiredWithContext(ctx aws.Context, input *TestDiscoveryIdentifiersRequiredInput, opts ...request.Option) (*TestDiscoveryIdentifiersRequiredOutput, error) {
|
||||
req, out := c.TestDiscoveryIdentifiersRequiredRequest(input)
|
||||
req.SetContext(ctx)
|
||||
req.ApplyOptions(opts...)
|
||||
return out, req.Send()
|
||||
}
|
||||
|
||||
const opTestDiscoveryOptional = "TestDiscoveryOptional"
|
||||
|
||||
// TestDiscoveryOptionalRequest generates a "aws/request.Request" representing the
|
||||
// client's request for the TestDiscoveryOptional operation. The "output" return
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfully.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
// the "output" return value is not valid until after Send returns without error.
|
||||
//
|
||||
// See TestDiscoveryOptional for more information on using the TestDiscoveryOptional
|
||||
// API call, and error handling.
|
||||
//
|
||||
// This method is useful when you want to inject custom logic or configuration
|
||||
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
|
||||
//
|
||||
//
|
||||
// // Example sending a request using the TestDiscoveryOptionalRequest method.
|
||||
// req, resp := client.TestDiscoveryOptionalRequest(params)
|
||||
//
|
||||
// err := req.Send()
|
||||
// if err == nil { // resp is now filled
|
||||
// fmt.Println(resp)
|
||||
// }
|
||||
func (c *AwsEndpointDiscoveryTest) TestDiscoveryOptionalRequest(input *TestDiscoveryOptionalInput) (req *request.Request, output *TestDiscoveryOptionalOutput) {
|
||||
op := &request.Operation{
|
||||
Name: opTestDiscoveryOptional,
|
||||
HTTPMethod: "POST",
|
||||
HTTPPath: "/",
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &TestDiscoveryOptionalInput{}
|
||||
}
|
||||
|
||||
output = &TestDiscoveryOptionalOutput{}
|
||||
req = c.newRequest(op, input, output)
|
||||
if aws.BoolValue(req.Config.EnableEndpointDiscovery) {
|
||||
de := discovererDescribeEndpoints{
|
||||
Required: false,
|
||||
EndpointCache: c.endpointCache,
|
||||
Params: map[string]*string{
|
||||
"op": aws.String(req.Operation.Name),
|
||||
},
|
||||
Client: c,
|
||||
}
|
||||
|
||||
for k, v := range de.Params {
|
||||
if v == nil {
|
||||
delete(de.Params, k)
|
||||
}
|
||||
}
|
||||
|
||||
req.Handlers.Build.PushFrontNamed(request.NamedHandler{
|
||||
Name: "crr.endpointdiscovery",
|
||||
Fn: de.Handler,
|
||||
})
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// TestDiscoveryOptional API operation for AwsEndpointDiscoveryTest.
|
||||
//
|
||||
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
|
||||
// with awserr.Error's Code and Message methods to get detailed information about
|
||||
// the error.
|
||||
//
|
||||
// See the AWS API reference guide for AwsEndpointDiscoveryTest's
|
||||
// API operation TestDiscoveryOptional for usage and error information.
|
||||
func (c *AwsEndpointDiscoveryTest) TestDiscoveryOptional(input *TestDiscoveryOptionalInput) (*TestDiscoveryOptionalOutput, error) {
|
||||
req, out := c.TestDiscoveryOptionalRequest(input)
|
||||
return out, req.Send()
|
||||
}
|
||||
|
||||
// TestDiscoveryOptionalWithContext is the same as TestDiscoveryOptional with the addition of
|
||||
// the ability to pass a context and additional request options.
|
||||
//
|
||||
// See TestDiscoveryOptional for details on how to use this API operation.
|
||||
//
|
||||
// The context must be non-nil and will be used for request cancellation. If
|
||||
// the context is nil a panic will occur. In the future the SDK may create
|
||||
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
|
||||
// for more information on using Contexts.
|
||||
func (c *AwsEndpointDiscoveryTest) TestDiscoveryOptionalWithContext(ctx aws.Context, input *TestDiscoveryOptionalInput, opts ...request.Option) (*TestDiscoveryOptionalOutput, error) {
|
||||
req, out := c.TestDiscoveryOptionalRequest(input)
|
||||
req.SetContext(ctx)
|
||||
req.ApplyOptions(opts...)
|
||||
return out, req.Send()
|
||||
}
|
||||
|
||||
const opTestDiscoveryRequired = "TestDiscoveryRequired"
|
||||
|
||||
// TestDiscoveryRequiredRequest generates a "aws/request.Request" representing the
|
||||
// client's request for the TestDiscoveryRequired operation. The "output" return
|
||||
// value will be populated with the request's response once the request completes
|
||||
// successfully.
|
||||
//
|
||||
// Use "Send" method on the returned Request to send the API call to the service.
|
||||
// the "output" return value is not valid until after Send returns without error.
|
||||
//
|
||||
// See TestDiscoveryRequired for more information on using the TestDiscoveryRequired
|
||||
// API call, and error handling.
|
||||
//
|
||||
// This method is useful when you want to inject custom logic or configuration
|
||||
// into the SDK's request lifecycle. Such as custom headers, or retry logic.
|
||||
//
|
||||
//
|
||||
// // Example sending a request using the TestDiscoveryRequiredRequest method.
|
||||
// req, resp := client.TestDiscoveryRequiredRequest(params)
|
||||
//
|
||||
// err := req.Send()
|
||||
// if err == nil { // resp is now filled
|
||||
// fmt.Println(resp)
|
||||
// }
|
||||
func (c *AwsEndpointDiscoveryTest) TestDiscoveryRequiredRequest(input *TestDiscoveryRequiredInput) (req *request.Request, output *TestDiscoveryRequiredOutput) {
|
||||
op := &request.Operation{
|
||||
Name: opTestDiscoveryRequired,
|
||||
HTTPMethod: "POST",
|
||||
HTTPPath: "/",
|
||||
}
|
||||
|
||||
if input == nil {
|
||||
input = &TestDiscoveryRequiredInput{}
|
||||
}
|
||||
|
||||
output = &TestDiscoveryRequiredOutput{}
|
||||
req = c.newRequest(op, input, output)
|
||||
if aws.BoolValue(req.Config.EnableEndpointDiscovery) {
|
||||
de := discovererDescribeEndpoints{
|
||||
Required: false,
|
||||
EndpointCache: c.endpointCache,
|
||||
Params: map[string]*string{
|
||||
"op": aws.String(req.Operation.Name),
|
||||
},
|
||||
Client: c,
|
||||
}
|
||||
|
||||
for k, v := range de.Params {
|
||||
if v == nil {
|
||||
delete(de.Params, k)
|
||||
}
|
||||
}
|
||||
|
||||
req.Handlers.Build.PushFrontNamed(request.NamedHandler{
|
||||
Name: "crr.endpointdiscovery",
|
||||
Fn: de.Handler,
|
||||
})
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// TestDiscoveryRequired API operation for AwsEndpointDiscoveryTest.
|
||||
//
|
||||
// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
|
||||
// with awserr.Error's Code and Message methods to get detailed information about
|
||||
// the error.
|
||||
//
|
||||
// See the AWS API reference guide for AwsEndpointDiscoveryTest's
|
||||
// API operation TestDiscoveryRequired for usage and error information.
|
||||
func (c *AwsEndpointDiscoveryTest) TestDiscoveryRequired(input *TestDiscoveryRequiredInput) (*TestDiscoveryRequiredOutput, error) {
|
||||
req, out := c.TestDiscoveryRequiredRequest(input)
|
||||
return out, req.Send()
|
||||
}
|
||||
|
||||
// TestDiscoveryRequiredWithContext is the same as TestDiscoveryRequired with the addition of
|
||||
// the ability to pass a context and additional request options.
|
||||
//
|
||||
// See TestDiscoveryRequired for details on how to use this API operation.
|
||||
//
|
||||
// The context must be non-nil and will be used for request cancellation. If
|
||||
// the context is nil a panic will occur. In the future the SDK may create
|
||||
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
|
||||
// for more information on using Contexts.
|
||||
func (c *AwsEndpointDiscoveryTest) TestDiscoveryRequiredWithContext(ctx aws.Context, input *TestDiscoveryRequiredInput, opts ...request.Option) (*TestDiscoveryRequiredOutput, error) {
|
||||
req, out := c.TestDiscoveryRequiredRequest(input)
|
||||
req.SetContext(ctx)
|
||||
req.ApplyOptions(opts...)
|
||||
return out, req.Send()
|
||||
}
|
||||
|
||||
type DescribeEndpointsInput struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
Operation *string `type:"string"`
|
||||
}
|
||||
|
||||
// String returns the string representation
|
||||
func (s DescribeEndpointsInput) String() string {
|
||||
return awsutil.Prettify(s)
|
||||
}
|
||||
|
||||
// GoString returns the string representation
|
||||
func (s DescribeEndpointsInput) GoString() string {
|
||||
return s.String()
|
||||
}
|
||||
|
||||
// SetOperation sets the Operation field's value.
|
||||
func (s *DescribeEndpointsInput) SetOperation(v string) *DescribeEndpointsInput {
|
||||
s.Operation = &v
|
||||
return s
|
||||
}
|
||||
|
||||
type DescribeEndpointsOutput struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
// Endpoints is a required field
|
||||
Endpoints []*Endpoint `type:"list" required:"true"`
|
||||
}
|
||||
|
||||
// String returns the string representation
|
||||
func (s DescribeEndpointsOutput) String() string {
|
||||
return awsutil.Prettify(s)
|
||||
}
|
||||
|
||||
// GoString returns the string representation
|
||||
func (s DescribeEndpointsOutput) GoString() string {
|
||||
return s.String()
|
||||
}
|
||||
|
||||
// SetEndpoints sets the Endpoints field's value.
|
||||
func (s *DescribeEndpointsOutput) SetEndpoints(v []*Endpoint) *DescribeEndpointsOutput {
|
||||
s.Endpoints = v
|
||||
return s
|
||||
}
|
||||
|
||||
type Endpoint struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
// Address is a required field
|
||||
Address *string `type:"string" required:"true"`
|
||||
|
||||
// CachePeriodInMinutes is a required field
|
||||
CachePeriodInMinutes *int64 `type:"long" required:"true"`
|
||||
}
|
||||
|
||||
// String returns the string representation
|
||||
func (s Endpoint) String() string {
|
||||
return awsutil.Prettify(s)
|
||||
}
|
||||
|
||||
// GoString returns the string representation
|
||||
func (s Endpoint) GoString() string {
|
||||
return s.String()
|
||||
}
|
||||
|
||||
// SetAddress sets the Address field's value.
|
||||
func (s *Endpoint) SetAddress(v string) *Endpoint {
|
||||
s.Address = &v
|
||||
return s
|
||||
}
|
||||
|
||||
// SetCachePeriodInMinutes sets the CachePeriodInMinutes field's value.
|
||||
func (s *Endpoint) SetCachePeriodInMinutes(v int64) *Endpoint {
|
||||
s.CachePeriodInMinutes = &v
|
||||
return s
|
||||
}
|
||||
|
||||
type TestDiscoveryIdentifiersRequiredInput struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
// Sdk is a required field
|
||||
Sdk *string `type:"string" required:"true"`
|
||||
}
|
||||
|
||||
// String returns the string representation
|
||||
func (s TestDiscoveryIdentifiersRequiredInput) String() string {
|
||||
return awsutil.Prettify(s)
|
||||
}
|
||||
|
||||
// GoString returns the string representation
|
||||
func (s TestDiscoveryIdentifiersRequiredInput) GoString() string {
|
||||
return s.String()
|
||||
}
|
||||
|
||||
// Validate inspects the fields of the type to determine if they are valid.
|
||||
func (s *TestDiscoveryIdentifiersRequiredInput) Validate() error {
|
||||
invalidParams := request.ErrInvalidParams{Context: "TestDiscoveryIdentifiersRequiredInput"}
|
||||
if s.Sdk == nil {
|
||||
invalidParams.Add(request.NewErrParamRequired("Sdk"))
|
||||
}
|
||||
|
||||
if invalidParams.Len() > 0 {
|
||||
return invalidParams
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetSdk sets the Sdk field's value.
|
||||
func (s *TestDiscoveryIdentifiersRequiredInput) SetSdk(v string) *TestDiscoveryIdentifiersRequiredInput {
|
||||
s.Sdk = &v
|
||||
return s
|
||||
}
|
||||
|
||||
type TestDiscoveryIdentifiersRequiredOutput struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
RequestSuccessful *bool `type:"boolean"`
|
||||
}
|
||||
|
||||
// String returns the string representation
|
||||
func (s TestDiscoveryIdentifiersRequiredOutput) String() string {
|
||||
return awsutil.Prettify(s)
|
||||
}
|
||||
|
||||
// GoString returns the string representation
|
||||
func (s TestDiscoveryIdentifiersRequiredOutput) GoString() string {
|
||||
return s.String()
|
||||
}
|
||||
|
||||
// SetRequestSuccessful sets the RequestSuccessful field's value.
|
||||
func (s *TestDiscoveryIdentifiersRequiredOutput) SetRequestSuccessful(v bool) *TestDiscoveryIdentifiersRequiredOutput {
|
||||
s.RequestSuccessful = &v
|
||||
return s
|
||||
}
|
||||
|
||||
type TestDiscoveryOptionalInput struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
Sdk *string `type:"string"`
|
||||
}
|
||||
|
||||
// String returns the string representation
|
||||
func (s TestDiscoveryOptionalInput) String() string {
|
||||
return awsutil.Prettify(s)
|
||||
}
|
||||
|
||||
// GoString returns the string representation
|
||||
func (s TestDiscoveryOptionalInput) GoString() string {
|
||||
return s.String()
|
||||
}
|
||||
|
||||
// SetSdk sets the Sdk field's value.
|
||||
func (s *TestDiscoveryOptionalInput) SetSdk(v string) *TestDiscoveryOptionalInput {
|
||||
s.Sdk = &v
|
||||
return s
|
||||
}
|
||||
|
||||
type TestDiscoveryOptionalOutput struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
RequestSuccessful *bool `type:"boolean"`
|
||||
}
|
||||
|
||||
// String returns the string representation
|
||||
func (s TestDiscoveryOptionalOutput) String() string {
|
||||
return awsutil.Prettify(s)
|
||||
}
|
||||
|
||||
// GoString returns the string representation
|
||||
func (s TestDiscoveryOptionalOutput) GoString() string {
|
||||
return s.String()
|
||||
}
|
||||
|
||||
// SetRequestSuccessful sets the RequestSuccessful field's value.
|
||||
func (s *TestDiscoveryOptionalOutput) SetRequestSuccessful(v bool) *TestDiscoveryOptionalOutput {
|
||||
s.RequestSuccessful = &v
|
||||
return s
|
||||
}
|
||||
|
||||
type TestDiscoveryRequiredInput struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
Sdk *string `type:"string"`
|
||||
}
|
||||
|
||||
// String returns the string representation
|
||||
func (s TestDiscoveryRequiredInput) String() string {
|
||||
return awsutil.Prettify(s)
|
||||
}
|
||||
|
||||
// GoString returns the string representation
|
||||
func (s TestDiscoveryRequiredInput) GoString() string {
|
||||
return s.String()
|
||||
}
|
||||
|
||||
// SetSdk sets the Sdk field's value.
|
||||
func (s *TestDiscoveryRequiredInput) SetSdk(v string) *TestDiscoveryRequiredInput {
|
||||
s.Sdk = &v
|
||||
return s
|
||||
}
|
||||
|
||||
type TestDiscoveryRequiredOutput struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
RequestSuccessful *bool `type:"boolean"`
|
||||
}
|
||||
|
||||
// String returns the string representation
|
||||
func (s TestDiscoveryRequiredOutput) String() string {
|
||||
return awsutil.Prettify(s)
|
||||
}
|
||||
|
||||
// GoString returns the string representation
|
||||
func (s TestDiscoveryRequiredOutput) GoString() string {
|
||||
return s.String()
|
||||
}
|
||||
|
||||
// SetRequestSuccessful sets the RequestSuccessful field's value.
|
||||
func (s *TestDiscoveryRequiredOutput) SetRequestSuccessful(v bool) *TestDiscoveryRequiredOutput {
|
||||
s.RequestSuccessful = &v
|
||||
return s
|
||||
}
|
||||
Generated
Vendored
+80
@@ -0,0 +1,80 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
// Package awsendpointdiscoverytestiface provides an interface to enable mocking the AwsEndpointDiscoveryTest service client
|
||||
// for testing your code.
|
||||
//
|
||||
// It is important to note that this interface will have breaking changes
|
||||
// when the service model is updated and adds new API operations, paginators,
|
||||
// and waiters.
|
||||
package awsendpointdiscoverytestiface
|
||||
|
||||
import (
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/private/model/api/codegentest/service/awsendpointdiscoverytest"
|
||||
)
|
||||
|
||||
// AwsEndpointDiscoveryTestAPI provides an interface to enable mocking the
|
||||
// awsendpointdiscoverytest.AwsEndpointDiscoveryTest service client's API operation,
|
||||
// paginators, and waiters. This make unit testing your code that calls out
|
||||
// to the SDK's service client's calls easier.
|
||||
//
|
||||
// The best way to use this interface is so the SDK's service client's calls
|
||||
// can be stubbed out for unit testing your code with the SDK without needing
|
||||
// to inject custom request handlers into the SDK's request pipeline.
|
||||
//
|
||||
// // myFunc uses an SDK service client to make a request to
|
||||
// // AwsEndpointDiscoveryTest.
|
||||
// func myFunc(svc awsendpointdiscoverytestiface.AwsEndpointDiscoveryTestAPI) bool {
|
||||
// // Make svc.DescribeEndpoints request
|
||||
// }
|
||||
//
|
||||
// func main() {
|
||||
// sess := session.New()
|
||||
// svc := awsendpointdiscoverytest.New(sess)
|
||||
//
|
||||
// myFunc(svc)
|
||||
// }
|
||||
//
|
||||
// In your _test.go file:
|
||||
//
|
||||
// // Define a mock struct to be used in your unit tests of myFunc.
|
||||
// type mockAwsEndpointDiscoveryTestClient struct {
|
||||
// awsendpointdiscoverytestiface.AwsEndpointDiscoveryTestAPI
|
||||
// }
|
||||
// func (m *mockAwsEndpointDiscoveryTestClient) DescribeEndpoints(input *awsendpointdiscoverytest.DescribeEndpointsInput) (*awsendpointdiscoverytest.DescribeEndpointsOutput, error) {
|
||||
// // mock response/functionality
|
||||
// }
|
||||
//
|
||||
// func TestMyFunc(t *testing.T) {
|
||||
// // Setup Test
|
||||
// mockSvc := &mockAwsEndpointDiscoveryTestClient{}
|
||||
//
|
||||
// myfunc(mockSvc)
|
||||
//
|
||||
// // Verify myFunc's functionality
|
||||
// }
|
||||
//
|
||||
// It is important to note that this interface will have breaking changes
|
||||
// when the service model is updated and adds new API operations, paginators,
|
||||
// and waiters. Its suggested to use the pattern above for testing, or using
|
||||
// tooling to generate mocks to satisfy the interfaces.
|
||||
type AwsEndpointDiscoveryTestAPI interface {
|
||||
DescribeEndpoints(*awsendpointdiscoverytest.DescribeEndpointsInput) (*awsendpointdiscoverytest.DescribeEndpointsOutput, error)
|
||||
DescribeEndpointsWithContext(aws.Context, *awsendpointdiscoverytest.DescribeEndpointsInput, ...request.Option) (*awsendpointdiscoverytest.DescribeEndpointsOutput, error)
|
||||
DescribeEndpointsRequest(*awsendpointdiscoverytest.DescribeEndpointsInput) (*request.Request, *awsendpointdiscoverytest.DescribeEndpointsOutput)
|
||||
|
||||
TestDiscoveryIdentifiersRequired(*awsendpointdiscoverytest.TestDiscoveryIdentifiersRequiredInput) (*awsendpointdiscoverytest.TestDiscoveryIdentifiersRequiredOutput, error)
|
||||
TestDiscoveryIdentifiersRequiredWithContext(aws.Context, *awsendpointdiscoverytest.TestDiscoveryIdentifiersRequiredInput, ...request.Option) (*awsendpointdiscoverytest.TestDiscoveryIdentifiersRequiredOutput, error)
|
||||
TestDiscoveryIdentifiersRequiredRequest(*awsendpointdiscoverytest.TestDiscoveryIdentifiersRequiredInput) (*request.Request, *awsendpointdiscoverytest.TestDiscoveryIdentifiersRequiredOutput)
|
||||
|
||||
TestDiscoveryOptional(*awsendpointdiscoverytest.TestDiscoveryOptionalInput) (*awsendpointdiscoverytest.TestDiscoveryOptionalOutput, error)
|
||||
TestDiscoveryOptionalWithContext(aws.Context, *awsendpointdiscoverytest.TestDiscoveryOptionalInput, ...request.Option) (*awsendpointdiscoverytest.TestDiscoveryOptionalOutput, error)
|
||||
TestDiscoveryOptionalRequest(*awsendpointdiscoverytest.TestDiscoveryOptionalInput) (*request.Request, *awsendpointdiscoverytest.TestDiscoveryOptionalOutput)
|
||||
|
||||
TestDiscoveryRequired(*awsendpointdiscoverytest.TestDiscoveryRequiredInput) (*awsendpointdiscoverytest.TestDiscoveryRequiredOutput, error)
|
||||
TestDiscoveryRequiredWithContext(aws.Context, *awsendpointdiscoverytest.TestDiscoveryRequiredInput, ...request.Option) (*awsendpointdiscoverytest.TestDiscoveryRequiredOutput, error)
|
||||
TestDiscoveryRequiredRequest(*awsendpointdiscoverytest.TestDiscoveryRequiredInput) (*request.Request, *awsendpointdiscoverytest.TestDiscoveryRequiredOutput)
|
||||
}
|
||||
|
||||
var _ AwsEndpointDiscoveryTestAPI = (*awsendpointdiscoverytest.AwsEndpointDiscoveryTest)(nil)
|
||||
Generated
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
// Package awsendpointdiscoverytest provides the client and types for making API
|
||||
// requests to AwsEndpointDiscoveryTest.
|
||||
//
|
||||
// See awsendpointdiscoverytest package documentation for more information.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/service/awsendpointdiscoverytest/
|
||||
//
|
||||
// Using the Client
|
||||
//
|
||||
// To contact AwsEndpointDiscoveryTest with the SDK use the New function to create
|
||||
// a new service client. With that client you can make API requests to the service.
|
||||
// These clients are safe to use concurrently.
|
||||
//
|
||||
// See the SDK's documentation for more information on how to use the SDK.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/
|
||||
//
|
||||
// See aws.Config documentation for more information on configuring SDK clients.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config
|
||||
//
|
||||
// See the AwsEndpointDiscoveryTest client AwsEndpointDiscoveryTest for more
|
||||
// information on creating client for this service.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/service/awsendpointdiscoverytest/#New
|
||||
package awsendpointdiscoverytest
|
||||
Generated
Vendored
+136
@@ -0,0 +1,136 @@
|
||||
package awsendpointdiscoverytest
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/awstesting/unit"
|
||||
)
|
||||
|
||||
func TestEndpointDiscovery(t *testing.T) {
|
||||
svc := New(unit.Session, &aws.Config{
|
||||
EnableEndpointDiscovery: aws.Bool(true),
|
||||
})
|
||||
svc.Handlers.Clear()
|
||||
svc.Handlers.Send.PushBack(mockSendDescEndpoint)
|
||||
|
||||
var descCount int32
|
||||
svc.Handlers.Complete.PushBack(func(r *request.Request) {
|
||||
if r.Operation.Name != opDescribeEndpoints {
|
||||
return
|
||||
}
|
||||
atomic.AddInt32(&descCount, 1)
|
||||
})
|
||||
|
||||
for i := 0; i < 2; i++ {
|
||||
req, _ := svc.TestDiscoveryIdentifiersRequiredRequest(
|
||||
&TestDiscoveryIdentifiersRequiredInput{
|
||||
Sdk: aws.String("sdk"),
|
||||
},
|
||||
)
|
||||
req.Handlers.Send.PushBack(func(r *request.Request) {
|
||||
if e, a := "http://foo", r.HTTPRequest.URL.String(); e != a {
|
||||
t.Errorf("expected %q, but received %q", e, a)
|
||||
}
|
||||
})
|
||||
if err := req.Send(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
if e, a := int32(1), atomic.LoadInt32(&descCount); e != a {
|
||||
t.Errorf("expect desc endpoint called %d, got %d", e, a)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAsyncEndpointDiscovery(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
svc := New(unit.Session, &aws.Config{
|
||||
EnableEndpointDiscovery: aws.Bool(true),
|
||||
})
|
||||
svc.Handlers.Clear()
|
||||
|
||||
var firstAsyncReq sync.WaitGroup
|
||||
firstAsyncReq.Add(1)
|
||||
svc.Handlers.Build.PushBack(func(r *request.Request) {
|
||||
if r.Operation.Name == opDescribeEndpoints {
|
||||
firstAsyncReq.Wait()
|
||||
}
|
||||
})
|
||||
svc.Handlers.Send.PushBack(mockSendDescEndpoint)
|
||||
|
||||
req, _ := svc.TestDiscoveryOptionalRequest(&TestDiscoveryOptionalInput{
|
||||
Sdk: aws.String("sdk"),
|
||||
})
|
||||
const clientHost = "awsendpointdiscoverytestservice.mock-region.amazonaws.com"
|
||||
req.Handlers.Send.PushBack(func(r *request.Request) {
|
||||
if e, a := clientHost, r.HTTPRequest.URL.Host; e != a {
|
||||
t.Errorf("expected %q, but received %q", e, a)
|
||||
}
|
||||
})
|
||||
req.Handlers.Complete.PushBack(func(r *request.Request) {
|
||||
firstAsyncReq.Done()
|
||||
})
|
||||
if err := req.Send(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
var cacheUpdated bool
|
||||
for s := time.Now().Add(10 * time.Second); s.After(time.Now()); {
|
||||
// Wait for the cache to be updated before making second request.
|
||||
if svc.endpointCache.Has(req.Operation.Name) {
|
||||
cacheUpdated = true
|
||||
break
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
if !cacheUpdated {
|
||||
t.Fatalf("expect endpoint cache to be updated, was not")
|
||||
}
|
||||
|
||||
req, _ = svc.TestDiscoveryOptionalRequest(&TestDiscoveryOptionalInput{
|
||||
Sdk: aws.String("sdk"),
|
||||
})
|
||||
req.Handlers.Send.PushBack(func(r *request.Request) {
|
||||
if e, a := "http://foo", r.HTTPRequest.URL.String(); e != a {
|
||||
t.Errorf("expected %q, but received %q", e, a)
|
||||
}
|
||||
})
|
||||
if err := req.Send(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func removeHandlers(h request.Handlers, removeSendHandlers bool) request.Handlers {
|
||||
if removeSendHandlers {
|
||||
h.Send.Clear()
|
||||
}
|
||||
h.Unmarshal.Clear()
|
||||
h.UnmarshalStream.Clear()
|
||||
h.UnmarshalMeta.Clear()
|
||||
h.UnmarshalError.Clear()
|
||||
h.Validate.Clear()
|
||||
h.Complete.Clear()
|
||||
h.ValidateResponse.Clear()
|
||||
return h
|
||||
}
|
||||
|
||||
func mockSendDescEndpoint(r *request.Request) {
|
||||
if r.Operation.Name != opDescribeEndpoints {
|
||||
return
|
||||
}
|
||||
|
||||
out, _ := r.Data.(*DescribeEndpointsOutput)
|
||||
out.Endpoints = []*Endpoint{
|
||||
{
|
||||
Address: aws.String("http://foo"),
|
||||
CachePeriodInMinutes: aws.Int64(5),
|
||||
},
|
||||
}
|
||||
r.Data = out
|
||||
}
|
||||
Generated
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
package awsendpointdiscoverytest
|
||||
Generated
Vendored
+103
@@ -0,0 +1,103 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
package awsendpointdiscoverytest
|
||||
|
||||
import (
|
||||
"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/crr"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/aws/signer/v4"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
|
||||
)
|
||||
|
||||
// AwsEndpointDiscoveryTest provides the API operation methods for making requests to
|
||||
// AwsEndpointDiscoveryTest. See this package's package overview docs
|
||||
// for details on the service.
|
||||
//
|
||||
// AwsEndpointDiscoveryTest methods are safe to use concurrently. It is not safe to
|
||||
// modify mutate any of the struct's properties though.
|
||||
type AwsEndpointDiscoveryTest struct {
|
||||
*client.Client
|
||||
endpointCache *crr.EndpointCache
|
||||
}
|
||||
|
||||
// Used for custom client initialization logic
|
||||
var initClient func(*client.Client)
|
||||
|
||||
// Used for custom request initialization logic
|
||||
var initRequest func(*request.Request)
|
||||
|
||||
// Service information constants
|
||||
const (
|
||||
ServiceName = "AwsEndpointDiscoveryTest" // Name of service.
|
||||
EndpointsID = "awsendpointdiscoverytestservice" // ID to lookup a service endpoint with.
|
||||
ServiceID = "AwsEndpointDiscoveryTest" // ServiceID is a unique identifer of a specific service.
|
||||
)
|
||||
|
||||
// New creates a new instance of the AwsEndpointDiscoveryTest 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 AwsEndpointDiscoveryTest client from just a session.
|
||||
// svc := awsendpointdiscoverytest.New(mySession)
|
||||
//
|
||||
// // Create a AwsEndpointDiscoveryTest client with additional configuration
|
||||
// svc := awsendpointdiscoverytest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
|
||||
func New(p client.ConfigProvider, cfgs ...*aws.Config) *AwsEndpointDiscoveryTest {
|
||||
c := p.ClientConfig(EndpointsID, cfgs...)
|
||||
if c.SigningNameDerived || len(c.SigningName) == 0 {
|
||||
c.SigningName = "awsendpointdiscoverytestservice"
|
||||
}
|
||||
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
|
||||
}
|
||||
|
||||
// newClient creates, initializes and returns a new service client instance.
|
||||
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *AwsEndpointDiscoveryTest {
|
||||
svc := &AwsEndpointDiscoveryTest{
|
||||
Client: client.New(
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: ServiceName,
|
||||
ServiceID: ServiceID,
|
||||
SigningName: signingName,
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
APIVersion: "2018-08-31",
|
||||
JSONVersion: "1.1",
|
||||
TargetPrefix: "AwsEndpointDiscoveryTestService",
|
||||
},
|
||||
handlers,
|
||||
),
|
||||
}
|
||||
svc.endpointCache = crr.NewEndpointCache(10)
|
||||
|
||||
// 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)
|
||||
|
||||
// Run custom client initialization if present
|
||||
if initClient != nil {
|
||||
initClient(svc.Client)
|
||||
}
|
||||
|
||||
return svc
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a AwsEndpointDiscoveryTest operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *AwsEndpointDiscoveryTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
|
||||
req := c.NewRequest(op, params, data)
|
||||
|
||||
// Run custom request initialization if present
|
||||
if initRequest != nil {
|
||||
initRequest(req)
|
||||
}
|
||||
|
||||
return req
|
||||
}
|
||||
Generated
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
// Package service contains automatically generated AWS clients.
|
||||
package service
|
||||
|
||||
//go:generate go run -tags codegen ../../../cli/gen-api/main.go -path=../service -svc-import-path "github.com/aws/aws-sdk-go/private/model/api/codegentest/service" ../models/*/*/api-2.json
|
||||
//go:generate gofmt -s -w ../service
|
||||
Generated
Vendored
+1355
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
// Package restjsonservice provides the client and types for making API
|
||||
// requests to REST JSON Service.
|
||||
//
|
||||
// See https://docs.aws.amazon.com/goto/WebAPI/RESTJSONService-0000-00-00 for more information on this service.
|
||||
//
|
||||
// See restjsonservice package documentation for more information.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/service/restjsonservice/
|
||||
//
|
||||
// Using the Client
|
||||
//
|
||||
// To contact REST JSON Service with the SDK use the New function to create
|
||||
// a new service client. With that client you can make API requests to the service.
|
||||
// These clients are safe to use concurrently.
|
||||
//
|
||||
// See the SDK's documentation for more information on how to use the SDK.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/
|
||||
//
|
||||
// See aws.Config documentation for more information on configuring SDK clients.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config
|
||||
//
|
||||
// See the REST JSON Service client RESTJSONService for more
|
||||
// information on creating client for this service.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/service/restjsonservice/#New
|
||||
package restjsonservice
|
||||
Generated
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
package restjsonservice
|
||||
|
||||
const (
|
||||
|
||||
// ErrCodeExceptionEvent for service response error code
|
||||
// "ExceptionEvent".
|
||||
ErrCodeExceptionEvent = "ExceptionEvent"
|
||||
|
||||
// ErrCodeExceptionEvent2 for service response error code
|
||||
// "ExceptionEvent2".
|
||||
ErrCodeExceptionEvent2 = "ExceptionEvent2"
|
||||
)
|
||||
Generated
Vendored
+526
@@ -0,0 +1,526 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
// +build go1.6
|
||||
|
||||
package restjsonservice
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||
"github.com/aws/aws-sdk-go/aws/corehandlers"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/awstesting/unit"
|
||||
"github.com/aws/aws-sdk-go/private/protocol"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/eventstream"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamtest"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/restjson"
|
||||
)
|
||||
|
||||
var _ time.Time
|
||||
var _ awserr.Error
|
||||
|
||||
func TestEmptyStream_Read(t *testing.T) {
|
||||
expectEvents, eventMsgs := mockEmptyStreamReadEvents()
|
||||
sess, cleanupFn, err := eventstreamtest.SetupEventStreamSession(t,
|
||||
eventstreamtest.ServeEventStream{
|
||||
T: t,
|
||||
Events: eventMsgs,
|
||||
},
|
||||
true,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error, %v", err)
|
||||
}
|
||||
defer cleanupFn()
|
||||
|
||||
svc := New(sess)
|
||||
resp, err := svc.EmptyStream(nil)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error got, %v", err)
|
||||
}
|
||||
defer resp.EventStream.Close()
|
||||
|
||||
var i int
|
||||
for event := range resp.EventStream.Events() {
|
||||
if event == nil {
|
||||
t.Errorf("%d, expect event, got nil", i)
|
||||
}
|
||||
if e, a := expectEvents[i], event; !reflect.DeepEqual(e, a) {
|
||||
t.Errorf("%d, expect %T %v, got %T %v", i, e, e, a, a)
|
||||
}
|
||||
i++
|
||||
}
|
||||
|
||||
if err := resp.EventStream.Err(); err != nil {
|
||||
t.Errorf("expect no error, %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEmptyStream_ReadClose(t *testing.T) {
|
||||
_, eventMsgs := mockEmptyStreamReadEvents()
|
||||
sess, cleanupFn, err := eventstreamtest.SetupEventStreamSession(t,
|
||||
eventstreamtest.ServeEventStream{
|
||||
T: t,
|
||||
Events: eventMsgs,
|
||||
},
|
||||
true,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error, %v", err)
|
||||
}
|
||||
defer cleanupFn()
|
||||
|
||||
svc := New(sess)
|
||||
resp, err := svc.EmptyStream(nil)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error got, %v", err)
|
||||
}
|
||||
|
||||
resp.EventStream.Close()
|
||||
<-resp.EventStream.Events()
|
||||
|
||||
if err := resp.EventStream.Err(); err != nil {
|
||||
t.Errorf("expect no error, %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkEmptyStream_Read(b *testing.B) {
|
||||
_, eventMsgs := mockEmptyStreamReadEvents()
|
||||
var buf bytes.Buffer
|
||||
encoder := eventstream.NewEncoder(&buf)
|
||||
for _, msg := range eventMsgs {
|
||||
if err := encoder.Encode(msg); err != nil {
|
||||
b.Fatalf("failed to encode message, %v", err)
|
||||
}
|
||||
}
|
||||
stream := &loopReader{source: bytes.NewReader(buf.Bytes())}
|
||||
|
||||
sess := unit.Session
|
||||
svc := New(sess, &aws.Config{
|
||||
Endpoint: aws.String("https://example.com"),
|
||||
DisableParamValidation: aws.Bool(true),
|
||||
})
|
||||
svc.Handlers.Send.Swap(corehandlers.SendHandler.Name,
|
||||
request.NamedHandler{Name: "mockSend",
|
||||
Fn: func(r *request.Request) {
|
||||
r.HTTPResponse = &http.Response{
|
||||
Status: "200 OK",
|
||||
StatusCode: 200,
|
||||
Header: http.Header{},
|
||||
Body: ioutil.NopCloser(stream),
|
||||
}
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
resp, err := svc.EmptyStream(nil)
|
||||
if err != nil {
|
||||
b.Fatalf("failed to create request, %v", err)
|
||||
}
|
||||
defer resp.EventStream.Close()
|
||||
b.ResetTimer()
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
if err = resp.EventStream.Err(); err != nil {
|
||||
b.Fatalf("expect no error, got %v", err)
|
||||
}
|
||||
event := <-resp.EventStream.Events()
|
||||
if event == nil {
|
||||
b.Fatalf("expect event, got nil, %v, %d", resp.EventStream.Err(), i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func mockEmptyStreamReadEvents() (
|
||||
[]EmptyEventStreamEvent,
|
||||
[]eventstream.Message,
|
||||
) {
|
||||
expectEvents := []EmptyEventStreamEvent{}
|
||||
|
||||
var marshalers request.HandlerList
|
||||
marshalers.PushBackNamed(restjson.BuildHandler)
|
||||
payloadMarshaler := protocol.HandlerPayloadMarshal{
|
||||
Marshalers: marshalers,
|
||||
}
|
||||
_ = payloadMarshaler
|
||||
|
||||
eventMsgs := []eventstream.Message{}
|
||||
|
||||
return expectEvents, eventMsgs
|
||||
}
|
||||
|
||||
func TestGetEventStream_Read(t *testing.T) {
|
||||
expectEvents, eventMsgs := mockGetEventStreamReadEvents()
|
||||
sess, cleanupFn, err := eventstreamtest.SetupEventStreamSession(t,
|
||||
eventstreamtest.ServeEventStream{
|
||||
T: t,
|
||||
Events: eventMsgs,
|
||||
},
|
||||
true,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error, %v", err)
|
||||
}
|
||||
defer cleanupFn()
|
||||
|
||||
svc := New(sess)
|
||||
resp, err := svc.GetEventStream(nil)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error got, %v", err)
|
||||
}
|
||||
defer resp.EventStream.Close()
|
||||
|
||||
var i int
|
||||
for event := range resp.EventStream.Events() {
|
||||
if event == nil {
|
||||
t.Errorf("%d, expect event, got nil", i)
|
||||
}
|
||||
if e, a := expectEvents[i], event; !reflect.DeepEqual(e, a) {
|
||||
t.Errorf("%d, expect %T %v, got %T %v", i, e, e, a, a)
|
||||
}
|
||||
i++
|
||||
}
|
||||
|
||||
if err := resp.EventStream.Err(); err != nil {
|
||||
t.Errorf("expect no error, %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetEventStream_ReadClose(t *testing.T) {
|
||||
_, eventMsgs := mockGetEventStreamReadEvents()
|
||||
sess, cleanupFn, err := eventstreamtest.SetupEventStreamSession(t,
|
||||
eventstreamtest.ServeEventStream{
|
||||
T: t,
|
||||
Events: eventMsgs,
|
||||
},
|
||||
true,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error, %v", err)
|
||||
}
|
||||
defer cleanupFn()
|
||||
|
||||
svc := New(sess)
|
||||
resp, err := svc.GetEventStream(nil)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error got, %v", err)
|
||||
}
|
||||
|
||||
resp.EventStream.Close()
|
||||
<-resp.EventStream.Events()
|
||||
|
||||
if err := resp.EventStream.Err(); err != nil {
|
||||
t.Errorf("expect no error, %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkGetEventStream_Read(b *testing.B) {
|
||||
_, eventMsgs := mockGetEventStreamReadEvents()
|
||||
var buf bytes.Buffer
|
||||
encoder := eventstream.NewEncoder(&buf)
|
||||
for _, msg := range eventMsgs {
|
||||
if err := encoder.Encode(msg); err != nil {
|
||||
b.Fatalf("failed to encode message, %v", err)
|
||||
}
|
||||
}
|
||||
stream := &loopReader{source: bytes.NewReader(buf.Bytes())}
|
||||
|
||||
sess := unit.Session
|
||||
svc := New(sess, &aws.Config{
|
||||
Endpoint: aws.String("https://example.com"),
|
||||
DisableParamValidation: aws.Bool(true),
|
||||
})
|
||||
svc.Handlers.Send.Swap(corehandlers.SendHandler.Name,
|
||||
request.NamedHandler{Name: "mockSend",
|
||||
Fn: func(r *request.Request) {
|
||||
r.HTTPResponse = &http.Response{
|
||||
Status: "200 OK",
|
||||
StatusCode: 200,
|
||||
Header: http.Header{},
|
||||
Body: ioutil.NopCloser(stream),
|
||||
}
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
resp, err := svc.GetEventStream(nil)
|
||||
if err != nil {
|
||||
b.Fatalf("failed to create request, %v", err)
|
||||
}
|
||||
defer resp.EventStream.Close()
|
||||
b.ResetTimer()
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
if err = resp.EventStream.Err(); err != nil {
|
||||
b.Fatalf("expect no error, got %v", err)
|
||||
}
|
||||
event := <-resp.EventStream.Events()
|
||||
if event == nil {
|
||||
b.Fatalf("expect event, got nil, %v, %d", resp.EventStream.Err(), i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func mockGetEventStreamReadEvents() (
|
||||
[]EventStreamEvent,
|
||||
[]eventstream.Message,
|
||||
) {
|
||||
expectEvents := []EventStreamEvent{
|
||||
&EmptyEvent{},
|
||||
&ExplicitPayloadEvent{
|
||||
LongVal: aws.Int64(1234),
|
||||
NestedVal: &NestedShape{
|
||||
IntVal: aws.Int64(123),
|
||||
StrVal: aws.String("string value goes here"),
|
||||
},
|
||||
StringVal: aws.String("string value goes here"),
|
||||
},
|
||||
&HeaderOnlyEvent{
|
||||
BlobVal: []byte("blob value goes here"),
|
||||
BoolVal: aws.Bool(true),
|
||||
ByteVal: aws.Int64(1),
|
||||
IntegerVal: aws.Int64(123),
|
||||
LongVal: aws.Int64(1234),
|
||||
ShortVal: aws.Int64(12),
|
||||
StringVal: aws.String("string value goes here"),
|
||||
TimeVal: aws.Time(time.Unix(1396594860, 0).UTC()),
|
||||
},
|
||||
&ImplicitPayloadEvent{
|
||||
ByteVal: aws.Int64(1),
|
||||
IntegerVal: aws.Int64(123),
|
||||
ShortVal: aws.Int64(12),
|
||||
},
|
||||
&PayloadOnlyEvent{
|
||||
NestedVal: &NestedShape{
|
||||
IntVal: aws.Int64(123),
|
||||
StrVal: aws.String("string value goes here"),
|
||||
},
|
||||
},
|
||||
&PayloadOnlyBlobEvent{
|
||||
BlobPayload: []byte("blob value goes here"),
|
||||
},
|
||||
&PayloadOnlyStringEvent{
|
||||
StringPayload: aws.String("string value goes here"),
|
||||
},
|
||||
}
|
||||
|
||||
var marshalers request.HandlerList
|
||||
marshalers.PushBackNamed(restjson.BuildHandler)
|
||||
payloadMarshaler := protocol.HandlerPayloadMarshal{
|
||||
Marshalers: marshalers,
|
||||
}
|
||||
_ = payloadMarshaler
|
||||
|
||||
eventMsgs := []eventstream.Message{
|
||||
{
|
||||
Headers: eventstream.Headers{
|
||||
eventstreamtest.EventMessageTypeHeader,
|
||||
{
|
||||
Name: eventstreamapi.EventTypeHeader,
|
||||
Value: eventstream.StringValue("Empty"),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Headers: eventstream.Headers{
|
||||
eventstreamtest.EventMessageTypeHeader,
|
||||
{
|
||||
Name: eventstreamapi.EventTypeHeader,
|
||||
Value: eventstream.StringValue("ExplicitPayload"),
|
||||
},
|
||||
{
|
||||
Name: "LongVal",
|
||||
Value: eventstream.Int64Value(*expectEvents[1].(*ExplicitPayloadEvent).LongVal),
|
||||
},
|
||||
{
|
||||
Name: "StringVal",
|
||||
Value: eventstream.StringValue(*expectEvents[1].(*ExplicitPayloadEvent).StringVal),
|
||||
},
|
||||
},
|
||||
Payload: eventstreamtest.MarshalEventPayload(payloadMarshaler, expectEvents[1]),
|
||||
},
|
||||
{
|
||||
Headers: eventstream.Headers{
|
||||
eventstreamtest.EventMessageTypeHeader,
|
||||
{
|
||||
Name: eventstreamapi.EventTypeHeader,
|
||||
Value: eventstream.StringValue("Headers"),
|
||||
},
|
||||
{
|
||||
Name: "BlobVal",
|
||||
Value: eventstream.BytesValue(expectEvents[2].(*HeaderOnlyEvent).BlobVal),
|
||||
},
|
||||
{
|
||||
Name: "BoolVal",
|
||||
Value: eventstream.BoolValue(*expectEvents[2].(*HeaderOnlyEvent).BoolVal),
|
||||
},
|
||||
{
|
||||
Name: "ByteVal",
|
||||
Value: eventstream.Int8Value(int8(*expectEvents[2].(*HeaderOnlyEvent).ByteVal)),
|
||||
},
|
||||
{
|
||||
Name: "IntegerVal",
|
||||
Value: eventstream.Int32Value(int32(*expectEvents[2].(*HeaderOnlyEvent).IntegerVal)),
|
||||
},
|
||||
{
|
||||
Name: "LongVal",
|
||||
Value: eventstream.Int64Value(*expectEvents[2].(*HeaderOnlyEvent).LongVal),
|
||||
},
|
||||
{
|
||||
Name: "ShortVal",
|
||||
Value: eventstream.Int16Value(int16(*expectEvents[2].(*HeaderOnlyEvent).ShortVal)),
|
||||
},
|
||||
{
|
||||
Name: "StringVal",
|
||||
Value: eventstream.StringValue(*expectEvents[2].(*HeaderOnlyEvent).StringVal),
|
||||
},
|
||||
{
|
||||
Name: "TimeVal",
|
||||
Value: eventstream.TimestampValue(*expectEvents[2].(*HeaderOnlyEvent).TimeVal),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Headers: eventstream.Headers{
|
||||
eventstreamtest.EventMessageTypeHeader,
|
||||
{
|
||||
Name: eventstreamapi.EventTypeHeader,
|
||||
Value: eventstream.StringValue("ImplicitPayload"),
|
||||
},
|
||||
{
|
||||
Name: "ByteVal",
|
||||
Value: eventstream.Int8Value(int8(*expectEvents[3].(*ImplicitPayloadEvent).ByteVal)),
|
||||
},
|
||||
},
|
||||
Payload: eventstreamtest.MarshalEventPayload(payloadMarshaler, expectEvents[3]),
|
||||
},
|
||||
{
|
||||
Headers: eventstream.Headers{
|
||||
eventstreamtest.EventMessageTypeHeader,
|
||||
{
|
||||
Name: eventstreamapi.EventTypeHeader,
|
||||
Value: eventstream.StringValue("PayloadOnly"),
|
||||
},
|
||||
},
|
||||
Payload: eventstreamtest.MarshalEventPayload(payloadMarshaler, expectEvents[4]),
|
||||
},
|
||||
{
|
||||
Headers: eventstream.Headers{
|
||||
eventstreamtest.EventMessageTypeHeader,
|
||||
{
|
||||
Name: eventstreamapi.EventTypeHeader,
|
||||
Value: eventstream.StringValue("PayloadOnlyBlob"),
|
||||
},
|
||||
},
|
||||
Payload: expectEvents[5].(*PayloadOnlyBlobEvent).BlobPayload,
|
||||
},
|
||||
{
|
||||
Headers: eventstream.Headers{
|
||||
eventstreamtest.EventMessageTypeHeader,
|
||||
{
|
||||
Name: eventstreamapi.EventTypeHeader,
|
||||
Value: eventstream.StringValue("PayloadOnlyString"),
|
||||
},
|
||||
},
|
||||
Payload: []byte(*expectEvents[6].(*PayloadOnlyStringEvent).StringPayload),
|
||||
},
|
||||
}
|
||||
|
||||
return expectEvents, eventMsgs
|
||||
}
|
||||
func TestGetEventStream_ReadException(t *testing.T) {
|
||||
expectEvents := []EventStreamEvent{
|
||||
&ExceptionEvent{
|
||||
IntVal: aws.Int64(123),
|
||||
Message_: aws.String("string value goes here"),
|
||||
},
|
||||
}
|
||||
|
||||
var marshalers request.HandlerList
|
||||
marshalers.PushBackNamed(restjson.BuildHandler)
|
||||
payloadMarshaler := protocol.HandlerPayloadMarshal{
|
||||
Marshalers: marshalers,
|
||||
}
|
||||
|
||||
eventMsgs := []eventstream.Message{
|
||||
{
|
||||
Headers: eventstream.Headers{
|
||||
eventstreamtest.EventExceptionTypeHeader,
|
||||
{
|
||||
Name: eventstreamapi.ExceptionTypeHeader,
|
||||
Value: eventstream.StringValue("Exception"),
|
||||
},
|
||||
},
|
||||
Payload: eventstreamtest.MarshalEventPayload(payloadMarshaler, expectEvents[0]),
|
||||
},
|
||||
}
|
||||
|
||||
sess, cleanupFn, err := eventstreamtest.SetupEventStreamSession(t,
|
||||
eventstreamtest.ServeEventStream{
|
||||
T: t,
|
||||
Events: eventMsgs,
|
||||
},
|
||||
true,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error, %v", err)
|
||||
}
|
||||
defer cleanupFn()
|
||||
|
||||
svc := New(sess)
|
||||
resp, err := svc.GetEventStream(nil)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error got, %v", err)
|
||||
}
|
||||
|
||||
defer resp.EventStream.Close()
|
||||
|
||||
<-resp.EventStream.Events()
|
||||
|
||||
err = resp.EventStream.Err()
|
||||
if err == nil {
|
||||
t.Fatalf("expect err, got none")
|
||||
}
|
||||
|
||||
expectErr := &ExceptionEvent{
|
||||
IntVal: aws.Int64(123),
|
||||
Message_: aws.String("string value goes here"),
|
||||
}
|
||||
aerr, ok := err.(awserr.Error)
|
||||
if !ok {
|
||||
t.Errorf("expect exception, got %T, %#v", err, err)
|
||||
}
|
||||
if e, a := expectErr.Code(), aerr.Code(); e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := expectErr.Message(), aerr.Message(); e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
if e, a := expectErr, aerr; !reflect.DeepEqual(e, a) {
|
||||
t.Errorf("expect %#v, got %#v", e, a)
|
||||
}
|
||||
}
|
||||
|
||||
var _ awserr.Error = (*ExceptionEvent)(nil)
|
||||
var _ awserr.Error = (*ExceptionEvent2)(nil)
|
||||
|
||||
type loopReader struct {
|
||||
source *bytes.Reader
|
||||
}
|
||||
|
||||
func (c *loopReader) Read(p []byte) (int, error) {
|
||||
if c.source.Len() == 0 {
|
||||
c.source.Seek(0, 0)
|
||||
}
|
||||
|
||||
return c.source.Read(p)
|
||||
}
|
||||
Generated
Vendored
+76
@@ -0,0 +1,76 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
// Package restjsonserviceiface provides an interface to enable mocking the REST JSON Service service client
|
||||
// for testing your code.
|
||||
//
|
||||
// It is important to note that this interface will have breaking changes
|
||||
// when the service model is updated and adds new API operations, paginators,
|
||||
// and waiters.
|
||||
package restjsonserviceiface
|
||||
|
||||
import (
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/private/model/api/codegentest/service/restjsonservice"
|
||||
)
|
||||
|
||||
// RESTJSONServiceAPI provides an interface to enable mocking the
|
||||
// restjsonservice.RESTJSONService service client's API operation,
|
||||
// paginators, and waiters. This make unit testing your code that calls out
|
||||
// to the SDK's service client's calls easier.
|
||||
//
|
||||
// The best way to use this interface is so the SDK's service client's calls
|
||||
// can be stubbed out for unit testing your code with the SDK without needing
|
||||
// to inject custom request handlers into the SDK's request pipeline.
|
||||
//
|
||||
// // myFunc uses an SDK service client to make a request to
|
||||
// // REST JSON Service.
|
||||
// func myFunc(svc restjsonserviceiface.RESTJSONServiceAPI) bool {
|
||||
// // Make svc.EmptyStream request
|
||||
// }
|
||||
//
|
||||
// func main() {
|
||||
// sess := session.New()
|
||||
// svc := restjsonservice.New(sess)
|
||||
//
|
||||
// myFunc(svc)
|
||||
// }
|
||||
//
|
||||
// In your _test.go file:
|
||||
//
|
||||
// // Define a mock struct to be used in your unit tests of myFunc.
|
||||
// type mockRESTJSONServiceClient struct {
|
||||
// restjsonserviceiface.RESTJSONServiceAPI
|
||||
// }
|
||||
// func (m *mockRESTJSONServiceClient) EmptyStream(input *restjsonservice.EmptyStreamInput) (*restjsonservice.EmptyStreamOutput, error) {
|
||||
// // mock response/functionality
|
||||
// }
|
||||
//
|
||||
// func TestMyFunc(t *testing.T) {
|
||||
// // Setup Test
|
||||
// mockSvc := &mockRESTJSONServiceClient{}
|
||||
//
|
||||
// myfunc(mockSvc)
|
||||
//
|
||||
// // Verify myFunc's functionality
|
||||
// }
|
||||
//
|
||||
// It is important to note that this interface will have breaking changes
|
||||
// when the service model is updated and adds new API operations, paginators,
|
||||
// and waiters. Its suggested to use the pattern above for testing, or using
|
||||
// tooling to generate mocks to satisfy the interfaces.
|
||||
type RESTJSONServiceAPI interface {
|
||||
EmptyStream(*restjsonservice.EmptyStreamInput) (*restjsonservice.EmptyStreamOutput, error)
|
||||
EmptyStreamWithContext(aws.Context, *restjsonservice.EmptyStreamInput, ...request.Option) (*restjsonservice.EmptyStreamOutput, error)
|
||||
EmptyStreamRequest(*restjsonservice.EmptyStreamInput) (*request.Request, *restjsonservice.EmptyStreamOutput)
|
||||
|
||||
GetEventStream(*restjsonservice.GetEventStreamInput) (*restjsonservice.GetEventStreamOutput, error)
|
||||
GetEventStreamWithContext(aws.Context, *restjsonservice.GetEventStreamInput, ...request.Option) (*restjsonservice.GetEventStreamOutput, error)
|
||||
GetEventStreamRequest(*restjsonservice.GetEventStreamInput) (*request.Request, *restjsonservice.GetEventStreamOutput)
|
||||
|
||||
OtherOperation(*restjsonservice.OtherOperationInput) (*restjsonservice.OtherOperationOutput, error)
|
||||
OtherOperationWithContext(aws.Context, *restjsonservice.OtherOperationInput, ...request.Option) (*restjsonservice.OtherOperationOutput, error)
|
||||
OtherOperationRequest(*restjsonservice.OtherOperationInput) (*request.Request, *restjsonservice.OtherOperationOutput)
|
||||
}
|
||||
|
||||
var _ RESTJSONServiceAPI = (*restjsonservice.RESTJSONService)(nil)
|
||||
Generated
Vendored
+97
@@ -0,0 +1,97 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
package restjsonservice
|
||||
|
||||
import (
|
||||
"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/private/protocol/restjson"
|
||||
)
|
||||
|
||||
// RESTJSONService provides the API operation methods for making requests to
|
||||
// REST JSON Service. See this package's package overview docs
|
||||
// for details on the service.
|
||||
//
|
||||
// RESTJSONService methods are safe to use concurrently. It is not safe to
|
||||
// modify mutate any of the struct's properties though.
|
||||
type RESTJSONService struct {
|
||||
*client.Client
|
||||
}
|
||||
|
||||
// Used for custom client initialization logic
|
||||
var initClient func(*client.Client)
|
||||
|
||||
// Used for custom request initialization logic
|
||||
var initRequest func(*request.Request)
|
||||
|
||||
// Service information constants
|
||||
const (
|
||||
ServiceName = "RESTJSONService" // Name of service.
|
||||
EndpointsID = "restjsonservice" // ID to lookup a service endpoint with.
|
||||
ServiceID = "RESTJSONService" // ServiceID is a unique identifer of a specific service.
|
||||
)
|
||||
|
||||
// New creates a new instance of the RESTJSONService 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 RESTJSONService client from just a session.
|
||||
// svc := restjsonservice.New(mySession)
|
||||
//
|
||||
// // Create a RESTJSONService client with additional configuration
|
||||
// svc := restjsonservice.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
|
||||
func New(p client.ConfigProvider, cfgs ...*aws.Config) *RESTJSONService {
|
||||
c := p.ClientConfig(EndpointsID, cfgs...)
|
||||
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
|
||||
}
|
||||
|
||||
// newClient creates, initializes and returns a new service client instance.
|
||||
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *RESTJSONService {
|
||||
svc := &RESTJSONService{
|
||||
Client: client.New(
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: ServiceName,
|
||||
ServiceID: ServiceID,
|
||||
SigningName: signingName,
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
APIVersion: "0000-00-00",
|
||||
},
|
||||
handlers,
|
||||
),
|
||||
}
|
||||
|
||||
// Handlers
|
||||
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
|
||||
svc.Handlers.Build.PushBackNamed(restjson.BuildHandler)
|
||||
svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler)
|
||||
svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler)
|
||||
svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler)
|
||||
|
||||
svc.Handlers.UnmarshalStream.PushBackNamed(restjson.UnmarshalHandler)
|
||||
|
||||
// Run custom client initialization if present
|
||||
if initClient != nil {
|
||||
initClient(svc.Client)
|
||||
}
|
||||
|
||||
return svc
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a RESTJSONService operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *RESTJSONService) newRequest(op *request.Operation, params, data interface{}) *request.Request {
|
||||
req := c.NewRequest(op, params, data)
|
||||
|
||||
// Run custom request initialization if present
|
||||
if initRequest != nil {
|
||||
initRequest(req)
|
||||
}
|
||||
|
||||
return req
|
||||
}
|
||||
Generated
Vendored
+1355
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
// Package restxmlservice provides the client and types for making API
|
||||
// requests to REST XML Service.
|
||||
//
|
||||
// See https://docs.aws.amazon.com/goto/WebAPI/RESTXMLService-0000-00-00 for more information on this service.
|
||||
//
|
||||
// See restxmlservice package documentation for more information.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/service/restxmlservice/
|
||||
//
|
||||
// Using the Client
|
||||
//
|
||||
// To contact REST XML Service with the SDK use the New function to create
|
||||
// a new service client. With that client you can make API requests to the service.
|
||||
// These clients are safe to use concurrently.
|
||||
//
|
||||
// See the SDK's documentation for more information on how to use the SDK.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/
|
||||
//
|
||||
// See aws.Config documentation for more information on configuring SDK clients.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config
|
||||
//
|
||||
// See the REST XML Service client RESTXMLService for more
|
||||
// information on creating client for this service.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/service/restxmlservice/#New
|
||||
package restxmlservice
|
||||
Generated
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
package restxmlservice
|
||||
|
||||
const (
|
||||
|
||||
// ErrCodeExceptionEvent for service response error code
|
||||
// "ExceptionEvent".
|
||||
ErrCodeExceptionEvent = "ExceptionEvent"
|
||||
|
||||
// ErrCodeExceptionEvent2 for service response error code
|
||||
// "ExceptionEvent2".
|
||||
ErrCodeExceptionEvent2 = "ExceptionEvent2"
|
||||
)
|
||||
Generated
Vendored
+526
@@ -0,0 +1,526 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
// +build go1.6
|
||||
|
||||
package restxmlservice
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||
"github.com/aws/aws-sdk-go/aws/corehandlers"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/awstesting/unit"
|
||||
"github.com/aws/aws-sdk-go/private/protocol"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/eventstream"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamtest"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/restxml"
|
||||
)
|
||||
|
||||
var _ time.Time
|
||||
var _ awserr.Error
|
||||
|
||||
func TestEmptyStream_Read(t *testing.T) {
|
||||
expectEvents, eventMsgs := mockEmptyStreamReadEvents()
|
||||
sess, cleanupFn, err := eventstreamtest.SetupEventStreamSession(t,
|
||||
eventstreamtest.ServeEventStream{
|
||||
T: t,
|
||||
Events: eventMsgs,
|
||||
},
|
||||
true,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error, %v", err)
|
||||
}
|
||||
defer cleanupFn()
|
||||
|
||||
svc := New(sess)
|
||||
resp, err := svc.EmptyStream(nil)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error got, %v", err)
|
||||
}
|
||||
defer resp.EventStream.Close()
|
||||
|
||||
var i int
|
||||
for event := range resp.EventStream.Events() {
|
||||
if event == nil {
|
||||
t.Errorf("%d, expect event, got nil", i)
|
||||
}
|
||||
if e, a := expectEvents[i], event; !reflect.DeepEqual(e, a) {
|
||||
t.Errorf("%d, expect %T %v, got %T %v", i, e, e, a, a)
|
||||
}
|
||||
i++
|
||||
}
|
||||
|
||||
if err := resp.EventStream.Err(); err != nil {
|
||||
t.Errorf("expect no error, %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEmptyStream_ReadClose(t *testing.T) {
|
||||
_, eventMsgs := mockEmptyStreamReadEvents()
|
||||
sess, cleanupFn, err := eventstreamtest.SetupEventStreamSession(t,
|
||||
eventstreamtest.ServeEventStream{
|
||||
T: t,
|
||||
Events: eventMsgs,
|
||||
},
|
||||
true,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error, %v", err)
|
||||
}
|
||||
defer cleanupFn()
|
||||
|
||||
svc := New(sess)
|
||||
resp, err := svc.EmptyStream(nil)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error got, %v", err)
|
||||
}
|
||||
|
||||
resp.EventStream.Close()
|
||||
<-resp.EventStream.Events()
|
||||
|
||||
if err := resp.EventStream.Err(); err != nil {
|
||||
t.Errorf("expect no error, %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkEmptyStream_Read(b *testing.B) {
|
||||
_, eventMsgs := mockEmptyStreamReadEvents()
|
||||
var buf bytes.Buffer
|
||||
encoder := eventstream.NewEncoder(&buf)
|
||||
for _, msg := range eventMsgs {
|
||||
if err := encoder.Encode(msg); err != nil {
|
||||
b.Fatalf("failed to encode message, %v", err)
|
||||
}
|
||||
}
|
||||
stream := &loopReader{source: bytes.NewReader(buf.Bytes())}
|
||||
|
||||
sess := unit.Session
|
||||
svc := New(sess, &aws.Config{
|
||||
Endpoint: aws.String("https://example.com"),
|
||||
DisableParamValidation: aws.Bool(true),
|
||||
})
|
||||
svc.Handlers.Send.Swap(corehandlers.SendHandler.Name,
|
||||
request.NamedHandler{Name: "mockSend",
|
||||
Fn: func(r *request.Request) {
|
||||
r.HTTPResponse = &http.Response{
|
||||
Status: "200 OK",
|
||||
StatusCode: 200,
|
||||
Header: http.Header{},
|
||||
Body: ioutil.NopCloser(stream),
|
||||
}
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
resp, err := svc.EmptyStream(nil)
|
||||
if err != nil {
|
||||
b.Fatalf("failed to create request, %v", err)
|
||||
}
|
||||
defer resp.EventStream.Close()
|
||||
b.ResetTimer()
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
if err = resp.EventStream.Err(); err != nil {
|
||||
b.Fatalf("expect no error, got %v", err)
|
||||
}
|
||||
event := <-resp.EventStream.Events()
|
||||
if event == nil {
|
||||
b.Fatalf("expect event, got nil, %v, %d", resp.EventStream.Err(), i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func mockEmptyStreamReadEvents() (
|
||||
[]EmptyEventStreamEvent,
|
||||
[]eventstream.Message,
|
||||
) {
|
||||
expectEvents := []EmptyEventStreamEvent{}
|
||||
|
||||
var marshalers request.HandlerList
|
||||
marshalers.PushBackNamed(restxml.BuildHandler)
|
||||
payloadMarshaler := protocol.HandlerPayloadMarshal{
|
||||
Marshalers: marshalers,
|
||||
}
|
||||
_ = payloadMarshaler
|
||||
|
||||
eventMsgs := []eventstream.Message{}
|
||||
|
||||
return expectEvents, eventMsgs
|
||||
}
|
||||
|
||||
func TestGetEventStream_Read(t *testing.T) {
|
||||
expectEvents, eventMsgs := mockGetEventStreamReadEvents()
|
||||
sess, cleanupFn, err := eventstreamtest.SetupEventStreamSession(t,
|
||||
eventstreamtest.ServeEventStream{
|
||||
T: t,
|
||||
Events: eventMsgs,
|
||||
},
|
||||
true,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error, %v", err)
|
||||
}
|
||||
defer cleanupFn()
|
||||
|
||||
svc := New(sess)
|
||||
resp, err := svc.GetEventStream(nil)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error got, %v", err)
|
||||
}
|
||||
defer resp.EventStream.Close()
|
||||
|
||||
var i int
|
||||
for event := range resp.EventStream.Events() {
|
||||
if event == nil {
|
||||
t.Errorf("%d, expect event, got nil", i)
|
||||
}
|
||||
if e, a := expectEvents[i], event; !reflect.DeepEqual(e, a) {
|
||||
t.Errorf("%d, expect %T %v, got %T %v", i, e, e, a, a)
|
||||
}
|
||||
i++
|
||||
}
|
||||
|
||||
if err := resp.EventStream.Err(); err != nil {
|
||||
t.Errorf("expect no error, %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetEventStream_ReadClose(t *testing.T) {
|
||||
_, eventMsgs := mockGetEventStreamReadEvents()
|
||||
sess, cleanupFn, err := eventstreamtest.SetupEventStreamSession(t,
|
||||
eventstreamtest.ServeEventStream{
|
||||
T: t,
|
||||
Events: eventMsgs,
|
||||
},
|
||||
true,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error, %v", err)
|
||||
}
|
||||
defer cleanupFn()
|
||||
|
||||
svc := New(sess)
|
||||
resp, err := svc.GetEventStream(nil)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error got, %v", err)
|
||||
}
|
||||
|
||||
resp.EventStream.Close()
|
||||
<-resp.EventStream.Events()
|
||||
|
||||
if err := resp.EventStream.Err(); err != nil {
|
||||
t.Errorf("expect no error, %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkGetEventStream_Read(b *testing.B) {
|
||||
_, eventMsgs := mockGetEventStreamReadEvents()
|
||||
var buf bytes.Buffer
|
||||
encoder := eventstream.NewEncoder(&buf)
|
||||
for _, msg := range eventMsgs {
|
||||
if err := encoder.Encode(msg); err != nil {
|
||||
b.Fatalf("failed to encode message, %v", err)
|
||||
}
|
||||
}
|
||||
stream := &loopReader{source: bytes.NewReader(buf.Bytes())}
|
||||
|
||||
sess := unit.Session
|
||||
svc := New(sess, &aws.Config{
|
||||
Endpoint: aws.String("https://example.com"),
|
||||
DisableParamValidation: aws.Bool(true),
|
||||
})
|
||||
svc.Handlers.Send.Swap(corehandlers.SendHandler.Name,
|
||||
request.NamedHandler{Name: "mockSend",
|
||||
Fn: func(r *request.Request) {
|
||||
r.HTTPResponse = &http.Response{
|
||||
Status: "200 OK",
|
||||
StatusCode: 200,
|
||||
Header: http.Header{},
|
||||
Body: ioutil.NopCloser(stream),
|
||||
}
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
resp, err := svc.GetEventStream(nil)
|
||||
if err != nil {
|
||||
b.Fatalf("failed to create request, %v", err)
|
||||
}
|
||||
defer resp.EventStream.Close()
|
||||
b.ResetTimer()
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
if err = resp.EventStream.Err(); err != nil {
|
||||
b.Fatalf("expect no error, got %v", err)
|
||||
}
|
||||
event := <-resp.EventStream.Events()
|
||||
if event == nil {
|
||||
b.Fatalf("expect event, got nil, %v, %d", resp.EventStream.Err(), i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func mockGetEventStreamReadEvents() (
|
||||
[]EventStreamEvent,
|
||||
[]eventstream.Message,
|
||||
) {
|
||||
expectEvents := []EventStreamEvent{
|
||||
&EmptyEvent{},
|
||||
&ExplicitPayloadEvent{
|
||||
LongVal: aws.Int64(1234),
|
||||
NestedVal: &NestedShape{
|
||||
IntVal: aws.Int64(123),
|
||||
StrVal: aws.String("string value goes here"),
|
||||
},
|
||||
StringVal: aws.String("string value goes here"),
|
||||
},
|
||||
&HeaderOnlyEvent{
|
||||
BlobVal: []byte("blob value goes here"),
|
||||
BoolVal: aws.Bool(true),
|
||||
ByteVal: aws.Int64(1),
|
||||
IntegerVal: aws.Int64(123),
|
||||
LongVal: aws.Int64(1234),
|
||||
ShortVal: aws.Int64(12),
|
||||
StringVal: aws.String("string value goes here"),
|
||||
TimeVal: aws.Time(time.Unix(1396594860, 0).UTC()),
|
||||
},
|
||||
&ImplicitPayloadEvent{
|
||||
ByteVal: aws.Int64(1),
|
||||
IntegerVal: aws.Int64(123),
|
||||
ShortVal: aws.Int64(12),
|
||||
},
|
||||
&PayloadOnlyEvent{
|
||||
NestedVal: &NestedShape{
|
||||
IntVal: aws.Int64(123),
|
||||
StrVal: aws.String("string value goes here"),
|
||||
},
|
||||
},
|
||||
&PayloadOnlyBlobEvent{
|
||||
BlobPayload: []byte("blob value goes here"),
|
||||
},
|
||||
&PayloadOnlyStringEvent{
|
||||
StringPayload: aws.String("string value goes here"),
|
||||
},
|
||||
}
|
||||
|
||||
var marshalers request.HandlerList
|
||||
marshalers.PushBackNamed(restxml.BuildHandler)
|
||||
payloadMarshaler := protocol.HandlerPayloadMarshal{
|
||||
Marshalers: marshalers,
|
||||
}
|
||||
_ = payloadMarshaler
|
||||
|
||||
eventMsgs := []eventstream.Message{
|
||||
{
|
||||
Headers: eventstream.Headers{
|
||||
eventstreamtest.EventMessageTypeHeader,
|
||||
{
|
||||
Name: eventstreamapi.EventTypeHeader,
|
||||
Value: eventstream.StringValue("Empty"),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Headers: eventstream.Headers{
|
||||
eventstreamtest.EventMessageTypeHeader,
|
||||
{
|
||||
Name: eventstreamapi.EventTypeHeader,
|
||||
Value: eventstream.StringValue("ExplicitPayload"),
|
||||
},
|
||||
{
|
||||
Name: "LongVal",
|
||||
Value: eventstream.Int64Value(*expectEvents[1].(*ExplicitPayloadEvent).LongVal),
|
||||
},
|
||||
{
|
||||
Name: "StringVal",
|
||||
Value: eventstream.StringValue(*expectEvents[1].(*ExplicitPayloadEvent).StringVal),
|
||||
},
|
||||
},
|
||||
Payload: eventstreamtest.MarshalEventPayload(payloadMarshaler, expectEvents[1]),
|
||||
},
|
||||
{
|
||||
Headers: eventstream.Headers{
|
||||
eventstreamtest.EventMessageTypeHeader,
|
||||
{
|
||||
Name: eventstreamapi.EventTypeHeader,
|
||||
Value: eventstream.StringValue("Headers"),
|
||||
},
|
||||
{
|
||||
Name: "BlobVal",
|
||||
Value: eventstream.BytesValue(expectEvents[2].(*HeaderOnlyEvent).BlobVal),
|
||||
},
|
||||
{
|
||||
Name: "BoolVal",
|
||||
Value: eventstream.BoolValue(*expectEvents[2].(*HeaderOnlyEvent).BoolVal),
|
||||
},
|
||||
{
|
||||
Name: "ByteVal",
|
||||
Value: eventstream.Int8Value(int8(*expectEvents[2].(*HeaderOnlyEvent).ByteVal)),
|
||||
},
|
||||
{
|
||||
Name: "IntegerVal",
|
||||
Value: eventstream.Int32Value(int32(*expectEvents[2].(*HeaderOnlyEvent).IntegerVal)),
|
||||
},
|
||||
{
|
||||
Name: "LongVal",
|
||||
Value: eventstream.Int64Value(*expectEvents[2].(*HeaderOnlyEvent).LongVal),
|
||||
},
|
||||
{
|
||||
Name: "ShortVal",
|
||||
Value: eventstream.Int16Value(int16(*expectEvents[2].(*HeaderOnlyEvent).ShortVal)),
|
||||
},
|
||||
{
|
||||
Name: "StringVal",
|
||||
Value: eventstream.StringValue(*expectEvents[2].(*HeaderOnlyEvent).StringVal),
|
||||
},
|
||||
{
|
||||
Name: "TimeVal",
|
||||
Value: eventstream.TimestampValue(*expectEvents[2].(*HeaderOnlyEvent).TimeVal),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Headers: eventstream.Headers{
|
||||
eventstreamtest.EventMessageTypeHeader,
|
||||
{
|
||||
Name: eventstreamapi.EventTypeHeader,
|
||||
Value: eventstream.StringValue("ImplicitPayload"),
|
||||
},
|
||||
{
|
||||
Name: "ByteVal",
|
||||
Value: eventstream.Int8Value(int8(*expectEvents[3].(*ImplicitPayloadEvent).ByteVal)),
|
||||
},
|
||||
},
|
||||
Payload: eventstreamtest.MarshalEventPayload(payloadMarshaler, expectEvents[3]),
|
||||
},
|
||||
{
|
||||
Headers: eventstream.Headers{
|
||||
eventstreamtest.EventMessageTypeHeader,
|
||||
{
|
||||
Name: eventstreamapi.EventTypeHeader,
|
||||
Value: eventstream.StringValue("PayloadOnly"),
|
||||
},
|
||||
},
|
||||
Payload: eventstreamtest.MarshalEventPayload(payloadMarshaler, expectEvents[4]),
|
||||
},
|
||||
{
|
||||
Headers: eventstream.Headers{
|
||||
eventstreamtest.EventMessageTypeHeader,
|
||||
{
|
||||
Name: eventstreamapi.EventTypeHeader,
|
||||
Value: eventstream.StringValue("PayloadOnlyBlob"),
|
||||
},
|
||||
},
|
||||
Payload: expectEvents[5].(*PayloadOnlyBlobEvent).BlobPayload,
|
||||
},
|
||||
{
|
||||
Headers: eventstream.Headers{
|
||||
eventstreamtest.EventMessageTypeHeader,
|
||||
{
|
||||
Name: eventstreamapi.EventTypeHeader,
|
||||
Value: eventstream.StringValue("PayloadOnlyString"),
|
||||
},
|
||||
},
|
||||
Payload: []byte(*expectEvents[6].(*PayloadOnlyStringEvent).StringPayload),
|
||||
},
|
||||
}
|
||||
|
||||
return expectEvents, eventMsgs
|
||||
}
|
||||
func TestGetEventStream_ReadException(t *testing.T) {
|
||||
expectEvents := []EventStreamEvent{
|
||||
&ExceptionEvent{
|
||||
IntVal: aws.Int64(123),
|
||||
Message_: aws.String("string value goes here"),
|
||||
},
|
||||
}
|
||||
|
||||
var marshalers request.HandlerList
|
||||
marshalers.PushBackNamed(restxml.BuildHandler)
|
||||
payloadMarshaler := protocol.HandlerPayloadMarshal{
|
||||
Marshalers: marshalers,
|
||||
}
|
||||
|
||||
eventMsgs := []eventstream.Message{
|
||||
{
|
||||
Headers: eventstream.Headers{
|
||||
eventstreamtest.EventExceptionTypeHeader,
|
||||
{
|
||||
Name: eventstreamapi.ExceptionTypeHeader,
|
||||
Value: eventstream.StringValue("Exception"),
|
||||
},
|
||||
},
|
||||
Payload: eventstreamtest.MarshalEventPayload(payloadMarshaler, expectEvents[0]),
|
||||
},
|
||||
}
|
||||
|
||||
sess, cleanupFn, err := eventstreamtest.SetupEventStreamSession(t,
|
||||
eventstreamtest.ServeEventStream{
|
||||
T: t,
|
||||
Events: eventMsgs,
|
||||
},
|
||||
true,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error, %v", err)
|
||||
}
|
||||
defer cleanupFn()
|
||||
|
||||
svc := New(sess)
|
||||
resp, err := svc.GetEventStream(nil)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error got, %v", err)
|
||||
}
|
||||
|
||||
defer resp.EventStream.Close()
|
||||
|
||||
<-resp.EventStream.Events()
|
||||
|
||||
err = resp.EventStream.Err()
|
||||
if err == nil {
|
||||
t.Fatalf("expect err, got none")
|
||||
}
|
||||
|
||||
expectErr := &ExceptionEvent{
|
||||
IntVal: aws.Int64(123),
|
||||
Message_: aws.String("string value goes here"),
|
||||
}
|
||||
aerr, ok := err.(awserr.Error)
|
||||
if !ok {
|
||||
t.Errorf("expect exception, got %T, %#v", err, err)
|
||||
}
|
||||
if e, a := expectErr.Code(), aerr.Code(); e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := expectErr.Message(), aerr.Message(); e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
if e, a := expectErr, aerr; !reflect.DeepEqual(e, a) {
|
||||
t.Errorf("expect %#v, got %#v", e, a)
|
||||
}
|
||||
}
|
||||
|
||||
var _ awserr.Error = (*ExceptionEvent)(nil)
|
||||
var _ awserr.Error = (*ExceptionEvent2)(nil)
|
||||
|
||||
type loopReader struct {
|
||||
source *bytes.Reader
|
||||
}
|
||||
|
||||
func (c *loopReader) Read(p []byte) (int, error) {
|
||||
if c.source.Len() == 0 {
|
||||
c.source.Seek(0, 0)
|
||||
}
|
||||
|
||||
return c.source.Read(p)
|
||||
}
|
||||
Generated
Vendored
+76
@@ -0,0 +1,76 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
// Package restxmlserviceiface provides an interface to enable mocking the REST XML Service service client
|
||||
// for testing your code.
|
||||
//
|
||||
// It is important to note that this interface will have breaking changes
|
||||
// when the service model is updated and adds new API operations, paginators,
|
||||
// and waiters.
|
||||
package restxmlserviceiface
|
||||
|
||||
import (
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/private/model/api/codegentest/service/restxmlservice"
|
||||
)
|
||||
|
||||
// RESTXMLServiceAPI provides an interface to enable mocking the
|
||||
// restxmlservice.RESTXMLService service client's API operation,
|
||||
// paginators, and waiters. This make unit testing your code that calls out
|
||||
// to the SDK's service client's calls easier.
|
||||
//
|
||||
// The best way to use this interface is so the SDK's service client's calls
|
||||
// can be stubbed out for unit testing your code with the SDK without needing
|
||||
// to inject custom request handlers into the SDK's request pipeline.
|
||||
//
|
||||
// // myFunc uses an SDK service client to make a request to
|
||||
// // REST XML Service.
|
||||
// func myFunc(svc restxmlserviceiface.RESTXMLServiceAPI) bool {
|
||||
// // Make svc.EmptyStream request
|
||||
// }
|
||||
//
|
||||
// func main() {
|
||||
// sess := session.New()
|
||||
// svc := restxmlservice.New(sess)
|
||||
//
|
||||
// myFunc(svc)
|
||||
// }
|
||||
//
|
||||
// In your _test.go file:
|
||||
//
|
||||
// // Define a mock struct to be used in your unit tests of myFunc.
|
||||
// type mockRESTXMLServiceClient struct {
|
||||
// restxmlserviceiface.RESTXMLServiceAPI
|
||||
// }
|
||||
// func (m *mockRESTXMLServiceClient) EmptyStream(input *restxmlservice.EmptyStreamInput) (*restxmlservice.EmptyStreamOutput, error) {
|
||||
// // mock response/functionality
|
||||
// }
|
||||
//
|
||||
// func TestMyFunc(t *testing.T) {
|
||||
// // Setup Test
|
||||
// mockSvc := &mockRESTXMLServiceClient{}
|
||||
//
|
||||
// myfunc(mockSvc)
|
||||
//
|
||||
// // Verify myFunc's functionality
|
||||
// }
|
||||
//
|
||||
// It is important to note that this interface will have breaking changes
|
||||
// when the service model is updated and adds new API operations, paginators,
|
||||
// and waiters. Its suggested to use the pattern above for testing, or using
|
||||
// tooling to generate mocks to satisfy the interfaces.
|
||||
type RESTXMLServiceAPI interface {
|
||||
EmptyStream(*restxmlservice.EmptyStreamInput) (*restxmlservice.EmptyStreamOutput, error)
|
||||
EmptyStreamWithContext(aws.Context, *restxmlservice.EmptyStreamInput, ...request.Option) (*restxmlservice.EmptyStreamOutput, error)
|
||||
EmptyStreamRequest(*restxmlservice.EmptyStreamInput) (*request.Request, *restxmlservice.EmptyStreamOutput)
|
||||
|
||||
GetEventStream(*restxmlservice.GetEventStreamInput) (*restxmlservice.GetEventStreamOutput, error)
|
||||
GetEventStreamWithContext(aws.Context, *restxmlservice.GetEventStreamInput, ...request.Option) (*restxmlservice.GetEventStreamOutput, error)
|
||||
GetEventStreamRequest(*restxmlservice.GetEventStreamInput) (*request.Request, *restxmlservice.GetEventStreamOutput)
|
||||
|
||||
OtherOperation(*restxmlservice.OtherOperationInput) (*restxmlservice.OtherOperationOutput, error)
|
||||
OtherOperationWithContext(aws.Context, *restxmlservice.OtherOperationInput, ...request.Option) (*restxmlservice.OtherOperationOutput, error)
|
||||
OtherOperationRequest(*restxmlservice.OtherOperationInput) (*request.Request, *restxmlservice.OtherOperationOutput)
|
||||
}
|
||||
|
||||
var _ RESTXMLServiceAPI = (*restxmlservice.RESTXMLService)(nil)
|
||||
Generated
Vendored
+97
@@ -0,0 +1,97 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
package restxmlservice
|
||||
|
||||
import (
|
||||
"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/private/protocol/restxml"
|
||||
)
|
||||
|
||||
// RESTXMLService provides the API operation methods for making requests to
|
||||
// REST XML Service. See this package's package overview docs
|
||||
// for details on the service.
|
||||
//
|
||||
// RESTXMLService methods are safe to use concurrently. It is not safe to
|
||||
// modify mutate any of the struct's properties though.
|
||||
type RESTXMLService struct {
|
||||
*client.Client
|
||||
}
|
||||
|
||||
// Used for custom client initialization logic
|
||||
var initClient func(*client.Client)
|
||||
|
||||
// Used for custom request initialization logic
|
||||
var initRequest func(*request.Request)
|
||||
|
||||
// Service information constants
|
||||
const (
|
||||
ServiceName = "RESTXMLService" // Name of service.
|
||||
EndpointsID = "restxmlservice" // ID to lookup a service endpoint with.
|
||||
ServiceID = "RESTXMLService" // ServiceID is a unique identifer of a specific service.
|
||||
)
|
||||
|
||||
// New creates a new instance of the RESTXMLService 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 RESTXMLService client from just a session.
|
||||
// svc := restxmlservice.New(mySession)
|
||||
//
|
||||
// // Create a RESTXMLService client with additional configuration
|
||||
// svc := restxmlservice.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
|
||||
func New(p client.ConfigProvider, cfgs ...*aws.Config) *RESTXMLService {
|
||||
c := p.ClientConfig(EndpointsID, cfgs...)
|
||||
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
|
||||
}
|
||||
|
||||
// newClient creates, initializes and returns a new service client instance.
|
||||
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *RESTXMLService {
|
||||
svc := &RESTXMLService{
|
||||
Client: client.New(
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: ServiceName,
|
||||
ServiceID: ServiceID,
|
||||
SigningName: signingName,
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
APIVersion: "0000-00-00",
|
||||
},
|
||||
handlers,
|
||||
),
|
||||
}
|
||||
|
||||
// Handlers
|
||||
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
|
||||
svc.Handlers.Build.PushBackNamed(restxml.BuildHandler)
|
||||
svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)
|
||||
svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)
|
||||
svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)
|
||||
|
||||
svc.Handlers.UnmarshalStream.PushBackNamed(restxml.UnmarshalHandler)
|
||||
|
||||
// Run custom client initialization if present
|
||||
if initClient != nil {
|
||||
initClient(svc.Client)
|
||||
}
|
||||
|
||||
return svc
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a RESTXMLService operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *RESTXMLService) newRequest(op *request.Operation, params, data interface{}) *request.Request {
|
||||
req := c.NewRequest(op, params, data)
|
||||
|
||||
// Run custom request initialization if present
|
||||
if initRequest != nil {
|
||||
initRequest(req)
|
||||
}
|
||||
|
||||
return req
|
||||
}
|
||||
Generated
Vendored
+1452
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
// Package rpcservice provides the client and types for making API
|
||||
// requests to RPC Service.
|
||||
//
|
||||
// See https://docs.aws.amazon.com/goto/WebAPI/RPCService-0000-00-00 for more information on this service.
|
||||
//
|
||||
// See rpcservice package documentation for more information.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/service/rpcservice/
|
||||
//
|
||||
// Using the Client
|
||||
//
|
||||
// To contact RPC Service with the SDK use the New function to create
|
||||
// a new service client. With that client you can make API requests to the service.
|
||||
// These clients are safe to use concurrently.
|
||||
//
|
||||
// See the SDK's documentation for more information on how to use the SDK.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/
|
||||
//
|
||||
// See aws.Config documentation for more information on configuring SDK clients.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config
|
||||
//
|
||||
// See the RPC Service client RPCService for more
|
||||
// information on creating client for this service.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/service/rpcservice/#New
|
||||
package rpcservice
|
||||
Generated
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
package rpcservice
|
||||
|
||||
const (
|
||||
|
||||
// ErrCodeExceptionEvent for service response error code
|
||||
// "ExceptionEvent".
|
||||
ErrCodeExceptionEvent = "ExceptionEvent"
|
||||
|
||||
// ErrCodeExceptionEvent2 for service response error code
|
||||
// "ExceptionEvent2".
|
||||
ErrCodeExceptionEvent2 = "ExceptionEvent2"
|
||||
)
|
||||
Generated
Vendored
+578
@@ -0,0 +1,578 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
// +build go1.6
|
||||
|
||||
package rpcservice
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||
"github.com/aws/aws-sdk-go/aws/corehandlers"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/awstesting/unit"
|
||||
"github.com/aws/aws-sdk-go/private/protocol"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/eventstream"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamtest"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
|
||||
)
|
||||
|
||||
var _ time.Time
|
||||
var _ awserr.Error
|
||||
|
||||
func TestEmptyStream_Read(t *testing.T) {
|
||||
expectEvents, eventMsgs := mockEmptyStreamReadEvents()
|
||||
sess, cleanupFn, err := eventstreamtest.SetupEventStreamSession(t,
|
||||
eventstreamtest.ServeEventStream{
|
||||
T: t,
|
||||
Events: eventMsgs,
|
||||
},
|
||||
true,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error, %v", err)
|
||||
}
|
||||
defer cleanupFn()
|
||||
|
||||
svc := New(sess)
|
||||
resp, err := svc.EmptyStream(nil)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error got, %v", err)
|
||||
}
|
||||
defer resp.EventStream.Close()
|
||||
// Trim off response output type pseudo event so only event messages remain.
|
||||
expectEvents = expectEvents[1:]
|
||||
|
||||
var i int
|
||||
for event := range resp.EventStream.Events() {
|
||||
if event == nil {
|
||||
t.Errorf("%d, expect event, got nil", i)
|
||||
}
|
||||
if e, a := expectEvents[i], event; !reflect.DeepEqual(e, a) {
|
||||
t.Errorf("%d, expect %T %v, got %T %v", i, e, e, a, a)
|
||||
}
|
||||
i++
|
||||
}
|
||||
|
||||
if err := resp.EventStream.Err(); err != nil {
|
||||
t.Errorf("expect no error, %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEmptyStream_ReadClose(t *testing.T) {
|
||||
_, eventMsgs := mockEmptyStreamReadEvents()
|
||||
sess, cleanupFn, err := eventstreamtest.SetupEventStreamSession(t,
|
||||
eventstreamtest.ServeEventStream{
|
||||
T: t,
|
||||
Events: eventMsgs,
|
||||
},
|
||||
true,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error, %v", err)
|
||||
}
|
||||
defer cleanupFn()
|
||||
|
||||
svc := New(sess)
|
||||
resp, err := svc.EmptyStream(nil)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error got, %v", err)
|
||||
}
|
||||
|
||||
resp.EventStream.Close()
|
||||
<-resp.EventStream.Events()
|
||||
|
||||
if err := resp.EventStream.Err(); err != nil {
|
||||
t.Errorf("expect no error, %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkEmptyStream_Read(b *testing.B) {
|
||||
_, eventMsgs := mockEmptyStreamReadEvents()
|
||||
var buf bytes.Buffer
|
||||
encoder := eventstream.NewEncoder(&buf)
|
||||
for _, msg := range eventMsgs {
|
||||
if err := encoder.Encode(msg); err != nil {
|
||||
b.Fatalf("failed to encode message, %v", err)
|
||||
}
|
||||
}
|
||||
stream := &loopReader{source: bytes.NewReader(buf.Bytes())}
|
||||
|
||||
sess := unit.Session
|
||||
svc := New(sess, &aws.Config{
|
||||
Endpoint: aws.String("https://example.com"),
|
||||
DisableParamValidation: aws.Bool(true),
|
||||
})
|
||||
svc.Handlers.Send.Swap(corehandlers.SendHandler.Name,
|
||||
request.NamedHandler{Name: "mockSend",
|
||||
Fn: func(r *request.Request) {
|
||||
r.HTTPResponse = &http.Response{
|
||||
Status: "200 OK",
|
||||
StatusCode: 200,
|
||||
Header: http.Header{},
|
||||
Body: ioutil.NopCloser(stream),
|
||||
}
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
resp, err := svc.EmptyStream(nil)
|
||||
if err != nil {
|
||||
b.Fatalf("failed to create request, %v", err)
|
||||
}
|
||||
defer resp.EventStream.Close()
|
||||
b.ResetTimer()
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
if err = resp.EventStream.Err(); err != nil {
|
||||
b.Fatalf("expect no error, got %v", err)
|
||||
}
|
||||
event := <-resp.EventStream.Events()
|
||||
if event == nil {
|
||||
b.Fatalf("expect event, got nil, %v, %d", resp.EventStream.Err(), i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func mockEmptyStreamReadEvents() (
|
||||
[]EmptyEventStreamEvent,
|
||||
[]eventstream.Message,
|
||||
) {
|
||||
expectEvents := []EmptyEventStreamEvent{
|
||||
&EmptyStreamOutput{},
|
||||
}
|
||||
|
||||
var marshalers request.HandlerList
|
||||
marshalers.PushBackNamed(jsonrpc.BuildHandler)
|
||||
payloadMarshaler := protocol.HandlerPayloadMarshal{
|
||||
Marshalers: marshalers,
|
||||
}
|
||||
_ = payloadMarshaler
|
||||
|
||||
eventMsgs := []eventstream.Message{
|
||||
{
|
||||
Headers: eventstream.Headers{
|
||||
eventstreamtest.EventMessageTypeHeader,
|
||||
{
|
||||
Name: eventstreamapi.EventTypeHeader,
|
||||
Value: eventstream.StringValue("initial-response"),
|
||||
},
|
||||
},
|
||||
Payload: eventstreamtest.MarshalEventPayload(payloadMarshaler, expectEvents[0]),
|
||||
},
|
||||
}
|
||||
|
||||
return expectEvents, eventMsgs
|
||||
}
|
||||
|
||||
func TestGetEventStream_Read(t *testing.T) {
|
||||
expectEvents, eventMsgs := mockGetEventStreamReadEvents()
|
||||
sess, cleanupFn, err := eventstreamtest.SetupEventStreamSession(t,
|
||||
eventstreamtest.ServeEventStream{
|
||||
T: t,
|
||||
Events: eventMsgs,
|
||||
},
|
||||
true,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error, %v", err)
|
||||
}
|
||||
defer cleanupFn()
|
||||
|
||||
svc := New(sess)
|
||||
resp, err := svc.GetEventStream(nil)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error got, %v", err)
|
||||
}
|
||||
defer resp.EventStream.Close()
|
||||
expectResp := expectEvents[0].(*GetEventStreamOutput)
|
||||
if e, a := expectResp.IntVal, resp.IntVal; !reflect.DeepEqual(e, a) {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := expectResp.StrVal, resp.StrVal; !reflect.DeepEqual(e, a) {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
// Trim off response output type pseudo event so only event messages remain.
|
||||
expectEvents = expectEvents[1:]
|
||||
|
||||
var i int
|
||||
for event := range resp.EventStream.Events() {
|
||||
if event == nil {
|
||||
t.Errorf("%d, expect event, got nil", i)
|
||||
}
|
||||
if e, a := expectEvents[i], event; !reflect.DeepEqual(e, a) {
|
||||
t.Errorf("%d, expect %T %v, got %T %v", i, e, e, a, a)
|
||||
}
|
||||
i++
|
||||
}
|
||||
|
||||
if err := resp.EventStream.Err(); err != nil {
|
||||
t.Errorf("expect no error, %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetEventStream_ReadClose(t *testing.T) {
|
||||
_, eventMsgs := mockGetEventStreamReadEvents()
|
||||
sess, cleanupFn, err := eventstreamtest.SetupEventStreamSession(t,
|
||||
eventstreamtest.ServeEventStream{
|
||||
T: t,
|
||||
Events: eventMsgs,
|
||||
},
|
||||
true,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error, %v", err)
|
||||
}
|
||||
defer cleanupFn()
|
||||
|
||||
svc := New(sess)
|
||||
resp, err := svc.GetEventStream(nil)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error got, %v", err)
|
||||
}
|
||||
|
||||
resp.EventStream.Close()
|
||||
<-resp.EventStream.Events()
|
||||
|
||||
if err := resp.EventStream.Err(); err != nil {
|
||||
t.Errorf("expect no error, %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkGetEventStream_Read(b *testing.B) {
|
||||
_, eventMsgs := mockGetEventStreamReadEvents()
|
||||
var buf bytes.Buffer
|
||||
encoder := eventstream.NewEncoder(&buf)
|
||||
for _, msg := range eventMsgs {
|
||||
if err := encoder.Encode(msg); err != nil {
|
||||
b.Fatalf("failed to encode message, %v", err)
|
||||
}
|
||||
}
|
||||
stream := &loopReader{source: bytes.NewReader(buf.Bytes())}
|
||||
|
||||
sess := unit.Session
|
||||
svc := New(sess, &aws.Config{
|
||||
Endpoint: aws.String("https://example.com"),
|
||||
DisableParamValidation: aws.Bool(true),
|
||||
})
|
||||
svc.Handlers.Send.Swap(corehandlers.SendHandler.Name,
|
||||
request.NamedHandler{Name: "mockSend",
|
||||
Fn: func(r *request.Request) {
|
||||
r.HTTPResponse = &http.Response{
|
||||
Status: "200 OK",
|
||||
StatusCode: 200,
|
||||
Header: http.Header{},
|
||||
Body: ioutil.NopCloser(stream),
|
||||
}
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
resp, err := svc.GetEventStream(nil)
|
||||
if err != nil {
|
||||
b.Fatalf("failed to create request, %v", err)
|
||||
}
|
||||
defer resp.EventStream.Close()
|
||||
b.ResetTimer()
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
if err = resp.EventStream.Err(); err != nil {
|
||||
b.Fatalf("expect no error, got %v", err)
|
||||
}
|
||||
event := <-resp.EventStream.Events()
|
||||
if event == nil {
|
||||
b.Fatalf("expect event, got nil, %v, %d", resp.EventStream.Err(), i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func mockGetEventStreamReadEvents() (
|
||||
[]EventStreamEvent,
|
||||
[]eventstream.Message,
|
||||
) {
|
||||
expectEvents := []EventStreamEvent{
|
||||
&GetEventStreamOutput{
|
||||
IntVal: aws.Int64(123),
|
||||
StrVal: aws.String("string value goes here"),
|
||||
},
|
||||
&EmptyEvent{},
|
||||
&ExplicitPayloadEvent{
|
||||
LongVal: aws.Int64(1234),
|
||||
NestedVal: &NestedShape{
|
||||
IntVal: aws.Int64(123),
|
||||
StrVal: aws.String("string value goes here"),
|
||||
},
|
||||
StringVal: aws.String("string value goes here"),
|
||||
},
|
||||
&HeaderOnlyEvent{
|
||||
BlobVal: []byte("blob value goes here"),
|
||||
BoolVal: aws.Bool(true),
|
||||
ByteVal: aws.Int64(1),
|
||||
IntegerVal: aws.Int64(123),
|
||||
LongVal: aws.Int64(1234),
|
||||
ShortVal: aws.Int64(12),
|
||||
StringVal: aws.String("string value goes here"),
|
||||
TimeVal: aws.Time(time.Unix(1396594860, 0).UTC()),
|
||||
},
|
||||
&ImplicitPayloadEvent{
|
||||
ByteVal: aws.Int64(1),
|
||||
IntegerVal: aws.Int64(123),
|
||||
ShortVal: aws.Int64(12),
|
||||
},
|
||||
&PayloadOnlyEvent{
|
||||
NestedVal: &NestedShape{
|
||||
IntVal: aws.Int64(123),
|
||||
StrVal: aws.String("string value goes here"),
|
||||
},
|
||||
},
|
||||
&PayloadOnlyBlobEvent{
|
||||
BlobPayload: []byte("blob value goes here"),
|
||||
},
|
||||
&PayloadOnlyStringEvent{
|
||||
StringPayload: aws.String("string value goes here"),
|
||||
},
|
||||
}
|
||||
|
||||
var marshalers request.HandlerList
|
||||
marshalers.PushBackNamed(jsonrpc.BuildHandler)
|
||||
payloadMarshaler := protocol.HandlerPayloadMarshal{
|
||||
Marshalers: marshalers,
|
||||
}
|
||||
_ = payloadMarshaler
|
||||
|
||||
eventMsgs := []eventstream.Message{
|
||||
{
|
||||
Headers: eventstream.Headers{
|
||||
eventstreamtest.EventMessageTypeHeader,
|
||||
{
|
||||
Name: eventstreamapi.EventTypeHeader,
|
||||
Value: eventstream.StringValue("initial-response"),
|
||||
},
|
||||
},
|
||||
Payload: eventstreamtest.MarshalEventPayload(payloadMarshaler, expectEvents[0]),
|
||||
},
|
||||
{
|
||||
Headers: eventstream.Headers{
|
||||
eventstreamtest.EventMessageTypeHeader,
|
||||
{
|
||||
Name: eventstreamapi.EventTypeHeader,
|
||||
Value: eventstream.StringValue("Empty"),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Headers: eventstream.Headers{
|
||||
eventstreamtest.EventMessageTypeHeader,
|
||||
{
|
||||
Name: eventstreamapi.EventTypeHeader,
|
||||
Value: eventstream.StringValue("ExplicitPayload"),
|
||||
},
|
||||
{
|
||||
Name: "LongVal",
|
||||
Value: eventstream.Int64Value(*expectEvents[2].(*ExplicitPayloadEvent).LongVal),
|
||||
},
|
||||
{
|
||||
Name: "StringVal",
|
||||
Value: eventstream.StringValue(*expectEvents[2].(*ExplicitPayloadEvent).StringVal),
|
||||
},
|
||||
},
|
||||
Payload: eventstreamtest.MarshalEventPayload(payloadMarshaler, expectEvents[2]),
|
||||
},
|
||||
{
|
||||
Headers: eventstream.Headers{
|
||||
eventstreamtest.EventMessageTypeHeader,
|
||||
{
|
||||
Name: eventstreamapi.EventTypeHeader,
|
||||
Value: eventstream.StringValue("Headers"),
|
||||
},
|
||||
{
|
||||
Name: "BlobVal",
|
||||
Value: eventstream.BytesValue(expectEvents[3].(*HeaderOnlyEvent).BlobVal),
|
||||
},
|
||||
{
|
||||
Name: "BoolVal",
|
||||
Value: eventstream.BoolValue(*expectEvents[3].(*HeaderOnlyEvent).BoolVal),
|
||||
},
|
||||
{
|
||||
Name: "ByteVal",
|
||||
Value: eventstream.Int8Value(int8(*expectEvents[3].(*HeaderOnlyEvent).ByteVal)),
|
||||
},
|
||||
{
|
||||
Name: "IntegerVal",
|
||||
Value: eventstream.Int32Value(int32(*expectEvents[3].(*HeaderOnlyEvent).IntegerVal)),
|
||||
},
|
||||
{
|
||||
Name: "LongVal",
|
||||
Value: eventstream.Int64Value(*expectEvents[3].(*HeaderOnlyEvent).LongVal),
|
||||
},
|
||||
{
|
||||
Name: "ShortVal",
|
||||
Value: eventstream.Int16Value(int16(*expectEvents[3].(*HeaderOnlyEvent).ShortVal)),
|
||||
},
|
||||
{
|
||||
Name: "StringVal",
|
||||
Value: eventstream.StringValue(*expectEvents[3].(*HeaderOnlyEvent).StringVal),
|
||||
},
|
||||
{
|
||||
Name: "TimeVal",
|
||||
Value: eventstream.TimestampValue(*expectEvents[3].(*HeaderOnlyEvent).TimeVal),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Headers: eventstream.Headers{
|
||||
eventstreamtest.EventMessageTypeHeader,
|
||||
{
|
||||
Name: eventstreamapi.EventTypeHeader,
|
||||
Value: eventstream.StringValue("ImplicitPayload"),
|
||||
},
|
||||
{
|
||||
Name: "ByteVal",
|
||||
Value: eventstream.Int8Value(int8(*expectEvents[4].(*ImplicitPayloadEvent).ByteVal)),
|
||||
},
|
||||
},
|
||||
Payload: eventstreamtest.MarshalEventPayload(payloadMarshaler, expectEvents[4]),
|
||||
},
|
||||
{
|
||||
Headers: eventstream.Headers{
|
||||
eventstreamtest.EventMessageTypeHeader,
|
||||
{
|
||||
Name: eventstreamapi.EventTypeHeader,
|
||||
Value: eventstream.StringValue("PayloadOnly"),
|
||||
},
|
||||
},
|
||||
Payload: eventstreamtest.MarshalEventPayload(payloadMarshaler, expectEvents[5]),
|
||||
},
|
||||
{
|
||||
Headers: eventstream.Headers{
|
||||
eventstreamtest.EventMessageTypeHeader,
|
||||
{
|
||||
Name: eventstreamapi.EventTypeHeader,
|
||||
Value: eventstream.StringValue("PayloadOnlyBlob"),
|
||||
},
|
||||
},
|
||||
Payload: expectEvents[6].(*PayloadOnlyBlobEvent).BlobPayload,
|
||||
},
|
||||
{
|
||||
Headers: eventstream.Headers{
|
||||
eventstreamtest.EventMessageTypeHeader,
|
||||
{
|
||||
Name: eventstreamapi.EventTypeHeader,
|
||||
Value: eventstream.StringValue("PayloadOnlyString"),
|
||||
},
|
||||
},
|
||||
Payload: []byte(*expectEvents[7].(*PayloadOnlyStringEvent).StringPayload),
|
||||
},
|
||||
}
|
||||
|
||||
return expectEvents, eventMsgs
|
||||
}
|
||||
func TestGetEventStream_ReadException(t *testing.T) {
|
||||
expectEvents := []EventStreamEvent{
|
||||
&GetEventStreamOutput{
|
||||
IntVal: aws.Int64(123),
|
||||
StrVal: aws.String("string value goes here"),
|
||||
},
|
||||
&ExceptionEvent{
|
||||
IntVal: aws.Int64(123),
|
||||
Message_: aws.String("string value goes here"),
|
||||
},
|
||||
}
|
||||
|
||||
var marshalers request.HandlerList
|
||||
marshalers.PushBackNamed(jsonrpc.BuildHandler)
|
||||
payloadMarshaler := protocol.HandlerPayloadMarshal{
|
||||
Marshalers: marshalers,
|
||||
}
|
||||
|
||||
eventMsgs := []eventstream.Message{
|
||||
{
|
||||
Headers: eventstream.Headers{
|
||||
eventstreamtest.EventMessageTypeHeader,
|
||||
{
|
||||
Name: eventstreamapi.EventTypeHeader,
|
||||
Value: eventstream.StringValue("initial-response"),
|
||||
},
|
||||
},
|
||||
Payload: eventstreamtest.MarshalEventPayload(payloadMarshaler, expectEvents[0]),
|
||||
},
|
||||
{
|
||||
Headers: eventstream.Headers{
|
||||
eventstreamtest.EventExceptionTypeHeader,
|
||||
{
|
||||
Name: eventstreamapi.ExceptionTypeHeader,
|
||||
Value: eventstream.StringValue("Exception"),
|
||||
},
|
||||
},
|
||||
Payload: eventstreamtest.MarshalEventPayload(payloadMarshaler, expectEvents[1]),
|
||||
},
|
||||
}
|
||||
|
||||
sess, cleanupFn, err := eventstreamtest.SetupEventStreamSession(t,
|
||||
eventstreamtest.ServeEventStream{
|
||||
T: t,
|
||||
Events: eventMsgs,
|
||||
},
|
||||
true,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error, %v", err)
|
||||
}
|
||||
defer cleanupFn()
|
||||
|
||||
svc := New(sess)
|
||||
resp, err := svc.GetEventStream(nil)
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error got, %v", err)
|
||||
}
|
||||
|
||||
defer resp.EventStream.Close()
|
||||
|
||||
<-resp.EventStream.Events()
|
||||
|
||||
err = resp.EventStream.Err()
|
||||
if err == nil {
|
||||
t.Fatalf("expect err, got none")
|
||||
}
|
||||
|
||||
expectErr := &ExceptionEvent{
|
||||
IntVal: aws.Int64(123),
|
||||
Message_: aws.String("string value goes here"),
|
||||
}
|
||||
aerr, ok := err.(awserr.Error)
|
||||
if !ok {
|
||||
t.Errorf("expect exception, got %T, %#v", err, err)
|
||||
}
|
||||
if e, a := expectErr.Code(), aerr.Code(); e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := expectErr.Message(), aerr.Message(); e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
if e, a := expectErr, aerr; !reflect.DeepEqual(e, a) {
|
||||
t.Errorf("expect %#v, got %#v", e, a)
|
||||
}
|
||||
}
|
||||
|
||||
var _ awserr.Error = (*ExceptionEvent)(nil)
|
||||
var _ awserr.Error = (*ExceptionEvent2)(nil)
|
||||
|
||||
type loopReader struct {
|
||||
source *bytes.Reader
|
||||
}
|
||||
|
||||
func (c *loopReader) Read(p []byte) (int, error) {
|
||||
if c.source.Len() == 0 {
|
||||
c.source.Seek(0, 0)
|
||||
}
|
||||
|
||||
return c.source.Read(p)
|
||||
}
|
||||
Generated
Vendored
+76
@@ -0,0 +1,76 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
// Package rpcserviceiface provides an interface to enable mocking the RPC Service service client
|
||||
// for testing your code.
|
||||
//
|
||||
// It is important to note that this interface will have breaking changes
|
||||
// when the service model is updated and adds new API operations, paginators,
|
||||
// and waiters.
|
||||
package rpcserviceiface
|
||||
|
||||
import (
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/private/model/api/codegentest/service/rpcservice"
|
||||
)
|
||||
|
||||
// RPCServiceAPI provides an interface to enable mocking the
|
||||
// rpcservice.RPCService service client's API operation,
|
||||
// paginators, and waiters. This make unit testing your code that calls out
|
||||
// to the SDK's service client's calls easier.
|
||||
//
|
||||
// The best way to use this interface is so the SDK's service client's calls
|
||||
// can be stubbed out for unit testing your code with the SDK without needing
|
||||
// to inject custom request handlers into the SDK's request pipeline.
|
||||
//
|
||||
// // myFunc uses an SDK service client to make a request to
|
||||
// // RPC Service.
|
||||
// func myFunc(svc rpcserviceiface.RPCServiceAPI) bool {
|
||||
// // Make svc.EmptyStream request
|
||||
// }
|
||||
//
|
||||
// func main() {
|
||||
// sess := session.New()
|
||||
// svc := rpcservice.New(sess)
|
||||
//
|
||||
// myFunc(svc)
|
||||
// }
|
||||
//
|
||||
// In your _test.go file:
|
||||
//
|
||||
// // Define a mock struct to be used in your unit tests of myFunc.
|
||||
// type mockRPCServiceClient struct {
|
||||
// rpcserviceiface.RPCServiceAPI
|
||||
// }
|
||||
// func (m *mockRPCServiceClient) EmptyStream(input *rpcservice.EmptyStreamInput) (*rpcservice.EmptyStreamOutput, error) {
|
||||
// // mock response/functionality
|
||||
// }
|
||||
//
|
||||
// func TestMyFunc(t *testing.T) {
|
||||
// // Setup Test
|
||||
// mockSvc := &mockRPCServiceClient{}
|
||||
//
|
||||
// myfunc(mockSvc)
|
||||
//
|
||||
// // Verify myFunc's functionality
|
||||
// }
|
||||
//
|
||||
// It is important to note that this interface will have breaking changes
|
||||
// when the service model is updated and adds new API operations, paginators,
|
||||
// and waiters. Its suggested to use the pattern above for testing, or using
|
||||
// tooling to generate mocks to satisfy the interfaces.
|
||||
type RPCServiceAPI interface {
|
||||
EmptyStream(*rpcservice.EmptyStreamInput) (*rpcservice.EmptyStreamOutput, error)
|
||||
EmptyStreamWithContext(aws.Context, *rpcservice.EmptyStreamInput, ...request.Option) (*rpcservice.EmptyStreamOutput, error)
|
||||
EmptyStreamRequest(*rpcservice.EmptyStreamInput) (*request.Request, *rpcservice.EmptyStreamOutput)
|
||||
|
||||
GetEventStream(*rpcservice.GetEventStreamInput) (*rpcservice.GetEventStreamOutput, error)
|
||||
GetEventStreamWithContext(aws.Context, *rpcservice.GetEventStreamInput, ...request.Option) (*rpcservice.GetEventStreamOutput, error)
|
||||
GetEventStreamRequest(*rpcservice.GetEventStreamInput) (*request.Request, *rpcservice.GetEventStreamOutput)
|
||||
|
||||
OtherOperation(*rpcservice.OtherOperationInput) (*rpcservice.OtherOperationOutput, error)
|
||||
OtherOperationWithContext(aws.Context, *rpcservice.OtherOperationInput, ...request.Option) (*rpcservice.OtherOperationOutput, error)
|
||||
OtherOperationRequest(*rpcservice.OtherOperationInput) (*request.Request, *rpcservice.OtherOperationOutput)
|
||||
}
|
||||
|
||||
var _ RPCServiceAPI = (*rpcservice.RPCService)(nil)
|
||||
Generated
Vendored
+99
@@ -0,0 +1,99 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
package rpcservice
|
||||
|
||||
import (
|
||||
"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/private/protocol/jsonrpc"
|
||||
)
|
||||
|
||||
// RPCService provides the API operation methods for making requests to
|
||||
// RPC Service. See this package's package overview docs
|
||||
// for details on the service.
|
||||
//
|
||||
// RPCService methods are safe to use concurrently. It is not safe to
|
||||
// modify mutate any of the struct's properties though.
|
||||
type RPCService struct {
|
||||
*client.Client
|
||||
}
|
||||
|
||||
// Used for custom client initialization logic
|
||||
var initClient func(*client.Client)
|
||||
|
||||
// Used for custom request initialization logic
|
||||
var initRequest func(*request.Request)
|
||||
|
||||
// Service information constants
|
||||
const (
|
||||
ServiceName = "RPCService" // Name of service.
|
||||
EndpointsID = "rpcservice" // ID to lookup a service endpoint with.
|
||||
ServiceID = "RPCService" // ServiceID is a unique identifer of a specific service.
|
||||
)
|
||||
|
||||
// New creates a new instance of the RPCService 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 RPCService client from just a session.
|
||||
// svc := rpcservice.New(mySession)
|
||||
//
|
||||
// // Create a RPCService client with additional configuration
|
||||
// svc := rpcservice.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
|
||||
func New(p client.ConfigProvider, cfgs ...*aws.Config) *RPCService {
|
||||
c := p.ClientConfig(EndpointsID, cfgs...)
|
||||
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
|
||||
}
|
||||
|
||||
// newClient creates, initializes and returns a new service client instance.
|
||||
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *RPCService {
|
||||
svc := &RPCService{
|
||||
Client: client.New(
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: ServiceName,
|
||||
ServiceID: ServiceID,
|
||||
SigningName: signingName,
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
APIVersion: "0000-00-00",
|
||||
JSONVersion: "1.1",
|
||||
TargetPrefix: "RPCService_00000000",
|
||||
},
|
||||
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)
|
||||
|
||||
svc.Handlers.UnmarshalStream.PushBackNamed(jsonrpc.UnmarshalHandler)
|
||||
|
||||
// Run custom client initialization if present
|
||||
if initClient != nil {
|
||||
initClient(svc.Client)
|
||||
}
|
||||
|
||||
return svc
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a RPCService operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *RPCService) newRequest(op *request.Operation, params, data interface{}) *request.Request {
|
||||
req := c.NewRequest(op, params, data)
|
||||
|
||||
// Run custom request initialization if present
|
||||
if initRequest != nil {
|
||||
initRequest(req)
|
||||
}
|
||||
|
||||
return req
|
||||
}
|
||||
Reference in New Issue
Block a user