examples_test.go 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package sms_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/sms"
  10. )
  11. var _ time.Duration
  12. var _ bytes.Buffer
  13. func ExampleSMS_CreateReplicationJob() {
  14. sess, err := session.NewSession()
  15. if err != nil {
  16. fmt.Println("failed to create session,", err)
  17. return
  18. }
  19. svc := sms.New(sess)
  20. params := &sms.CreateReplicationJobInput{
  21. Frequency: aws.Int64(1), // Required
  22. SeedReplicationTime: aws.Time(time.Now()), // Required
  23. ServerId: aws.String("ServerId"), // Required
  24. Description: aws.String("Description"),
  25. LicenseType: aws.String("LicenseType"),
  26. RoleName: aws.String("RoleName"),
  27. }
  28. resp, err := svc.CreateReplicationJob(params)
  29. if err != nil {
  30. // Print the error, cast err to awserr.Error to get the Code and
  31. // Message from an error.
  32. fmt.Println(err.Error())
  33. return
  34. }
  35. // Pretty-print the response data.
  36. fmt.Println(resp)
  37. }
  38. func ExampleSMS_DeleteReplicationJob() {
  39. sess, err := session.NewSession()
  40. if err != nil {
  41. fmt.Println("failed to create session,", err)
  42. return
  43. }
  44. svc := sms.New(sess)
  45. params := &sms.DeleteReplicationJobInput{
  46. ReplicationJobId: aws.String("ReplicationJobId"), // Required
  47. }
  48. resp, err := svc.DeleteReplicationJob(params)
  49. if err != nil {
  50. // Print the error, cast err to awserr.Error to get the Code and
  51. // Message from an error.
  52. fmt.Println(err.Error())
  53. return
  54. }
  55. // Pretty-print the response data.
  56. fmt.Println(resp)
  57. }
  58. func ExampleSMS_DeleteServerCatalog() {
  59. sess, err := session.NewSession()
  60. if err != nil {
  61. fmt.Println("failed to create session,", err)
  62. return
  63. }
  64. svc := sms.New(sess)
  65. var params *sms.DeleteServerCatalogInput
  66. resp, err := svc.DeleteServerCatalog(params)
  67. if err != nil {
  68. // Print the error, cast err to awserr.Error to get the Code and
  69. // Message from an error.
  70. fmt.Println(err.Error())
  71. return
  72. }
  73. // Pretty-print the response data.
  74. fmt.Println(resp)
  75. }
  76. func ExampleSMS_DisassociateConnector() {
  77. sess, err := session.NewSession()
  78. if err != nil {
  79. fmt.Println("failed to create session,", err)
  80. return
  81. }
  82. svc := sms.New(sess)
  83. params := &sms.DisassociateConnectorInput{
  84. ConnectorId: aws.String("ConnectorId"), // Required
  85. }
  86. resp, err := svc.DisassociateConnector(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 ExampleSMS_GetConnectors() {
  97. sess, err := session.NewSession()
  98. if err != nil {
  99. fmt.Println("failed to create session,", err)
  100. return
  101. }
  102. svc := sms.New(sess)
  103. params := &sms.GetConnectorsInput{
  104. MaxResults: aws.Int64(1),
  105. NextToken: aws.String("NextToken"),
  106. }
  107. resp, err := svc.GetConnectors(params)
  108. if err != nil {
  109. // Print the error, cast err to awserr.Error to get the Code and
  110. // Message from an error.
  111. fmt.Println(err.Error())
  112. return
  113. }
  114. // Pretty-print the response data.
  115. fmt.Println(resp)
  116. }
  117. func ExampleSMS_GetReplicationJobs() {
  118. sess, err := session.NewSession()
  119. if err != nil {
  120. fmt.Println("failed to create session,", err)
  121. return
  122. }
  123. svc := sms.New(sess)
  124. params := &sms.GetReplicationJobsInput{
  125. MaxResults: aws.Int64(1),
  126. NextToken: aws.String("NextToken"),
  127. ReplicationJobId: aws.String("ReplicationJobId"),
  128. }
  129. resp, err := svc.GetReplicationJobs(params)
  130. if err != nil {
  131. // Print the error, cast err to awserr.Error to get the Code and
  132. // Message from an error.
  133. fmt.Println(err.Error())
  134. return
  135. }
  136. // Pretty-print the response data.
  137. fmt.Println(resp)
  138. }
  139. func ExampleSMS_GetReplicationRuns() {
  140. sess, err := session.NewSession()
  141. if err != nil {
  142. fmt.Println("failed to create session,", err)
  143. return
  144. }
  145. svc := sms.New(sess)
  146. params := &sms.GetReplicationRunsInput{
  147. ReplicationJobId: aws.String("ReplicationJobId"), // Required
  148. MaxResults: aws.Int64(1),
  149. NextToken: aws.String("NextToken"),
  150. }
  151. resp, err := svc.GetReplicationRuns(params)
  152. if err != nil {
  153. // Print the error, cast err to awserr.Error to get the Code and
  154. // Message from an error.
  155. fmt.Println(err.Error())
  156. return
  157. }
  158. // Pretty-print the response data.
  159. fmt.Println(resp)
  160. }
  161. func ExampleSMS_GetServers() {
  162. sess, err := session.NewSession()
  163. if err != nil {
  164. fmt.Println("failed to create session,", err)
  165. return
  166. }
  167. svc := sms.New(sess)
  168. params := &sms.GetServersInput{
  169. MaxResults: aws.Int64(1),
  170. NextToken: aws.String("NextToken"),
  171. }
  172. resp, err := svc.GetServers(params)
  173. if err != nil {
  174. // Print the error, cast err to awserr.Error to get the Code and
  175. // Message from an error.
  176. fmt.Println(err.Error())
  177. return
  178. }
  179. // Pretty-print the response data.
  180. fmt.Println(resp)
  181. }
  182. func ExampleSMS_ImportServerCatalog() {
  183. sess, err := session.NewSession()
  184. if err != nil {
  185. fmt.Println("failed to create session,", err)
  186. return
  187. }
  188. svc := sms.New(sess)
  189. var params *sms.ImportServerCatalogInput
  190. resp, err := svc.ImportServerCatalog(params)
  191. if err != nil {
  192. // Print the error, cast err to awserr.Error to get the Code and
  193. // Message from an error.
  194. fmt.Println(err.Error())
  195. return
  196. }
  197. // Pretty-print the response data.
  198. fmt.Println(resp)
  199. }
  200. func ExampleSMS_StartOnDemandReplicationRun() {
  201. sess, err := session.NewSession()
  202. if err != nil {
  203. fmt.Println("failed to create session,", err)
  204. return
  205. }
  206. svc := sms.New(sess)
  207. params := &sms.StartOnDemandReplicationRunInput{
  208. ReplicationJobId: aws.String("ReplicationJobId"), // Required
  209. Description: aws.String("Description"),
  210. }
  211. resp, err := svc.StartOnDemandReplicationRun(params)
  212. if err != nil {
  213. // Print the error, cast err to awserr.Error to get the Code and
  214. // Message from an error.
  215. fmt.Println(err.Error())
  216. return
  217. }
  218. // Pretty-print the response data.
  219. fmt.Println(resp)
  220. }
  221. func ExampleSMS_UpdateReplicationJob() {
  222. sess, err := session.NewSession()
  223. if err != nil {
  224. fmt.Println("failed to create session,", err)
  225. return
  226. }
  227. svc := sms.New(sess)
  228. params := &sms.UpdateReplicationJobInput{
  229. ReplicationJobId: aws.String("ReplicationJobId"), // Required
  230. Description: aws.String("Description"),
  231. Frequency: aws.Int64(1),
  232. LicenseType: aws.String("LicenseType"),
  233. NextReplicationRunStartTime: aws.Time(time.Now()),
  234. RoleName: aws.String("RoleName"),
  235. }
  236. resp, err := svc.UpdateReplicationJob(params)
  237. if err != nil {
  238. // Print the error, cast err to awserr.Error to get the Code and
  239. // Message from an error.
  240. fmt.Println(err.Error())
  241. return
  242. }
  243. // Pretty-print the response data.
  244. fmt.Println(resp)
  245. }