examples_test.go 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package devicefarm_test
  3. import (
  4. "bytes"
  5. "fmt"
  6. "time"
  7. "github.com/aws/aws-sdk-go/aws"
  8. "github.com/aws/aws-sdk-go/service/devicefarm"
  9. )
  10. var _ time.Duration
  11. var _ bytes.Buffer
  12. func ExampleDeviceFarm_CreateDevicePool() {
  13. svc := devicefarm.New(nil)
  14. params := &devicefarm.CreateDevicePoolInput{
  15. Name: aws.String("Name"), // Required
  16. ProjectArn: aws.String("AmazonResourceName"), // Required
  17. Rules: []*devicefarm.Rule{ // Required
  18. { // Required
  19. Attribute: aws.String("DeviceAttribute"),
  20. Operator: aws.String("RuleOperator"),
  21. Value: aws.String("String"),
  22. },
  23. // More values...
  24. },
  25. Description: aws.String("Message"),
  26. }
  27. resp, err := svc.CreateDevicePool(params)
  28. if err != nil {
  29. // Print the error, cast err to awserr.Error to get the Code and
  30. // Message from an error.
  31. fmt.Println(err.Error())
  32. return
  33. }
  34. // Pretty-print the response data.
  35. fmt.Println(resp)
  36. }
  37. func ExampleDeviceFarm_CreateProject() {
  38. svc := devicefarm.New(nil)
  39. params := &devicefarm.CreateProjectInput{
  40. Name: aws.String("Name"), // Required
  41. }
  42. resp, err := svc.CreateProject(params)
  43. if err != nil {
  44. // Print the error, cast err to awserr.Error to get the Code and
  45. // Message from an error.
  46. fmt.Println(err.Error())
  47. return
  48. }
  49. // Pretty-print the response data.
  50. fmt.Println(resp)
  51. }
  52. func ExampleDeviceFarm_CreateUpload() {
  53. svc := devicefarm.New(nil)
  54. params := &devicefarm.CreateUploadInput{
  55. Name: aws.String("Name"), // Required
  56. ProjectArn: aws.String("AmazonResourceName"), // Required
  57. Type: aws.String("UploadType"), // Required
  58. ContentType: aws.String("ContentType"),
  59. }
  60. resp, err := svc.CreateUpload(params)
  61. if err != nil {
  62. // Print the error, cast err to awserr.Error to get the Code and
  63. // Message from an error.
  64. fmt.Println(err.Error())
  65. return
  66. }
  67. // Pretty-print the response data.
  68. fmt.Println(resp)
  69. }
  70. func ExampleDeviceFarm_GetAccountSettings() {
  71. svc := devicefarm.New(nil)
  72. var params *devicefarm.GetAccountSettingsInput
  73. resp, err := svc.GetAccountSettings(params)
  74. if err != nil {
  75. // Print the error, cast err to awserr.Error to get the Code and
  76. // Message from an error.
  77. fmt.Println(err.Error())
  78. return
  79. }
  80. // Pretty-print the response data.
  81. fmt.Println(resp)
  82. }
  83. func ExampleDeviceFarm_GetDevice() {
  84. svc := devicefarm.New(nil)
  85. params := &devicefarm.GetDeviceInput{
  86. Arn: aws.String("AmazonResourceName"), // Required
  87. }
  88. resp, err := svc.GetDevice(params)
  89. if err != nil {
  90. // Print the error, cast err to awserr.Error to get the Code and
  91. // Message from an error.
  92. fmt.Println(err.Error())
  93. return
  94. }
  95. // Pretty-print the response data.
  96. fmt.Println(resp)
  97. }
  98. func ExampleDeviceFarm_GetDevicePool() {
  99. svc := devicefarm.New(nil)
  100. params := &devicefarm.GetDevicePoolInput{
  101. Arn: aws.String("AmazonResourceName"), // Required
  102. }
  103. resp, err := svc.GetDevicePool(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 ExampleDeviceFarm_GetDevicePoolCompatibility() {
  114. svc := devicefarm.New(nil)
  115. params := &devicefarm.GetDevicePoolCompatibilityInput{
  116. AppArn: aws.String("AmazonResourceName"), // Required
  117. DevicePoolArn: aws.String("AmazonResourceName"), // Required
  118. TestType: aws.String("TestType"),
  119. }
  120. resp, err := svc.GetDevicePoolCompatibility(params)
  121. if err != nil {
  122. // Print the error, cast err to awserr.Error to get the Code and
  123. // Message from an error.
  124. fmt.Println(err.Error())
  125. return
  126. }
  127. // Pretty-print the response data.
  128. fmt.Println(resp)
  129. }
  130. func ExampleDeviceFarm_GetJob() {
  131. svc := devicefarm.New(nil)
  132. params := &devicefarm.GetJobInput{
  133. Arn: aws.String("AmazonResourceName"), // Required
  134. }
  135. resp, err := svc.GetJob(params)
  136. if err != nil {
  137. // Print the error, cast err to awserr.Error to get the Code and
  138. // Message from an error.
  139. fmt.Println(err.Error())
  140. return
  141. }
  142. // Pretty-print the response data.
  143. fmt.Println(resp)
  144. }
  145. func ExampleDeviceFarm_GetProject() {
  146. svc := devicefarm.New(nil)
  147. params := &devicefarm.GetProjectInput{
  148. Arn: aws.String("AmazonResourceName"), // Required
  149. }
  150. resp, err := svc.GetProject(params)
  151. if err != nil {
  152. // Print the error, cast err to awserr.Error to get the Code and
  153. // Message from an error.
  154. fmt.Println(err.Error())
  155. return
  156. }
  157. // Pretty-print the response data.
  158. fmt.Println(resp)
  159. }
  160. func ExampleDeviceFarm_GetRun() {
  161. svc := devicefarm.New(nil)
  162. params := &devicefarm.GetRunInput{
  163. Arn: aws.String("AmazonResourceName"), // Required
  164. }
  165. resp, err := svc.GetRun(params)
  166. if err != nil {
  167. // Print the error, cast err to awserr.Error to get the Code and
  168. // Message from an error.
  169. fmt.Println(err.Error())
  170. return
  171. }
  172. // Pretty-print the response data.
  173. fmt.Println(resp)
  174. }
  175. func ExampleDeviceFarm_GetSuite() {
  176. svc := devicefarm.New(nil)
  177. params := &devicefarm.GetSuiteInput{
  178. Arn: aws.String("AmazonResourceName"), // Required
  179. }
  180. resp, err := svc.GetSuite(params)
  181. if err != nil {
  182. // Print the error, cast err to awserr.Error to get the Code and
  183. // Message from an error.
  184. fmt.Println(err.Error())
  185. return
  186. }
  187. // Pretty-print the response data.
  188. fmt.Println(resp)
  189. }
  190. func ExampleDeviceFarm_GetTest() {
  191. svc := devicefarm.New(nil)
  192. params := &devicefarm.GetTestInput{
  193. Arn: aws.String("AmazonResourceName"), // Required
  194. }
  195. resp, err := svc.GetTest(params)
  196. if err != nil {
  197. // Print the error, cast err to awserr.Error to get the Code and
  198. // Message from an error.
  199. fmt.Println(err.Error())
  200. return
  201. }
  202. // Pretty-print the response data.
  203. fmt.Println(resp)
  204. }
  205. func ExampleDeviceFarm_GetUpload() {
  206. svc := devicefarm.New(nil)
  207. params := &devicefarm.GetUploadInput{
  208. Arn: aws.String("AmazonResourceName"), // Required
  209. }
  210. resp, err := svc.GetUpload(params)
  211. if err != nil {
  212. // Print the error, cast err to awserr.Error to get the Code and
  213. // Message from an error.
  214. fmt.Println(err.Error())
  215. return
  216. }
  217. // Pretty-print the response data.
  218. fmt.Println(resp)
  219. }
  220. func ExampleDeviceFarm_ListArtifacts() {
  221. svc := devicefarm.New(nil)
  222. params := &devicefarm.ListArtifactsInput{
  223. Arn: aws.String("AmazonResourceName"), // Required
  224. Type: aws.String("ArtifactCategory"), // Required
  225. NextToken: aws.String("PaginationToken"),
  226. }
  227. resp, err := svc.ListArtifacts(params)
  228. if err != nil {
  229. // Print the error, cast err to awserr.Error to get the Code and
  230. // Message from an error.
  231. fmt.Println(err.Error())
  232. return
  233. }
  234. // Pretty-print the response data.
  235. fmt.Println(resp)
  236. }
  237. func ExampleDeviceFarm_ListDevicePools() {
  238. svc := devicefarm.New(nil)
  239. params := &devicefarm.ListDevicePoolsInput{
  240. Arn: aws.String("AmazonResourceName"), // Required
  241. NextToken: aws.String("PaginationToken"),
  242. Type: aws.String("DevicePoolType"),
  243. }
  244. resp, err := svc.ListDevicePools(params)
  245. if err != nil {
  246. // Print the error, cast err to awserr.Error to get the Code and
  247. // Message from an error.
  248. fmt.Println(err.Error())
  249. return
  250. }
  251. // Pretty-print the response data.
  252. fmt.Println(resp)
  253. }
  254. func ExampleDeviceFarm_ListDevices() {
  255. svc := devicefarm.New(nil)
  256. params := &devicefarm.ListDevicesInput{
  257. Arn: aws.String("AmazonResourceName"),
  258. NextToken: aws.String("PaginationToken"),
  259. }
  260. resp, err := svc.ListDevices(params)
  261. if err != nil {
  262. // Print the error, cast err to awserr.Error to get the Code and
  263. // Message from an error.
  264. fmt.Println(err.Error())
  265. return
  266. }
  267. // Pretty-print the response data.
  268. fmt.Println(resp)
  269. }
  270. func ExampleDeviceFarm_ListJobs() {
  271. svc := devicefarm.New(nil)
  272. params := &devicefarm.ListJobsInput{
  273. Arn: aws.String("AmazonResourceName"), // Required
  274. NextToken: aws.String("PaginationToken"),
  275. }
  276. resp, err := svc.ListJobs(params)
  277. if err != nil {
  278. // Print the error, cast err to awserr.Error to get the Code and
  279. // Message from an error.
  280. fmt.Println(err.Error())
  281. return
  282. }
  283. // Pretty-print the response data.
  284. fmt.Println(resp)
  285. }
  286. func ExampleDeviceFarm_ListProjects() {
  287. svc := devicefarm.New(nil)
  288. params := &devicefarm.ListProjectsInput{
  289. Arn: aws.String("AmazonResourceName"),
  290. NextToken: aws.String("PaginationToken"),
  291. }
  292. resp, err := svc.ListProjects(params)
  293. if err != nil {
  294. // Print the error, cast err to awserr.Error to get the Code and
  295. // Message from an error.
  296. fmt.Println(err.Error())
  297. return
  298. }
  299. // Pretty-print the response data.
  300. fmt.Println(resp)
  301. }
  302. func ExampleDeviceFarm_ListRuns() {
  303. svc := devicefarm.New(nil)
  304. params := &devicefarm.ListRunsInput{
  305. Arn: aws.String("AmazonResourceName"), // Required
  306. NextToken: aws.String("PaginationToken"),
  307. }
  308. resp, err := svc.ListRuns(params)
  309. if err != nil {
  310. // Print the error, cast err to awserr.Error to get the Code and
  311. // Message from an error.
  312. fmt.Println(err.Error())
  313. return
  314. }
  315. // Pretty-print the response data.
  316. fmt.Println(resp)
  317. }
  318. func ExampleDeviceFarm_ListSamples() {
  319. svc := devicefarm.New(nil)
  320. params := &devicefarm.ListSamplesInput{
  321. Arn: aws.String("AmazonResourceName"), // Required
  322. NextToken: aws.String("PaginationToken"),
  323. }
  324. resp, err := svc.ListSamples(params)
  325. if err != nil {
  326. // Print the error, cast err to awserr.Error to get the Code and
  327. // Message from an error.
  328. fmt.Println(err.Error())
  329. return
  330. }
  331. // Pretty-print the response data.
  332. fmt.Println(resp)
  333. }
  334. func ExampleDeviceFarm_ListSuites() {
  335. svc := devicefarm.New(nil)
  336. params := &devicefarm.ListSuitesInput{
  337. Arn: aws.String("AmazonResourceName"), // Required
  338. NextToken: aws.String("PaginationToken"),
  339. }
  340. resp, err := svc.ListSuites(params)
  341. if err != nil {
  342. // Print the error, cast err to awserr.Error to get the Code and
  343. // Message from an error.
  344. fmt.Println(err.Error())
  345. return
  346. }
  347. // Pretty-print the response data.
  348. fmt.Println(resp)
  349. }
  350. func ExampleDeviceFarm_ListTests() {
  351. svc := devicefarm.New(nil)
  352. params := &devicefarm.ListTestsInput{
  353. Arn: aws.String("AmazonResourceName"), // Required
  354. NextToken: aws.String("PaginationToken"),
  355. }
  356. resp, err := svc.ListTests(params)
  357. if err != nil {
  358. // Print the error, cast err to awserr.Error to get the Code and
  359. // Message from an error.
  360. fmt.Println(err.Error())
  361. return
  362. }
  363. // Pretty-print the response data.
  364. fmt.Println(resp)
  365. }
  366. func ExampleDeviceFarm_ListUniqueProblems() {
  367. svc := devicefarm.New(nil)
  368. params := &devicefarm.ListUniqueProblemsInput{
  369. Arn: aws.String("AmazonResourceName"), // Required
  370. NextToken: aws.String("PaginationToken"),
  371. }
  372. resp, err := svc.ListUniqueProblems(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 ExampleDeviceFarm_ListUploads() {
  383. svc := devicefarm.New(nil)
  384. params := &devicefarm.ListUploadsInput{
  385. Arn: aws.String("AmazonResourceName"), // Required
  386. NextToken: aws.String("PaginationToken"),
  387. }
  388. resp, err := svc.ListUploads(params)
  389. if err != nil {
  390. // Print the error, cast err to awserr.Error to get the Code and
  391. // Message from an error.
  392. fmt.Println(err.Error())
  393. return
  394. }
  395. // Pretty-print the response data.
  396. fmt.Println(resp)
  397. }
  398. func ExampleDeviceFarm_ScheduleRun() {
  399. svc := devicefarm.New(nil)
  400. params := &devicefarm.ScheduleRunInput{
  401. AppArn: aws.String("AmazonResourceName"), // Required
  402. DevicePoolArn: aws.String("AmazonResourceName"), // Required
  403. ProjectArn: aws.String("AmazonResourceName"), // Required
  404. Test: &devicefarm.ScheduleRunTest{ // Required
  405. Type: aws.String("TestType"), // Required
  406. Filter: aws.String("Filter"),
  407. Parameters: map[string]*string{
  408. "Key": aws.String("String"), // Required
  409. // More values...
  410. },
  411. TestPackageArn: aws.String("AmazonResourceName"),
  412. },
  413. Configuration: &devicefarm.ScheduleRunConfiguration{
  414. AuxiliaryApps: []*string{
  415. aws.String("AmazonResourceName"), // Required
  416. // More values...
  417. },
  418. BillingMethod: aws.String("BillingMethod"),
  419. ExtraDataPackageArn: aws.String("AmazonResourceName"),
  420. Locale: aws.String("String"),
  421. Location: &devicefarm.Location{
  422. Latitude: aws.Float64(1.0), // Required
  423. Longitude: aws.Float64(1.0), // Required
  424. },
  425. NetworkProfileArn: aws.String("AmazonResourceName"),
  426. Radios: &devicefarm.Radios{
  427. Bluetooth: aws.Bool(true),
  428. Gps: aws.Bool(true),
  429. Nfc: aws.Bool(true),
  430. Wifi: aws.Bool(true),
  431. },
  432. },
  433. Name: aws.String("Name"),
  434. }
  435. resp, err := svc.ScheduleRun(params)
  436. if err != nil {
  437. // Print the error, cast err to awserr.Error to get the Code and
  438. // Message from an error.
  439. fmt.Println(err.Error())
  440. return
  441. }
  442. // Pretty-print the response data.
  443. fmt.Println(resp)
  444. }