unmarshal_test.go 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037
  1. package jsonrpc_test
  2. import (
  3. "bytes"
  4. "encoding/json"
  5. "encoding/xml"
  6. "fmt"
  7. "io"
  8. "io/ioutil"
  9. "net/http"
  10. "net/url"
  11. "testing"
  12. "time"
  13. "github.com/aws/aws-sdk-go/aws"
  14. "github.com/aws/aws-sdk-go/aws/client"
  15. "github.com/aws/aws-sdk-go/aws/client/metadata"
  16. "github.com/aws/aws-sdk-go/aws/request"
  17. "github.com/aws/aws-sdk-go/aws/signer/v4"
  18. "github.com/aws/aws-sdk-go/awstesting"
  19. "github.com/aws/aws-sdk-go/awstesting/unit"
  20. "github.com/aws/aws-sdk-go/private/protocol"
  21. "github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
  22. "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil"
  23. "github.com/aws/aws-sdk-go/private/util"
  24. "github.com/stretchr/testify/assert"
  25. )
  26. var _ bytes.Buffer // always import bytes
  27. var _ http.Request
  28. var _ json.Marshaler
  29. var _ time.Time
  30. var _ xmlutil.XMLNode
  31. var _ xml.Attr
  32. var _ = ioutil.Discard
  33. var _ = util.Trim("")
  34. var _ = url.Values{}
  35. var _ = io.EOF
  36. var _ = aws.String
  37. var _ = fmt.Println
  38. func init() {
  39. protocol.RandReader = &awstesting.ZeroReader{}
  40. }
  41. //The service client's operations are safe to be used concurrently.
  42. // It is not safe to mutate any of the client's properties though.
  43. type OutputService1ProtocolTest struct {
  44. *client.Client
  45. }
  46. // New creates a new instance of the OutputService1ProtocolTest client with a session.
  47. // If additional configuration is needed for the client instance use the optional
  48. // aws.Config parameter to add your extra config.
  49. //
  50. // Example:
  51. // // Create a OutputService1ProtocolTest client from just a session.
  52. // svc := outputservice1protocoltest.New(mySession)
  53. //
  54. // // Create a OutputService1ProtocolTest client with additional configuration
  55. // svc := outputservice1protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  56. func NewOutputService1ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService1ProtocolTest {
  57. c := p.ClientConfig("outputservice1protocoltest", cfgs...)
  58. return newOutputService1ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  59. }
  60. // newClient creates, initializes and returns a new service client instance.
  61. func newOutputService1ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService1ProtocolTest {
  62. svc := &OutputService1ProtocolTest{
  63. Client: client.New(
  64. cfg,
  65. metadata.ClientInfo{
  66. ServiceName: "outputservice1protocoltest",
  67. SigningRegion: signingRegion,
  68. Endpoint: endpoint,
  69. APIVersion: "",
  70. JSONVersion: "",
  71. TargetPrefix: "",
  72. },
  73. handlers,
  74. ),
  75. }
  76. // Handlers
  77. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  78. svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
  79. svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
  80. svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
  81. svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
  82. return svc
  83. }
  84. // newRequest creates a new request for a OutputService1ProtocolTest operation and runs any
  85. // custom request initialization.
  86. func (c *OutputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  87. req := c.NewRequest(op, params, data)
  88. return req
  89. }
  90. const opOutputService1TestCaseOperation1 = "OperationName"
  91. // OutputService1TestCaseOperation1Request generates a "aws/request.Request" representing the
  92. // client's request for the OutputService1TestCaseOperation1 operation. The "output" return
  93. // value can be used to capture response data after the request's "Send" method
  94. // is called.
  95. //
  96. // See OutputService1TestCaseOperation1 for usage and error information.
  97. //
  98. // Creating a request object using this method should be used when you want to inject
  99. // custom logic into the request's lifecycle using a custom handler, or if you want to
  100. // access properties on the request object before or after sending the request. If
  101. // you just want the service response, call the OutputService1TestCaseOperation1 method directly
  102. // instead.
  103. //
  104. // Note: You must call the "Send" method on the returned request object in order
  105. // to execute the request.
  106. //
  107. // // Example sending a request using the OutputService1TestCaseOperation1Request method.
  108. // req, resp := client.OutputService1TestCaseOperation1Request(params)
  109. //
  110. // err := req.Send()
  111. // if err == nil { // resp is now filled
  112. // fmt.Println(resp)
  113. // }
  114. //
  115. func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1Request(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (req *request.Request, output *OutputService1TestShapeOutputService1TestCaseOperation1Output) {
  116. op := &request.Operation{
  117. Name: opOutputService1TestCaseOperation1,
  118. HTTPPath: "/",
  119. }
  120. if input == nil {
  121. input = &OutputService1TestShapeOutputService1TestCaseOperation1Input{}
  122. }
  123. req = c.newRequest(op, input, output)
  124. output = &OutputService1TestShapeOutputService1TestCaseOperation1Output{}
  125. req.Data = output
  126. return
  127. }
  128. // OutputService1TestCaseOperation1 API operation for .
  129. //
  130. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  131. // with awserr.Error's Code and Message methods to get detailed information about
  132. // the error.
  133. //
  134. // See the AWS API reference guide for 's
  135. // API operation OutputService1TestCaseOperation1 for usage and error information.
  136. func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation1(input *OutputService1TestShapeOutputService1TestCaseOperation1Input) (*OutputService1TestShapeOutputService1TestCaseOperation1Output, error) {
  137. req, out := c.OutputService1TestCaseOperation1Request(input)
  138. err := req.Send()
  139. return out, err
  140. }
  141. type OutputService1TestShapeOutputService1TestCaseOperation1Input struct {
  142. _ struct{} `type:"structure"`
  143. }
  144. type OutputService1TestShapeOutputService1TestCaseOperation1Output struct {
  145. _ struct{} `type:"structure"`
  146. Char *string `type:"character"`
  147. Double *float64 `type:"double"`
  148. FalseBool *bool `type:"boolean"`
  149. Float *float64 `type:"float"`
  150. Long *int64 `type:"long"`
  151. Num *int64 `type:"integer"`
  152. Str *string `type:"string"`
  153. TrueBool *bool `type:"boolean"`
  154. }
  155. //The service client's operations are safe to be used concurrently.
  156. // It is not safe to mutate any of the client's properties though.
  157. type OutputService2ProtocolTest struct {
  158. *client.Client
  159. }
  160. // New creates a new instance of the OutputService2ProtocolTest client with a session.
  161. // If additional configuration is needed for the client instance use the optional
  162. // aws.Config parameter to add your extra config.
  163. //
  164. // Example:
  165. // // Create a OutputService2ProtocolTest client from just a session.
  166. // svc := outputservice2protocoltest.New(mySession)
  167. //
  168. // // Create a OutputService2ProtocolTest client with additional configuration
  169. // svc := outputservice2protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  170. func NewOutputService2ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService2ProtocolTest {
  171. c := p.ClientConfig("outputservice2protocoltest", cfgs...)
  172. return newOutputService2ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  173. }
  174. // newClient creates, initializes and returns a new service client instance.
  175. func newOutputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService2ProtocolTest {
  176. svc := &OutputService2ProtocolTest{
  177. Client: client.New(
  178. cfg,
  179. metadata.ClientInfo{
  180. ServiceName: "outputservice2protocoltest",
  181. SigningRegion: signingRegion,
  182. Endpoint: endpoint,
  183. APIVersion: "",
  184. JSONVersion: "",
  185. TargetPrefix: "",
  186. },
  187. handlers,
  188. ),
  189. }
  190. // Handlers
  191. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  192. svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
  193. svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
  194. svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
  195. svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
  196. return svc
  197. }
  198. // newRequest creates a new request for a OutputService2ProtocolTest operation and runs any
  199. // custom request initialization.
  200. func (c *OutputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  201. req := c.NewRequest(op, params, data)
  202. return req
  203. }
  204. const opOutputService2TestCaseOperation1 = "OperationName"
  205. // OutputService2TestCaseOperation1Request generates a "aws/request.Request" representing the
  206. // client's request for the OutputService2TestCaseOperation1 operation. The "output" return
  207. // value can be used to capture response data after the request's "Send" method
  208. // is called.
  209. //
  210. // See OutputService2TestCaseOperation1 for usage and error information.
  211. //
  212. // Creating a request object using this method should be used when you want to inject
  213. // custom logic into the request's lifecycle using a custom handler, or if you want to
  214. // access properties on the request object before or after sending the request. If
  215. // you just want the service response, call the OutputService2TestCaseOperation1 method directly
  216. // instead.
  217. //
  218. // Note: You must call the "Send" method on the returned request object in order
  219. // to execute the request.
  220. //
  221. // // Example sending a request using the OutputService2TestCaseOperation1Request method.
  222. // req, resp := client.OutputService2TestCaseOperation1Request(params)
  223. //
  224. // err := req.Send()
  225. // if err == nil { // resp is now filled
  226. // fmt.Println(resp)
  227. // }
  228. //
  229. func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1Request(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (req *request.Request, output *OutputService2TestShapeOutputService2TestCaseOperation1Output) {
  230. op := &request.Operation{
  231. Name: opOutputService2TestCaseOperation1,
  232. HTTPPath: "/",
  233. }
  234. if input == nil {
  235. input = &OutputService2TestShapeOutputService2TestCaseOperation1Input{}
  236. }
  237. req = c.newRequest(op, input, output)
  238. output = &OutputService2TestShapeOutputService2TestCaseOperation1Output{}
  239. req.Data = output
  240. return
  241. }
  242. // OutputService2TestCaseOperation1 API operation for .
  243. //
  244. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  245. // with awserr.Error's Code and Message methods to get detailed information about
  246. // the error.
  247. //
  248. // See the AWS API reference guide for 's
  249. // API operation OutputService2TestCaseOperation1 for usage and error information.
  250. func (c *OutputService2ProtocolTest) OutputService2TestCaseOperation1(input *OutputService2TestShapeOutputService2TestCaseOperation1Input) (*OutputService2TestShapeOutputService2TestCaseOperation1Output, error) {
  251. req, out := c.OutputService2TestCaseOperation1Request(input)
  252. err := req.Send()
  253. return out, err
  254. }
  255. type OutputService2TestShapeBlobContainer struct {
  256. _ struct{} `type:"structure"`
  257. // Foo is automatically base64 encoded/decoded by the SDK.
  258. Foo []byte `locationName:"foo" type:"blob"`
  259. }
  260. type OutputService2TestShapeOutputService2TestCaseOperation1Input struct {
  261. _ struct{} `type:"structure"`
  262. }
  263. type OutputService2TestShapeOutputService2TestCaseOperation1Output struct {
  264. _ struct{} `type:"structure"`
  265. // BlobMember is automatically base64 encoded/decoded by the SDK.
  266. BlobMember []byte `type:"blob"`
  267. StructMember *OutputService2TestShapeBlobContainer `type:"structure"`
  268. }
  269. //The service client's operations are safe to be used concurrently.
  270. // It is not safe to mutate any of the client's properties though.
  271. type OutputService3ProtocolTest struct {
  272. *client.Client
  273. }
  274. // New creates a new instance of the OutputService3ProtocolTest client with a session.
  275. // If additional configuration is needed for the client instance use the optional
  276. // aws.Config parameter to add your extra config.
  277. //
  278. // Example:
  279. // // Create a OutputService3ProtocolTest client from just a session.
  280. // svc := outputservice3protocoltest.New(mySession)
  281. //
  282. // // Create a OutputService3ProtocolTest client with additional configuration
  283. // svc := outputservice3protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  284. func NewOutputService3ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService3ProtocolTest {
  285. c := p.ClientConfig("outputservice3protocoltest", cfgs...)
  286. return newOutputService3ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  287. }
  288. // newClient creates, initializes and returns a new service client instance.
  289. func newOutputService3ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService3ProtocolTest {
  290. svc := &OutputService3ProtocolTest{
  291. Client: client.New(
  292. cfg,
  293. metadata.ClientInfo{
  294. ServiceName: "outputservice3protocoltest",
  295. SigningRegion: signingRegion,
  296. Endpoint: endpoint,
  297. APIVersion: "",
  298. JSONVersion: "",
  299. TargetPrefix: "",
  300. },
  301. handlers,
  302. ),
  303. }
  304. // Handlers
  305. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  306. svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
  307. svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
  308. svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
  309. svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
  310. return svc
  311. }
  312. // newRequest creates a new request for a OutputService3ProtocolTest operation and runs any
  313. // custom request initialization.
  314. func (c *OutputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  315. req := c.NewRequest(op, params, data)
  316. return req
  317. }
  318. const opOutputService3TestCaseOperation1 = "OperationName"
  319. // OutputService3TestCaseOperation1Request generates a "aws/request.Request" representing the
  320. // client's request for the OutputService3TestCaseOperation1 operation. The "output" return
  321. // value can be used to capture response data after the request's "Send" method
  322. // is called.
  323. //
  324. // See OutputService3TestCaseOperation1 for usage and error information.
  325. //
  326. // Creating a request object using this method should be used when you want to inject
  327. // custom logic into the request's lifecycle using a custom handler, or if you want to
  328. // access properties on the request object before or after sending the request. If
  329. // you just want the service response, call the OutputService3TestCaseOperation1 method directly
  330. // instead.
  331. //
  332. // Note: You must call the "Send" method on the returned request object in order
  333. // to execute the request.
  334. //
  335. // // Example sending a request using the OutputService3TestCaseOperation1Request method.
  336. // req, resp := client.OutputService3TestCaseOperation1Request(params)
  337. //
  338. // err := req.Send()
  339. // if err == nil { // resp is now filled
  340. // fmt.Println(resp)
  341. // }
  342. //
  343. func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1Request(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (req *request.Request, output *OutputService3TestShapeOutputService3TestCaseOperation1Output) {
  344. op := &request.Operation{
  345. Name: opOutputService3TestCaseOperation1,
  346. HTTPPath: "/",
  347. }
  348. if input == nil {
  349. input = &OutputService3TestShapeOutputService3TestCaseOperation1Input{}
  350. }
  351. req = c.newRequest(op, input, output)
  352. output = &OutputService3TestShapeOutputService3TestCaseOperation1Output{}
  353. req.Data = output
  354. return
  355. }
  356. // OutputService3TestCaseOperation1 API operation for .
  357. //
  358. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  359. // with awserr.Error's Code and Message methods to get detailed information about
  360. // the error.
  361. //
  362. // See the AWS API reference guide for 's
  363. // API operation OutputService3TestCaseOperation1 for usage and error information.
  364. func (c *OutputService3ProtocolTest) OutputService3TestCaseOperation1(input *OutputService3TestShapeOutputService3TestCaseOperation1Input) (*OutputService3TestShapeOutputService3TestCaseOperation1Output, error) {
  365. req, out := c.OutputService3TestCaseOperation1Request(input)
  366. err := req.Send()
  367. return out, err
  368. }
  369. type OutputService3TestShapeOutputService3TestCaseOperation1Input struct {
  370. _ struct{} `type:"structure"`
  371. }
  372. type OutputService3TestShapeOutputService3TestCaseOperation1Output struct {
  373. _ struct{} `type:"structure"`
  374. StructMember *OutputService3TestShapeTimeContainer `type:"structure"`
  375. TimeMember *time.Time `type:"timestamp" timestampFormat:"unix"`
  376. }
  377. type OutputService3TestShapeTimeContainer struct {
  378. _ struct{} `type:"structure"`
  379. Foo *time.Time `locationName:"foo" type:"timestamp" timestampFormat:"unix"`
  380. }
  381. //The service client's operations are safe to be used concurrently.
  382. // It is not safe to mutate any of the client's properties though.
  383. type OutputService4ProtocolTest struct {
  384. *client.Client
  385. }
  386. // New creates a new instance of the OutputService4ProtocolTest client with a session.
  387. // If additional configuration is needed for the client instance use the optional
  388. // aws.Config parameter to add your extra config.
  389. //
  390. // Example:
  391. // // Create a OutputService4ProtocolTest client from just a session.
  392. // svc := outputservice4protocoltest.New(mySession)
  393. //
  394. // // Create a OutputService4ProtocolTest client with additional configuration
  395. // svc := outputservice4protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  396. func NewOutputService4ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService4ProtocolTest {
  397. c := p.ClientConfig("outputservice4protocoltest", cfgs...)
  398. return newOutputService4ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  399. }
  400. // newClient creates, initializes and returns a new service client instance.
  401. func newOutputService4ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService4ProtocolTest {
  402. svc := &OutputService4ProtocolTest{
  403. Client: client.New(
  404. cfg,
  405. metadata.ClientInfo{
  406. ServiceName: "outputservice4protocoltest",
  407. SigningRegion: signingRegion,
  408. Endpoint: endpoint,
  409. APIVersion: "",
  410. JSONVersion: "",
  411. TargetPrefix: "",
  412. },
  413. handlers,
  414. ),
  415. }
  416. // Handlers
  417. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  418. svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
  419. svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
  420. svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
  421. svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
  422. return svc
  423. }
  424. // newRequest creates a new request for a OutputService4ProtocolTest operation and runs any
  425. // custom request initialization.
  426. func (c *OutputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  427. req := c.NewRequest(op, params, data)
  428. return req
  429. }
  430. const opOutputService4TestCaseOperation1 = "OperationName"
  431. // OutputService4TestCaseOperation1Request generates a "aws/request.Request" representing the
  432. // client's request for the OutputService4TestCaseOperation1 operation. The "output" return
  433. // value can be used to capture response data after the request's "Send" method
  434. // is called.
  435. //
  436. // See OutputService4TestCaseOperation1 for usage and error information.
  437. //
  438. // Creating a request object using this method should be used when you want to inject
  439. // custom logic into the request's lifecycle using a custom handler, or if you want to
  440. // access properties on the request object before or after sending the request. If
  441. // you just want the service response, call the OutputService4TestCaseOperation1 method directly
  442. // instead.
  443. //
  444. // Note: You must call the "Send" method on the returned request object in order
  445. // to execute the request.
  446. //
  447. // // Example sending a request using the OutputService4TestCaseOperation1Request method.
  448. // req, resp := client.OutputService4TestCaseOperation1Request(params)
  449. //
  450. // err := req.Send()
  451. // if err == nil { // resp is now filled
  452. // fmt.Println(resp)
  453. // }
  454. //
  455. func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1Request(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (req *request.Request, output *OutputService4TestShapeOutputShape) {
  456. op := &request.Operation{
  457. Name: opOutputService4TestCaseOperation1,
  458. HTTPPath: "/",
  459. }
  460. if input == nil {
  461. input = &OutputService4TestShapeOutputService4TestCaseOperation1Input{}
  462. }
  463. req = c.newRequest(op, input, output)
  464. output = &OutputService4TestShapeOutputShape{}
  465. req.Data = output
  466. return
  467. }
  468. // OutputService4TestCaseOperation1 API operation for .
  469. //
  470. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  471. // with awserr.Error's Code and Message methods to get detailed information about
  472. // the error.
  473. //
  474. // See the AWS API reference guide for 's
  475. // API operation OutputService4TestCaseOperation1 for usage and error information.
  476. func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation1(input *OutputService4TestShapeOutputService4TestCaseOperation1Input) (*OutputService4TestShapeOutputShape, error) {
  477. req, out := c.OutputService4TestCaseOperation1Request(input)
  478. err := req.Send()
  479. return out, err
  480. }
  481. const opOutputService4TestCaseOperation2 = "OperationName"
  482. // OutputService4TestCaseOperation2Request generates a "aws/request.Request" representing the
  483. // client's request for the OutputService4TestCaseOperation2 operation. The "output" return
  484. // value can be used to capture response data after the request's "Send" method
  485. // is called.
  486. //
  487. // See OutputService4TestCaseOperation2 for usage and error information.
  488. //
  489. // Creating a request object using this method should be used when you want to inject
  490. // custom logic into the request's lifecycle using a custom handler, or if you want to
  491. // access properties on the request object before or after sending the request. If
  492. // you just want the service response, call the OutputService4TestCaseOperation2 method directly
  493. // instead.
  494. //
  495. // Note: You must call the "Send" method on the returned request object in order
  496. // to execute the request.
  497. //
  498. // // Example sending a request using the OutputService4TestCaseOperation2Request method.
  499. // req, resp := client.OutputService4TestCaseOperation2Request(params)
  500. //
  501. // err := req.Send()
  502. // if err == nil { // resp is now filled
  503. // fmt.Println(resp)
  504. // }
  505. //
  506. func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation2Request(input *OutputService4TestShapeOutputService4TestCaseOperation2Input) (req *request.Request, output *OutputService4TestShapeOutputShape) {
  507. op := &request.Operation{
  508. Name: opOutputService4TestCaseOperation2,
  509. HTTPPath: "/",
  510. }
  511. if input == nil {
  512. input = &OutputService4TestShapeOutputService4TestCaseOperation2Input{}
  513. }
  514. req = c.newRequest(op, input, output)
  515. output = &OutputService4TestShapeOutputShape{}
  516. req.Data = output
  517. return
  518. }
  519. // OutputService4TestCaseOperation2 API operation for .
  520. //
  521. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  522. // with awserr.Error's Code and Message methods to get detailed information about
  523. // the error.
  524. //
  525. // See the AWS API reference guide for 's
  526. // API operation OutputService4TestCaseOperation2 for usage and error information.
  527. func (c *OutputService4ProtocolTest) OutputService4TestCaseOperation2(input *OutputService4TestShapeOutputService4TestCaseOperation2Input) (*OutputService4TestShapeOutputShape, error) {
  528. req, out := c.OutputService4TestCaseOperation2Request(input)
  529. err := req.Send()
  530. return out, err
  531. }
  532. type OutputService4TestShapeOutputService4TestCaseOperation1Input struct {
  533. _ struct{} `type:"structure"`
  534. }
  535. type OutputService4TestShapeOutputService4TestCaseOperation2Input struct {
  536. _ struct{} `type:"structure"`
  537. }
  538. type OutputService4TestShapeOutputShape struct {
  539. _ struct{} `type:"structure"`
  540. ListMember []*string `type:"list"`
  541. ListMemberMap []map[string]*string `type:"list"`
  542. ListMemberStruct []*OutputService4TestShapeStructType `type:"list"`
  543. }
  544. type OutputService4TestShapeStructType struct {
  545. _ struct{} `type:"structure"`
  546. }
  547. //The service client's operations are safe to be used concurrently.
  548. // It is not safe to mutate any of the client's properties though.
  549. type OutputService5ProtocolTest struct {
  550. *client.Client
  551. }
  552. // New creates a new instance of the OutputService5ProtocolTest client with a session.
  553. // If additional configuration is needed for the client instance use the optional
  554. // aws.Config parameter to add your extra config.
  555. //
  556. // Example:
  557. // // Create a OutputService5ProtocolTest client from just a session.
  558. // svc := outputservice5protocoltest.New(mySession)
  559. //
  560. // // Create a OutputService5ProtocolTest client with additional configuration
  561. // svc := outputservice5protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  562. func NewOutputService5ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService5ProtocolTest {
  563. c := p.ClientConfig("outputservice5protocoltest", cfgs...)
  564. return newOutputService5ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  565. }
  566. // newClient creates, initializes and returns a new service client instance.
  567. func newOutputService5ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService5ProtocolTest {
  568. svc := &OutputService5ProtocolTest{
  569. Client: client.New(
  570. cfg,
  571. metadata.ClientInfo{
  572. ServiceName: "outputservice5protocoltest",
  573. SigningRegion: signingRegion,
  574. Endpoint: endpoint,
  575. APIVersion: "",
  576. JSONVersion: "",
  577. TargetPrefix: "",
  578. },
  579. handlers,
  580. ),
  581. }
  582. // Handlers
  583. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  584. svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
  585. svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
  586. svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
  587. svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
  588. return svc
  589. }
  590. // newRequest creates a new request for a OutputService5ProtocolTest operation and runs any
  591. // custom request initialization.
  592. func (c *OutputService5ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  593. req := c.NewRequest(op, params, data)
  594. return req
  595. }
  596. const opOutputService5TestCaseOperation1 = "OperationName"
  597. // OutputService5TestCaseOperation1Request generates a "aws/request.Request" representing the
  598. // client's request for the OutputService5TestCaseOperation1 operation. The "output" return
  599. // value can be used to capture response data after the request's "Send" method
  600. // is called.
  601. //
  602. // See OutputService5TestCaseOperation1 for usage and error information.
  603. //
  604. // Creating a request object using this method should be used when you want to inject
  605. // custom logic into the request's lifecycle using a custom handler, or if you want to
  606. // access properties on the request object before or after sending the request. If
  607. // you just want the service response, call the OutputService5TestCaseOperation1 method directly
  608. // instead.
  609. //
  610. // Note: You must call the "Send" method on the returned request object in order
  611. // to execute the request.
  612. //
  613. // // Example sending a request using the OutputService5TestCaseOperation1Request method.
  614. // req, resp := client.OutputService5TestCaseOperation1Request(params)
  615. //
  616. // err := req.Send()
  617. // if err == nil { // resp is now filled
  618. // fmt.Println(resp)
  619. // }
  620. //
  621. func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1Request(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (req *request.Request, output *OutputService5TestShapeOutputService5TestCaseOperation1Output) {
  622. op := &request.Operation{
  623. Name: opOutputService5TestCaseOperation1,
  624. HTTPPath: "/",
  625. }
  626. if input == nil {
  627. input = &OutputService5TestShapeOutputService5TestCaseOperation1Input{}
  628. }
  629. req = c.newRequest(op, input, output)
  630. output = &OutputService5TestShapeOutputService5TestCaseOperation1Output{}
  631. req.Data = output
  632. return
  633. }
  634. // OutputService5TestCaseOperation1 API operation for .
  635. //
  636. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  637. // with awserr.Error's Code and Message methods to get detailed information about
  638. // the error.
  639. //
  640. // See the AWS API reference guide for 's
  641. // API operation OutputService5TestCaseOperation1 for usage and error information.
  642. func (c *OutputService5ProtocolTest) OutputService5TestCaseOperation1(input *OutputService5TestShapeOutputService5TestCaseOperation1Input) (*OutputService5TestShapeOutputService5TestCaseOperation1Output, error) {
  643. req, out := c.OutputService5TestCaseOperation1Request(input)
  644. err := req.Send()
  645. return out, err
  646. }
  647. type OutputService5TestShapeOutputService5TestCaseOperation1Input struct {
  648. _ struct{} `type:"structure"`
  649. }
  650. type OutputService5TestShapeOutputService5TestCaseOperation1Output struct {
  651. _ struct{} `type:"structure"`
  652. MapMember map[string][]*int64 `type:"map"`
  653. }
  654. //The service client's operations are safe to be used concurrently.
  655. // It is not safe to mutate any of the client's properties though.
  656. type OutputService6ProtocolTest struct {
  657. *client.Client
  658. }
  659. // New creates a new instance of the OutputService6ProtocolTest client with a session.
  660. // If additional configuration is needed for the client instance use the optional
  661. // aws.Config parameter to add your extra config.
  662. //
  663. // Example:
  664. // // Create a OutputService6ProtocolTest client from just a session.
  665. // svc := outputservice6protocoltest.New(mySession)
  666. //
  667. // // Create a OutputService6ProtocolTest client with additional configuration
  668. // svc := outputservice6protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  669. func NewOutputService6ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService6ProtocolTest {
  670. c := p.ClientConfig("outputservice6protocoltest", cfgs...)
  671. return newOutputService6ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  672. }
  673. // newClient creates, initializes and returns a new service client instance.
  674. func newOutputService6ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OutputService6ProtocolTest {
  675. svc := &OutputService6ProtocolTest{
  676. Client: client.New(
  677. cfg,
  678. metadata.ClientInfo{
  679. ServiceName: "outputservice6protocoltest",
  680. SigningRegion: signingRegion,
  681. Endpoint: endpoint,
  682. APIVersion: "",
  683. JSONVersion: "",
  684. TargetPrefix: "",
  685. },
  686. handlers,
  687. ),
  688. }
  689. // Handlers
  690. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  691. svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
  692. svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
  693. svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
  694. svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
  695. return svc
  696. }
  697. // newRequest creates a new request for a OutputService6ProtocolTest operation and runs any
  698. // custom request initialization.
  699. func (c *OutputService6ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  700. req := c.NewRequest(op, params, data)
  701. return req
  702. }
  703. const opOutputService6TestCaseOperation1 = "OperationName"
  704. // OutputService6TestCaseOperation1Request generates a "aws/request.Request" representing the
  705. // client's request for the OutputService6TestCaseOperation1 operation. The "output" return
  706. // value can be used to capture response data after the request's "Send" method
  707. // is called.
  708. //
  709. // See OutputService6TestCaseOperation1 for usage and error information.
  710. //
  711. // Creating a request object using this method should be used when you want to inject
  712. // custom logic into the request's lifecycle using a custom handler, or if you want to
  713. // access properties on the request object before or after sending the request. If
  714. // you just want the service response, call the OutputService6TestCaseOperation1 method directly
  715. // instead.
  716. //
  717. // Note: You must call the "Send" method on the returned request object in order
  718. // to execute the request.
  719. //
  720. // // Example sending a request using the OutputService6TestCaseOperation1Request method.
  721. // req, resp := client.OutputService6TestCaseOperation1Request(params)
  722. //
  723. // err := req.Send()
  724. // if err == nil { // resp is now filled
  725. // fmt.Println(resp)
  726. // }
  727. //
  728. func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1Request(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (req *request.Request, output *OutputService6TestShapeOutputService6TestCaseOperation1Output) {
  729. op := &request.Operation{
  730. Name: opOutputService6TestCaseOperation1,
  731. HTTPPath: "/",
  732. }
  733. if input == nil {
  734. input = &OutputService6TestShapeOutputService6TestCaseOperation1Input{}
  735. }
  736. req = c.newRequest(op, input, output)
  737. output = &OutputService6TestShapeOutputService6TestCaseOperation1Output{}
  738. req.Data = output
  739. return
  740. }
  741. // OutputService6TestCaseOperation1 API operation for .
  742. //
  743. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  744. // with awserr.Error's Code and Message methods to get detailed information about
  745. // the error.
  746. //
  747. // See the AWS API reference guide for 's
  748. // API operation OutputService6TestCaseOperation1 for usage and error information.
  749. func (c *OutputService6ProtocolTest) OutputService6TestCaseOperation1(input *OutputService6TestShapeOutputService6TestCaseOperation1Input) (*OutputService6TestShapeOutputService6TestCaseOperation1Output, error) {
  750. req, out := c.OutputService6TestCaseOperation1Request(input)
  751. err := req.Send()
  752. return out, err
  753. }
  754. type OutputService6TestShapeOutputService6TestCaseOperation1Input struct {
  755. _ struct{} `type:"structure"`
  756. }
  757. type OutputService6TestShapeOutputService6TestCaseOperation1Output struct {
  758. _ struct{} `type:"structure"`
  759. StrType *string `type:"string"`
  760. }
  761. //
  762. // Tests begin here
  763. //
  764. func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) {
  765. svc := NewOutputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
  766. buf := bytes.NewReader([]byte("{\"Str\": \"myname\", \"Num\": 123, \"FalseBool\": false, \"TrueBool\": true, \"Float\": 1.2, \"Double\": 1.3, \"Long\": 200, \"Char\": \"a\"}"))
  767. req, out := svc.OutputService1TestCaseOperation1Request(nil)
  768. req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
  769. // set headers
  770. // unmarshal response
  771. jsonrpc.UnmarshalMeta(req)
  772. jsonrpc.Unmarshal(req)
  773. assert.NoError(t, req.Error)
  774. // assert response
  775. assert.NotNil(t, out) // ensure out variable is used
  776. assert.Equal(t, "a", *out.Char)
  777. assert.Equal(t, 1.3, *out.Double)
  778. assert.Equal(t, false, *out.FalseBool)
  779. assert.Equal(t, 1.2, *out.Float)
  780. assert.Equal(t, int64(200), *out.Long)
  781. assert.Equal(t, int64(123), *out.Num)
  782. assert.Equal(t, "myname", *out.Str)
  783. assert.Equal(t, true, *out.TrueBool)
  784. }
  785. func TestOutputService2ProtocolTestBlobMembersCase1(t *testing.T) {
  786. svc := NewOutputService2ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
  787. buf := bytes.NewReader([]byte("{\"BlobMember\": \"aGkh\", \"StructMember\": {\"foo\": \"dGhlcmUh\"}}"))
  788. req, out := svc.OutputService2TestCaseOperation1Request(nil)
  789. req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
  790. // set headers
  791. // unmarshal response
  792. jsonrpc.UnmarshalMeta(req)
  793. jsonrpc.Unmarshal(req)
  794. assert.NoError(t, req.Error)
  795. // assert response
  796. assert.NotNil(t, out) // ensure out variable is used
  797. assert.Equal(t, "hi!", string(out.BlobMember))
  798. assert.Equal(t, "there!", string(out.StructMember.Foo))
  799. }
  800. func TestOutputService3ProtocolTestTimestampMembersCase1(t *testing.T) {
  801. svc := NewOutputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
  802. buf := bytes.NewReader([]byte("{\"TimeMember\": 1398796238, \"StructMember\": {\"foo\": 1398796238}}"))
  803. req, out := svc.OutputService3TestCaseOperation1Request(nil)
  804. req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
  805. // set headers
  806. // unmarshal response
  807. jsonrpc.UnmarshalMeta(req)
  808. jsonrpc.Unmarshal(req)
  809. assert.NoError(t, req.Error)
  810. // assert response
  811. assert.NotNil(t, out) // ensure out variable is used
  812. assert.Equal(t, time.Unix(1.398796238e+09, 0).UTC().String(), out.StructMember.Foo.String())
  813. assert.Equal(t, time.Unix(1.398796238e+09, 0).UTC().String(), out.TimeMember.String())
  814. }
  815. func TestOutputService4ProtocolTestListsCase1(t *testing.T) {
  816. svc := NewOutputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
  817. buf := bytes.NewReader([]byte("{\"ListMember\": [\"a\", \"b\"]}"))
  818. req, out := svc.OutputService4TestCaseOperation1Request(nil)
  819. req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
  820. // set headers
  821. // unmarshal response
  822. jsonrpc.UnmarshalMeta(req)
  823. jsonrpc.Unmarshal(req)
  824. assert.NoError(t, req.Error)
  825. // assert response
  826. assert.NotNil(t, out) // ensure out variable is used
  827. assert.Equal(t, "a", *out.ListMember[0])
  828. assert.Equal(t, "b", *out.ListMember[1])
  829. }
  830. func TestOutputService4ProtocolTestListsCase2(t *testing.T) {
  831. svc := NewOutputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
  832. buf := bytes.NewReader([]byte("{\"ListMember\": [\"a\", null], \"ListMemberMap\": [{}, null, null, {}], \"ListMemberStruct\": [{}, null, null, {}]}"))
  833. req, out := svc.OutputService4TestCaseOperation2Request(nil)
  834. req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
  835. // set headers
  836. // unmarshal response
  837. jsonrpc.UnmarshalMeta(req)
  838. jsonrpc.Unmarshal(req)
  839. assert.NoError(t, req.Error)
  840. // assert response
  841. assert.NotNil(t, out) // ensure out variable is used
  842. assert.Equal(t, "a", *out.ListMember[0])
  843. assert.Nil(t, out.ListMember[1])
  844. assert.Nil(t, out.ListMemberMap[1])
  845. assert.Nil(t, out.ListMemberMap[2])
  846. assert.Nil(t, out.ListMemberStruct[1])
  847. assert.Nil(t, out.ListMemberStruct[2])
  848. }
  849. func TestOutputService5ProtocolTestMapsCase1(t *testing.T) {
  850. svc := NewOutputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
  851. buf := bytes.NewReader([]byte("{\"MapMember\": {\"a\": [1, 2], \"b\": [3, 4]}}"))
  852. req, out := svc.OutputService5TestCaseOperation1Request(nil)
  853. req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
  854. // set headers
  855. // unmarshal response
  856. jsonrpc.UnmarshalMeta(req)
  857. jsonrpc.Unmarshal(req)
  858. assert.NoError(t, req.Error)
  859. // assert response
  860. assert.NotNil(t, out) // ensure out variable is used
  861. assert.Equal(t, int64(1), *out.MapMember["a"][0])
  862. assert.Equal(t, int64(2), *out.MapMember["a"][1])
  863. assert.Equal(t, int64(3), *out.MapMember["b"][0])
  864. assert.Equal(t, int64(4), *out.MapMember["b"][1])
  865. }
  866. func TestOutputService6ProtocolTestIgnoresExtraDataCase1(t *testing.T) {
  867. svc := NewOutputService6ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")})
  868. buf := bytes.NewReader([]byte("{\"foo\": \"bar\"}"))
  869. req, out := svc.OutputService6TestCaseOperation1Request(nil)
  870. req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}}
  871. // set headers
  872. // unmarshal response
  873. jsonrpc.UnmarshalMeta(req)
  874. jsonrpc.Unmarshal(req)
  875. assert.NoError(t, req.Error)
  876. // assert response
  877. assert.NotNil(t, out) // ensure out variable is used
  878. }