examples_test.go 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package glacier_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/glacier"
  10. )
  11. var _ time.Duration
  12. var _ bytes.Buffer
  13. func ExampleGlacier_AbortMultipartUpload() {
  14. sess, err := session.NewSession()
  15. if err != nil {
  16. fmt.Println("failed to create session,", err)
  17. return
  18. }
  19. svc := glacier.New(sess)
  20. params := &glacier.AbortMultipartUploadInput{
  21. AccountId: aws.String("string"), // Required
  22. UploadId: aws.String("string"), // Required
  23. VaultName: aws.String("string"), // Required
  24. }
  25. resp, err := svc.AbortMultipartUpload(params)
  26. if err != nil {
  27. // Print the error, cast err to awserr.Error to get the Code and
  28. // Message from an error.
  29. fmt.Println(err.Error())
  30. return
  31. }
  32. // Pretty-print the response data.
  33. fmt.Println(resp)
  34. }
  35. func ExampleGlacier_AbortVaultLock() {
  36. sess, err := session.NewSession()
  37. if err != nil {
  38. fmt.Println("failed to create session,", err)
  39. return
  40. }
  41. svc := glacier.New(sess)
  42. params := &glacier.AbortVaultLockInput{
  43. AccountId: aws.String("string"), // Required
  44. VaultName: aws.String("string"), // Required
  45. }
  46. resp, err := svc.AbortVaultLock(params)
  47. if err != nil {
  48. // Print the error, cast err to awserr.Error to get the Code and
  49. // Message from an error.
  50. fmt.Println(err.Error())
  51. return
  52. }
  53. // Pretty-print the response data.
  54. fmt.Println(resp)
  55. }
  56. func ExampleGlacier_AddTagsToVault() {
  57. sess, err := session.NewSession()
  58. if err != nil {
  59. fmt.Println("failed to create session,", err)
  60. return
  61. }
  62. svc := glacier.New(sess)
  63. params := &glacier.AddTagsToVaultInput{
  64. AccountId: aws.String("string"), // Required
  65. VaultName: aws.String("string"), // Required
  66. Tags: map[string]*string{
  67. "Key": aws.String("TagValue"), // Required
  68. // More values...
  69. },
  70. }
  71. resp, err := svc.AddTagsToVault(params)
  72. if err != nil {
  73. // Print the error, cast err to awserr.Error to get the Code and
  74. // Message from an error.
  75. fmt.Println(err.Error())
  76. return
  77. }
  78. // Pretty-print the response data.
  79. fmt.Println(resp)
  80. }
  81. func ExampleGlacier_CompleteMultipartUpload() {
  82. sess, err := session.NewSession()
  83. if err != nil {
  84. fmt.Println("failed to create session,", err)
  85. return
  86. }
  87. svc := glacier.New(sess)
  88. params := &glacier.CompleteMultipartUploadInput{
  89. AccountId: aws.String("string"), // Required
  90. UploadId: aws.String("string"), // Required
  91. VaultName: aws.String("string"), // Required
  92. ArchiveSize: aws.String("string"),
  93. Checksum: aws.String("string"),
  94. }
  95. resp, err := svc.CompleteMultipartUpload(params)
  96. if err != nil {
  97. // Print the error, cast err to awserr.Error to get the Code and
  98. // Message from an error.
  99. fmt.Println(err.Error())
  100. return
  101. }
  102. // Pretty-print the response data.
  103. fmt.Println(resp)
  104. }
  105. func ExampleGlacier_CompleteVaultLock() {
  106. sess, err := session.NewSession()
  107. if err != nil {
  108. fmt.Println("failed to create session,", err)
  109. return
  110. }
  111. svc := glacier.New(sess)
  112. params := &glacier.CompleteVaultLockInput{
  113. AccountId: aws.String("string"), // Required
  114. LockId: aws.String("string"), // Required
  115. VaultName: aws.String("string"), // Required
  116. }
  117. resp, err := svc.CompleteVaultLock(params)
  118. if err != nil {
  119. // Print the error, cast err to awserr.Error to get the Code and
  120. // Message from an error.
  121. fmt.Println(err.Error())
  122. return
  123. }
  124. // Pretty-print the response data.
  125. fmt.Println(resp)
  126. }
  127. func ExampleGlacier_CreateVault() {
  128. sess, err := session.NewSession()
  129. if err != nil {
  130. fmt.Println("failed to create session,", err)
  131. return
  132. }
  133. svc := glacier.New(sess)
  134. params := &glacier.CreateVaultInput{
  135. AccountId: aws.String("string"), // Required
  136. VaultName: aws.String("string"), // Required
  137. }
  138. resp, err := svc.CreateVault(params)
  139. if err != nil {
  140. // Print the error, cast err to awserr.Error to get the Code and
  141. // Message from an error.
  142. fmt.Println(err.Error())
  143. return
  144. }
  145. // Pretty-print the response data.
  146. fmt.Println(resp)
  147. }
  148. func ExampleGlacier_DeleteArchive() {
  149. sess, err := session.NewSession()
  150. if err != nil {
  151. fmt.Println("failed to create session,", err)
  152. return
  153. }
  154. svc := glacier.New(sess)
  155. params := &glacier.DeleteArchiveInput{
  156. AccountId: aws.String("string"), // Required
  157. ArchiveId: aws.String("string"), // Required
  158. VaultName: aws.String("string"), // Required
  159. }
  160. resp, err := svc.DeleteArchive(params)
  161. if err != nil {
  162. // Print the error, cast err to awserr.Error to get the Code and
  163. // Message from an error.
  164. fmt.Println(err.Error())
  165. return
  166. }
  167. // Pretty-print the response data.
  168. fmt.Println(resp)
  169. }
  170. func ExampleGlacier_DeleteVault() {
  171. sess, err := session.NewSession()
  172. if err != nil {
  173. fmt.Println("failed to create session,", err)
  174. return
  175. }
  176. svc := glacier.New(sess)
  177. params := &glacier.DeleteVaultInput{
  178. AccountId: aws.String("string"), // Required
  179. VaultName: aws.String("string"), // Required
  180. }
  181. resp, err := svc.DeleteVault(params)
  182. if err != nil {
  183. // Print the error, cast err to awserr.Error to get the Code and
  184. // Message from an error.
  185. fmt.Println(err.Error())
  186. return
  187. }
  188. // Pretty-print the response data.
  189. fmt.Println(resp)
  190. }
  191. func ExampleGlacier_DeleteVaultAccessPolicy() {
  192. sess, err := session.NewSession()
  193. if err != nil {
  194. fmt.Println("failed to create session,", err)
  195. return
  196. }
  197. svc := glacier.New(sess)
  198. params := &glacier.DeleteVaultAccessPolicyInput{
  199. AccountId: aws.String("string"), // Required
  200. VaultName: aws.String("string"), // Required
  201. }
  202. resp, err := svc.DeleteVaultAccessPolicy(params)
  203. if err != nil {
  204. // Print the error, cast err to awserr.Error to get the Code and
  205. // Message from an error.
  206. fmt.Println(err.Error())
  207. return
  208. }
  209. // Pretty-print the response data.
  210. fmt.Println(resp)
  211. }
  212. func ExampleGlacier_DeleteVaultNotifications() {
  213. sess, err := session.NewSession()
  214. if err != nil {
  215. fmt.Println("failed to create session,", err)
  216. return
  217. }
  218. svc := glacier.New(sess)
  219. params := &glacier.DeleteVaultNotificationsInput{
  220. AccountId: aws.String("string"), // Required
  221. VaultName: aws.String("string"), // Required
  222. }
  223. resp, err := svc.DeleteVaultNotifications(params)
  224. if err != nil {
  225. // Print the error, cast err to awserr.Error to get the Code and
  226. // Message from an error.
  227. fmt.Println(err.Error())
  228. return
  229. }
  230. // Pretty-print the response data.
  231. fmt.Println(resp)
  232. }
  233. func ExampleGlacier_DescribeJob() {
  234. sess, err := session.NewSession()
  235. if err != nil {
  236. fmt.Println("failed to create session,", err)
  237. return
  238. }
  239. svc := glacier.New(sess)
  240. params := &glacier.DescribeJobInput{
  241. AccountId: aws.String("string"), // Required
  242. JobId: aws.String("string"), // Required
  243. VaultName: aws.String("string"), // Required
  244. }
  245. resp, err := svc.DescribeJob(params)
  246. if err != nil {
  247. // Print the error, cast err to awserr.Error to get the Code and
  248. // Message from an error.
  249. fmt.Println(err.Error())
  250. return
  251. }
  252. // Pretty-print the response data.
  253. fmt.Println(resp)
  254. }
  255. func ExampleGlacier_DescribeVault() {
  256. sess, err := session.NewSession()
  257. if err != nil {
  258. fmt.Println("failed to create session,", err)
  259. return
  260. }
  261. svc := glacier.New(sess)
  262. params := &glacier.DescribeVaultInput{
  263. AccountId: aws.String("string"), // Required
  264. VaultName: aws.String("string"), // Required
  265. }
  266. resp, err := svc.DescribeVault(params)
  267. if err != nil {
  268. // Print the error, cast err to awserr.Error to get the Code and
  269. // Message from an error.
  270. fmt.Println(err.Error())
  271. return
  272. }
  273. // Pretty-print the response data.
  274. fmt.Println(resp)
  275. }
  276. func ExampleGlacier_GetDataRetrievalPolicy() {
  277. sess, err := session.NewSession()
  278. if err != nil {
  279. fmt.Println("failed to create session,", err)
  280. return
  281. }
  282. svc := glacier.New(sess)
  283. params := &glacier.GetDataRetrievalPolicyInput{
  284. AccountId: aws.String("string"), // Required
  285. }
  286. resp, err := svc.GetDataRetrievalPolicy(params)
  287. if err != nil {
  288. // Print the error, cast err to awserr.Error to get the Code and
  289. // Message from an error.
  290. fmt.Println(err.Error())
  291. return
  292. }
  293. // Pretty-print the response data.
  294. fmt.Println(resp)
  295. }
  296. func ExampleGlacier_GetJobOutput() {
  297. sess, err := session.NewSession()
  298. if err != nil {
  299. fmt.Println("failed to create session,", err)
  300. return
  301. }
  302. svc := glacier.New(sess)
  303. params := &glacier.GetJobOutputInput{
  304. AccountId: aws.String("string"), // Required
  305. JobId: aws.String("string"), // Required
  306. VaultName: aws.String("string"), // Required
  307. Range: aws.String("string"),
  308. }
  309. resp, err := svc.GetJobOutput(params)
  310. if err != nil {
  311. // Print the error, cast err to awserr.Error to get the Code and
  312. // Message from an error.
  313. fmt.Println(err.Error())
  314. return
  315. }
  316. // Pretty-print the response data.
  317. fmt.Println(resp)
  318. }
  319. func ExampleGlacier_GetVaultAccessPolicy() {
  320. sess, err := session.NewSession()
  321. if err != nil {
  322. fmt.Println("failed to create session,", err)
  323. return
  324. }
  325. svc := glacier.New(sess)
  326. params := &glacier.GetVaultAccessPolicyInput{
  327. AccountId: aws.String("string"), // Required
  328. VaultName: aws.String("string"), // Required
  329. }
  330. resp, err := svc.GetVaultAccessPolicy(params)
  331. if err != nil {
  332. // Print the error, cast err to awserr.Error to get the Code and
  333. // Message from an error.
  334. fmt.Println(err.Error())
  335. return
  336. }
  337. // Pretty-print the response data.
  338. fmt.Println(resp)
  339. }
  340. func ExampleGlacier_GetVaultLock() {
  341. sess, err := session.NewSession()
  342. if err != nil {
  343. fmt.Println("failed to create session,", err)
  344. return
  345. }
  346. svc := glacier.New(sess)
  347. params := &glacier.GetVaultLockInput{
  348. AccountId: aws.String("string"), // Required
  349. VaultName: aws.String("string"), // Required
  350. }
  351. resp, err := svc.GetVaultLock(params)
  352. if err != nil {
  353. // Print the error, cast err to awserr.Error to get the Code and
  354. // Message from an error.
  355. fmt.Println(err.Error())
  356. return
  357. }
  358. // Pretty-print the response data.
  359. fmt.Println(resp)
  360. }
  361. func ExampleGlacier_GetVaultNotifications() {
  362. sess, err := session.NewSession()
  363. if err != nil {
  364. fmt.Println("failed to create session,", err)
  365. return
  366. }
  367. svc := glacier.New(sess)
  368. params := &glacier.GetVaultNotificationsInput{
  369. AccountId: aws.String("string"), // Required
  370. VaultName: aws.String("string"), // Required
  371. }
  372. resp, err := svc.GetVaultNotifications(params)
  373. if err != nil {
  374. // Print the error, cast err to awserr.Error to get the Code and
  375. // Message from an error.
  376. fmt.Println(err.Error())
  377. return
  378. }
  379. // Pretty-print the response data.
  380. fmt.Println(resp)
  381. }
  382. func ExampleGlacier_InitiateJob() {
  383. sess, err := session.NewSession()
  384. if err != nil {
  385. fmt.Println("failed to create session,", err)
  386. return
  387. }
  388. svc := glacier.New(sess)
  389. params := &glacier.InitiateJobInput{
  390. AccountId: aws.String("string"), // Required
  391. VaultName: aws.String("string"), // Required
  392. JobParameters: &glacier.JobParameters{
  393. ArchiveId: aws.String("string"),
  394. Description: aws.String("string"),
  395. Format: aws.String("string"),
  396. InventoryRetrievalParameters: &glacier.InventoryRetrievalJobInput{
  397. EndDate: aws.String("string"),
  398. Limit: aws.String("string"),
  399. Marker: aws.String("string"),
  400. StartDate: aws.String("string"),
  401. },
  402. RetrievalByteRange: aws.String("string"),
  403. SNSTopic: aws.String("string"),
  404. Type: aws.String("string"),
  405. },
  406. }
  407. resp, err := svc.InitiateJob(params)
  408. if err != nil {
  409. // Print the error, cast err to awserr.Error to get the Code and
  410. // Message from an error.
  411. fmt.Println(err.Error())
  412. return
  413. }
  414. // Pretty-print the response data.
  415. fmt.Println(resp)
  416. }
  417. func ExampleGlacier_InitiateMultipartUpload() {
  418. sess, err := session.NewSession()
  419. if err != nil {
  420. fmt.Println("failed to create session,", err)
  421. return
  422. }
  423. svc := glacier.New(sess)
  424. params := &glacier.InitiateMultipartUploadInput{
  425. AccountId: aws.String("string"), // Required
  426. VaultName: aws.String("string"), // Required
  427. ArchiveDescription: aws.String("string"),
  428. PartSize: aws.String("string"),
  429. }
  430. resp, err := svc.InitiateMultipartUpload(params)
  431. if err != nil {
  432. // Print the error, cast err to awserr.Error to get the Code and
  433. // Message from an error.
  434. fmt.Println(err.Error())
  435. return
  436. }
  437. // Pretty-print the response data.
  438. fmt.Println(resp)
  439. }
  440. func ExampleGlacier_InitiateVaultLock() {
  441. sess, err := session.NewSession()
  442. if err != nil {
  443. fmt.Println("failed to create session,", err)
  444. return
  445. }
  446. svc := glacier.New(sess)
  447. params := &glacier.InitiateVaultLockInput{
  448. AccountId: aws.String("string"), // Required
  449. VaultName: aws.String("string"), // Required
  450. Policy: &glacier.VaultLockPolicy{
  451. Policy: aws.String("string"),
  452. },
  453. }
  454. resp, err := svc.InitiateVaultLock(params)
  455. if err != nil {
  456. // Print the error, cast err to awserr.Error to get the Code and
  457. // Message from an error.
  458. fmt.Println(err.Error())
  459. return
  460. }
  461. // Pretty-print the response data.
  462. fmt.Println(resp)
  463. }
  464. func ExampleGlacier_ListJobs() {
  465. sess, err := session.NewSession()
  466. if err != nil {
  467. fmt.Println("failed to create session,", err)
  468. return
  469. }
  470. svc := glacier.New(sess)
  471. params := &glacier.ListJobsInput{
  472. AccountId: aws.String("string"), // Required
  473. VaultName: aws.String("string"), // Required
  474. Completed: aws.String("string"),
  475. Limit: aws.String("string"),
  476. Marker: aws.String("string"),
  477. Statuscode: aws.String("string"),
  478. }
  479. resp, err := svc.ListJobs(params)
  480. if err != nil {
  481. // Print the error, cast err to awserr.Error to get the Code and
  482. // Message from an error.
  483. fmt.Println(err.Error())
  484. return
  485. }
  486. // Pretty-print the response data.
  487. fmt.Println(resp)
  488. }
  489. func ExampleGlacier_ListMultipartUploads() {
  490. sess, err := session.NewSession()
  491. if err != nil {
  492. fmt.Println("failed to create session,", err)
  493. return
  494. }
  495. svc := glacier.New(sess)
  496. params := &glacier.ListMultipartUploadsInput{
  497. AccountId: aws.String("string"), // Required
  498. VaultName: aws.String("string"), // Required
  499. Limit: aws.String("string"),
  500. Marker: aws.String("string"),
  501. }
  502. resp, err := svc.ListMultipartUploads(params)
  503. if err != nil {
  504. // Print the error, cast err to awserr.Error to get the Code and
  505. // Message from an error.
  506. fmt.Println(err.Error())
  507. return
  508. }
  509. // Pretty-print the response data.
  510. fmt.Println(resp)
  511. }
  512. func ExampleGlacier_ListParts() {
  513. sess, err := session.NewSession()
  514. if err != nil {
  515. fmt.Println("failed to create session,", err)
  516. return
  517. }
  518. svc := glacier.New(sess)
  519. params := &glacier.ListPartsInput{
  520. AccountId: aws.String("string"), // Required
  521. UploadId: aws.String("string"), // Required
  522. VaultName: aws.String("string"), // Required
  523. Limit: aws.String("string"),
  524. Marker: aws.String("string"),
  525. }
  526. resp, err := svc.ListParts(params)
  527. if err != nil {
  528. // Print the error, cast err to awserr.Error to get the Code and
  529. // Message from an error.
  530. fmt.Println(err.Error())
  531. return
  532. }
  533. // Pretty-print the response data.
  534. fmt.Println(resp)
  535. }
  536. func ExampleGlacier_ListTagsForVault() {
  537. sess, err := session.NewSession()
  538. if err != nil {
  539. fmt.Println("failed to create session,", err)
  540. return
  541. }
  542. svc := glacier.New(sess)
  543. params := &glacier.ListTagsForVaultInput{
  544. AccountId: aws.String("string"), // Required
  545. VaultName: aws.String("string"), // Required
  546. }
  547. resp, err := svc.ListTagsForVault(params)
  548. if err != nil {
  549. // Print the error, cast err to awserr.Error to get the Code and
  550. // Message from an error.
  551. fmt.Println(err.Error())
  552. return
  553. }
  554. // Pretty-print the response data.
  555. fmt.Println(resp)
  556. }
  557. func ExampleGlacier_ListVaults() {
  558. sess, err := session.NewSession()
  559. if err != nil {
  560. fmt.Println("failed to create session,", err)
  561. return
  562. }
  563. svc := glacier.New(sess)
  564. params := &glacier.ListVaultsInput{
  565. AccountId: aws.String("string"), // Required
  566. Limit: aws.String("string"),
  567. Marker: aws.String("string"),
  568. }
  569. resp, err := svc.ListVaults(params)
  570. if err != nil {
  571. // Print the error, cast err to awserr.Error to get the Code and
  572. // Message from an error.
  573. fmt.Println(err.Error())
  574. return
  575. }
  576. // Pretty-print the response data.
  577. fmt.Println(resp)
  578. }
  579. func ExampleGlacier_RemoveTagsFromVault() {
  580. sess, err := session.NewSession()
  581. if err != nil {
  582. fmt.Println("failed to create session,", err)
  583. return
  584. }
  585. svc := glacier.New(sess)
  586. params := &glacier.RemoveTagsFromVaultInput{
  587. AccountId: aws.String("string"), // Required
  588. VaultName: aws.String("string"), // Required
  589. TagKeys: []*string{
  590. aws.String("string"), // Required
  591. // More values...
  592. },
  593. }
  594. resp, err := svc.RemoveTagsFromVault(params)
  595. if err != nil {
  596. // Print the error, cast err to awserr.Error to get the Code and
  597. // Message from an error.
  598. fmt.Println(err.Error())
  599. return
  600. }
  601. // Pretty-print the response data.
  602. fmt.Println(resp)
  603. }
  604. func ExampleGlacier_SetDataRetrievalPolicy() {
  605. sess, err := session.NewSession()
  606. if err != nil {
  607. fmt.Println("failed to create session,", err)
  608. return
  609. }
  610. svc := glacier.New(sess)
  611. params := &glacier.SetDataRetrievalPolicyInput{
  612. AccountId: aws.String("string"), // Required
  613. Policy: &glacier.DataRetrievalPolicy{
  614. Rules: []*glacier.DataRetrievalRule{
  615. { // Required
  616. BytesPerHour: aws.Int64(1),
  617. Strategy: aws.String("string"),
  618. },
  619. // More values...
  620. },
  621. },
  622. }
  623. resp, err := svc.SetDataRetrievalPolicy(params)
  624. if err != nil {
  625. // Print the error, cast err to awserr.Error to get the Code and
  626. // Message from an error.
  627. fmt.Println(err.Error())
  628. return
  629. }
  630. // Pretty-print the response data.
  631. fmt.Println(resp)
  632. }
  633. func ExampleGlacier_SetVaultAccessPolicy() {
  634. sess, err := session.NewSession()
  635. if err != nil {
  636. fmt.Println("failed to create session,", err)
  637. return
  638. }
  639. svc := glacier.New(sess)
  640. params := &glacier.SetVaultAccessPolicyInput{
  641. AccountId: aws.String("string"), // Required
  642. VaultName: aws.String("string"), // Required
  643. Policy: &glacier.VaultAccessPolicy{
  644. Policy: aws.String("string"),
  645. },
  646. }
  647. resp, err := svc.SetVaultAccessPolicy(params)
  648. if err != nil {
  649. // Print the error, cast err to awserr.Error to get the Code and
  650. // Message from an error.
  651. fmt.Println(err.Error())
  652. return
  653. }
  654. // Pretty-print the response data.
  655. fmt.Println(resp)
  656. }
  657. func ExampleGlacier_SetVaultNotifications() {
  658. sess, err := session.NewSession()
  659. if err != nil {
  660. fmt.Println("failed to create session,", err)
  661. return
  662. }
  663. svc := glacier.New(sess)
  664. params := &glacier.SetVaultNotificationsInput{
  665. AccountId: aws.String("string"), // Required
  666. VaultName: aws.String("string"), // Required
  667. VaultNotificationConfig: &glacier.VaultNotificationConfig{
  668. Events: []*string{
  669. aws.String("string"), // Required
  670. // More values...
  671. },
  672. SNSTopic: aws.String("string"),
  673. },
  674. }
  675. resp, err := svc.SetVaultNotifications(params)
  676. if err != nil {
  677. // Print the error, cast err to awserr.Error to get the Code and
  678. // Message from an error.
  679. fmt.Println(err.Error())
  680. return
  681. }
  682. // Pretty-print the response data.
  683. fmt.Println(resp)
  684. }
  685. func ExampleGlacier_UploadArchive() {
  686. sess, err := session.NewSession()
  687. if err != nil {
  688. fmt.Println("failed to create session,", err)
  689. return
  690. }
  691. svc := glacier.New(sess)
  692. params := &glacier.UploadArchiveInput{
  693. AccountId: aws.String("string"), // Required
  694. VaultName: aws.String("string"), // Required
  695. ArchiveDescription: aws.String("string"),
  696. Body: bytes.NewReader([]byte("PAYLOAD")),
  697. Checksum: aws.String("string"),
  698. }
  699. resp, err := svc.UploadArchive(params)
  700. if err != nil {
  701. // Print the error, cast err to awserr.Error to get the Code and
  702. // Message from an error.
  703. fmt.Println(err.Error())
  704. return
  705. }
  706. // Pretty-print the response data.
  707. fmt.Println(resp)
  708. }
  709. func ExampleGlacier_UploadMultipartPart() {
  710. sess, err := session.NewSession()
  711. if err != nil {
  712. fmt.Println("failed to create session,", err)
  713. return
  714. }
  715. svc := glacier.New(sess)
  716. params := &glacier.UploadMultipartPartInput{
  717. AccountId: aws.String("string"), // Required
  718. UploadId: aws.String("string"), // Required
  719. VaultName: aws.String("string"), // Required
  720. Body: bytes.NewReader([]byte("PAYLOAD")),
  721. Checksum: aws.String("string"),
  722. Range: aws.String("string"),
  723. }
  724. resp, err := svc.UploadMultipartPart(params)
  725. if err != nil {
  726. // Print the error, cast err to awserr.Error to get the Code and
  727. // Message from an error.
  728. fmt.Println(err.Error())
  729. return
  730. }
  731. // Pretty-print the response data.
  732. fmt.Println(resp)
  733. }