examples_test.go 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package dynamodb_test
  3. import (
  4. "bytes"
  5. "fmt"
  6. "time"
  7. "github.com/aws/aws-sdk-go/aws"
  8. "github.com/aws/aws-sdk-go/aws/session"
  9. "github.com/aws/aws-sdk-go/service/dynamodb"
  10. )
  11. var _ time.Duration
  12. var _ bytes.Buffer
  13. func ExampleDynamoDB_BatchGetItem() {
  14. sess, err := session.NewSession()
  15. if err != nil {
  16. fmt.Println("failed to create session,", err)
  17. return
  18. }
  19. svc := dynamodb.New(sess)
  20. params := &dynamodb.BatchGetItemInput{
  21. RequestItems: map[string]*dynamodb.KeysAndAttributes{ // Required
  22. "Key": { // Required
  23. Keys: []map[string]*dynamodb.AttributeValue{ // Required
  24. { // Required
  25. "Key": { // Required
  26. B: []byte("PAYLOAD"),
  27. BOOL: aws.Bool(true),
  28. BS: [][]byte{
  29. []byte("PAYLOAD"), // Required
  30. // More values...
  31. },
  32. L: []*dynamodb.AttributeValue{
  33. { // Required
  34. // Recursive values...
  35. },
  36. // More values...
  37. },
  38. M: map[string]*dynamodb.AttributeValue{
  39. "Key": { // Required
  40. // Recursive values...
  41. },
  42. // More values...
  43. },
  44. N: aws.String("NumberAttributeValue"),
  45. NS: []*string{
  46. aws.String("NumberAttributeValue"), // Required
  47. // More values...
  48. },
  49. NULL: aws.Bool(true),
  50. S: aws.String("StringAttributeValue"),
  51. SS: []*string{
  52. aws.String("StringAttributeValue"), // Required
  53. // More values...
  54. },
  55. },
  56. // More values...
  57. },
  58. // More values...
  59. },
  60. AttributesToGet: []*string{
  61. aws.String("AttributeName"), // Required
  62. // More values...
  63. },
  64. ConsistentRead: aws.Bool(true),
  65. ExpressionAttributeNames: map[string]*string{
  66. "Key": aws.String("AttributeName"), // Required
  67. // More values...
  68. },
  69. ProjectionExpression: aws.String("ProjectionExpression"),
  70. },
  71. // More values...
  72. },
  73. ReturnConsumedCapacity: aws.String("ReturnConsumedCapacity"),
  74. }
  75. resp, err := svc.BatchGetItem(params)
  76. if err != nil {
  77. // Print the error, cast err to awserr.Error to get the Code and
  78. // Message from an error.
  79. fmt.Println(err.Error())
  80. return
  81. }
  82. // Pretty-print the response data.
  83. fmt.Println(resp)
  84. }
  85. func ExampleDynamoDB_BatchWriteItem() {
  86. sess, err := session.NewSession()
  87. if err != nil {
  88. fmt.Println("failed to create session,", err)
  89. return
  90. }
  91. svc := dynamodb.New(sess)
  92. params := &dynamodb.BatchWriteItemInput{
  93. RequestItems: map[string][]*dynamodb.WriteRequest{ // Required
  94. "Key": { // Required
  95. { // Required
  96. DeleteRequest: &dynamodb.DeleteRequest{
  97. Key: map[string]*dynamodb.AttributeValue{ // Required
  98. "Key": { // Required
  99. B: []byte("PAYLOAD"),
  100. BOOL: aws.Bool(true),
  101. BS: [][]byte{
  102. []byte("PAYLOAD"), // Required
  103. // More values...
  104. },
  105. L: []*dynamodb.AttributeValue{
  106. { // Required
  107. // Recursive values...
  108. },
  109. // More values...
  110. },
  111. M: map[string]*dynamodb.AttributeValue{
  112. "Key": { // Required
  113. // Recursive values...
  114. },
  115. // More values...
  116. },
  117. N: aws.String("NumberAttributeValue"),
  118. NS: []*string{
  119. aws.String("NumberAttributeValue"), // Required
  120. // More values...
  121. },
  122. NULL: aws.Bool(true),
  123. S: aws.String("StringAttributeValue"),
  124. SS: []*string{
  125. aws.String("StringAttributeValue"), // Required
  126. // More values...
  127. },
  128. },
  129. // More values...
  130. },
  131. },
  132. PutRequest: &dynamodb.PutRequest{
  133. Item: map[string]*dynamodb.AttributeValue{ // Required
  134. "Key": { // Required
  135. B: []byte("PAYLOAD"),
  136. BOOL: aws.Bool(true),
  137. BS: [][]byte{
  138. []byte("PAYLOAD"), // Required
  139. // More values...
  140. },
  141. L: []*dynamodb.AttributeValue{
  142. { // Required
  143. // Recursive values...
  144. },
  145. // More values...
  146. },
  147. M: map[string]*dynamodb.AttributeValue{
  148. "Key": { // Required
  149. // Recursive values...
  150. },
  151. // More values...
  152. },
  153. N: aws.String("NumberAttributeValue"),
  154. NS: []*string{
  155. aws.String("NumberAttributeValue"), // Required
  156. // More values...
  157. },
  158. NULL: aws.Bool(true),
  159. S: aws.String("StringAttributeValue"),
  160. SS: []*string{
  161. aws.String("StringAttributeValue"), // Required
  162. // More values...
  163. },
  164. },
  165. // More values...
  166. },
  167. },
  168. },
  169. // More values...
  170. },
  171. // More values...
  172. },
  173. ReturnConsumedCapacity: aws.String("ReturnConsumedCapacity"),
  174. ReturnItemCollectionMetrics: aws.String("ReturnItemCollectionMetrics"),
  175. }
  176. resp, err := svc.BatchWriteItem(params)
  177. if err != nil {
  178. // Print the error, cast err to awserr.Error to get the Code and
  179. // Message from an error.
  180. fmt.Println(err.Error())
  181. return
  182. }
  183. // Pretty-print the response data.
  184. fmt.Println(resp)
  185. }
  186. func ExampleDynamoDB_CreateTable() {
  187. sess, err := session.NewSession()
  188. if err != nil {
  189. fmt.Println("failed to create session,", err)
  190. return
  191. }
  192. svc := dynamodb.New(sess)
  193. params := &dynamodb.CreateTableInput{
  194. AttributeDefinitions: []*dynamodb.AttributeDefinition{ // Required
  195. { // Required
  196. AttributeName: aws.String("KeySchemaAttributeName"), // Required
  197. AttributeType: aws.String("ScalarAttributeType"), // Required
  198. },
  199. // More values...
  200. },
  201. KeySchema: []*dynamodb.KeySchemaElement{ // Required
  202. { // Required
  203. AttributeName: aws.String("KeySchemaAttributeName"), // Required
  204. KeyType: aws.String("KeyType"), // Required
  205. },
  206. // More values...
  207. },
  208. ProvisionedThroughput: &dynamodb.ProvisionedThroughput{ // Required
  209. ReadCapacityUnits: aws.Int64(1), // Required
  210. WriteCapacityUnits: aws.Int64(1), // Required
  211. },
  212. TableName: aws.String("TableName"), // Required
  213. GlobalSecondaryIndexes: []*dynamodb.GlobalSecondaryIndex{
  214. { // Required
  215. IndexName: aws.String("IndexName"), // Required
  216. KeySchema: []*dynamodb.KeySchemaElement{ // Required
  217. { // Required
  218. AttributeName: aws.String("KeySchemaAttributeName"), // Required
  219. KeyType: aws.String("KeyType"), // Required
  220. },
  221. // More values...
  222. },
  223. Projection: &dynamodb.Projection{ // Required
  224. NonKeyAttributes: []*string{
  225. aws.String("NonKeyAttributeName"), // Required
  226. // More values...
  227. },
  228. ProjectionType: aws.String("ProjectionType"),
  229. },
  230. ProvisionedThroughput: &dynamodb.ProvisionedThroughput{ // Required
  231. ReadCapacityUnits: aws.Int64(1), // Required
  232. WriteCapacityUnits: aws.Int64(1), // Required
  233. },
  234. },
  235. // More values...
  236. },
  237. LocalSecondaryIndexes: []*dynamodb.LocalSecondaryIndex{
  238. { // Required
  239. IndexName: aws.String("IndexName"), // Required
  240. KeySchema: []*dynamodb.KeySchemaElement{ // Required
  241. { // Required
  242. AttributeName: aws.String("KeySchemaAttributeName"), // Required
  243. KeyType: aws.String("KeyType"), // Required
  244. },
  245. // More values...
  246. },
  247. Projection: &dynamodb.Projection{ // Required
  248. NonKeyAttributes: []*string{
  249. aws.String("NonKeyAttributeName"), // Required
  250. // More values...
  251. },
  252. ProjectionType: aws.String("ProjectionType"),
  253. },
  254. },
  255. // More values...
  256. },
  257. StreamSpecification: &dynamodb.StreamSpecification{
  258. StreamEnabled: aws.Bool(true),
  259. StreamViewType: aws.String("StreamViewType"),
  260. },
  261. }
  262. resp, err := svc.CreateTable(params)
  263. if err != nil {
  264. // Print the error, cast err to awserr.Error to get the Code and
  265. // Message from an error.
  266. fmt.Println(err.Error())
  267. return
  268. }
  269. // Pretty-print the response data.
  270. fmt.Println(resp)
  271. }
  272. func ExampleDynamoDB_DeleteItem() {
  273. sess, err := session.NewSession()
  274. if err != nil {
  275. fmt.Println("failed to create session,", err)
  276. return
  277. }
  278. svc := dynamodb.New(sess)
  279. params := &dynamodb.DeleteItemInput{
  280. Key: map[string]*dynamodb.AttributeValue{ // Required
  281. "Key": { // Required
  282. B: []byte("PAYLOAD"),
  283. BOOL: aws.Bool(true),
  284. BS: [][]byte{
  285. []byte("PAYLOAD"), // Required
  286. // More values...
  287. },
  288. L: []*dynamodb.AttributeValue{
  289. { // Required
  290. // Recursive values...
  291. },
  292. // More values...
  293. },
  294. M: map[string]*dynamodb.AttributeValue{
  295. "Key": { // Required
  296. // Recursive values...
  297. },
  298. // More values...
  299. },
  300. N: aws.String("NumberAttributeValue"),
  301. NS: []*string{
  302. aws.String("NumberAttributeValue"), // Required
  303. // More values...
  304. },
  305. NULL: aws.Bool(true),
  306. S: aws.String("StringAttributeValue"),
  307. SS: []*string{
  308. aws.String("StringAttributeValue"), // Required
  309. // More values...
  310. },
  311. },
  312. // More values...
  313. },
  314. TableName: aws.String("TableName"), // Required
  315. ConditionExpression: aws.String("ConditionExpression"),
  316. ConditionalOperator: aws.String("ConditionalOperator"),
  317. Expected: map[string]*dynamodb.ExpectedAttributeValue{
  318. "Key": { // Required
  319. AttributeValueList: []*dynamodb.AttributeValue{
  320. { // Required
  321. B: []byte("PAYLOAD"),
  322. BOOL: aws.Bool(true),
  323. BS: [][]byte{
  324. []byte("PAYLOAD"), // Required
  325. // More values...
  326. },
  327. L: []*dynamodb.AttributeValue{
  328. { // Required
  329. // Recursive values...
  330. },
  331. // More values...
  332. },
  333. M: map[string]*dynamodb.AttributeValue{
  334. "Key": { // Required
  335. // Recursive values...
  336. },
  337. // More values...
  338. },
  339. N: aws.String("NumberAttributeValue"),
  340. NS: []*string{
  341. aws.String("NumberAttributeValue"), // Required
  342. // More values...
  343. },
  344. NULL: aws.Bool(true),
  345. S: aws.String("StringAttributeValue"),
  346. SS: []*string{
  347. aws.String("StringAttributeValue"), // Required
  348. // More values...
  349. },
  350. },
  351. // More values...
  352. },
  353. ComparisonOperator: aws.String("ComparisonOperator"),
  354. Exists: aws.Bool(true),
  355. Value: &dynamodb.AttributeValue{
  356. B: []byte("PAYLOAD"),
  357. BOOL: aws.Bool(true),
  358. BS: [][]byte{
  359. []byte("PAYLOAD"), // Required
  360. // More values...
  361. },
  362. L: []*dynamodb.AttributeValue{
  363. { // Required
  364. // Recursive values...
  365. },
  366. // More values...
  367. },
  368. M: map[string]*dynamodb.AttributeValue{
  369. "Key": { // Required
  370. // Recursive values...
  371. },
  372. // More values...
  373. },
  374. N: aws.String("NumberAttributeValue"),
  375. NS: []*string{
  376. aws.String("NumberAttributeValue"), // Required
  377. // More values...
  378. },
  379. NULL: aws.Bool(true),
  380. S: aws.String("StringAttributeValue"),
  381. SS: []*string{
  382. aws.String("StringAttributeValue"), // Required
  383. // More values...
  384. },
  385. },
  386. },
  387. // More values...
  388. },
  389. ExpressionAttributeNames: map[string]*string{
  390. "Key": aws.String("AttributeName"), // Required
  391. // More values...
  392. },
  393. ExpressionAttributeValues: map[string]*dynamodb.AttributeValue{
  394. "Key": { // Required
  395. B: []byte("PAYLOAD"),
  396. BOOL: aws.Bool(true),
  397. BS: [][]byte{
  398. []byte("PAYLOAD"), // Required
  399. // More values...
  400. },
  401. L: []*dynamodb.AttributeValue{
  402. { // Required
  403. // Recursive values...
  404. },
  405. // More values...
  406. },
  407. M: map[string]*dynamodb.AttributeValue{
  408. "Key": { // Required
  409. // Recursive values...
  410. },
  411. // More values...
  412. },
  413. N: aws.String("NumberAttributeValue"),
  414. NS: []*string{
  415. aws.String("NumberAttributeValue"), // Required
  416. // More values...
  417. },
  418. NULL: aws.Bool(true),
  419. S: aws.String("StringAttributeValue"),
  420. SS: []*string{
  421. aws.String("StringAttributeValue"), // Required
  422. // More values...
  423. },
  424. },
  425. // More values...
  426. },
  427. ReturnConsumedCapacity: aws.String("ReturnConsumedCapacity"),
  428. ReturnItemCollectionMetrics: aws.String("ReturnItemCollectionMetrics"),
  429. ReturnValues: aws.String("ReturnValue"),
  430. }
  431. resp, err := svc.DeleteItem(params)
  432. if err != nil {
  433. // Print the error, cast err to awserr.Error to get the Code and
  434. // Message from an error.
  435. fmt.Println(err.Error())
  436. return
  437. }
  438. // Pretty-print the response data.
  439. fmt.Println(resp)
  440. }
  441. func ExampleDynamoDB_DeleteTable() {
  442. sess, err := session.NewSession()
  443. if err != nil {
  444. fmt.Println("failed to create session,", err)
  445. return
  446. }
  447. svc := dynamodb.New(sess)
  448. params := &dynamodb.DeleteTableInput{
  449. TableName: aws.String("TableName"), // Required
  450. }
  451. resp, err := svc.DeleteTable(params)
  452. if err != nil {
  453. // Print the error, cast err to awserr.Error to get the Code and
  454. // Message from an error.
  455. fmt.Println(err.Error())
  456. return
  457. }
  458. // Pretty-print the response data.
  459. fmt.Println(resp)
  460. }
  461. func ExampleDynamoDB_DescribeLimits() {
  462. sess, err := session.NewSession()
  463. if err != nil {
  464. fmt.Println("failed to create session,", err)
  465. return
  466. }
  467. svc := dynamodb.New(sess)
  468. var params *dynamodb.DescribeLimitsInput
  469. resp, err := svc.DescribeLimits(params)
  470. if err != nil {
  471. // Print the error, cast err to awserr.Error to get the Code and
  472. // Message from an error.
  473. fmt.Println(err.Error())
  474. return
  475. }
  476. // Pretty-print the response data.
  477. fmt.Println(resp)
  478. }
  479. func ExampleDynamoDB_DescribeTable() {
  480. sess, err := session.NewSession()
  481. if err != nil {
  482. fmt.Println("failed to create session,", err)
  483. return
  484. }
  485. svc := dynamodb.New(sess)
  486. params := &dynamodb.DescribeTableInput{
  487. TableName: aws.String("TableName"), // Required
  488. }
  489. resp, err := svc.DescribeTable(params)
  490. if err != nil {
  491. // Print the error, cast err to awserr.Error to get the Code and
  492. // Message from an error.
  493. fmt.Println(err.Error())
  494. return
  495. }
  496. // Pretty-print the response data.
  497. fmt.Println(resp)
  498. }
  499. func ExampleDynamoDB_GetItem() {
  500. sess, err := session.NewSession()
  501. if err != nil {
  502. fmt.Println("failed to create session,", err)
  503. return
  504. }
  505. svc := dynamodb.New(sess)
  506. params := &dynamodb.GetItemInput{
  507. Key: map[string]*dynamodb.AttributeValue{ // Required
  508. "Key": { // Required
  509. B: []byte("PAYLOAD"),
  510. BOOL: aws.Bool(true),
  511. BS: [][]byte{
  512. []byte("PAYLOAD"), // Required
  513. // More values...
  514. },
  515. L: []*dynamodb.AttributeValue{
  516. { // Required
  517. // Recursive values...
  518. },
  519. // More values...
  520. },
  521. M: map[string]*dynamodb.AttributeValue{
  522. "Key": { // Required
  523. // Recursive values...
  524. },
  525. // More values...
  526. },
  527. N: aws.String("NumberAttributeValue"),
  528. NS: []*string{
  529. aws.String("NumberAttributeValue"), // Required
  530. // More values...
  531. },
  532. NULL: aws.Bool(true),
  533. S: aws.String("StringAttributeValue"),
  534. SS: []*string{
  535. aws.String("StringAttributeValue"), // Required
  536. // More values...
  537. },
  538. },
  539. // More values...
  540. },
  541. TableName: aws.String("TableName"), // Required
  542. AttributesToGet: []*string{
  543. aws.String("AttributeName"), // Required
  544. // More values...
  545. },
  546. ConsistentRead: aws.Bool(true),
  547. ExpressionAttributeNames: map[string]*string{
  548. "Key": aws.String("AttributeName"), // Required
  549. // More values...
  550. },
  551. ProjectionExpression: aws.String("ProjectionExpression"),
  552. ReturnConsumedCapacity: aws.String("ReturnConsumedCapacity"),
  553. }
  554. resp, err := svc.GetItem(params)
  555. if err != nil {
  556. // Print the error, cast err to awserr.Error to get the Code and
  557. // Message from an error.
  558. fmt.Println(err.Error())
  559. return
  560. }
  561. // Pretty-print the response data.
  562. fmt.Println(resp)
  563. }
  564. func ExampleDynamoDB_ListTables() {
  565. sess, err := session.NewSession()
  566. if err != nil {
  567. fmt.Println("failed to create session,", err)
  568. return
  569. }
  570. svc := dynamodb.New(sess)
  571. params := &dynamodb.ListTablesInput{
  572. ExclusiveStartTableName: aws.String("TableName"),
  573. Limit: aws.Int64(1),
  574. }
  575. resp, err := svc.ListTables(params)
  576. if err != nil {
  577. // Print the error, cast err to awserr.Error to get the Code and
  578. // Message from an error.
  579. fmt.Println(err.Error())
  580. return
  581. }
  582. // Pretty-print the response data.
  583. fmt.Println(resp)
  584. }
  585. func ExampleDynamoDB_PutItem() {
  586. sess, err := session.NewSession()
  587. if err != nil {
  588. fmt.Println("failed to create session,", err)
  589. return
  590. }
  591. svc := dynamodb.New(sess)
  592. params := &dynamodb.PutItemInput{
  593. Item: map[string]*dynamodb.AttributeValue{ // Required
  594. "Key": { // Required
  595. B: []byte("PAYLOAD"),
  596. BOOL: aws.Bool(true),
  597. BS: [][]byte{
  598. []byte("PAYLOAD"), // Required
  599. // More values...
  600. },
  601. L: []*dynamodb.AttributeValue{
  602. { // Required
  603. // Recursive values...
  604. },
  605. // More values...
  606. },
  607. M: map[string]*dynamodb.AttributeValue{
  608. "Key": { // Required
  609. // Recursive values...
  610. },
  611. // More values...
  612. },
  613. N: aws.String("NumberAttributeValue"),
  614. NS: []*string{
  615. aws.String("NumberAttributeValue"), // Required
  616. // More values...
  617. },
  618. NULL: aws.Bool(true),
  619. S: aws.String("StringAttributeValue"),
  620. SS: []*string{
  621. aws.String("StringAttributeValue"), // Required
  622. // More values...
  623. },
  624. },
  625. // More values...
  626. },
  627. TableName: aws.String("TableName"), // Required
  628. ConditionExpression: aws.String("ConditionExpression"),
  629. ConditionalOperator: aws.String("ConditionalOperator"),
  630. Expected: map[string]*dynamodb.ExpectedAttributeValue{
  631. "Key": { // Required
  632. AttributeValueList: []*dynamodb.AttributeValue{
  633. { // Required
  634. B: []byte("PAYLOAD"),
  635. BOOL: aws.Bool(true),
  636. BS: [][]byte{
  637. []byte("PAYLOAD"), // Required
  638. // More values...
  639. },
  640. L: []*dynamodb.AttributeValue{
  641. { // Required
  642. // Recursive values...
  643. },
  644. // More values...
  645. },
  646. M: map[string]*dynamodb.AttributeValue{
  647. "Key": { // Required
  648. // Recursive values...
  649. },
  650. // More values...
  651. },
  652. N: aws.String("NumberAttributeValue"),
  653. NS: []*string{
  654. aws.String("NumberAttributeValue"), // Required
  655. // More values...
  656. },
  657. NULL: aws.Bool(true),
  658. S: aws.String("StringAttributeValue"),
  659. SS: []*string{
  660. aws.String("StringAttributeValue"), // Required
  661. // More values...
  662. },
  663. },
  664. // More values...
  665. },
  666. ComparisonOperator: aws.String("ComparisonOperator"),
  667. Exists: aws.Bool(true),
  668. Value: &dynamodb.AttributeValue{
  669. B: []byte("PAYLOAD"),
  670. BOOL: aws.Bool(true),
  671. BS: [][]byte{
  672. []byte("PAYLOAD"), // Required
  673. // More values...
  674. },
  675. L: []*dynamodb.AttributeValue{
  676. { // Required
  677. // Recursive values...
  678. },
  679. // More values...
  680. },
  681. M: map[string]*dynamodb.AttributeValue{
  682. "Key": { // Required
  683. // Recursive values...
  684. },
  685. // More values...
  686. },
  687. N: aws.String("NumberAttributeValue"),
  688. NS: []*string{
  689. aws.String("NumberAttributeValue"), // Required
  690. // More values...
  691. },
  692. NULL: aws.Bool(true),
  693. S: aws.String("StringAttributeValue"),
  694. SS: []*string{
  695. aws.String("StringAttributeValue"), // Required
  696. // More values...
  697. },
  698. },
  699. },
  700. // More values...
  701. },
  702. ExpressionAttributeNames: map[string]*string{
  703. "Key": aws.String("AttributeName"), // Required
  704. // More values...
  705. },
  706. ExpressionAttributeValues: map[string]*dynamodb.AttributeValue{
  707. "Key": { // Required
  708. B: []byte("PAYLOAD"),
  709. BOOL: aws.Bool(true),
  710. BS: [][]byte{
  711. []byte("PAYLOAD"), // Required
  712. // More values...
  713. },
  714. L: []*dynamodb.AttributeValue{
  715. { // Required
  716. // Recursive values...
  717. },
  718. // More values...
  719. },
  720. M: map[string]*dynamodb.AttributeValue{
  721. "Key": { // Required
  722. // Recursive values...
  723. },
  724. // More values...
  725. },
  726. N: aws.String("NumberAttributeValue"),
  727. NS: []*string{
  728. aws.String("NumberAttributeValue"), // Required
  729. // More values...
  730. },
  731. NULL: aws.Bool(true),
  732. S: aws.String("StringAttributeValue"),
  733. SS: []*string{
  734. aws.String("StringAttributeValue"), // Required
  735. // More values...
  736. },
  737. },
  738. // More values...
  739. },
  740. ReturnConsumedCapacity: aws.String("ReturnConsumedCapacity"),
  741. ReturnItemCollectionMetrics: aws.String("ReturnItemCollectionMetrics"),
  742. ReturnValues: aws.String("ReturnValue"),
  743. }
  744. resp, err := svc.PutItem(params)
  745. if err != nil {
  746. // Print the error, cast err to awserr.Error to get the Code and
  747. // Message from an error.
  748. fmt.Println(err.Error())
  749. return
  750. }
  751. // Pretty-print the response data.
  752. fmt.Println(resp)
  753. }
  754. func ExampleDynamoDB_Query() {
  755. sess, err := session.NewSession()
  756. if err != nil {
  757. fmt.Println("failed to create session,", err)
  758. return
  759. }
  760. svc := dynamodb.New(sess)
  761. params := &dynamodb.QueryInput{
  762. TableName: aws.String("TableName"), // Required
  763. AttributesToGet: []*string{
  764. aws.String("AttributeName"), // Required
  765. // More values...
  766. },
  767. ConditionalOperator: aws.String("ConditionalOperator"),
  768. ConsistentRead: aws.Bool(true),
  769. ExclusiveStartKey: map[string]*dynamodb.AttributeValue{
  770. "Key": { // Required
  771. B: []byte("PAYLOAD"),
  772. BOOL: aws.Bool(true),
  773. BS: [][]byte{
  774. []byte("PAYLOAD"), // Required
  775. // More values...
  776. },
  777. L: []*dynamodb.AttributeValue{
  778. { // Required
  779. // Recursive values...
  780. },
  781. // More values...
  782. },
  783. M: map[string]*dynamodb.AttributeValue{
  784. "Key": { // Required
  785. // Recursive values...
  786. },
  787. // More values...
  788. },
  789. N: aws.String("NumberAttributeValue"),
  790. NS: []*string{
  791. aws.String("NumberAttributeValue"), // Required
  792. // More values...
  793. },
  794. NULL: aws.Bool(true),
  795. S: aws.String("StringAttributeValue"),
  796. SS: []*string{
  797. aws.String("StringAttributeValue"), // Required
  798. // More values...
  799. },
  800. },
  801. // More values...
  802. },
  803. ExpressionAttributeNames: map[string]*string{
  804. "Key": aws.String("AttributeName"), // Required
  805. // More values...
  806. },
  807. ExpressionAttributeValues: map[string]*dynamodb.AttributeValue{
  808. "Key": { // Required
  809. B: []byte("PAYLOAD"),
  810. BOOL: aws.Bool(true),
  811. BS: [][]byte{
  812. []byte("PAYLOAD"), // Required
  813. // More values...
  814. },
  815. L: []*dynamodb.AttributeValue{
  816. { // Required
  817. // Recursive values...
  818. },
  819. // More values...
  820. },
  821. M: map[string]*dynamodb.AttributeValue{
  822. "Key": { // Required
  823. // Recursive values...
  824. },
  825. // More values...
  826. },
  827. N: aws.String("NumberAttributeValue"),
  828. NS: []*string{
  829. aws.String("NumberAttributeValue"), // Required
  830. // More values...
  831. },
  832. NULL: aws.Bool(true),
  833. S: aws.String("StringAttributeValue"),
  834. SS: []*string{
  835. aws.String("StringAttributeValue"), // Required
  836. // More values...
  837. },
  838. },
  839. // More values...
  840. },
  841. FilterExpression: aws.String("ConditionExpression"),
  842. IndexName: aws.String("IndexName"),
  843. KeyConditionExpression: aws.String("KeyExpression"),
  844. KeyConditions: map[string]*dynamodb.Condition{
  845. "Key": { // Required
  846. ComparisonOperator: aws.String("ComparisonOperator"), // Required
  847. AttributeValueList: []*dynamodb.AttributeValue{
  848. { // Required
  849. B: []byte("PAYLOAD"),
  850. BOOL: aws.Bool(true),
  851. BS: [][]byte{
  852. []byte("PAYLOAD"), // Required
  853. // More values...
  854. },
  855. L: []*dynamodb.AttributeValue{
  856. { // Required
  857. // Recursive values...
  858. },
  859. // More values...
  860. },
  861. M: map[string]*dynamodb.AttributeValue{
  862. "Key": { // Required
  863. // Recursive values...
  864. },
  865. // More values...
  866. },
  867. N: aws.String("NumberAttributeValue"),
  868. NS: []*string{
  869. aws.String("NumberAttributeValue"), // Required
  870. // More values...
  871. },
  872. NULL: aws.Bool(true),
  873. S: aws.String("StringAttributeValue"),
  874. SS: []*string{
  875. aws.String("StringAttributeValue"), // Required
  876. // More values...
  877. },
  878. },
  879. // More values...
  880. },
  881. },
  882. // More values...
  883. },
  884. Limit: aws.Int64(1),
  885. ProjectionExpression: aws.String("ProjectionExpression"),
  886. QueryFilter: map[string]*dynamodb.Condition{
  887. "Key": { // Required
  888. ComparisonOperator: aws.String("ComparisonOperator"), // Required
  889. AttributeValueList: []*dynamodb.AttributeValue{
  890. { // Required
  891. B: []byte("PAYLOAD"),
  892. BOOL: aws.Bool(true),
  893. BS: [][]byte{
  894. []byte("PAYLOAD"), // Required
  895. // More values...
  896. },
  897. L: []*dynamodb.AttributeValue{
  898. { // Required
  899. // Recursive values...
  900. },
  901. // More values...
  902. },
  903. M: map[string]*dynamodb.AttributeValue{
  904. "Key": { // Required
  905. // Recursive values...
  906. },
  907. // More values...
  908. },
  909. N: aws.String("NumberAttributeValue"),
  910. NS: []*string{
  911. aws.String("NumberAttributeValue"), // Required
  912. // More values...
  913. },
  914. NULL: aws.Bool(true),
  915. S: aws.String("StringAttributeValue"),
  916. SS: []*string{
  917. aws.String("StringAttributeValue"), // Required
  918. // More values...
  919. },
  920. },
  921. // More values...
  922. },
  923. },
  924. // More values...
  925. },
  926. ReturnConsumedCapacity: aws.String("ReturnConsumedCapacity"),
  927. ScanIndexForward: aws.Bool(true),
  928. Select: aws.String("Select"),
  929. }
  930. resp, err := svc.Query(params)
  931. if err != nil {
  932. // Print the error, cast err to awserr.Error to get the Code and
  933. // Message from an error.
  934. fmt.Println(err.Error())
  935. return
  936. }
  937. // Pretty-print the response data.
  938. fmt.Println(resp)
  939. }
  940. func ExampleDynamoDB_Scan() {
  941. sess, err := session.NewSession()
  942. if err != nil {
  943. fmt.Println("failed to create session,", err)
  944. return
  945. }
  946. svc := dynamodb.New(sess)
  947. params := &dynamodb.ScanInput{
  948. TableName: aws.String("TableName"), // Required
  949. AttributesToGet: []*string{
  950. aws.String("AttributeName"), // Required
  951. // More values...
  952. },
  953. ConditionalOperator: aws.String("ConditionalOperator"),
  954. ConsistentRead: aws.Bool(true),
  955. ExclusiveStartKey: map[string]*dynamodb.AttributeValue{
  956. "Key": { // Required
  957. B: []byte("PAYLOAD"),
  958. BOOL: aws.Bool(true),
  959. BS: [][]byte{
  960. []byte("PAYLOAD"), // Required
  961. // More values...
  962. },
  963. L: []*dynamodb.AttributeValue{
  964. { // Required
  965. // Recursive values...
  966. },
  967. // More values...
  968. },
  969. M: map[string]*dynamodb.AttributeValue{
  970. "Key": { // Required
  971. // Recursive values...
  972. },
  973. // More values...
  974. },
  975. N: aws.String("NumberAttributeValue"),
  976. NS: []*string{
  977. aws.String("NumberAttributeValue"), // Required
  978. // More values...
  979. },
  980. NULL: aws.Bool(true),
  981. S: aws.String("StringAttributeValue"),
  982. SS: []*string{
  983. aws.String("StringAttributeValue"), // Required
  984. // More values...
  985. },
  986. },
  987. // More values...
  988. },
  989. ExpressionAttributeNames: map[string]*string{
  990. "Key": aws.String("AttributeName"), // Required
  991. // More values...
  992. },
  993. ExpressionAttributeValues: map[string]*dynamodb.AttributeValue{
  994. "Key": { // Required
  995. B: []byte("PAYLOAD"),
  996. BOOL: aws.Bool(true),
  997. BS: [][]byte{
  998. []byte("PAYLOAD"), // Required
  999. // More values...
  1000. },
  1001. L: []*dynamodb.AttributeValue{
  1002. { // Required
  1003. // Recursive values...
  1004. },
  1005. // More values...
  1006. },
  1007. M: map[string]*dynamodb.AttributeValue{
  1008. "Key": { // Required
  1009. // Recursive values...
  1010. },
  1011. // More values...
  1012. },
  1013. N: aws.String("NumberAttributeValue"),
  1014. NS: []*string{
  1015. aws.String("NumberAttributeValue"), // Required
  1016. // More values...
  1017. },
  1018. NULL: aws.Bool(true),
  1019. S: aws.String("StringAttributeValue"),
  1020. SS: []*string{
  1021. aws.String("StringAttributeValue"), // Required
  1022. // More values...
  1023. },
  1024. },
  1025. // More values...
  1026. },
  1027. FilterExpression: aws.String("ConditionExpression"),
  1028. IndexName: aws.String("IndexName"),
  1029. Limit: aws.Int64(1),
  1030. ProjectionExpression: aws.String("ProjectionExpression"),
  1031. ReturnConsumedCapacity: aws.String("ReturnConsumedCapacity"),
  1032. ScanFilter: map[string]*dynamodb.Condition{
  1033. "Key": { // Required
  1034. ComparisonOperator: aws.String("ComparisonOperator"), // Required
  1035. AttributeValueList: []*dynamodb.AttributeValue{
  1036. { // Required
  1037. B: []byte("PAYLOAD"),
  1038. BOOL: aws.Bool(true),
  1039. BS: [][]byte{
  1040. []byte("PAYLOAD"), // Required
  1041. // More values...
  1042. },
  1043. L: []*dynamodb.AttributeValue{
  1044. { // Required
  1045. // Recursive values...
  1046. },
  1047. // More values...
  1048. },
  1049. M: map[string]*dynamodb.AttributeValue{
  1050. "Key": { // Required
  1051. // Recursive values...
  1052. },
  1053. // More values...
  1054. },
  1055. N: aws.String("NumberAttributeValue"),
  1056. NS: []*string{
  1057. aws.String("NumberAttributeValue"), // Required
  1058. // More values...
  1059. },
  1060. NULL: aws.Bool(true),
  1061. S: aws.String("StringAttributeValue"),
  1062. SS: []*string{
  1063. aws.String("StringAttributeValue"), // Required
  1064. // More values...
  1065. },
  1066. },
  1067. // More values...
  1068. },
  1069. },
  1070. // More values...
  1071. },
  1072. Segment: aws.Int64(1),
  1073. Select: aws.String("Select"),
  1074. TotalSegments: aws.Int64(1),
  1075. }
  1076. resp, err := svc.Scan(params)
  1077. if err != nil {
  1078. // Print the error, cast err to awserr.Error to get the Code and
  1079. // Message from an error.
  1080. fmt.Println(err.Error())
  1081. return
  1082. }
  1083. // Pretty-print the response data.
  1084. fmt.Println(resp)
  1085. }
  1086. func ExampleDynamoDB_UpdateItem() {
  1087. sess, err := session.NewSession()
  1088. if err != nil {
  1089. fmt.Println("failed to create session,", err)
  1090. return
  1091. }
  1092. svc := dynamodb.New(sess)
  1093. params := &dynamodb.UpdateItemInput{
  1094. Key: map[string]*dynamodb.AttributeValue{ // Required
  1095. "Key": { // Required
  1096. B: []byte("PAYLOAD"),
  1097. BOOL: aws.Bool(true),
  1098. BS: [][]byte{
  1099. []byte("PAYLOAD"), // Required
  1100. // More values...
  1101. },
  1102. L: []*dynamodb.AttributeValue{
  1103. { // Required
  1104. // Recursive values...
  1105. },
  1106. // More values...
  1107. },
  1108. M: map[string]*dynamodb.AttributeValue{
  1109. "Key": { // Required
  1110. // Recursive values...
  1111. },
  1112. // More values...
  1113. },
  1114. N: aws.String("NumberAttributeValue"),
  1115. NS: []*string{
  1116. aws.String("NumberAttributeValue"), // Required
  1117. // More values...
  1118. },
  1119. NULL: aws.Bool(true),
  1120. S: aws.String("StringAttributeValue"),
  1121. SS: []*string{
  1122. aws.String("StringAttributeValue"), // Required
  1123. // More values...
  1124. },
  1125. },
  1126. // More values...
  1127. },
  1128. TableName: aws.String("TableName"), // Required
  1129. AttributeUpdates: map[string]*dynamodb.AttributeValueUpdate{
  1130. "Key": { // Required
  1131. Action: aws.String("AttributeAction"),
  1132. Value: &dynamodb.AttributeValue{
  1133. B: []byte("PAYLOAD"),
  1134. BOOL: aws.Bool(true),
  1135. BS: [][]byte{
  1136. []byte("PAYLOAD"), // Required
  1137. // More values...
  1138. },
  1139. L: []*dynamodb.AttributeValue{
  1140. { // Required
  1141. // Recursive values...
  1142. },
  1143. // More values...
  1144. },
  1145. M: map[string]*dynamodb.AttributeValue{
  1146. "Key": { // Required
  1147. // Recursive values...
  1148. },
  1149. // More values...
  1150. },
  1151. N: aws.String("NumberAttributeValue"),
  1152. NS: []*string{
  1153. aws.String("NumberAttributeValue"), // Required
  1154. // More values...
  1155. },
  1156. NULL: aws.Bool(true),
  1157. S: aws.String("StringAttributeValue"),
  1158. SS: []*string{
  1159. aws.String("StringAttributeValue"), // Required
  1160. // More values...
  1161. },
  1162. },
  1163. },
  1164. // More values...
  1165. },
  1166. ConditionExpression: aws.String("ConditionExpression"),
  1167. ConditionalOperator: aws.String("ConditionalOperator"),
  1168. Expected: map[string]*dynamodb.ExpectedAttributeValue{
  1169. "Key": { // Required
  1170. AttributeValueList: []*dynamodb.AttributeValue{
  1171. { // Required
  1172. B: []byte("PAYLOAD"),
  1173. BOOL: aws.Bool(true),
  1174. BS: [][]byte{
  1175. []byte("PAYLOAD"), // Required
  1176. // More values...
  1177. },
  1178. L: []*dynamodb.AttributeValue{
  1179. { // Required
  1180. // Recursive values...
  1181. },
  1182. // More values...
  1183. },
  1184. M: map[string]*dynamodb.AttributeValue{
  1185. "Key": { // Required
  1186. // Recursive values...
  1187. },
  1188. // More values...
  1189. },
  1190. N: aws.String("NumberAttributeValue"),
  1191. NS: []*string{
  1192. aws.String("NumberAttributeValue"), // Required
  1193. // More values...
  1194. },
  1195. NULL: aws.Bool(true),
  1196. S: aws.String("StringAttributeValue"),
  1197. SS: []*string{
  1198. aws.String("StringAttributeValue"), // Required
  1199. // More values...
  1200. },
  1201. },
  1202. // More values...
  1203. },
  1204. ComparisonOperator: aws.String("ComparisonOperator"),
  1205. Exists: aws.Bool(true),
  1206. Value: &dynamodb.AttributeValue{
  1207. B: []byte("PAYLOAD"),
  1208. BOOL: aws.Bool(true),
  1209. BS: [][]byte{
  1210. []byte("PAYLOAD"), // Required
  1211. // More values...
  1212. },
  1213. L: []*dynamodb.AttributeValue{
  1214. { // Required
  1215. // Recursive values...
  1216. },
  1217. // More values...
  1218. },
  1219. M: map[string]*dynamodb.AttributeValue{
  1220. "Key": { // Required
  1221. // Recursive values...
  1222. },
  1223. // More values...
  1224. },
  1225. N: aws.String("NumberAttributeValue"),
  1226. NS: []*string{
  1227. aws.String("NumberAttributeValue"), // Required
  1228. // More values...
  1229. },
  1230. NULL: aws.Bool(true),
  1231. S: aws.String("StringAttributeValue"),
  1232. SS: []*string{
  1233. aws.String("StringAttributeValue"), // Required
  1234. // More values...
  1235. },
  1236. },
  1237. },
  1238. // More values...
  1239. },
  1240. ExpressionAttributeNames: map[string]*string{
  1241. "Key": aws.String("AttributeName"), // Required
  1242. // More values...
  1243. },
  1244. ExpressionAttributeValues: map[string]*dynamodb.AttributeValue{
  1245. "Key": { // Required
  1246. B: []byte("PAYLOAD"),
  1247. BOOL: aws.Bool(true),
  1248. BS: [][]byte{
  1249. []byte("PAYLOAD"), // Required
  1250. // More values...
  1251. },
  1252. L: []*dynamodb.AttributeValue{
  1253. { // Required
  1254. // Recursive values...
  1255. },
  1256. // More values...
  1257. },
  1258. M: map[string]*dynamodb.AttributeValue{
  1259. "Key": { // Required
  1260. // Recursive values...
  1261. },
  1262. // More values...
  1263. },
  1264. N: aws.String("NumberAttributeValue"),
  1265. NS: []*string{
  1266. aws.String("NumberAttributeValue"), // Required
  1267. // More values...
  1268. },
  1269. NULL: aws.Bool(true),
  1270. S: aws.String("StringAttributeValue"),
  1271. SS: []*string{
  1272. aws.String("StringAttributeValue"), // Required
  1273. // More values...
  1274. },
  1275. },
  1276. // More values...
  1277. },
  1278. ReturnConsumedCapacity: aws.String("ReturnConsumedCapacity"),
  1279. ReturnItemCollectionMetrics: aws.String("ReturnItemCollectionMetrics"),
  1280. ReturnValues: aws.String("ReturnValue"),
  1281. UpdateExpression: aws.String("UpdateExpression"),
  1282. }
  1283. resp, err := svc.UpdateItem(params)
  1284. if err != nil {
  1285. // Print the error, cast err to awserr.Error to get the Code and
  1286. // Message from an error.
  1287. fmt.Println(err.Error())
  1288. return
  1289. }
  1290. // Pretty-print the response data.
  1291. fmt.Println(resp)
  1292. }
  1293. func ExampleDynamoDB_UpdateTable() {
  1294. sess, err := session.NewSession()
  1295. if err != nil {
  1296. fmt.Println("failed to create session,", err)
  1297. return
  1298. }
  1299. svc := dynamodb.New(sess)
  1300. params := &dynamodb.UpdateTableInput{
  1301. TableName: aws.String("TableName"), // Required
  1302. AttributeDefinitions: []*dynamodb.AttributeDefinition{
  1303. { // Required
  1304. AttributeName: aws.String("KeySchemaAttributeName"), // Required
  1305. AttributeType: aws.String("ScalarAttributeType"), // Required
  1306. },
  1307. // More values...
  1308. },
  1309. GlobalSecondaryIndexUpdates: []*dynamodb.GlobalSecondaryIndexUpdate{
  1310. { // Required
  1311. Create: &dynamodb.CreateGlobalSecondaryIndexAction{
  1312. IndexName: aws.String("IndexName"), // Required
  1313. KeySchema: []*dynamodb.KeySchemaElement{ // Required
  1314. { // Required
  1315. AttributeName: aws.String("KeySchemaAttributeName"), // Required
  1316. KeyType: aws.String("KeyType"), // Required
  1317. },
  1318. // More values...
  1319. },
  1320. Projection: &dynamodb.Projection{ // Required
  1321. NonKeyAttributes: []*string{
  1322. aws.String("NonKeyAttributeName"), // Required
  1323. // More values...
  1324. },
  1325. ProjectionType: aws.String("ProjectionType"),
  1326. },
  1327. ProvisionedThroughput: &dynamodb.ProvisionedThroughput{ // Required
  1328. ReadCapacityUnits: aws.Int64(1), // Required
  1329. WriteCapacityUnits: aws.Int64(1), // Required
  1330. },
  1331. },
  1332. Delete: &dynamodb.DeleteGlobalSecondaryIndexAction{
  1333. IndexName: aws.String("IndexName"), // Required
  1334. },
  1335. Update: &dynamodb.UpdateGlobalSecondaryIndexAction{
  1336. IndexName: aws.String("IndexName"), // Required
  1337. ProvisionedThroughput: &dynamodb.ProvisionedThroughput{ // Required
  1338. ReadCapacityUnits: aws.Int64(1), // Required
  1339. WriteCapacityUnits: aws.Int64(1), // Required
  1340. },
  1341. },
  1342. },
  1343. // More values...
  1344. },
  1345. ProvisionedThroughput: &dynamodb.ProvisionedThroughput{
  1346. ReadCapacityUnits: aws.Int64(1), // Required
  1347. WriteCapacityUnits: aws.Int64(1), // Required
  1348. },
  1349. StreamSpecification: &dynamodb.StreamSpecification{
  1350. StreamEnabled: aws.Bool(true),
  1351. StreamViewType: aws.String("StreamViewType"),
  1352. },
  1353. }
  1354. resp, err := svc.UpdateTable(params)
  1355. if err != nil {
  1356. // Print the error, cast err to awserr.Error to get the Code and
  1357. // Message from an error.
  1358. fmt.Println(err.Error())
  1359. return
  1360. }
  1361. // Pretty-print the response data.
  1362. fmt.Println(resp)
  1363. }