github.com/aavshr/aws-sdk-go@v1.41.3/service/devicefarm/examples_test.go (about) 1 // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 3 package devicefarm_test 4 5 import ( 6 "fmt" 7 "strings" 8 "time" 9 10 "github.com/aavshr/aws-sdk-go/aws" 11 "github.com/aavshr/aws-sdk-go/aws/awserr" 12 "github.com/aavshr/aws-sdk-go/aws/session" 13 "github.com/aavshr/aws-sdk-go/service/devicefarm" 14 ) 15 16 var _ time.Duration 17 var _ strings.Reader 18 var _ aws.Config 19 20 func parseTime(layout, value string) *time.Time { 21 t, err := time.Parse(layout, value) 22 if err != nil { 23 panic(err) 24 } 25 return &t 26 } 27 28 // To create a new device pool 29 // 30 // The following example creates a new device pool named MyDevicePool inside an existing 31 // project. 32 func ExampleDeviceFarm_CreateDevicePool_shared00() { 33 svc := devicefarm.New(session.New()) 34 input := &devicefarm.CreateDevicePoolInput{ 35 Description: aws.String("My Android devices"), 36 Name: aws.String("MyDevicePool"), 37 ProjectArn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:project:EXAMPLE-GUID-123-456"), 38 } 39 40 result, err := svc.CreateDevicePool(input) 41 if err != nil { 42 if aerr, ok := err.(awserr.Error); ok { 43 switch aerr.Code() { 44 case devicefarm.ErrCodeArgumentException: 45 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 46 case devicefarm.ErrCodeNotFoundException: 47 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 48 case devicefarm.ErrCodeLimitExceededException: 49 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 50 case devicefarm.ErrCodeServiceAccountException: 51 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 52 default: 53 fmt.Println(aerr.Error()) 54 } 55 } else { 56 // Print the error, cast err to awserr.Error to get the Code and 57 // Message from an error. 58 fmt.Println(err.Error()) 59 } 60 return 61 } 62 63 fmt.Println(result) 64 } 65 66 // To create a new project 67 // 68 // The following example creates a new project named MyProject. 69 func ExampleDeviceFarm_CreateProject_shared00() { 70 svc := devicefarm.New(session.New()) 71 input := &devicefarm.CreateProjectInput{ 72 Name: aws.String("MyProject"), 73 } 74 75 result, err := svc.CreateProject(input) 76 if err != nil { 77 if aerr, ok := err.(awserr.Error); ok { 78 switch aerr.Code() { 79 case devicefarm.ErrCodeArgumentException: 80 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 81 case devicefarm.ErrCodeNotFoundException: 82 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 83 case devicefarm.ErrCodeLimitExceededException: 84 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 85 case devicefarm.ErrCodeServiceAccountException: 86 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 87 case devicefarm.ErrCodeTagOperationException: 88 fmt.Println(devicefarm.ErrCodeTagOperationException, aerr.Error()) 89 default: 90 fmt.Println(aerr.Error()) 91 } 92 } else { 93 // Print the error, cast err to awserr.Error to get the Code and 94 // Message from an error. 95 fmt.Println(err.Error()) 96 } 97 return 98 } 99 100 fmt.Println(result) 101 } 102 103 // To create a remote access session 104 // 105 // The following example creates a remote access session named MySession. 106 func ExampleDeviceFarm_CreateRemoteAccessSession_shared00() { 107 svc := devicefarm.New(session.New()) 108 input := &devicefarm.CreateRemoteAccessSessionInput{ 109 Configuration: &devicefarm.CreateRemoteAccessSessionConfiguration{ 110 BillingMethod: aws.String("METERED"), 111 }, 112 DeviceArn: aws.String("arn:aws:devicefarm:us-west-2::device:123EXAMPLE"), 113 Name: aws.String("MySession"), 114 ProjectArn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:project:EXAMPLE-GUID-123-456"), 115 } 116 117 result, err := svc.CreateRemoteAccessSession(input) 118 if err != nil { 119 if aerr, ok := err.(awserr.Error); ok { 120 switch aerr.Code() { 121 case devicefarm.ErrCodeArgumentException: 122 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 123 case devicefarm.ErrCodeNotFoundException: 124 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 125 case devicefarm.ErrCodeLimitExceededException: 126 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 127 case devicefarm.ErrCodeServiceAccountException: 128 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 129 default: 130 fmt.Println(aerr.Error()) 131 } 132 } else { 133 // Print the error, cast err to awserr.Error to get the Code and 134 // Message from an error. 135 fmt.Println(err.Error()) 136 } 137 return 138 } 139 140 fmt.Println(result) 141 } 142 143 // To create a new test package upload 144 // 145 // The following example creates a new Appium Python test package upload inside an existing 146 // project. 147 func ExampleDeviceFarm_CreateUpload_shared00() { 148 svc := devicefarm.New(session.New()) 149 input := &devicefarm.CreateUploadInput{ 150 Name: aws.String("MyAppiumPythonUpload"), 151 ProjectArn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:project:EXAMPLE-GUID-123-456"), 152 Type: aws.String("APPIUM_PYTHON_TEST_PACKAGE"), 153 } 154 155 result, err := svc.CreateUpload(input) 156 if err != nil { 157 if aerr, ok := err.(awserr.Error); ok { 158 switch aerr.Code() { 159 case devicefarm.ErrCodeArgumentException: 160 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 161 case devicefarm.ErrCodeNotFoundException: 162 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 163 case devicefarm.ErrCodeLimitExceededException: 164 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 165 case devicefarm.ErrCodeServiceAccountException: 166 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 167 default: 168 fmt.Println(aerr.Error()) 169 } 170 } else { 171 // Print the error, cast err to awserr.Error to get the Code and 172 // Message from an error. 173 fmt.Println(err.Error()) 174 } 175 return 176 } 177 178 fmt.Println(result) 179 } 180 181 // To delete a device pool 182 // 183 // The following example deletes a specific device pool. 184 func ExampleDeviceFarm_DeleteDevicePool_shared00() { 185 svc := devicefarm.New(session.New()) 186 input := &devicefarm.DeleteDevicePoolInput{ 187 Arn: aws.String("arn:aws:devicefarm:us-west-2::devicepool:123-456-EXAMPLE-GUID"), 188 } 189 190 result, err := svc.DeleteDevicePool(input) 191 if err != nil { 192 if aerr, ok := err.(awserr.Error); ok { 193 switch aerr.Code() { 194 case devicefarm.ErrCodeArgumentException: 195 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 196 case devicefarm.ErrCodeNotFoundException: 197 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 198 case devicefarm.ErrCodeLimitExceededException: 199 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 200 case devicefarm.ErrCodeServiceAccountException: 201 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 202 default: 203 fmt.Println(aerr.Error()) 204 } 205 } else { 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 } 210 return 211 } 212 213 fmt.Println(result) 214 } 215 216 // To delete a project 217 // 218 // The following example deletes a specific project. 219 func ExampleDeviceFarm_DeleteProject_shared00() { 220 svc := devicefarm.New(session.New()) 221 input := &devicefarm.DeleteProjectInput{ 222 Arn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:project:EXAMPLE-GUID-123-456"), 223 } 224 225 result, err := svc.DeleteProject(input) 226 if err != nil { 227 if aerr, ok := err.(awserr.Error); ok { 228 switch aerr.Code() { 229 case devicefarm.ErrCodeArgumentException: 230 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 231 case devicefarm.ErrCodeNotFoundException: 232 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 233 case devicefarm.ErrCodeLimitExceededException: 234 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 235 case devicefarm.ErrCodeServiceAccountException: 236 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 237 default: 238 fmt.Println(aerr.Error()) 239 } 240 } else { 241 // Print the error, cast err to awserr.Error to get the Code and 242 // Message from an error. 243 fmt.Println(err.Error()) 244 } 245 return 246 } 247 248 fmt.Println(result) 249 } 250 251 // To delete a specific remote access session 252 // 253 // The following example deletes a specific remote access session. 254 func ExampleDeviceFarm_DeleteRemoteAccessSession_shared00() { 255 svc := devicefarm.New(session.New()) 256 input := &devicefarm.DeleteRemoteAccessSessionInput{ 257 Arn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:session:EXAMPLE-GUID-123-456"), 258 } 259 260 result, err := svc.DeleteRemoteAccessSession(input) 261 if err != nil { 262 if aerr, ok := err.(awserr.Error); ok { 263 switch aerr.Code() { 264 case devicefarm.ErrCodeArgumentException: 265 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 266 case devicefarm.ErrCodeNotFoundException: 267 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 268 case devicefarm.ErrCodeLimitExceededException: 269 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 270 case devicefarm.ErrCodeServiceAccountException: 271 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 272 default: 273 fmt.Println(aerr.Error()) 274 } 275 } else { 276 // Print the error, cast err to awserr.Error to get the Code and 277 // Message from an error. 278 fmt.Println(err.Error()) 279 } 280 return 281 } 282 283 fmt.Println(result) 284 } 285 286 // To delete a run 287 // 288 // The following example deletes a specific test run. 289 func ExampleDeviceFarm_DeleteRun_shared00() { 290 svc := devicefarm.New(session.New()) 291 input := &devicefarm.DeleteRunInput{ 292 Arn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:run:EXAMPLE-GUID-123-456"), 293 } 294 295 result, err := svc.DeleteRun(input) 296 if err != nil { 297 if aerr, ok := err.(awserr.Error); ok { 298 switch aerr.Code() { 299 case devicefarm.ErrCodeArgumentException: 300 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 301 case devicefarm.ErrCodeNotFoundException: 302 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 303 case devicefarm.ErrCodeLimitExceededException: 304 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 305 case devicefarm.ErrCodeServiceAccountException: 306 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 307 default: 308 fmt.Println(aerr.Error()) 309 } 310 } else { 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 } 315 return 316 } 317 318 fmt.Println(result) 319 } 320 321 // To delete a specific upload 322 // 323 // The following example deletes a specific upload. 324 func ExampleDeviceFarm_DeleteUpload_shared00() { 325 svc := devicefarm.New(session.New()) 326 input := &devicefarm.DeleteUploadInput{ 327 Arn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:upload:EXAMPLE-GUID-123-456"), 328 } 329 330 result, err := svc.DeleteUpload(input) 331 if err != nil { 332 if aerr, ok := err.(awserr.Error); ok { 333 switch aerr.Code() { 334 case devicefarm.ErrCodeArgumentException: 335 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 336 case devicefarm.ErrCodeNotFoundException: 337 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 338 case devicefarm.ErrCodeLimitExceededException: 339 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 340 case devicefarm.ErrCodeServiceAccountException: 341 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 342 default: 343 fmt.Println(aerr.Error()) 344 } 345 } else { 346 // Print the error, cast err to awserr.Error to get the Code and 347 // Message from an error. 348 fmt.Println(err.Error()) 349 } 350 return 351 } 352 353 fmt.Println(result) 354 } 355 356 // To get information about account settings 357 // 358 // The following example returns information about your Device Farm account settings. 359 func ExampleDeviceFarm_GetAccountSettings_shared00() { 360 svc := devicefarm.New(session.New()) 361 input := &devicefarm.GetAccountSettingsInput{} 362 363 result, err := svc.GetAccountSettings(input) 364 if err != nil { 365 if aerr, ok := err.(awserr.Error); ok { 366 switch aerr.Code() { 367 case devicefarm.ErrCodeArgumentException: 368 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 369 case devicefarm.ErrCodeNotFoundException: 370 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 371 case devicefarm.ErrCodeLimitExceededException: 372 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 373 case devicefarm.ErrCodeServiceAccountException: 374 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 375 default: 376 fmt.Println(aerr.Error()) 377 } 378 } else { 379 // Print the error, cast err to awserr.Error to get the Code and 380 // Message from an error. 381 fmt.Println(err.Error()) 382 } 383 return 384 } 385 386 fmt.Println(result) 387 } 388 389 // To get information about a device 390 // 391 // The following example returns information about a specific device. 392 func ExampleDeviceFarm_GetDevice_shared00() { 393 svc := devicefarm.New(session.New()) 394 input := &devicefarm.GetDeviceInput{ 395 Arn: aws.String("arn:aws:devicefarm:us-west-2::device:123EXAMPLE"), 396 } 397 398 result, err := svc.GetDevice(input) 399 if err != nil { 400 if aerr, ok := err.(awserr.Error); ok { 401 switch aerr.Code() { 402 case devicefarm.ErrCodeArgumentException: 403 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 404 case devicefarm.ErrCodeNotFoundException: 405 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 406 case devicefarm.ErrCodeLimitExceededException: 407 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 408 case devicefarm.ErrCodeServiceAccountException: 409 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 410 default: 411 fmt.Println(aerr.Error()) 412 } 413 } else { 414 // Print the error, cast err to awserr.Error to get the Code and 415 // Message from an error. 416 fmt.Println(err.Error()) 417 } 418 return 419 } 420 421 fmt.Println(result) 422 } 423 424 // To get information about a device pool 425 // 426 // The following example returns information about a specific device pool, given a project 427 // ARN. 428 func ExampleDeviceFarm_GetDevicePool_shared00() { 429 svc := devicefarm.New(session.New()) 430 input := &devicefarm.GetDevicePoolInput{ 431 Arn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:project:EXAMPLE-GUID-123-456"), 432 } 433 434 result, err := svc.GetDevicePool(input) 435 if err != nil { 436 if aerr, ok := err.(awserr.Error); ok { 437 switch aerr.Code() { 438 case devicefarm.ErrCodeArgumentException: 439 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 440 case devicefarm.ErrCodeNotFoundException: 441 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 442 case devicefarm.ErrCodeLimitExceededException: 443 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 444 case devicefarm.ErrCodeServiceAccountException: 445 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 446 default: 447 fmt.Println(aerr.Error()) 448 } 449 } else { 450 // Print the error, cast err to awserr.Error to get the Code and 451 // Message from an error. 452 fmt.Println(err.Error()) 453 } 454 return 455 } 456 457 fmt.Println(result) 458 } 459 460 // To get information about the compatibility of a device pool 461 // 462 // The following example returns information about the compatibility of a specific device 463 // pool, given its ARN. 464 func ExampleDeviceFarm_GetDevicePoolCompatibility_shared00() { 465 svc := devicefarm.New(session.New()) 466 input := &devicefarm.GetDevicePoolCompatibilityInput{ 467 AppArn: aws.String("arn:aws:devicefarm:us-west-2::app:123-456-EXAMPLE-GUID"), 468 DevicePoolArn: aws.String("arn:aws:devicefarm:us-west-2::devicepool:123-456-EXAMPLE-GUID"), 469 TestType: aws.String("APPIUM_PYTHON"), 470 } 471 472 result, err := svc.GetDevicePoolCompatibility(input) 473 if err != nil { 474 if aerr, ok := err.(awserr.Error); ok { 475 switch aerr.Code() { 476 case devicefarm.ErrCodeArgumentException: 477 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 478 case devicefarm.ErrCodeNotFoundException: 479 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 480 case devicefarm.ErrCodeLimitExceededException: 481 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 482 case devicefarm.ErrCodeServiceAccountException: 483 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 484 default: 485 fmt.Println(aerr.Error()) 486 } 487 } else { 488 // Print the error, cast err to awserr.Error to get the Code and 489 // Message from an error. 490 fmt.Println(err.Error()) 491 } 492 return 493 } 494 495 fmt.Println(result) 496 } 497 498 // To get information about a job 499 // 500 // The following example returns information about a specific job. 501 func ExampleDeviceFarm_GetJob_shared00() { 502 svc := devicefarm.New(session.New()) 503 input := &devicefarm.GetJobInput{ 504 Arn: aws.String("arn:aws:devicefarm:us-west-2::job:123-456-EXAMPLE-GUID"), 505 } 506 507 result, err := svc.GetJob(input) 508 if err != nil { 509 if aerr, ok := err.(awserr.Error); ok { 510 switch aerr.Code() { 511 case devicefarm.ErrCodeArgumentException: 512 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 513 case devicefarm.ErrCodeNotFoundException: 514 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 515 case devicefarm.ErrCodeLimitExceededException: 516 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 517 case devicefarm.ErrCodeServiceAccountException: 518 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 519 default: 520 fmt.Println(aerr.Error()) 521 } 522 } else { 523 // Print the error, cast err to awserr.Error to get the Code and 524 // Message from an error. 525 fmt.Println(err.Error()) 526 } 527 return 528 } 529 530 fmt.Println(result) 531 } 532 533 // To get status information about device offerings 534 // 535 // The following example returns information about Device Farm offerings available to 536 // your account. 537 func ExampleDeviceFarm_GetOfferingStatus_shared00() { 538 svc := devicefarm.New(session.New()) 539 input := &devicefarm.GetOfferingStatusInput{ 540 NextToken: aws.String("RW5DdDJkMWYwZjM2MzM2VHVpOHJIUXlDUXlhc2QzRGViYnc9SEXAMPLE="), 541 } 542 543 result, err := svc.GetOfferingStatus(input) 544 if err != nil { 545 if aerr, ok := err.(awserr.Error); ok { 546 switch aerr.Code() { 547 case devicefarm.ErrCodeArgumentException: 548 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 549 case devicefarm.ErrCodeNotFoundException: 550 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 551 case devicefarm.ErrCodeNotEligibleException: 552 fmt.Println(devicefarm.ErrCodeNotEligibleException, aerr.Error()) 553 case devicefarm.ErrCodeLimitExceededException: 554 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 555 case devicefarm.ErrCodeServiceAccountException: 556 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 557 default: 558 fmt.Println(aerr.Error()) 559 } 560 } else { 561 // Print the error, cast err to awserr.Error to get the Code and 562 // Message from an error. 563 fmt.Println(err.Error()) 564 } 565 return 566 } 567 568 fmt.Println(result) 569 } 570 571 // To get information about a project 572 // 573 // The following example gets information about a specific project. 574 func ExampleDeviceFarm_GetProject_shared00() { 575 svc := devicefarm.New(session.New()) 576 input := &devicefarm.GetProjectInput{ 577 Arn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:project:5e01a8c7-c861-4c0a-b1d5-12345EXAMPLE"), 578 } 579 580 result, err := svc.GetProject(input) 581 if err != nil { 582 if aerr, ok := err.(awserr.Error); ok { 583 switch aerr.Code() { 584 case devicefarm.ErrCodeArgumentException: 585 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 586 case devicefarm.ErrCodeNotFoundException: 587 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 588 case devicefarm.ErrCodeLimitExceededException: 589 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 590 case devicefarm.ErrCodeServiceAccountException: 591 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 592 default: 593 fmt.Println(aerr.Error()) 594 } 595 } else { 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 } 600 return 601 } 602 603 fmt.Println(result) 604 } 605 606 // To get a remote access session 607 // 608 // The following example gets a specific remote access session. 609 func ExampleDeviceFarm_GetRemoteAccessSession_shared00() { 610 svc := devicefarm.New(session.New()) 611 input := &devicefarm.GetRemoteAccessSessionInput{ 612 Arn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:session:EXAMPLE-GUID-123-456"), 613 } 614 615 result, err := svc.GetRemoteAccessSession(input) 616 if err != nil { 617 if aerr, ok := err.(awserr.Error); ok { 618 switch aerr.Code() { 619 case devicefarm.ErrCodeArgumentException: 620 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 621 case devicefarm.ErrCodeNotFoundException: 622 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 623 case devicefarm.ErrCodeLimitExceededException: 624 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 625 case devicefarm.ErrCodeServiceAccountException: 626 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 627 default: 628 fmt.Println(aerr.Error()) 629 } 630 } else { 631 // Print the error, cast err to awserr.Error to get the Code and 632 // Message from an error. 633 fmt.Println(err.Error()) 634 } 635 return 636 } 637 638 fmt.Println(result) 639 } 640 641 // To get information about a test run 642 // 643 // The following example gets information about a specific test run. 644 func ExampleDeviceFarm_GetRun_shared00() { 645 svc := devicefarm.New(session.New()) 646 input := &devicefarm.GetRunInput{ 647 Arn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:run:5e01a8c7-c861-4c0a-b1d5-5ec6e6c6dd23/0fcac17b-6122-44d7-ae5a-12345EXAMPLE"), 648 } 649 650 result, err := svc.GetRun(input) 651 if err != nil { 652 if aerr, ok := err.(awserr.Error); ok { 653 switch aerr.Code() { 654 case devicefarm.ErrCodeArgumentException: 655 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 656 case devicefarm.ErrCodeNotFoundException: 657 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 658 case devicefarm.ErrCodeLimitExceededException: 659 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 660 case devicefarm.ErrCodeServiceAccountException: 661 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 662 default: 663 fmt.Println(aerr.Error()) 664 } 665 } else { 666 // Print the error, cast err to awserr.Error to get the Code and 667 // Message from an error. 668 fmt.Println(err.Error()) 669 } 670 return 671 } 672 673 fmt.Println(result) 674 } 675 676 // To get information about a test suite 677 // 678 // The following example gets information about a specific test suite. 679 func ExampleDeviceFarm_GetSuite_shared00() { 680 svc := devicefarm.New(session.New()) 681 input := &devicefarm.GetSuiteInput{ 682 Arn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:suite:EXAMPLE-GUID-123-456"), 683 } 684 685 result, err := svc.GetSuite(input) 686 if err != nil { 687 if aerr, ok := err.(awserr.Error); ok { 688 switch aerr.Code() { 689 case devicefarm.ErrCodeArgumentException: 690 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 691 case devicefarm.ErrCodeNotFoundException: 692 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 693 case devicefarm.ErrCodeLimitExceededException: 694 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 695 case devicefarm.ErrCodeServiceAccountException: 696 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 697 default: 698 fmt.Println(aerr.Error()) 699 } 700 } else { 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 } 705 return 706 } 707 708 fmt.Println(result) 709 } 710 711 // To get information about a specific test 712 // 713 // The following example gets information about a specific test. 714 func ExampleDeviceFarm_GetTest_shared00() { 715 svc := devicefarm.New(session.New()) 716 input := &devicefarm.GetTestInput{ 717 Arn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:test:EXAMPLE-GUID-123-456"), 718 } 719 720 result, err := svc.GetTest(input) 721 if err != nil { 722 if aerr, ok := err.(awserr.Error); ok { 723 switch aerr.Code() { 724 case devicefarm.ErrCodeArgumentException: 725 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 726 case devicefarm.ErrCodeNotFoundException: 727 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 728 case devicefarm.ErrCodeLimitExceededException: 729 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 730 case devicefarm.ErrCodeServiceAccountException: 731 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 732 default: 733 fmt.Println(aerr.Error()) 734 } 735 } else { 736 // Print the error, cast err to awserr.Error to get the Code and 737 // Message from an error. 738 fmt.Println(err.Error()) 739 } 740 return 741 } 742 743 fmt.Println(result) 744 } 745 746 // To get information about a specific upload 747 // 748 // The following example gets information about a specific upload. 749 func ExampleDeviceFarm_GetUpload_shared00() { 750 svc := devicefarm.New(session.New()) 751 input := &devicefarm.GetUploadInput{ 752 Arn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:upload:EXAMPLE-GUID-123-456"), 753 } 754 755 result, err := svc.GetUpload(input) 756 if err != nil { 757 if aerr, ok := err.(awserr.Error); ok { 758 switch aerr.Code() { 759 case devicefarm.ErrCodeArgumentException: 760 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 761 case devicefarm.ErrCodeNotFoundException: 762 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 763 case devicefarm.ErrCodeLimitExceededException: 764 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 765 case devicefarm.ErrCodeServiceAccountException: 766 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 767 default: 768 fmt.Println(aerr.Error()) 769 } 770 } else { 771 // Print the error, cast err to awserr.Error to get the Code and 772 // Message from an error. 773 fmt.Println(err.Error()) 774 } 775 return 776 } 777 778 fmt.Println(result) 779 } 780 781 // To install to a remote access session 782 // 783 // The following example installs a specific app to a device in a specific remote access 784 // session. 785 func ExampleDeviceFarm_InstallToRemoteAccessSession_shared00() { 786 svc := devicefarm.New(session.New()) 787 input := &devicefarm.InstallToRemoteAccessSessionInput{ 788 AppArn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:app:EXAMPLE-GUID-123-456"), 789 RemoteAccessSessionArn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:session:EXAMPLE-GUID-123-456"), 790 } 791 792 result, err := svc.InstallToRemoteAccessSession(input) 793 if err != nil { 794 if aerr, ok := err.(awserr.Error); ok { 795 switch aerr.Code() { 796 case devicefarm.ErrCodeArgumentException: 797 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 798 case devicefarm.ErrCodeNotFoundException: 799 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 800 case devicefarm.ErrCodeLimitExceededException: 801 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 802 case devicefarm.ErrCodeServiceAccountException: 803 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 804 default: 805 fmt.Println(aerr.Error()) 806 } 807 } else { 808 // Print the error, cast err to awserr.Error to get the Code and 809 // Message from an error. 810 fmt.Println(err.Error()) 811 } 812 return 813 } 814 815 fmt.Println(result) 816 } 817 818 // To list artifacts for a resource 819 // 820 // The following example lists screenshot artifacts for a specific run. 821 func ExampleDeviceFarm_ListArtifacts_shared00() { 822 svc := devicefarm.New(session.New()) 823 input := &devicefarm.ListArtifactsInput{ 824 Arn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:run:EXAMPLE-GUID-123-456"), 825 Type: aws.String("SCREENSHOT"), 826 } 827 828 result, err := svc.ListArtifacts(input) 829 if err != nil { 830 if aerr, ok := err.(awserr.Error); ok { 831 switch aerr.Code() { 832 case devicefarm.ErrCodeArgumentException: 833 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 834 case devicefarm.ErrCodeNotFoundException: 835 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 836 case devicefarm.ErrCodeLimitExceededException: 837 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 838 case devicefarm.ErrCodeServiceAccountException: 839 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 840 default: 841 fmt.Println(aerr.Error()) 842 } 843 } else { 844 // Print the error, cast err to awserr.Error to get the Code and 845 // Message from an error. 846 fmt.Println(err.Error()) 847 } 848 return 849 } 850 851 fmt.Println(result) 852 } 853 854 // To get information about device pools 855 // 856 // The following example returns information about the private device pools in a specific 857 // project. 858 func ExampleDeviceFarm_ListDevicePools_shared00() { 859 svc := devicefarm.New(session.New()) 860 input := &devicefarm.ListDevicePoolsInput{ 861 Arn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:project:EXAMPLE-GUID-123-456"), 862 Type: aws.String("PRIVATE"), 863 } 864 865 result, err := svc.ListDevicePools(input) 866 if err != nil { 867 if aerr, ok := err.(awserr.Error); ok { 868 switch aerr.Code() { 869 case devicefarm.ErrCodeArgumentException: 870 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 871 case devicefarm.ErrCodeNotFoundException: 872 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 873 case devicefarm.ErrCodeLimitExceededException: 874 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 875 case devicefarm.ErrCodeServiceAccountException: 876 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 877 default: 878 fmt.Println(aerr.Error()) 879 } 880 } else { 881 // Print the error, cast err to awserr.Error to get the Code and 882 // Message from an error. 883 fmt.Println(err.Error()) 884 } 885 return 886 } 887 888 fmt.Println(result) 889 } 890 891 // To get information about devices 892 // 893 // The following example returns information about the available devices in a specific 894 // project. 895 func ExampleDeviceFarm_ListDevices_shared00() { 896 svc := devicefarm.New(session.New()) 897 input := &devicefarm.ListDevicesInput{ 898 Arn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:project:EXAMPLE-GUID-123-456"), 899 } 900 901 result, err := svc.ListDevices(input) 902 if err != nil { 903 if aerr, ok := err.(awserr.Error); ok { 904 switch aerr.Code() { 905 case devicefarm.ErrCodeArgumentException: 906 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 907 case devicefarm.ErrCodeNotFoundException: 908 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 909 case devicefarm.ErrCodeLimitExceededException: 910 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 911 case devicefarm.ErrCodeServiceAccountException: 912 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 913 default: 914 fmt.Println(aerr.Error()) 915 } 916 } else { 917 // Print the error, cast err to awserr.Error to get the Code and 918 // Message from an error. 919 fmt.Println(err.Error()) 920 } 921 return 922 } 923 924 fmt.Println(result) 925 } 926 927 // To get information about jobs 928 // 929 // The following example returns information about jobs in a specific project. 930 func ExampleDeviceFarm_ListJobs_shared00() { 931 svc := devicefarm.New(session.New()) 932 input := &devicefarm.ListJobsInput{ 933 Arn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:project:EXAMPLE-GUID-123-456"), 934 } 935 936 result, err := svc.ListJobs(input) 937 if err != nil { 938 if aerr, ok := err.(awserr.Error); ok { 939 switch aerr.Code() { 940 case devicefarm.ErrCodeArgumentException: 941 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 942 case devicefarm.ErrCodeNotFoundException: 943 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 944 case devicefarm.ErrCodeLimitExceededException: 945 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 946 case devicefarm.ErrCodeServiceAccountException: 947 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 948 default: 949 fmt.Println(aerr.Error()) 950 } 951 } else { 952 // Print the error, cast err to awserr.Error to get the Code and 953 // Message from an error. 954 fmt.Println(err.Error()) 955 } 956 return 957 } 958 959 fmt.Println(result) 960 } 961 962 // To get information about device offering transactions 963 // 964 // The following example returns information about Device Farm offering transactions. 965 func ExampleDeviceFarm_ListOfferingTransactions_shared00() { 966 svc := devicefarm.New(session.New()) 967 input := &devicefarm.ListOfferingTransactionsInput{ 968 NextToken: aws.String("RW5DdDJkMWYwZjM2MzM2VHVpOHJIUXlDUXlhc2QzRGViYnc9SEXAMPLE="), 969 } 970 971 result, err := svc.ListOfferingTransactions(input) 972 if err != nil { 973 if aerr, ok := err.(awserr.Error); ok { 974 switch aerr.Code() { 975 case devicefarm.ErrCodeArgumentException: 976 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 977 case devicefarm.ErrCodeNotFoundException: 978 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 979 case devicefarm.ErrCodeNotEligibleException: 980 fmt.Println(devicefarm.ErrCodeNotEligibleException, aerr.Error()) 981 case devicefarm.ErrCodeLimitExceededException: 982 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 983 case devicefarm.ErrCodeServiceAccountException: 984 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 985 default: 986 fmt.Println(aerr.Error()) 987 } 988 } else { 989 // Print the error, cast err to awserr.Error to get the Code and 990 // Message from an error. 991 fmt.Println(err.Error()) 992 } 993 return 994 } 995 996 fmt.Println(result) 997 } 998 999 // To get information about device offerings 1000 // 1001 // The following example returns information about available device offerings. 1002 func ExampleDeviceFarm_ListOfferings_shared00() { 1003 svc := devicefarm.New(session.New()) 1004 input := &devicefarm.ListOfferingsInput{ 1005 NextToken: aws.String("RW5DdDJkMWYwZjM2MzM2VHVpOHJIUXlDUXlhc2QzRGViYnc9SEXAMPLE="), 1006 } 1007 1008 result, err := svc.ListOfferings(input) 1009 if err != nil { 1010 if aerr, ok := err.(awserr.Error); ok { 1011 switch aerr.Code() { 1012 case devicefarm.ErrCodeArgumentException: 1013 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 1014 case devicefarm.ErrCodeNotFoundException: 1015 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 1016 case devicefarm.ErrCodeNotEligibleException: 1017 fmt.Println(devicefarm.ErrCodeNotEligibleException, aerr.Error()) 1018 case devicefarm.ErrCodeLimitExceededException: 1019 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 1020 case devicefarm.ErrCodeServiceAccountException: 1021 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 1022 default: 1023 fmt.Println(aerr.Error()) 1024 } 1025 } else { 1026 // Print the error, cast err to awserr.Error to get the Code and 1027 // Message from an error. 1028 fmt.Println(err.Error()) 1029 } 1030 return 1031 } 1032 1033 fmt.Println(result) 1034 } 1035 1036 // To get information about a Device Farm project 1037 // 1038 // The following example returns information about the specified project in Device Farm. 1039 func ExampleDeviceFarm_ListProjects_shared00() { 1040 svc := devicefarm.New(session.New()) 1041 input := &devicefarm.ListProjectsInput{ 1042 Arn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:project:7ad300ed-8183-41a7-bf94-12345EXAMPLE"), 1043 NextToken: aws.String("RW5DdDJkMWYwZjM2MzM2VHVpOHJIUXlDUXlhc2QzRGViYnc9SEXAMPLE"), 1044 } 1045 1046 result, err := svc.ListProjects(input) 1047 if err != nil { 1048 if aerr, ok := err.(awserr.Error); ok { 1049 switch aerr.Code() { 1050 case devicefarm.ErrCodeArgumentException: 1051 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 1052 case devicefarm.ErrCodeNotFoundException: 1053 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 1054 case devicefarm.ErrCodeLimitExceededException: 1055 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 1056 case devicefarm.ErrCodeServiceAccountException: 1057 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 1058 default: 1059 fmt.Println(aerr.Error()) 1060 } 1061 } else { 1062 // Print the error, cast err to awserr.Error to get the Code and 1063 // Message from an error. 1064 fmt.Println(err.Error()) 1065 } 1066 return 1067 } 1068 1069 fmt.Println(result) 1070 } 1071 1072 // To get information about a remote access session 1073 // 1074 // The following example returns information about a specific Device Farm remote access 1075 // session. 1076 func ExampleDeviceFarm_ListRemoteAccessSessions_shared00() { 1077 svc := devicefarm.New(session.New()) 1078 input := &devicefarm.ListRemoteAccessSessionsInput{ 1079 Arn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:session:EXAMPLE-GUID-123-456"), 1080 NextToken: aws.String("RW5DdDJkMWYwZjM2MzM2VHVpOHJIUXlDUXlhc2QzRGViYnc9SEXAMPLE="), 1081 } 1082 1083 result, err := svc.ListRemoteAccessSessions(input) 1084 if err != nil { 1085 if aerr, ok := err.(awserr.Error); ok { 1086 switch aerr.Code() { 1087 case devicefarm.ErrCodeArgumentException: 1088 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 1089 case devicefarm.ErrCodeNotFoundException: 1090 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 1091 case devicefarm.ErrCodeLimitExceededException: 1092 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 1093 case devicefarm.ErrCodeServiceAccountException: 1094 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 1095 default: 1096 fmt.Println(aerr.Error()) 1097 } 1098 } else { 1099 // Print the error, cast err to awserr.Error to get the Code and 1100 // Message from an error. 1101 fmt.Println(err.Error()) 1102 } 1103 return 1104 } 1105 1106 fmt.Println(result) 1107 } 1108 1109 // To get information about a test run 1110 // 1111 // The following example returns information about a specific test run. 1112 func ExampleDeviceFarm_ListRuns_shared00() { 1113 svc := devicefarm.New(session.New()) 1114 input := &devicefarm.ListRunsInput{ 1115 Arn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:run:5e01a8c7-c861-4c0a-b1d5-5ec6e6c6dd23/0fcac17b-6122-44d7-ae5a-12345EXAMPLE"), 1116 NextToken: aws.String("RW5DdDJkMWYwZjM2MzM2VHVpOHJIUXlDUXlhc2QzRGViYnc9SEXAMPLE"), 1117 } 1118 1119 result, err := svc.ListRuns(input) 1120 if err != nil { 1121 if aerr, ok := err.(awserr.Error); ok { 1122 switch aerr.Code() { 1123 case devicefarm.ErrCodeArgumentException: 1124 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 1125 case devicefarm.ErrCodeNotFoundException: 1126 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 1127 case devicefarm.ErrCodeLimitExceededException: 1128 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 1129 case devicefarm.ErrCodeServiceAccountException: 1130 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 1131 default: 1132 fmt.Println(aerr.Error()) 1133 } 1134 } else { 1135 // Print the error, cast err to awserr.Error to get the Code and 1136 // Message from an error. 1137 fmt.Println(err.Error()) 1138 } 1139 return 1140 } 1141 1142 fmt.Println(result) 1143 } 1144 1145 // To get information about samples 1146 // 1147 // The following example returns information about samples, given a specific Device 1148 // Farm project. 1149 func ExampleDeviceFarm_ListSamples_shared00() { 1150 svc := devicefarm.New(session.New()) 1151 input := &devicefarm.ListSamplesInput{ 1152 Arn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:project:EXAMPLE-GUID-123-456"), 1153 NextToken: aws.String("RW5DdDJkMWYwZjM2MzM2VHVpOHJIUXlDUXlhc2QzRGViYnc9SEXAMPLE"), 1154 } 1155 1156 result, err := svc.ListSamples(input) 1157 if err != nil { 1158 if aerr, ok := err.(awserr.Error); ok { 1159 switch aerr.Code() { 1160 case devicefarm.ErrCodeArgumentException: 1161 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 1162 case devicefarm.ErrCodeNotFoundException: 1163 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 1164 case devicefarm.ErrCodeLimitExceededException: 1165 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 1166 case devicefarm.ErrCodeServiceAccountException: 1167 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 1168 default: 1169 fmt.Println(aerr.Error()) 1170 } 1171 } else { 1172 // Print the error, cast err to awserr.Error to get the Code and 1173 // Message from an error. 1174 fmt.Println(err.Error()) 1175 } 1176 return 1177 } 1178 1179 fmt.Println(result) 1180 } 1181 1182 // To get information about suites 1183 // 1184 // The following example returns information about suites, given a specific Device Farm 1185 // job. 1186 func ExampleDeviceFarm_ListSuites_shared00() { 1187 svc := devicefarm.New(session.New()) 1188 input := &devicefarm.ListSuitesInput{ 1189 Arn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:job:EXAMPLE-GUID-123-456"), 1190 NextToken: aws.String("RW5DdDJkMWYwZjM2MzM2VHVpOHJIUXlDUXlhc2QzRGViYnc9SEXAMPLE"), 1191 } 1192 1193 result, err := svc.ListSuites(input) 1194 if err != nil { 1195 if aerr, ok := err.(awserr.Error); ok { 1196 switch aerr.Code() { 1197 case devicefarm.ErrCodeArgumentException: 1198 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 1199 case devicefarm.ErrCodeNotFoundException: 1200 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 1201 case devicefarm.ErrCodeLimitExceededException: 1202 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 1203 case devicefarm.ErrCodeServiceAccountException: 1204 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 1205 default: 1206 fmt.Println(aerr.Error()) 1207 } 1208 } else { 1209 // Print the error, cast err to awserr.Error to get the Code and 1210 // Message from an error. 1211 fmt.Println(err.Error()) 1212 } 1213 return 1214 } 1215 1216 fmt.Println(result) 1217 } 1218 1219 // To get information about tests 1220 // 1221 // The following example returns information about tests, given a specific Device Farm 1222 // project. 1223 func ExampleDeviceFarm_ListTests_shared00() { 1224 svc := devicefarm.New(session.New()) 1225 input := &devicefarm.ListTestsInput{ 1226 Arn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:project:EXAMPLE-GUID-123-456"), 1227 NextToken: aws.String("RW5DdDJkMWYwZjM2MzM2VHVpOHJIUXlDUXlhc2QzRGViYnc9SEXAMPLE"), 1228 } 1229 1230 result, err := svc.ListTests(input) 1231 if err != nil { 1232 if aerr, ok := err.(awserr.Error); ok { 1233 switch aerr.Code() { 1234 case devicefarm.ErrCodeArgumentException: 1235 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 1236 case devicefarm.ErrCodeNotFoundException: 1237 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 1238 case devicefarm.ErrCodeLimitExceededException: 1239 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 1240 case devicefarm.ErrCodeServiceAccountException: 1241 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 1242 default: 1243 fmt.Println(aerr.Error()) 1244 } 1245 } else { 1246 // Print the error, cast err to awserr.Error to get the Code and 1247 // Message from an error. 1248 fmt.Println(err.Error()) 1249 } 1250 return 1251 } 1252 1253 fmt.Println(result) 1254 } 1255 1256 // To get information about unique problems 1257 // 1258 // The following example returns information about unique problems, given a specific 1259 // Device Farm project. 1260 func ExampleDeviceFarm_ListUniqueProblems_shared00() { 1261 svc := devicefarm.New(session.New()) 1262 input := &devicefarm.ListUniqueProblemsInput{ 1263 Arn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:project:EXAMPLE-GUID-123-456"), 1264 NextToken: aws.String("RW5DdDJkMWYwZjM2MzM2VHVpOHJIUXlDUXlhc2QzRGViYnc9SEXAMPLE"), 1265 } 1266 1267 result, err := svc.ListUniqueProblems(input) 1268 if err != nil { 1269 if aerr, ok := err.(awserr.Error); ok { 1270 switch aerr.Code() { 1271 case devicefarm.ErrCodeArgumentException: 1272 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 1273 case devicefarm.ErrCodeNotFoundException: 1274 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 1275 case devicefarm.ErrCodeLimitExceededException: 1276 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 1277 case devicefarm.ErrCodeServiceAccountException: 1278 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 1279 default: 1280 fmt.Println(aerr.Error()) 1281 } 1282 } else { 1283 // Print the error, cast err to awserr.Error to get the Code and 1284 // Message from an error. 1285 fmt.Println(err.Error()) 1286 } 1287 return 1288 } 1289 1290 fmt.Println(result) 1291 } 1292 1293 // To get information about uploads 1294 // 1295 // The following example returns information about uploads, given a specific Device 1296 // Farm project. 1297 func ExampleDeviceFarm_ListUploads_shared00() { 1298 svc := devicefarm.New(session.New()) 1299 input := &devicefarm.ListUploadsInput{ 1300 Arn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:project:EXAMPLE-GUID-123-456"), 1301 NextToken: aws.String("RW5DdDJkMWYwZjM2MzM2VHVpOHJIUXlDUXlhc2QzRGViYnc9SEXAMPLE"), 1302 } 1303 1304 result, err := svc.ListUploads(input) 1305 if err != nil { 1306 if aerr, ok := err.(awserr.Error); ok { 1307 switch aerr.Code() { 1308 case devicefarm.ErrCodeArgumentException: 1309 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 1310 case devicefarm.ErrCodeNotFoundException: 1311 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 1312 case devicefarm.ErrCodeLimitExceededException: 1313 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 1314 case devicefarm.ErrCodeServiceAccountException: 1315 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 1316 default: 1317 fmt.Println(aerr.Error()) 1318 } 1319 } else { 1320 // Print the error, cast err to awserr.Error to get the Code and 1321 // Message from an error. 1322 fmt.Println(err.Error()) 1323 } 1324 return 1325 } 1326 1327 fmt.Println(result) 1328 } 1329 1330 // To purchase a device slot offering 1331 // 1332 // The following example purchases a specific device slot offering. 1333 func ExampleDeviceFarm_PurchaseOffering_shared00() { 1334 svc := devicefarm.New(session.New()) 1335 input := &devicefarm.PurchaseOfferingInput{ 1336 OfferingId: aws.String("D68B3C05-1BA6-4360-BC69-12345EXAMPLE"), 1337 Quantity: aws.Int64(1), 1338 } 1339 1340 result, err := svc.PurchaseOffering(input) 1341 if err != nil { 1342 if aerr, ok := err.(awserr.Error); ok { 1343 switch aerr.Code() { 1344 case devicefarm.ErrCodeArgumentException: 1345 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 1346 case devicefarm.ErrCodeNotFoundException: 1347 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 1348 case devicefarm.ErrCodeNotEligibleException: 1349 fmt.Println(devicefarm.ErrCodeNotEligibleException, aerr.Error()) 1350 case devicefarm.ErrCodeLimitExceededException: 1351 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 1352 case devicefarm.ErrCodeServiceAccountException: 1353 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 1354 default: 1355 fmt.Println(aerr.Error()) 1356 } 1357 } else { 1358 // Print the error, cast err to awserr.Error to get the Code and 1359 // Message from an error. 1360 fmt.Println(err.Error()) 1361 } 1362 return 1363 } 1364 1365 fmt.Println(result) 1366 } 1367 1368 // To renew a device slot offering 1369 // 1370 // The following example renews a specific device slot offering. 1371 func ExampleDeviceFarm_RenewOffering_shared00() { 1372 svc := devicefarm.New(session.New()) 1373 input := &devicefarm.RenewOfferingInput{ 1374 OfferingId: aws.String("D68B3C05-1BA6-4360-BC69-12345EXAMPLE"), 1375 Quantity: aws.Int64(1), 1376 } 1377 1378 result, err := svc.RenewOffering(input) 1379 if err != nil { 1380 if aerr, ok := err.(awserr.Error); ok { 1381 switch aerr.Code() { 1382 case devicefarm.ErrCodeArgumentException: 1383 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 1384 case devicefarm.ErrCodeNotFoundException: 1385 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 1386 case devicefarm.ErrCodeNotEligibleException: 1387 fmt.Println(devicefarm.ErrCodeNotEligibleException, aerr.Error()) 1388 case devicefarm.ErrCodeLimitExceededException: 1389 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 1390 case devicefarm.ErrCodeServiceAccountException: 1391 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 1392 default: 1393 fmt.Println(aerr.Error()) 1394 } 1395 } else { 1396 // Print the error, cast err to awserr.Error to get the Code and 1397 // Message from an error. 1398 fmt.Println(err.Error()) 1399 } 1400 return 1401 } 1402 1403 fmt.Println(result) 1404 } 1405 1406 // To schedule a test run 1407 // 1408 // The following example schedules a test run named MyRun. 1409 func ExampleDeviceFarm_ScheduleRun_shared00() { 1410 svc := devicefarm.New(session.New()) 1411 input := &devicefarm.ScheduleRunInput{ 1412 DevicePoolArn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:pool:EXAMPLE-GUID-123-456"), 1413 Name: aws.String("MyRun"), 1414 ProjectArn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:project:EXAMPLE-GUID-123-456"), 1415 Test: &devicefarm.ScheduleRunTest{ 1416 TestPackageArn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:test:EXAMPLE-GUID-123-456"), 1417 Type: aws.String("APPIUM_JAVA_JUNIT"), 1418 }, 1419 } 1420 1421 result, err := svc.ScheduleRun(input) 1422 if err != nil { 1423 if aerr, ok := err.(awserr.Error); ok { 1424 switch aerr.Code() { 1425 case devicefarm.ErrCodeArgumentException: 1426 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 1427 case devicefarm.ErrCodeNotFoundException: 1428 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 1429 case devicefarm.ErrCodeLimitExceededException: 1430 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 1431 case devicefarm.ErrCodeIdempotencyException: 1432 fmt.Println(devicefarm.ErrCodeIdempotencyException, aerr.Error()) 1433 case devicefarm.ErrCodeServiceAccountException: 1434 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 1435 default: 1436 fmt.Println(aerr.Error()) 1437 } 1438 } else { 1439 // Print the error, cast err to awserr.Error to get the Code and 1440 // Message from an error. 1441 fmt.Println(err.Error()) 1442 } 1443 return 1444 } 1445 1446 fmt.Println(result) 1447 } 1448 1449 // To stop a test run 1450 // 1451 // The following example stops a specific test run. 1452 func ExampleDeviceFarm_StopRun_shared00() { 1453 svc := devicefarm.New(session.New()) 1454 input := &devicefarm.StopRunInput{ 1455 Arn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:run:EXAMPLE-GUID-123-456"), 1456 } 1457 1458 result, err := svc.StopRun(input) 1459 if err != nil { 1460 if aerr, ok := err.(awserr.Error); ok { 1461 switch aerr.Code() { 1462 case devicefarm.ErrCodeArgumentException: 1463 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 1464 case devicefarm.ErrCodeNotFoundException: 1465 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 1466 case devicefarm.ErrCodeLimitExceededException: 1467 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 1468 case devicefarm.ErrCodeServiceAccountException: 1469 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 1470 default: 1471 fmt.Println(aerr.Error()) 1472 } 1473 } else { 1474 // Print the error, cast err to awserr.Error to get the Code and 1475 // Message from an error. 1476 fmt.Println(err.Error()) 1477 } 1478 return 1479 } 1480 1481 fmt.Println(result) 1482 } 1483 1484 // To update a device pool 1485 // 1486 // The following example updates the specified device pool with a new name and description. 1487 // It also enables remote access of devices in the device pool. 1488 func ExampleDeviceFarm_UpdateDevicePool_shared00() { 1489 svc := devicefarm.New(session.New()) 1490 input := &devicefarm.UpdateDevicePoolInput{ 1491 Arn: aws.String("arn:aws:devicefarm:us-west-2::devicepool:082d10e5-d7d7-48a5-ba5c-12345EXAMPLE"), 1492 Description: aws.String("NewDescription"), 1493 Name: aws.String("NewName"), 1494 Rules: []*devicefarm.Rule{ 1495 { 1496 Attribute: aws.String("REMOTE_ACCESS_ENABLED"), 1497 Operator: aws.String("EQUALS"), 1498 Value: aws.String("True"), 1499 }, 1500 }, 1501 } 1502 1503 result, err := svc.UpdateDevicePool(input) 1504 if err != nil { 1505 if aerr, ok := err.(awserr.Error); ok { 1506 switch aerr.Code() { 1507 case devicefarm.ErrCodeArgumentException: 1508 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 1509 case devicefarm.ErrCodeNotFoundException: 1510 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 1511 case devicefarm.ErrCodeLimitExceededException: 1512 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 1513 case devicefarm.ErrCodeServiceAccountException: 1514 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 1515 default: 1516 fmt.Println(aerr.Error()) 1517 } 1518 } else { 1519 // Print the error, cast err to awserr.Error to get the Code and 1520 // Message from an error. 1521 fmt.Println(err.Error()) 1522 } 1523 return 1524 } 1525 1526 fmt.Println(result) 1527 } 1528 1529 // To update a device pool 1530 // 1531 // The following example updates the specified project with a new name. 1532 func ExampleDeviceFarm_UpdateProject_shared00() { 1533 svc := devicefarm.New(session.New()) 1534 input := &devicefarm.UpdateProjectInput{ 1535 Arn: aws.String("arn:aws:devicefarm:us-west-2:123456789101:project:8f75187d-101e-4625-accc-12345EXAMPLE"), 1536 Name: aws.String("NewName"), 1537 } 1538 1539 result, err := svc.UpdateProject(input) 1540 if err != nil { 1541 if aerr, ok := err.(awserr.Error); ok { 1542 switch aerr.Code() { 1543 case devicefarm.ErrCodeArgumentException: 1544 fmt.Println(devicefarm.ErrCodeArgumentException, aerr.Error()) 1545 case devicefarm.ErrCodeNotFoundException: 1546 fmt.Println(devicefarm.ErrCodeNotFoundException, aerr.Error()) 1547 case devicefarm.ErrCodeLimitExceededException: 1548 fmt.Println(devicefarm.ErrCodeLimitExceededException, aerr.Error()) 1549 case devicefarm.ErrCodeServiceAccountException: 1550 fmt.Println(devicefarm.ErrCodeServiceAccountException, aerr.Error()) 1551 default: 1552 fmt.Println(aerr.Error()) 1553 } 1554 } else { 1555 // Print the error, cast err to awserr.Error to get the Code and 1556 // Message from an error. 1557 fmt.Println(err.Error()) 1558 } 1559 return 1560 } 1561 1562 fmt.Println(result) 1563 }