examples_test.go 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package snowball_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/snowball"
  10. )
  11. var _ time.Duration
  12. var _ bytes.Buffer
  13. func ExampleSnowball_CancelJob() {
  14. sess, err := session.NewSession()
  15. if err != nil {
  16. fmt.Println("failed to create session,", err)
  17. return
  18. }
  19. svc := snowball.New(sess)
  20. params := &snowball.CancelJobInput{
  21. JobId: aws.String("JobId"), // Required
  22. }
  23. resp, err := svc.CancelJob(params)
  24. if err != nil {
  25. // Print the error, cast err to awserr.Error to get the Code and
  26. // Message from an error.
  27. fmt.Println(err.Error())
  28. return
  29. }
  30. // Pretty-print the response data.
  31. fmt.Println(resp)
  32. }
  33. func ExampleSnowball_CreateAddress() {
  34. sess, err := session.NewSession()
  35. if err != nil {
  36. fmt.Println("failed to create session,", err)
  37. return
  38. }
  39. svc := snowball.New(sess)
  40. params := &snowball.CreateAddressInput{
  41. Address: &snowball.Address{ // Required
  42. AddressId: aws.String("AddressId"),
  43. City: aws.String("String"),
  44. Company: aws.String("String"),
  45. Country: aws.String("String"),
  46. Landmark: aws.String("String"),
  47. Name: aws.String("String"),
  48. PhoneNumber: aws.String("String"),
  49. PostalCode: aws.String("String"),
  50. PrefectureOrDistrict: aws.String("String"),
  51. StateOrProvince: aws.String("String"),
  52. Street1: aws.String("String"),
  53. Street2: aws.String("String"),
  54. Street3: aws.String("String"),
  55. },
  56. }
  57. resp, err := svc.CreateAddress(params)
  58. if err != nil {
  59. // Print the error, cast err to awserr.Error to get the Code and
  60. // Message from an error.
  61. fmt.Println(err.Error())
  62. return
  63. }
  64. // Pretty-print the response data.
  65. fmt.Println(resp)
  66. }
  67. func ExampleSnowball_CreateJob() {
  68. sess, err := session.NewSession()
  69. if err != nil {
  70. fmt.Println("failed to create session,", err)
  71. return
  72. }
  73. svc := snowball.New(sess)
  74. params := &snowball.CreateJobInput{
  75. AddressId: aws.String("AddressId"), // Required
  76. JobType: aws.String("JobType"), // Required
  77. Resources: &snowball.JobResource{ // Required
  78. S3Resources: []*snowball.S3Resource{
  79. { // Required
  80. BucketArn: aws.String("ResourceARN"),
  81. KeyRange: &snowball.KeyRange{
  82. BeginMarker: aws.String("String"),
  83. EndMarker: aws.String("String"),
  84. },
  85. },
  86. // More values...
  87. },
  88. },
  89. RoleARN: aws.String("RoleARN"), // Required
  90. ShippingOption: aws.String("ShippingOption"), // Required
  91. Description: aws.String("String"),
  92. KmsKeyARN: aws.String("KmsKeyARN"),
  93. Notification: &snowball.Notification{
  94. JobStatesToNotify: []*string{
  95. aws.String("JobState"), // Required
  96. // More values...
  97. },
  98. NotifyAll: aws.Bool(true),
  99. SnsTopicARN: aws.String("SnsTopicARN"),
  100. },
  101. SnowballCapacityPreference: aws.String("Capacity"),
  102. }
  103. resp, err := svc.CreateJob(params)
  104. if err != nil {
  105. // Print the error, cast err to awserr.Error to get the Code and
  106. // Message from an error.
  107. fmt.Println(err.Error())
  108. return
  109. }
  110. // Pretty-print the response data.
  111. fmt.Println(resp)
  112. }
  113. func ExampleSnowball_DescribeAddress() {
  114. sess, err := session.NewSession()
  115. if err != nil {
  116. fmt.Println("failed to create session,", err)
  117. return
  118. }
  119. svc := snowball.New(sess)
  120. params := &snowball.DescribeAddressInput{
  121. AddressId: aws.String("AddressId"), // Required
  122. }
  123. resp, err := svc.DescribeAddress(params)
  124. if err != nil {
  125. // Print the error, cast err to awserr.Error to get the Code and
  126. // Message from an error.
  127. fmt.Println(err.Error())
  128. return
  129. }
  130. // Pretty-print the response data.
  131. fmt.Println(resp)
  132. }
  133. func ExampleSnowball_DescribeAddresses() {
  134. sess, err := session.NewSession()
  135. if err != nil {
  136. fmt.Println("failed to create session,", err)
  137. return
  138. }
  139. svc := snowball.New(sess)
  140. params := &snowball.DescribeAddressesInput{
  141. MaxResults: aws.Int64(1),
  142. NextToken: aws.String("String"),
  143. }
  144. resp, err := svc.DescribeAddresses(params)
  145. if err != nil {
  146. // Print the error, cast err to awserr.Error to get the Code and
  147. // Message from an error.
  148. fmt.Println(err.Error())
  149. return
  150. }
  151. // Pretty-print the response data.
  152. fmt.Println(resp)
  153. }
  154. func ExampleSnowball_DescribeJob() {
  155. sess, err := session.NewSession()
  156. if err != nil {
  157. fmt.Println("failed to create session,", err)
  158. return
  159. }
  160. svc := snowball.New(sess)
  161. params := &snowball.DescribeJobInput{
  162. JobId: aws.String("JobId"), // Required
  163. }
  164. resp, err := svc.DescribeJob(params)
  165. if err != nil {
  166. // Print the error, cast err to awserr.Error to get the Code and
  167. // Message from an error.
  168. fmt.Println(err.Error())
  169. return
  170. }
  171. // Pretty-print the response data.
  172. fmt.Println(resp)
  173. }
  174. func ExampleSnowball_GetJobManifest() {
  175. sess, err := session.NewSession()
  176. if err != nil {
  177. fmt.Println("failed to create session,", err)
  178. return
  179. }
  180. svc := snowball.New(sess)
  181. params := &snowball.GetJobManifestInput{
  182. JobId: aws.String("JobId"), // Required
  183. }
  184. resp, err := svc.GetJobManifest(params)
  185. if err != nil {
  186. // Print the error, cast err to awserr.Error to get the Code and
  187. // Message from an error.
  188. fmt.Println(err.Error())
  189. return
  190. }
  191. // Pretty-print the response data.
  192. fmt.Println(resp)
  193. }
  194. func ExampleSnowball_GetJobUnlockCode() {
  195. sess, err := session.NewSession()
  196. if err != nil {
  197. fmt.Println("failed to create session,", err)
  198. return
  199. }
  200. svc := snowball.New(sess)
  201. params := &snowball.GetJobUnlockCodeInput{
  202. JobId: aws.String("JobId"), // Required
  203. }
  204. resp, err := svc.GetJobUnlockCode(params)
  205. if err != nil {
  206. // Print the error, cast err to awserr.Error to get the Code and
  207. // Message from an error.
  208. fmt.Println(err.Error())
  209. return
  210. }
  211. // Pretty-print the response data.
  212. fmt.Println(resp)
  213. }
  214. func ExampleSnowball_GetSnowballUsage() {
  215. sess, err := session.NewSession()
  216. if err != nil {
  217. fmt.Println("failed to create session,", err)
  218. return
  219. }
  220. svc := snowball.New(sess)
  221. var params *snowball.GetSnowballUsageInput
  222. resp, err := svc.GetSnowballUsage(params)
  223. if err != nil {
  224. // Print the error, cast err to awserr.Error to get the Code and
  225. // Message from an error.
  226. fmt.Println(err.Error())
  227. return
  228. }
  229. // Pretty-print the response data.
  230. fmt.Println(resp)
  231. }
  232. func ExampleSnowball_ListJobs() {
  233. sess, err := session.NewSession()
  234. if err != nil {
  235. fmt.Println("failed to create session,", err)
  236. return
  237. }
  238. svc := snowball.New(sess)
  239. params := &snowball.ListJobsInput{
  240. MaxResults: aws.Int64(1),
  241. NextToken: aws.String("String"),
  242. }
  243. resp, err := svc.ListJobs(params)
  244. if err != nil {
  245. // Print the error, cast err to awserr.Error to get the Code and
  246. // Message from an error.
  247. fmt.Println(err.Error())
  248. return
  249. }
  250. // Pretty-print the response data.
  251. fmt.Println(resp)
  252. }
  253. func ExampleSnowball_UpdateJob() {
  254. sess, err := session.NewSession()
  255. if err != nil {
  256. fmt.Println("failed to create session,", err)
  257. return
  258. }
  259. svc := snowball.New(sess)
  260. params := &snowball.UpdateJobInput{
  261. JobId: aws.String("JobId"), // Required
  262. AddressId: aws.String("AddressId"),
  263. Description: aws.String("String"),
  264. Notification: &snowball.Notification{
  265. JobStatesToNotify: []*string{
  266. aws.String("JobState"), // Required
  267. // More values...
  268. },
  269. NotifyAll: aws.Bool(true),
  270. SnsTopicARN: aws.String("SnsTopicARN"),
  271. },
  272. Resources: &snowball.JobResource{
  273. S3Resources: []*snowball.S3Resource{
  274. { // Required
  275. BucketArn: aws.String("ResourceARN"),
  276. KeyRange: &snowball.KeyRange{
  277. BeginMarker: aws.String("String"),
  278. EndMarker: aws.String("String"),
  279. },
  280. },
  281. // More values...
  282. },
  283. },
  284. RoleARN: aws.String("RoleARN"),
  285. ShippingOption: aws.String("ShippingOption"),
  286. SnowballCapacityPreference: aws.String("Capacity"),
  287. }
  288. resp, err := svc.UpdateJob(params)
  289. if err != nil {
  290. // Print the error, cast err to awserr.Error to get the Code and
  291. // Message from an error.
  292. fmt.Println(err.Error())
  293. return
  294. }
  295. // Pretty-print the response data.
  296. fmt.Println(resp)
  297. }