examples_test.go 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package ssm_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/ssm"
  9. )
  10. var _ time.Duration
  11. var _ bytes.Buffer
  12. func ExampleSSM_CreateAssociation() {
  13. svc := ssm.New(nil)
  14. params := &ssm.CreateAssociationInput{
  15. InstanceId: aws.String("InstanceId"), // Required
  16. Name: aws.String("DocumentName"), // Required
  17. }
  18. resp, err := svc.CreateAssociation(params)
  19. if err != nil {
  20. // Print the error, cast err to awserr.Error to get the Code and
  21. // Message from an error.
  22. fmt.Println(err.Error())
  23. return
  24. }
  25. // Pretty-print the response data.
  26. fmt.Println(resp)
  27. }
  28. func ExampleSSM_CreateAssociationBatch() {
  29. svc := ssm.New(nil)
  30. params := &ssm.CreateAssociationBatchInput{
  31. Entries: []*ssm.CreateAssociationBatchRequestEntry{ // Required
  32. { // Required
  33. InstanceId: aws.String("InstanceId"),
  34. Name: aws.String("DocumentName"),
  35. },
  36. // More values...
  37. },
  38. }
  39. resp, err := svc.CreateAssociationBatch(params)
  40. if err != nil {
  41. // Print the error, cast err to awserr.Error to get the Code and
  42. // Message from an error.
  43. fmt.Println(err.Error())
  44. return
  45. }
  46. // Pretty-print the response data.
  47. fmt.Println(resp)
  48. }
  49. func ExampleSSM_CreateDocument() {
  50. svc := ssm.New(nil)
  51. params := &ssm.CreateDocumentInput{
  52. Content: aws.String("DocumentContent"), // Required
  53. Name: aws.String("DocumentName"), // Required
  54. }
  55. resp, err := svc.CreateDocument(params)
  56. if err != nil {
  57. // Print the error, cast err to awserr.Error to get the Code and
  58. // Message from an error.
  59. fmt.Println(err.Error())
  60. return
  61. }
  62. // Pretty-print the response data.
  63. fmt.Println(resp)
  64. }
  65. func ExampleSSM_DeleteAssociation() {
  66. svc := ssm.New(nil)
  67. params := &ssm.DeleteAssociationInput{
  68. InstanceId: aws.String("InstanceId"), // Required
  69. Name: aws.String("DocumentName"), // Required
  70. }
  71. resp, err := svc.DeleteAssociation(params)
  72. if err != nil {
  73. // Print the error, cast err to awserr.Error to get the Code and
  74. // Message from an error.
  75. fmt.Println(err.Error())
  76. return
  77. }
  78. // Pretty-print the response data.
  79. fmt.Println(resp)
  80. }
  81. func ExampleSSM_DeleteDocument() {
  82. svc := ssm.New(nil)
  83. params := &ssm.DeleteDocumentInput{
  84. Name: aws.String("DocumentName"), // Required
  85. }
  86. resp, err := svc.DeleteDocument(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 ExampleSSM_DescribeAssociation() {
  97. svc := ssm.New(nil)
  98. params := &ssm.DescribeAssociationInput{
  99. InstanceId: aws.String("InstanceId"), // Required
  100. Name: aws.String("DocumentName"), // Required
  101. }
  102. resp, err := svc.DescribeAssociation(params)
  103. if err != nil {
  104. // Print the error, cast err to awserr.Error to get the Code and
  105. // Message from an error.
  106. fmt.Println(err.Error())
  107. return
  108. }
  109. // Pretty-print the response data.
  110. fmt.Println(resp)
  111. }
  112. func ExampleSSM_DescribeDocument() {
  113. svc := ssm.New(nil)
  114. params := &ssm.DescribeDocumentInput{
  115. Name: aws.String("DocumentName"), // Required
  116. }
  117. resp, err := svc.DescribeDocument(params)
  118. if err != nil {
  119. // Print the error, cast err to awserr.Error to get the Code and
  120. // Message from an error.
  121. fmt.Println(err.Error())
  122. return
  123. }
  124. // Pretty-print the response data.
  125. fmt.Println(resp)
  126. }
  127. func ExampleSSM_GetDocument() {
  128. svc := ssm.New(nil)
  129. params := &ssm.GetDocumentInput{
  130. Name: aws.String("DocumentName"), // Required
  131. }
  132. resp, err := svc.GetDocument(params)
  133. if err != nil {
  134. // Print the error, cast err to awserr.Error to get the Code and
  135. // Message from an error.
  136. fmt.Println(err.Error())
  137. return
  138. }
  139. // Pretty-print the response data.
  140. fmt.Println(resp)
  141. }
  142. func ExampleSSM_ListAssociations() {
  143. svc := ssm.New(nil)
  144. params := &ssm.ListAssociationsInput{
  145. AssociationFilterList: []*ssm.AssociationFilter{ // Required
  146. { // Required
  147. Key: aws.String("AssociationFilterKey"), // Required
  148. Value: aws.String("AssociationFilterValue"), // Required
  149. },
  150. // More values...
  151. },
  152. MaxResults: aws.Int64(1),
  153. NextToken: aws.String("NextToken"),
  154. }
  155. resp, err := svc.ListAssociations(params)
  156. if err != nil {
  157. // Print the error, cast err to awserr.Error to get the Code and
  158. // Message from an error.
  159. fmt.Println(err.Error())
  160. return
  161. }
  162. // Pretty-print the response data.
  163. fmt.Println(resp)
  164. }
  165. func ExampleSSM_ListDocuments() {
  166. svc := ssm.New(nil)
  167. params := &ssm.ListDocumentsInput{
  168. DocumentFilterList: []*ssm.DocumentFilter{
  169. { // Required
  170. Key: aws.String("DocumentFilterKey"), // Required
  171. Value: aws.String("DocumentFilterValue"), // Required
  172. },
  173. // More values...
  174. },
  175. MaxResults: aws.Int64(1),
  176. NextToken: aws.String("NextToken"),
  177. }
  178. resp, err := svc.ListDocuments(params)
  179. if err != nil {
  180. // Print the error, cast err to awserr.Error to get the Code and
  181. // Message from an error.
  182. fmt.Println(err.Error())
  183. return
  184. }
  185. // Pretty-print the response data.
  186. fmt.Println(resp)
  187. }
  188. func ExampleSSM_UpdateAssociationStatus() {
  189. svc := ssm.New(nil)
  190. params := &ssm.UpdateAssociationStatusInput{
  191. AssociationStatus: &ssm.AssociationStatus{ // Required
  192. Date: aws.Time(time.Now()), // Required
  193. Message: aws.String("StatusMessage"), // Required
  194. Name: aws.String("AssociationStatusName"), // Required
  195. AdditionalInfo: aws.String("StatusAdditionalInfo"),
  196. },
  197. InstanceId: aws.String("InstanceId"), // Required
  198. Name: aws.String("DocumentName"), // Required
  199. }
  200. resp, err := svc.UpdateAssociationStatus(params)
  201. if err != nil {
  202. // Print the error, cast err to awserr.Error to get the Code and
  203. // Message from an error.
  204. fmt.Println(err.Error())
  205. return
  206. }
  207. // Pretty-print the response data.
  208. fmt.Println(resp)
  209. }