examples_test.go 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package configservice_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/configservice"
  9. )
  10. var _ time.Duration
  11. var _ bytes.Buffer
  12. func ExampleConfigService_DeleteDeliveryChannel() {
  13. svc := configservice.New(nil)
  14. params := &configservice.DeleteDeliveryChannelInput{
  15. DeliveryChannelName: aws.String("ChannelName"), // Required
  16. }
  17. resp, err := svc.DeleteDeliveryChannel(params)
  18. if err != nil {
  19. // Print the error, cast err to awserr.Error to get the Code and
  20. // Message from an error.
  21. fmt.Println(err.Error())
  22. return
  23. }
  24. // Pretty-print the response data.
  25. fmt.Println(resp)
  26. }
  27. func ExampleConfigService_DeliverConfigSnapshot() {
  28. svc := configservice.New(nil)
  29. params := &configservice.DeliverConfigSnapshotInput{
  30. DeliveryChannelName: aws.String("ChannelName"), // Required
  31. }
  32. resp, err := svc.DeliverConfigSnapshot(params)
  33. if err != nil {
  34. // Print the error, cast err to awserr.Error to get the Code and
  35. // Message from an error.
  36. fmt.Println(err.Error())
  37. return
  38. }
  39. // Pretty-print the response data.
  40. fmt.Println(resp)
  41. }
  42. func ExampleConfigService_DescribeConfigurationRecorderStatus() {
  43. svc := configservice.New(nil)
  44. params := &configservice.DescribeConfigurationRecorderStatusInput{
  45. ConfigurationRecorderNames: []*string{
  46. aws.String("RecorderName"), // Required
  47. // More values...
  48. },
  49. }
  50. resp, err := svc.DescribeConfigurationRecorderStatus(params)
  51. if err != nil {
  52. // Print the error, cast err to awserr.Error to get the Code and
  53. // Message from an error.
  54. fmt.Println(err.Error())
  55. return
  56. }
  57. // Pretty-print the response data.
  58. fmt.Println(resp)
  59. }
  60. func ExampleConfigService_DescribeConfigurationRecorders() {
  61. svc := configservice.New(nil)
  62. params := &configservice.DescribeConfigurationRecordersInput{
  63. ConfigurationRecorderNames: []*string{
  64. aws.String("RecorderName"), // Required
  65. // More values...
  66. },
  67. }
  68. resp, err := svc.DescribeConfigurationRecorders(params)
  69. if err != nil {
  70. // Print the error, cast err to awserr.Error to get the Code and
  71. // Message from an error.
  72. fmt.Println(err.Error())
  73. return
  74. }
  75. // Pretty-print the response data.
  76. fmt.Println(resp)
  77. }
  78. func ExampleConfigService_DescribeDeliveryChannelStatus() {
  79. svc := configservice.New(nil)
  80. params := &configservice.DescribeDeliveryChannelStatusInput{
  81. DeliveryChannelNames: []*string{
  82. aws.String("ChannelName"), // Required
  83. // More values...
  84. },
  85. }
  86. resp, err := svc.DescribeDeliveryChannelStatus(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 ExampleConfigService_DescribeDeliveryChannels() {
  97. svc := configservice.New(nil)
  98. params := &configservice.DescribeDeliveryChannelsInput{
  99. DeliveryChannelNames: []*string{
  100. aws.String("ChannelName"), // Required
  101. // More values...
  102. },
  103. }
  104. resp, err := svc.DescribeDeliveryChannels(params)
  105. if err != nil {
  106. // Print the error, cast err to awserr.Error to get the Code and
  107. // Message from an error.
  108. fmt.Println(err.Error())
  109. return
  110. }
  111. // Pretty-print the response data.
  112. fmt.Println(resp)
  113. }
  114. func ExampleConfigService_GetResourceConfigHistory() {
  115. svc := configservice.New(nil)
  116. params := &configservice.GetResourceConfigHistoryInput{
  117. ResourceId: aws.String("ResourceId"), // Required
  118. ResourceType: aws.String("ResourceType"), // Required
  119. ChronologicalOrder: aws.String("ChronologicalOrder"),
  120. EarlierTime: aws.Time(time.Now()),
  121. LaterTime: aws.Time(time.Now()),
  122. Limit: aws.Int64(1),
  123. NextToken: aws.String("NextToken"),
  124. }
  125. resp, err := svc.GetResourceConfigHistory(params)
  126. if err != nil {
  127. // Print the error, cast err to awserr.Error to get the Code and
  128. // Message from an error.
  129. fmt.Println(err.Error())
  130. return
  131. }
  132. // Pretty-print the response data.
  133. fmt.Println(resp)
  134. }
  135. func ExampleConfigService_ListDiscoveredResources() {
  136. svc := configservice.New(nil)
  137. params := &configservice.ListDiscoveredResourcesInput{
  138. ResourceType: aws.String("ResourceType"), // Required
  139. IncludeDeletedResources: aws.Bool(true),
  140. Limit: aws.Int64(1),
  141. NextToken: aws.String("NextToken"),
  142. ResourceIds: []*string{
  143. aws.String("ResourceId"), // Required
  144. // More values...
  145. },
  146. ResourceName: aws.String("ResourceName"),
  147. }
  148. resp, err := svc.ListDiscoveredResources(params)
  149. if err != nil {
  150. // Print the error, cast err to awserr.Error to get the Code and
  151. // Message from an error.
  152. fmt.Println(err.Error())
  153. return
  154. }
  155. // Pretty-print the response data.
  156. fmt.Println(resp)
  157. }
  158. func ExampleConfigService_PutConfigurationRecorder() {
  159. svc := configservice.New(nil)
  160. params := &configservice.PutConfigurationRecorderInput{
  161. ConfigurationRecorder: &configservice.ConfigurationRecorder{ // Required
  162. Name: aws.String("RecorderName"),
  163. RecordingGroup: &configservice.RecordingGroup{
  164. AllSupported: aws.Bool(true),
  165. ResourceTypes: []*string{
  166. aws.String("ResourceType"), // Required
  167. // More values...
  168. },
  169. },
  170. RoleARN: aws.String("String"),
  171. },
  172. }
  173. resp, err := svc.PutConfigurationRecorder(params)
  174. if err != nil {
  175. // Print the error, cast err to awserr.Error to get the Code and
  176. // Message from an error.
  177. fmt.Println(err.Error())
  178. return
  179. }
  180. // Pretty-print the response data.
  181. fmt.Println(resp)
  182. }
  183. func ExampleConfigService_PutDeliveryChannel() {
  184. svc := configservice.New(nil)
  185. params := &configservice.PutDeliveryChannelInput{
  186. DeliveryChannel: &configservice.DeliveryChannel{ // Required
  187. Name: aws.String("ChannelName"),
  188. S3BucketName: aws.String("String"),
  189. S3KeyPrefix: aws.String("String"),
  190. SnsTopicARN: aws.String("String"),
  191. },
  192. }
  193. resp, err := svc.PutDeliveryChannel(params)
  194. if err != nil {
  195. // Print the error, cast err to awserr.Error to get the Code and
  196. // Message from an error.
  197. fmt.Println(err.Error())
  198. return
  199. }
  200. // Pretty-print the response data.
  201. fmt.Println(resp)
  202. }
  203. func ExampleConfigService_StartConfigurationRecorder() {
  204. svc := configservice.New(nil)
  205. params := &configservice.StartConfigurationRecorderInput{
  206. ConfigurationRecorderName: aws.String("RecorderName"), // Required
  207. }
  208. resp, err := svc.StartConfigurationRecorder(params)
  209. if err != nil {
  210. // Print the error, cast err to awserr.Error to get the Code and
  211. // Message from an error.
  212. fmt.Println(err.Error())
  213. return
  214. }
  215. // Pretty-print the response data.
  216. fmt.Println(resp)
  217. }
  218. func ExampleConfigService_StopConfigurationRecorder() {
  219. svc := configservice.New(nil)
  220. params := &configservice.StopConfigurationRecorderInput{
  221. ConfigurationRecorderName: aws.String("RecorderName"), // Required
  222. }
  223. resp, err := svc.StopConfigurationRecorder(params)
  224. if err != nil {
  225. // Print the error, cast err to awserr.Error to get the Code and
  226. // Message from an error.
  227. fmt.Println(err.Error())
  228. return
  229. }
  230. // Pretty-print the response data.
  231. fmt.Println(resp)
  232. }