examples_test.go 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package applicationdiscoveryservice_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/applicationdiscoveryservice"
  10. )
  11. var _ time.Duration
  12. var _ bytes.Buffer
  13. func ExampleApplicationDiscoveryService_CreateTags() {
  14. sess, err := session.NewSession()
  15. if err != nil {
  16. fmt.Println("failed to create session,", err)
  17. return
  18. }
  19. svc := applicationdiscoveryservice.New(sess)
  20. params := &applicationdiscoveryservice.CreateTagsInput{
  21. ConfigurationIds: []*string{ // Required
  22. aws.String("ConfigurationId"), // Required
  23. // More values...
  24. },
  25. Tags: []*applicationdiscoveryservice.Tag{ // Required
  26. { // Required
  27. Key: aws.String("TagKey"), // Required
  28. Value: aws.String("TagValue"), // Required
  29. },
  30. // More values...
  31. },
  32. }
  33. resp, err := svc.CreateTags(params)
  34. if err != nil {
  35. // Print the error, cast err to awserr.Error to get the Code and
  36. // Message from an error.
  37. fmt.Println(err.Error())
  38. return
  39. }
  40. // Pretty-print the response data.
  41. fmt.Println(resp)
  42. }
  43. func ExampleApplicationDiscoveryService_DeleteTags() {
  44. sess, err := session.NewSession()
  45. if err != nil {
  46. fmt.Println("failed to create session,", err)
  47. return
  48. }
  49. svc := applicationdiscoveryservice.New(sess)
  50. params := &applicationdiscoveryservice.DeleteTagsInput{
  51. ConfigurationIds: []*string{ // Required
  52. aws.String("ConfigurationId"), // Required
  53. // More values...
  54. },
  55. Tags: []*applicationdiscoveryservice.Tag{
  56. { // Required
  57. Key: aws.String("TagKey"), // Required
  58. Value: aws.String("TagValue"), // Required
  59. },
  60. // More values...
  61. },
  62. }
  63. resp, err := svc.DeleteTags(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 ExampleApplicationDiscoveryService_DescribeAgents() {
  74. sess, err := session.NewSession()
  75. if err != nil {
  76. fmt.Println("failed to create session,", err)
  77. return
  78. }
  79. svc := applicationdiscoveryservice.New(sess)
  80. params := &applicationdiscoveryservice.DescribeAgentsInput{
  81. AgentIds: []*string{
  82. aws.String("AgentId"), // Required
  83. // More values...
  84. },
  85. MaxResults: aws.Int64(1),
  86. NextToken: aws.String("NextToken"),
  87. }
  88. resp, err := svc.DescribeAgents(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 ExampleApplicationDiscoveryService_DescribeConfigurations() {
  99. sess, err := session.NewSession()
  100. if err != nil {
  101. fmt.Println("failed to create session,", err)
  102. return
  103. }
  104. svc := applicationdiscoveryservice.New(sess)
  105. params := &applicationdiscoveryservice.DescribeConfigurationsInput{
  106. ConfigurationIds: []*string{ // Required
  107. aws.String("ConfigurationId"), // Required
  108. // More values...
  109. },
  110. }
  111. resp, err := svc.DescribeConfigurations(params)
  112. if err != nil {
  113. // Print the error, cast err to awserr.Error to get the Code and
  114. // Message from an error.
  115. fmt.Println(err.Error())
  116. return
  117. }
  118. // Pretty-print the response data.
  119. fmt.Println(resp)
  120. }
  121. func ExampleApplicationDiscoveryService_DescribeExportConfigurations() {
  122. sess, err := session.NewSession()
  123. if err != nil {
  124. fmt.Println("failed to create session,", err)
  125. return
  126. }
  127. svc := applicationdiscoveryservice.New(sess)
  128. params := &applicationdiscoveryservice.DescribeExportConfigurationsInput{
  129. ExportIds: []*string{
  130. aws.String("ConfigurationsExportId"), // Required
  131. // More values...
  132. },
  133. MaxResults: aws.Int64(1),
  134. NextToken: aws.String("NextToken"),
  135. }
  136. resp, err := svc.DescribeExportConfigurations(params)
  137. if err != nil {
  138. // Print the error, cast err to awserr.Error to get the Code and
  139. // Message from an error.
  140. fmt.Println(err.Error())
  141. return
  142. }
  143. // Pretty-print the response data.
  144. fmt.Println(resp)
  145. }
  146. func ExampleApplicationDiscoveryService_DescribeTags() {
  147. sess, err := session.NewSession()
  148. if err != nil {
  149. fmt.Println("failed to create session,", err)
  150. return
  151. }
  152. svc := applicationdiscoveryservice.New(sess)
  153. params := &applicationdiscoveryservice.DescribeTagsInput{
  154. Filters: []*applicationdiscoveryservice.TagFilter{
  155. { // Required
  156. Name: aws.String("FilterName"), // Required
  157. Values: []*string{ // Required
  158. aws.String("FilterValue"), // Required
  159. // More values...
  160. },
  161. },
  162. // More values...
  163. },
  164. MaxResults: aws.Int64(1),
  165. NextToken: aws.String("NextToken"),
  166. }
  167. resp, err := svc.DescribeTags(params)
  168. if err != nil {
  169. // Print the error, cast err to awserr.Error to get the Code and
  170. // Message from an error.
  171. fmt.Println(err.Error())
  172. return
  173. }
  174. // Pretty-print the response data.
  175. fmt.Println(resp)
  176. }
  177. func ExampleApplicationDiscoveryService_ExportConfigurations() {
  178. sess, err := session.NewSession()
  179. if err != nil {
  180. fmt.Println("failed to create session,", err)
  181. return
  182. }
  183. svc := applicationdiscoveryservice.New(sess)
  184. var params *applicationdiscoveryservice.ExportConfigurationsInput
  185. resp, err := svc.ExportConfigurations(params)
  186. if err != nil {
  187. // Print the error, cast err to awserr.Error to get the Code and
  188. // Message from an error.
  189. fmt.Println(err.Error())
  190. return
  191. }
  192. // Pretty-print the response data.
  193. fmt.Println(resp)
  194. }
  195. func ExampleApplicationDiscoveryService_ListConfigurations() {
  196. sess, err := session.NewSession()
  197. if err != nil {
  198. fmt.Println("failed to create session,", err)
  199. return
  200. }
  201. svc := applicationdiscoveryservice.New(sess)
  202. params := &applicationdiscoveryservice.ListConfigurationsInput{
  203. ConfigurationType: aws.String("ConfigurationItemType"), // Required
  204. Filters: []*applicationdiscoveryservice.Filter{
  205. { // Required
  206. Condition: aws.String("Condition"), // Required
  207. Name: aws.String("String"), // Required
  208. Values: []*string{ // Required
  209. aws.String("FilterValue"), // Required
  210. // More values...
  211. },
  212. },
  213. // More values...
  214. },
  215. MaxResults: aws.Int64(1),
  216. NextToken: aws.String("NextToken"),
  217. }
  218. resp, err := svc.ListConfigurations(params)
  219. if err != nil {
  220. // Print the error, cast err to awserr.Error to get the Code and
  221. // Message from an error.
  222. fmt.Println(err.Error())
  223. return
  224. }
  225. // Pretty-print the response data.
  226. fmt.Println(resp)
  227. }
  228. func ExampleApplicationDiscoveryService_StartDataCollectionByAgentIds() {
  229. sess, err := session.NewSession()
  230. if err != nil {
  231. fmt.Println("failed to create session,", err)
  232. return
  233. }
  234. svc := applicationdiscoveryservice.New(sess)
  235. params := &applicationdiscoveryservice.StartDataCollectionByAgentIdsInput{
  236. AgentIds: []*string{ // Required
  237. aws.String("AgentId"), // Required
  238. // More values...
  239. },
  240. }
  241. resp, err := svc.StartDataCollectionByAgentIds(params)
  242. if err != nil {
  243. // Print the error, cast err to awserr.Error to get the Code and
  244. // Message from an error.
  245. fmt.Println(err.Error())
  246. return
  247. }
  248. // Pretty-print the response data.
  249. fmt.Println(resp)
  250. }
  251. func ExampleApplicationDiscoveryService_StopDataCollectionByAgentIds() {
  252. sess, err := session.NewSession()
  253. if err != nil {
  254. fmt.Println("failed to create session,", err)
  255. return
  256. }
  257. svc := applicationdiscoveryservice.New(sess)
  258. params := &applicationdiscoveryservice.StopDataCollectionByAgentIdsInput{
  259. AgentIds: []*string{ // Required
  260. aws.String("AgentId"), // Required
  261. // More values...
  262. },
  263. }
  264. resp, err := svc.StopDataCollectionByAgentIds(params)
  265. if err != nil {
  266. // Print the error, cast err to awserr.Error to get the Code and
  267. // Message from an error.
  268. fmt.Println(err.Error())
  269. return
  270. }
  271. // Pretty-print the response data.
  272. fmt.Println(resp)
  273. }