examples_test.go 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package workspaces_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/workspaces"
  9. )
  10. var _ time.Duration
  11. var _ bytes.Buffer
  12. func ExampleWorkSpaces_CreateWorkspaces() {
  13. svc := workspaces.New(nil)
  14. params := &workspaces.CreateWorkspacesInput{
  15. Workspaces: []*workspaces.WorkspaceRequest{ // Required
  16. { // Required
  17. BundleId: aws.String("BundleId"), // Required
  18. DirectoryId: aws.String("DirectoryId"), // Required
  19. UserName: aws.String("UserName"), // Required
  20. },
  21. // More values...
  22. },
  23. }
  24. resp, err := svc.CreateWorkspaces(params)
  25. if err != nil {
  26. // Print the error, cast err to awserr.Error to get the Code and
  27. // Message from an error.
  28. fmt.Println(err.Error())
  29. return
  30. }
  31. // Pretty-print the response data.
  32. fmt.Println(resp)
  33. }
  34. func ExampleWorkSpaces_DescribeWorkspaceBundles() {
  35. svc := workspaces.New(nil)
  36. params := &workspaces.DescribeWorkspaceBundlesInput{
  37. BundleIds: []*string{
  38. aws.String("BundleId"), // Required
  39. // More values...
  40. },
  41. NextToken: aws.String("PaginationToken"),
  42. Owner: aws.String("BundleOwner"),
  43. }
  44. resp, err := svc.DescribeWorkspaceBundles(params)
  45. if err != nil {
  46. // Print the error, cast err to awserr.Error to get the Code and
  47. // Message from an error.
  48. fmt.Println(err.Error())
  49. return
  50. }
  51. // Pretty-print the response data.
  52. fmt.Println(resp)
  53. }
  54. func ExampleWorkSpaces_DescribeWorkspaceDirectories() {
  55. svc := workspaces.New(nil)
  56. params := &workspaces.DescribeWorkspaceDirectoriesInput{
  57. DirectoryIds: []*string{
  58. aws.String("DirectoryId"), // Required
  59. // More values...
  60. },
  61. NextToken: aws.String("PaginationToken"),
  62. }
  63. resp, err := svc.DescribeWorkspaceDirectories(params)
  64. if err != nil {
  65. // Print the error, cast err to awserr.Error to get the Code and
  66. // Message from an error.
  67. fmt.Println(err.Error())
  68. return
  69. }
  70. // Pretty-print the response data.
  71. fmt.Println(resp)
  72. }
  73. func ExampleWorkSpaces_DescribeWorkspaces() {
  74. svc := workspaces.New(nil)
  75. params := &workspaces.DescribeWorkspacesInput{
  76. BundleId: aws.String("BundleId"),
  77. DirectoryId: aws.String("DirectoryId"),
  78. Limit: aws.Int64(1),
  79. NextToken: aws.String("PaginationToken"),
  80. UserName: aws.String("UserName"),
  81. WorkspaceIds: []*string{
  82. aws.String("WorkspaceId"), // Required
  83. // More values...
  84. },
  85. }
  86. resp, err := svc.DescribeWorkspaces(params)
  87. if err != nil {
  88. // Print the error, cast err to awserr.Error to get the Code and
  89. // Message from an error.
  90. fmt.Println(err.Error())
  91. return
  92. }
  93. // Pretty-print the response data.
  94. fmt.Println(resp)
  95. }
  96. func ExampleWorkSpaces_RebootWorkspaces() {
  97. svc := workspaces.New(nil)
  98. params := &workspaces.RebootWorkspacesInput{
  99. RebootWorkspaceRequests: []*workspaces.RebootRequest{ // Required
  100. { // Required
  101. WorkspaceId: aws.String("WorkspaceId"), // Required
  102. },
  103. // More values...
  104. },
  105. }
  106. resp, err := svc.RebootWorkspaces(params)
  107. if err != nil {
  108. // Print the error, cast err to awserr.Error to get the Code and
  109. // Message from an error.
  110. fmt.Println(err.Error())
  111. return
  112. }
  113. // Pretty-print the response data.
  114. fmt.Println(resp)
  115. }
  116. func ExampleWorkSpaces_RebuildWorkspaces() {
  117. svc := workspaces.New(nil)
  118. params := &workspaces.RebuildWorkspacesInput{
  119. RebuildWorkspaceRequests: []*workspaces.RebuildRequest{ // Required
  120. { // Required
  121. WorkspaceId: aws.String("WorkspaceId"), // Required
  122. },
  123. // More values...
  124. },
  125. }
  126. resp, err := svc.RebuildWorkspaces(params)
  127. if err != nil {
  128. // Print the error, cast err to awserr.Error to get the Code and
  129. // Message from an error.
  130. fmt.Println(err.Error())
  131. return
  132. }
  133. // Pretty-print the response data.
  134. fmt.Println(resp)
  135. }
  136. func ExampleWorkSpaces_TerminateWorkspaces() {
  137. svc := workspaces.New(nil)
  138. params := &workspaces.TerminateWorkspacesInput{
  139. TerminateWorkspaceRequests: []*workspaces.TerminateRequest{ // Required
  140. { // Required
  141. WorkspaceId: aws.String("WorkspaceId"), // Required
  142. },
  143. // More values...
  144. },
  145. }
  146. resp, err := svc.TerminateWorkspaces(params)
  147. if err != nil {
  148. // Print the error, cast err to awserr.Error to get the Code and
  149. // Message from an error.
  150. fmt.Println(err.Error())
  151. return
  152. }
  153. // Pretty-print the response data.
  154. fmt.Println(resp)
  155. }