examples_test.go 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package cloudhsm_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/cloudhsm"
  9. )
  10. var _ time.Duration
  11. var _ bytes.Buffer
  12. func ExampleCloudHSM_CreateHapg() {
  13. svc := cloudhsm.New(nil)
  14. params := &cloudhsm.CreateHapgInput{
  15. Label: aws.String("Label"), // Required
  16. }
  17. resp, err := svc.CreateHapg(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 ExampleCloudHSM_CreateHsm() {
  28. svc := cloudhsm.New(nil)
  29. params := &cloudhsm.CreateHsmInput{
  30. IamRoleArn: aws.String("IamRoleArn"), // Required
  31. SshKey: aws.String("SshKey"), // Required
  32. SubnetId: aws.String("SubnetId"), // Required
  33. SubscriptionType: aws.String("SubscriptionType"), // Required
  34. ClientToken: aws.String("ClientToken"),
  35. EniIp: aws.String("IpAddress"),
  36. ExternalId: aws.String("ExternalId"),
  37. SyslogIp: aws.String("IpAddress"),
  38. }
  39. resp, err := svc.CreateHsm(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 ExampleCloudHSM_CreateLunaClient() {
  50. svc := cloudhsm.New(nil)
  51. params := &cloudhsm.CreateLunaClientInput{
  52. Certificate: aws.String("Certificate"), // Required
  53. Label: aws.String("ClientLabel"),
  54. }
  55. resp, err := svc.CreateLunaClient(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 ExampleCloudHSM_DeleteHapg() {
  66. svc := cloudhsm.New(nil)
  67. params := &cloudhsm.DeleteHapgInput{
  68. HapgArn: aws.String("HapgArn"), // Required
  69. }
  70. resp, err := svc.DeleteHapg(params)
  71. if err != nil {
  72. // Print the error, cast err to awserr.Error to get the Code and
  73. // Message from an error.
  74. fmt.Println(err.Error())
  75. return
  76. }
  77. // Pretty-print the response data.
  78. fmt.Println(resp)
  79. }
  80. func ExampleCloudHSM_DeleteHsm() {
  81. svc := cloudhsm.New(nil)
  82. params := &cloudhsm.DeleteHsmInput{
  83. HsmArn: aws.String("HsmArn"), // Required
  84. }
  85. resp, err := svc.DeleteHsm(params)
  86. if err != nil {
  87. // Print the error, cast err to awserr.Error to get the Code and
  88. // Message from an error.
  89. fmt.Println(err.Error())
  90. return
  91. }
  92. // Pretty-print the response data.
  93. fmt.Println(resp)
  94. }
  95. func ExampleCloudHSM_DeleteLunaClient() {
  96. svc := cloudhsm.New(nil)
  97. params := &cloudhsm.DeleteLunaClientInput{
  98. ClientArn: aws.String("ClientArn"), // Required
  99. }
  100. resp, err := svc.DeleteLunaClient(params)
  101. if err != nil {
  102. // Print the error, cast err to awserr.Error to get the Code and
  103. // Message from an error.
  104. fmt.Println(err.Error())
  105. return
  106. }
  107. // Pretty-print the response data.
  108. fmt.Println(resp)
  109. }
  110. func ExampleCloudHSM_DescribeHapg() {
  111. svc := cloudhsm.New(nil)
  112. params := &cloudhsm.DescribeHapgInput{
  113. HapgArn: aws.String("HapgArn"), // Required
  114. }
  115. resp, err := svc.DescribeHapg(params)
  116. if err != nil {
  117. // Print the error, cast err to awserr.Error to get the Code and
  118. // Message from an error.
  119. fmt.Println(err.Error())
  120. return
  121. }
  122. // Pretty-print the response data.
  123. fmt.Println(resp)
  124. }
  125. func ExampleCloudHSM_DescribeHsm() {
  126. svc := cloudhsm.New(nil)
  127. params := &cloudhsm.DescribeHsmInput{
  128. HsmArn: aws.String("HsmArn"),
  129. HsmSerialNumber: aws.String("HsmSerialNumber"),
  130. }
  131. resp, err := svc.DescribeHsm(params)
  132. if err != nil {
  133. // Print the error, cast err to awserr.Error to get the Code and
  134. // Message from an error.
  135. fmt.Println(err.Error())
  136. return
  137. }
  138. // Pretty-print the response data.
  139. fmt.Println(resp)
  140. }
  141. func ExampleCloudHSM_DescribeLunaClient() {
  142. svc := cloudhsm.New(nil)
  143. params := &cloudhsm.DescribeLunaClientInput{
  144. CertificateFingerprint: aws.String("CertificateFingerprint"),
  145. ClientArn: aws.String("ClientArn"),
  146. }
  147. resp, err := svc.DescribeLunaClient(params)
  148. if err != nil {
  149. // Print the error, cast err to awserr.Error to get the Code and
  150. // Message from an error.
  151. fmt.Println(err.Error())
  152. return
  153. }
  154. // Pretty-print the response data.
  155. fmt.Println(resp)
  156. }
  157. func ExampleCloudHSM_GetConfig() {
  158. svc := cloudhsm.New(nil)
  159. params := &cloudhsm.GetConfigInput{
  160. ClientArn: aws.String("ClientArn"), // Required
  161. ClientVersion: aws.String("ClientVersion"), // Required
  162. HapgList: []*string{ // Required
  163. aws.String("HapgArn"), // Required
  164. // More values...
  165. },
  166. }
  167. resp, err := svc.GetConfig(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 ExampleCloudHSM_ListAvailableZones() {
  178. svc := cloudhsm.New(nil)
  179. var params *cloudhsm.ListAvailableZonesInput
  180. resp, err := svc.ListAvailableZones(params)
  181. if err != nil {
  182. // Print the error, cast err to awserr.Error to get the Code and
  183. // Message from an error.
  184. fmt.Println(err.Error())
  185. return
  186. }
  187. // Pretty-print the response data.
  188. fmt.Println(resp)
  189. }
  190. func ExampleCloudHSM_ListHapgs() {
  191. svc := cloudhsm.New(nil)
  192. params := &cloudhsm.ListHapgsInput{
  193. NextToken: aws.String("PaginationToken"),
  194. }
  195. resp, err := svc.ListHapgs(params)
  196. if err != nil {
  197. // Print the error, cast err to awserr.Error to get the Code and
  198. // Message from an error.
  199. fmt.Println(err.Error())
  200. return
  201. }
  202. // Pretty-print the response data.
  203. fmt.Println(resp)
  204. }
  205. func ExampleCloudHSM_ListHsms() {
  206. svc := cloudhsm.New(nil)
  207. params := &cloudhsm.ListHsmsInput{
  208. NextToken: aws.String("PaginationToken"),
  209. }
  210. resp, err := svc.ListHsms(params)
  211. if err != nil {
  212. // Print the error, cast err to awserr.Error to get the Code and
  213. // Message from an error.
  214. fmt.Println(err.Error())
  215. return
  216. }
  217. // Pretty-print the response data.
  218. fmt.Println(resp)
  219. }
  220. func ExampleCloudHSM_ListLunaClients() {
  221. svc := cloudhsm.New(nil)
  222. params := &cloudhsm.ListLunaClientsInput{
  223. NextToken: aws.String("PaginationToken"),
  224. }
  225. resp, err := svc.ListLunaClients(params)
  226. if err != nil {
  227. // Print the error, cast err to awserr.Error to get the Code and
  228. // Message from an error.
  229. fmt.Println(err.Error())
  230. return
  231. }
  232. // Pretty-print the response data.
  233. fmt.Println(resp)
  234. }
  235. func ExampleCloudHSM_ModifyHapg() {
  236. svc := cloudhsm.New(nil)
  237. params := &cloudhsm.ModifyHapgInput{
  238. HapgArn: aws.String("HapgArn"), // Required
  239. Label: aws.String("Label"),
  240. PartitionSerialList: []*string{
  241. aws.String("PartitionSerial"), // Required
  242. // More values...
  243. },
  244. }
  245. resp, err := svc.ModifyHapg(params)
  246. if err != nil {
  247. // Print the error, cast err to awserr.Error to get the Code and
  248. // Message from an error.
  249. fmt.Println(err.Error())
  250. return
  251. }
  252. // Pretty-print the response data.
  253. fmt.Println(resp)
  254. }
  255. func ExampleCloudHSM_ModifyHsm() {
  256. svc := cloudhsm.New(nil)
  257. params := &cloudhsm.ModifyHsmInput{
  258. HsmArn: aws.String("HsmArn"), // Required
  259. EniIp: aws.String("IpAddress"),
  260. ExternalId: aws.String("ExternalId"),
  261. IamRoleArn: aws.String("IamRoleArn"),
  262. SubnetId: aws.String("SubnetId"),
  263. SyslogIp: aws.String("IpAddress"),
  264. }
  265. resp, err := svc.ModifyHsm(params)
  266. if err != nil {
  267. // Print the error, cast err to awserr.Error to get the Code and
  268. // Message from an error.
  269. fmt.Println(err.Error())
  270. return
  271. }
  272. // Pretty-print the response data.
  273. fmt.Println(resp)
  274. }
  275. func ExampleCloudHSM_ModifyLunaClient() {
  276. svc := cloudhsm.New(nil)
  277. params := &cloudhsm.ModifyLunaClientInput{
  278. Certificate: aws.String("Certificate"), // Required
  279. ClientArn: aws.String("ClientArn"), // Required
  280. }
  281. resp, err := svc.ModifyLunaClient(params)
  282. if err != nil {
  283. // Print the error, cast err to awserr.Error to get the Code and
  284. // Message from an error.
  285. fmt.Println(err.Error())
  286. return
  287. }
  288. // Pretty-print the response data.
  289. fmt.Println(resp)
  290. }