examples_test.go 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package cloudformation_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/cloudformation"
  9. )
  10. var _ time.Duration
  11. var _ bytes.Buffer
  12. func ExampleCloudFormation_CancelUpdateStack() {
  13. svc := cloudformation.New(nil)
  14. params := &cloudformation.CancelUpdateStackInput{
  15. StackName: aws.String("StackName"), // Required
  16. }
  17. resp, err := svc.CancelUpdateStack(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 ExampleCloudFormation_CreateStack() {
  28. svc := cloudformation.New(nil)
  29. params := &cloudformation.CreateStackInput{
  30. StackName: aws.String("StackName"), // Required
  31. Capabilities: []*string{
  32. aws.String("Capability"), // Required
  33. // More values...
  34. },
  35. DisableRollback: aws.Bool(true),
  36. NotificationARNs: []*string{
  37. aws.String("NotificationARN"), // Required
  38. // More values...
  39. },
  40. OnFailure: aws.String("OnFailure"),
  41. Parameters: []*cloudformation.Parameter{
  42. { // Required
  43. ParameterKey: aws.String("ParameterKey"),
  44. ParameterValue: aws.String("ParameterValue"),
  45. UsePreviousValue: aws.Bool(true),
  46. },
  47. // More values...
  48. },
  49. StackPolicyBody: aws.String("StackPolicyBody"),
  50. StackPolicyURL: aws.String("StackPolicyURL"),
  51. Tags: []*cloudformation.Tag{
  52. { // Required
  53. Key: aws.String("TagKey"),
  54. Value: aws.String("TagValue"),
  55. },
  56. // More values...
  57. },
  58. TemplateBody: aws.String("TemplateBody"),
  59. TemplateURL: aws.String("TemplateURL"),
  60. TimeoutInMinutes: aws.Int64(1),
  61. }
  62. resp, err := svc.CreateStack(params)
  63. if err != nil {
  64. // Print the error, cast err to awserr.Error to get the Code and
  65. // Message from an error.
  66. fmt.Println(err.Error())
  67. return
  68. }
  69. // Pretty-print the response data.
  70. fmt.Println(resp)
  71. }
  72. func ExampleCloudFormation_DeleteStack() {
  73. svc := cloudformation.New(nil)
  74. params := &cloudformation.DeleteStackInput{
  75. StackName: aws.String("StackName"), // Required
  76. }
  77. resp, err := svc.DeleteStack(params)
  78. if err != nil {
  79. // Print the error, cast err to awserr.Error to get the Code and
  80. // Message from an error.
  81. fmt.Println(err.Error())
  82. return
  83. }
  84. // Pretty-print the response data.
  85. fmt.Println(resp)
  86. }
  87. func ExampleCloudFormation_DescribeStackEvents() {
  88. svc := cloudformation.New(nil)
  89. params := &cloudformation.DescribeStackEventsInput{
  90. NextToken: aws.String("NextToken"),
  91. StackName: aws.String("StackName"),
  92. }
  93. resp, err := svc.DescribeStackEvents(params)
  94. if err != nil {
  95. // Print the error, cast err to awserr.Error to get the Code and
  96. // Message from an error.
  97. fmt.Println(err.Error())
  98. return
  99. }
  100. // Pretty-print the response data.
  101. fmt.Println(resp)
  102. }
  103. func ExampleCloudFormation_DescribeStackResource() {
  104. svc := cloudformation.New(nil)
  105. params := &cloudformation.DescribeStackResourceInput{
  106. LogicalResourceId: aws.String("LogicalResourceId"), // Required
  107. StackName: aws.String("StackName"), // Required
  108. }
  109. resp, err := svc.DescribeStackResource(params)
  110. if err != nil {
  111. // Print the error, cast err to awserr.Error to get the Code and
  112. // Message from an error.
  113. fmt.Println(err.Error())
  114. return
  115. }
  116. // Pretty-print the response data.
  117. fmt.Println(resp)
  118. }
  119. func ExampleCloudFormation_DescribeStackResources() {
  120. svc := cloudformation.New(nil)
  121. params := &cloudformation.DescribeStackResourcesInput{
  122. LogicalResourceId: aws.String("LogicalResourceId"),
  123. PhysicalResourceId: aws.String("PhysicalResourceId"),
  124. StackName: aws.String("StackName"),
  125. }
  126. resp, err := svc.DescribeStackResources(params)
  127. if err != nil {
  128. // Print the error, cast err to awserr.Error to get the Code and
  129. // Message from an error.
  130. fmt.Println(err.Error())
  131. return
  132. }
  133. // Pretty-print the response data.
  134. fmt.Println(resp)
  135. }
  136. func ExampleCloudFormation_DescribeStacks() {
  137. svc := cloudformation.New(nil)
  138. params := &cloudformation.DescribeStacksInput{
  139. NextToken: aws.String("NextToken"),
  140. StackName: aws.String("StackName"),
  141. }
  142. resp, err := svc.DescribeStacks(params)
  143. if err != nil {
  144. // Print the error, cast err to awserr.Error to get the Code and
  145. // Message from an error.
  146. fmt.Println(err.Error())
  147. return
  148. }
  149. // Pretty-print the response data.
  150. fmt.Println(resp)
  151. }
  152. func ExampleCloudFormation_EstimateTemplateCost() {
  153. svc := cloudformation.New(nil)
  154. params := &cloudformation.EstimateTemplateCostInput{
  155. Parameters: []*cloudformation.Parameter{
  156. { // Required
  157. ParameterKey: aws.String("ParameterKey"),
  158. ParameterValue: aws.String("ParameterValue"),
  159. UsePreviousValue: aws.Bool(true),
  160. },
  161. // More values...
  162. },
  163. TemplateBody: aws.String("TemplateBody"),
  164. TemplateURL: aws.String("TemplateURL"),
  165. }
  166. resp, err := svc.EstimateTemplateCost(params)
  167. if err != nil {
  168. // Print the error, cast err to awserr.Error to get the Code and
  169. // Message from an error.
  170. fmt.Println(err.Error())
  171. return
  172. }
  173. // Pretty-print the response data.
  174. fmt.Println(resp)
  175. }
  176. func ExampleCloudFormation_GetStackPolicy() {
  177. svc := cloudformation.New(nil)
  178. params := &cloudformation.GetStackPolicyInput{
  179. StackName: aws.String("StackName"), // Required
  180. }
  181. resp, err := svc.GetStackPolicy(params)
  182. if err != nil {
  183. // Print the error, cast err to awserr.Error to get the Code and
  184. // Message from an error.
  185. fmt.Println(err.Error())
  186. return
  187. }
  188. // Pretty-print the response data.
  189. fmt.Println(resp)
  190. }
  191. func ExampleCloudFormation_GetTemplate() {
  192. svc := cloudformation.New(nil)
  193. params := &cloudformation.GetTemplateInput{
  194. StackName: aws.String("StackName"), // Required
  195. }
  196. resp, err := svc.GetTemplate(params)
  197. if err != nil {
  198. // Print the error, cast err to awserr.Error to get the Code and
  199. // Message from an error.
  200. fmt.Println(err.Error())
  201. return
  202. }
  203. // Pretty-print the response data.
  204. fmt.Println(resp)
  205. }
  206. func ExampleCloudFormation_GetTemplateSummary() {
  207. svc := cloudformation.New(nil)
  208. params := &cloudformation.GetTemplateSummaryInput{
  209. StackName: aws.String("StackNameOrId"),
  210. TemplateBody: aws.String("TemplateBody"),
  211. TemplateURL: aws.String("TemplateURL"),
  212. }
  213. resp, err := svc.GetTemplateSummary(params)
  214. if err != nil {
  215. // Print the error, cast err to awserr.Error to get the Code and
  216. // Message from an error.
  217. fmt.Println(err.Error())
  218. return
  219. }
  220. // Pretty-print the response data.
  221. fmt.Println(resp)
  222. }
  223. func ExampleCloudFormation_ListStackResources() {
  224. svc := cloudformation.New(nil)
  225. params := &cloudformation.ListStackResourcesInput{
  226. StackName: aws.String("StackName"), // Required
  227. NextToken: aws.String("NextToken"),
  228. }
  229. resp, err := svc.ListStackResources(params)
  230. if err != nil {
  231. // Print the error, cast err to awserr.Error to get the Code and
  232. // Message from an error.
  233. fmt.Println(err.Error())
  234. return
  235. }
  236. // Pretty-print the response data.
  237. fmt.Println(resp)
  238. }
  239. func ExampleCloudFormation_ListStacks() {
  240. svc := cloudformation.New(nil)
  241. params := &cloudformation.ListStacksInput{
  242. NextToken: aws.String("NextToken"),
  243. StackStatusFilter: []*string{
  244. aws.String("StackStatus"), // Required
  245. // More values...
  246. },
  247. }
  248. resp, err := svc.ListStacks(params)
  249. if err != nil {
  250. // Print the error, cast err to awserr.Error to get the Code and
  251. // Message from an error.
  252. fmt.Println(err.Error())
  253. return
  254. }
  255. // Pretty-print the response data.
  256. fmt.Println(resp)
  257. }
  258. func ExampleCloudFormation_SetStackPolicy() {
  259. svc := cloudformation.New(nil)
  260. params := &cloudformation.SetStackPolicyInput{
  261. StackName: aws.String("StackName"), // Required
  262. StackPolicyBody: aws.String("StackPolicyBody"),
  263. StackPolicyURL: aws.String("StackPolicyURL"),
  264. }
  265. resp, err := svc.SetStackPolicy(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 ExampleCloudFormation_SignalResource() {
  276. svc := cloudformation.New(nil)
  277. params := &cloudformation.SignalResourceInput{
  278. LogicalResourceId: aws.String("LogicalResourceId"), // Required
  279. StackName: aws.String("StackNameOrId"), // Required
  280. Status: aws.String("ResourceSignalStatus"), // Required
  281. UniqueId: aws.String("ResourceSignalUniqueId"), // Required
  282. }
  283. resp, err := svc.SignalResource(params)
  284. if err != nil {
  285. // Print the error, cast err to awserr.Error to get the Code and
  286. // Message from an error.
  287. fmt.Println(err.Error())
  288. return
  289. }
  290. // Pretty-print the response data.
  291. fmt.Println(resp)
  292. }
  293. func ExampleCloudFormation_UpdateStack() {
  294. svc := cloudformation.New(nil)
  295. params := &cloudformation.UpdateStackInput{
  296. StackName: aws.String("StackName"), // Required
  297. Capabilities: []*string{
  298. aws.String("Capability"), // Required
  299. // More values...
  300. },
  301. NotificationARNs: []*string{
  302. aws.String("NotificationARN"), // Required
  303. // More values...
  304. },
  305. Parameters: []*cloudformation.Parameter{
  306. { // Required
  307. ParameterKey: aws.String("ParameterKey"),
  308. ParameterValue: aws.String("ParameterValue"),
  309. UsePreviousValue: aws.Bool(true),
  310. },
  311. // More values...
  312. },
  313. StackPolicyBody: aws.String("StackPolicyBody"),
  314. StackPolicyDuringUpdateBody: aws.String("StackPolicyDuringUpdateBody"),
  315. StackPolicyDuringUpdateURL: aws.String("StackPolicyDuringUpdateURL"),
  316. StackPolicyURL: aws.String("StackPolicyURL"),
  317. TemplateBody: aws.String("TemplateBody"),
  318. TemplateURL: aws.String("TemplateURL"),
  319. UsePreviousTemplate: aws.Bool(true),
  320. }
  321. resp, err := svc.UpdateStack(params)
  322. if err != nil {
  323. // Print the error, cast err to awserr.Error to get the Code and
  324. // Message from an error.
  325. fmt.Println(err.Error())
  326. return
  327. }
  328. // Pretty-print the response data.
  329. fmt.Println(resp)
  330. }
  331. func ExampleCloudFormation_ValidateTemplate() {
  332. svc := cloudformation.New(nil)
  333. params := &cloudformation.ValidateTemplateInput{
  334. TemplateBody: aws.String("TemplateBody"),
  335. TemplateURL: aws.String("TemplateURL"),
  336. }
  337. resp, err := svc.ValidateTemplate(params)
  338. if err != nil {
  339. // Print the error, cast err to awserr.Error to get the Code and
  340. // Message from an error.
  341. fmt.Println(err.Error())
  342. return
  343. }
  344. // Pretty-print the response data.
  345. fmt.Println(resp)
  346. }