examples_test.go 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package autoscaling_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/autoscaling"
  9. )
  10. var _ time.Duration
  11. var _ bytes.Buffer
  12. func ExampleAutoScaling_AttachInstances() {
  13. svc := autoscaling.New(nil)
  14. params := &autoscaling.AttachInstancesInput{
  15. AutoScalingGroupName: aws.String("ResourceName"), // Required
  16. InstanceIds: []*string{
  17. aws.String("XmlStringMaxLen16"), // Required
  18. // More values...
  19. },
  20. }
  21. resp, err := svc.AttachInstances(params)
  22. if err != nil {
  23. // Print the error, cast err to awserr.Error to get the Code and
  24. // Message from an error.
  25. fmt.Println(err.Error())
  26. return
  27. }
  28. // Pretty-print the response data.
  29. fmt.Println(resp)
  30. }
  31. func ExampleAutoScaling_AttachLoadBalancers() {
  32. svc := autoscaling.New(nil)
  33. params := &autoscaling.AttachLoadBalancersInput{
  34. AutoScalingGroupName: aws.String("ResourceName"),
  35. LoadBalancerNames: []*string{
  36. aws.String("XmlStringMaxLen255"), // Required
  37. // More values...
  38. },
  39. }
  40. resp, err := svc.AttachLoadBalancers(params)
  41. if err != nil {
  42. // Print the error, cast err to awserr.Error to get the Code and
  43. // Message from an error.
  44. fmt.Println(err.Error())
  45. return
  46. }
  47. // Pretty-print the response data.
  48. fmt.Println(resp)
  49. }
  50. func ExampleAutoScaling_CompleteLifecycleAction() {
  51. svc := autoscaling.New(nil)
  52. params := &autoscaling.CompleteLifecycleActionInput{
  53. AutoScalingGroupName: aws.String("ResourceName"), // Required
  54. LifecycleActionResult: aws.String("LifecycleActionResult"), // Required
  55. LifecycleActionToken: aws.String("LifecycleActionToken"), // Required
  56. LifecycleHookName: aws.String("AsciiStringMaxLen255"), // Required
  57. }
  58. resp, err := svc.CompleteLifecycleAction(params)
  59. if err != nil {
  60. // Print the error, cast err to awserr.Error to get the Code and
  61. // Message from an error.
  62. fmt.Println(err.Error())
  63. return
  64. }
  65. // Pretty-print the response data.
  66. fmt.Println(resp)
  67. }
  68. func ExampleAutoScaling_CreateAutoScalingGroup() {
  69. svc := autoscaling.New(nil)
  70. params := &autoscaling.CreateAutoScalingGroupInput{
  71. AutoScalingGroupName: aws.String("XmlStringMaxLen255"), // Required
  72. MaxSize: aws.Int64(1), // Required
  73. MinSize: aws.Int64(1), // Required
  74. AvailabilityZones: []*string{
  75. aws.String("XmlStringMaxLen255"), // Required
  76. // More values...
  77. },
  78. DefaultCooldown: aws.Int64(1),
  79. DesiredCapacity: aws.Int64(1),
  80. HealthCheckGracePeriod: aws.Int64(1),
  81. HealthCheckType: aws.String("XmlStringMaxLen32"),
  82. InstanceId: aws.String("XmlStringMaxLen16"),
  83. LaunchConfigurationName: aws.String("ResourceName"),
  84. LoadBalancerNames: []*string{
  85. aws.String("XmlStringMaxLen255"), // Required
  86. // More values...
  87. },
  88. PlacementGroup: aws.String("XmlStringMaxLen255"),
  89. Tags: []*autoscaling.Tag{
  90. { // Required
  91. Key: aws.String("TagKey"), // Required
  92. PropagateAtLaunch: aws.Bool(true),
  93. ResourceId: aws.String("XmlString"),
  94. ResourceType: aws.String("XmlString"),
  95. Value: aws.String("TagValue"),
  96. },
  97. // More values...
  98. },
  99. TerminationPolicies: []*string{
  100. aws.String("XmlStringMaxLen1600"), // Required
  101. // More values...
  102. },
  103. VPCZoneIdentifier: aws.String("XmlStringMaxLen255"),
  104. }
  105. resp, err := svc.CreateAutoScalingGroup(params)
  106. if err != nil {
  107. // Print the error, cast err to awserr.Error to get the Code and
  108. // Message from an error.
  109. fmt.Println(err.Error())
  110. return
  111. }
  112. // Pretty-print the response data.
  113. fmt.Println(resp)
  114. }
  115. func ExampleAutoScaling_CreateLaunchConfiguration() {
  116. svc := autoscaling.New(nil)
  117. params := &autoscaling.CreateLaunchConfigurationInput{
  118. LaunchConfigurationName: aws.String("XmlStringMaxLen255"), // Required
  119. AssociatePublicIpAddress: aws.Bool(true),
  120. BlockDeviceMappings: []*autoscaling.BlockDeviceMapping{
  121. { // Required
  122. DeviceName: aws.String("XmlStringMaxLen255"), // Required
  123. Ebs: &autoscaling.Ebs{
  124. DeleteOnTermination: aws.Bool(true),
  125. Iops: aws.Int64(1),
  126. SnapshotId: aws.String("XmlStringMaxLen255"),
  127. VolumeSize: aws.Int64(1),
  128. VolumeType: aws.String("BlockDeviceEbsVolumeType"),
  129. },
  130. NoDevice: aws.Bool(true),
  131. VirtualName: aws.String("XmlStringMaxLen255"),
  132. },
  133. // More values...
  134. },
  135. ClassicLinkVPCId: aws.String("XmlStringMaxLen255"),
  136. ClassicLinkVPCSecurityGroups: []*string{
  137. aws.String("XmlStringMaxLen255"), // Required
  138. // More values...
  139. },
  140. EbsOptimized: aws.Bool(true),
  141. IamInstanceProfile: aws.String("XmlStringMaxLen1600"),
  142. ImageId: aws.String("XmlStringMaxLen255"),
  143. InstanceId: aws.String("XmlStringMaxLen16"),
  144. InstanceMonitoring: &autoscaling.InstanceMonitoring{
  145. Enabled: aws.Bool(true),
  146. },
  147. InstanceType: aws.String("XmlStringMaxLen255"),
  148. KernelId: aws.String("XmlStringMaxLen255"),
  149. KeyName: aws.String("XmlStringMaxLen255"),
  150. PlacementTenancy: aws.String("XmlStringMaxLen64"),
  151. RamdiskId: aws.String("XmlStringMaxLen255"),
  152. SecurityGroups: []*string{
  153. aws.String("XmlString"), // Required
  154. // More values...
  155. },
  156. SpotPrice: aws.String("SpotPrice"),
  157. UserData: aws.String("XmlStringUserData"),
  158. }
  159. resp, err := svc.CreateLaunchConfiguration(params)
  160. if err != nil {
  161. // Print the error, cast err to awserr.Error to get the Code and
  162. // Message from an error.
  163. fmt.Println(err.Error())
  164. return
  165. }
  166. // Pretty-print the response data.
  167. fmt.Println(resp)
  168. }
  169. func ExampleAutoScaling_CreateOrUpdateTags() {
  170. svc := autoscaling.New(nil)
  171. params := &autoscaling.CreateOrUpdateTagsInput{
  172. Tags: []*autoscaling.Tag{ // Required
  173. { // Required
  174. Key: aws.String("TagKey"), // Required
  175. PropagateAtLaunch: aws.Bool(true),
  176. ResourceId: aws.String("XmlString"),
  177. ResourceType: aws.String("XmlString"),
  178. Value: aws.String("TagValue"),
  179. },
  180. // More values...
  181. },
  182. }
  183. resp, err := svc.CreateOrUpdateTags(params)
  184. if err != nil {
  185. // Print the error, cast err to awserr.Error to get the Code and
  186. // Message from an error.
  187. fmt.Println(err.Error())
  188. return
  189. }
  190. // Pretty-print the response data.
  191. fmt.Println(resp)
  192. }
  193. func ExampleAutoScaling_DeleteAutoScalingGroup() {
  194. svc := autoscaling.New(nil)
  195. params := &autoscaling.DeleteAutoScalingGroupInput{
  196. AutoScalingGroupName: aws.String("ResourceName"), // Required
  197. ForceDelete: aws.Bool(true),
  198. }
  199. resp, err := svc.DeleteAutoScalingGroup(params)
  200. if err != nil {
  201. // Print the error, cast err to awserr.Error to get the Code and
  202. // Message from an error.
  203. fmt.Println(err.Error())
  204. return
  205. }
  206. // Pretty-print the response data.
  207. fmt.Println(resp)
  208. }
  209. func ExampleAutoScaling_DeleteLaunchConfiguration() {
  210. svc := autoscaling.New(nil)
  211. params := &autoscaling.DeleteLaunchConfigurationInput{
  212. LaunchConfigurationName: aws.String("ResourceName"), // Required
  213. }
  214. resp, err := svc.DeleteLaunchConfiguration(params)
  215. if err != nil {
  216. // Print the error, cast err to awserr.Error to get the Code and
  217. // Message from an error.
  218. fmt.Println(err.Error())
  219. return
  220. }
  221. // Pretty-print the response data.
  222. fmt.Println(resp)
  223. }
  224. func ExampleAutoScaling_DeleteLifecycleHook() {
  225. svc := autoscaling.New(nil)
  226. params := &autoscaling.DeleteLifecycleHookInput{
  227. AutoScalingGroupName: aws.String("ResourceName"), // Required
  228. LifecycleHookName: aws.String("AsciiStringMaxLen255"), // Required
  229. }
  230. resp, err := svc.DeleteLifecycleHook(params)
  231. if err != nil {
  232. // Print the error, cast err to awserr.Error to get the Code and
  233. // Message from an error.
  234. fmt.Println(err.Error())
  235. return
  236. }
  237. // Pretty-print the response data.
  238. fmt.Println(resp)
  239. }
  240. func ExampleAutoScaling_DeleteNotificationConfiguration() {
  241. svc := autoscaling.New(nil)
  242. params := &autoscaling.DeleteNotificationConfigurationInput{
  243. AutoScalingGroupName: aws.String("ResourceName"), // Required
  244. TopicARN: aws.String("ResourceName"), // Required
  245. }
  246. resp, err := svc.DeleteNotificationConfiguration(params)
  247. if err != nil {
  248. // Print the error, cast err to awserr.Error to get the Code and
  249. // Message from an error.
  250. fmt.Println(err.Error())
  251. return
  252. }
  253. // Pretty-print the response data.
  254. fmt.Println(resp)
  255. }
  256. func ExampleAutoScaling_DeletePolicy() {
  257. svc := autoscaling.New(nil)
  258. params := &autoscaling.DeletePolicyInput{
  259. PolicyName: aws.String("ResourceName"), // Required
  260. AutoScalingGroupName: aws.String("ResourceName"),
  261. }
  262. resp, err := svc.DeletePolicy(params)
  263. if err != nil {
  264. // Print the error, cast err to awserr.Error to get the Code and
  265. // Message from an error.
  266. fmt.Println(err.Error())
  267. return
  268. }
  269. // Pretty-print the response data.
  270. fmt.Println(resp)
  271. }
  272. func ExampleAutoScaling_DeleteScheduledAction() {
  273. svc := autoscaling.New(nil)
  274. params := &autoscaling.DeleteScheduledActionInput{
  275. ScheduledActionName: aws.String("ResourceName"), // Required
  276. AutoScalingGroupName: aws.String("ResourceName"),
  277. }
  278. resp, err := svc.DeleteScheduledAction(params)
  279. if err != nil {
  280. // Print the error, cast err to awserr.Error to get the Code and
  281. // Message from an error.
  282. fmt.Println(err.Error())
  283. return
  284. }
  285. // Pretty-print the response data.
  286. fmt.Println(resp)
  287. }
  288. func ExampleAutoScaling_DeleteTags() {
  289. svc := autoscaling.New(nil)
  290. params := &autoscaling.DeleteTagsInput{
  291. Tags: []*autoscaling.Tag{ // Required
  292. { // Required
  293. Key: aws.String("TagKey"), // Required
  294. PropagateAtLaunch: aws.Bool(true),
  295. ResourceId: aws.String("XmlString"),
  296. ResourceType: aws.String("XmlString"),
  297. Value: aws.String("TagValue"),
  298. },
  299. // More values...
  300. },
  301. }
  302. resp, err := svc.DeleteTags(params)
  303. if err != nil {
  304. // Print the error, cast err to awserr.Error to get the Code and
  305. // Message from an error.
  306. fmt.Println(err.Error())
  307. return
  308. }
  309. // Pretty-print the response data.
  310. fmt.Println(resp)
  311. }
  312. func ExampleAutoScaling_DescribeAccountLimits() {
  313. svc := autoscaling.New(nil)
  314. var params *autoscaling.DescribeAccountLimitsInput
  315. resp, err := svc.DescribeAccountLimits(params)
  316. if err != nil {
  317. // Print the error, cast err to awserr.Error to get the Code and
  318. // Message from an error.
  319. fmt.Println(err.Error())
  320. return
  321. }
  322. // Pretty-print the response data.
  323. fmt.Println(resp)
  324. }
  325. func ExampleAutoScaling_DescribeAdjustmentTypes() {
  326. svc := autoscaling.New(nil)
  327. var params *autoscaling.DescribeAdjustmentTypesInput
  328. resp, err := svc.DescribeAdjustmentTypes(params)
  329. if err != nil {
  330. // Print the error, cast err to awserr.Error to get the Code and
  331. // Message from an error.
  332. fmt.Println(err.Error())
  333. return
  334. }
  335. // Pretty-print the response data.
  336. fmt.Println(resp)
  337. }
  338. func ExampleAutoScaling_DescribeAutoScalingGroups() {
  339. svc := autoscaling.New(nil)
  340. params := &autoscaling.DescribeAutoScalingGroupsInput{
  341. AutoScalingGroupNames: []*string{
  342. aws.String("ResourceName"), // Required
  343. // More values...
  344. },
  345. MaxRecords: aws.Int64(1),
  346. NextToken: aws.String("XmlString"),
  347. }
  348. resp, err := svc.DescribeAutoScalingGroups(params)
  349. if err != nil {
  350. // Print the error, cast err to awserr.Error to get the Code and
  351. // Message from an error.
  352. fmt.Println(err.Error())
  353. return
  354. }
  355. // Pretty-print the response data.
  356. fmt.Println(resp)
  357. }
  358. func ExampleAutoScaling_DescribeAutoScalingInstances() {
  359. svc := autoscaling.New(nil)
  360. params := &autoscaling.DescribeAutoScalingInstancesInput{
  361. InstanceIds: []*string{
  362. aws.String("XmlStringMaxLen16"), // Required
  363. // More values...
  364. },
  365. MaxRecords: aws.Int64(1),
  366. NextToken: aws.String("XmlString"),
  367. }
  368. resp, err := svc.DescribeAutoScalingInstances(params)
  369. if err != nil {
  370. // Print the error, cast err to awserr.Error to get the Code and
  371. // Message from an error.
  372. fmt.Println(err.Error())
  373. return
  374. }
  375. // Pretty-print the response data.
  376. fmt.Println(resp)
  377. }
  378. func ExampleAutoScaling_DescribeAutoScalingNotificationTypes() {
  379. svc := autoscaling.New(nil)
  380. var params *autoscaling.DescribeAutoScalingNotificationTypesInput
  381. resp, err := svc.DescribeAutoScalingNotificationTypes(params)
  382. if err != nil {
  383. // Print the error, cast err to awserr.Error to get the Code and
  384. // Message from an error.
  385. fmt.Println(err.Error())
  386. return
  387. }
  388. // Pretty-print the response data.
  389. fmt.Println(resp)
  390. }
  391. func ExampleAutoScaling_DescribeLaunchConfigurations() {
  392. svc := autoscaling.New(nil)
  393. params := &autoscaling.DescribeLaunchConfigurationsInput{
  394. LaunchConfigurationNames: []*string{
  395. aws.String("ResourceName"), // Required
  396. // More values...
  397. },
  398. MaxRecords: aws.Int64(1),
  399. NextToken: aws.String("XmlString"),
  400. }
  401. resp, err := svc.DescribeLaunchConfigurations(params)
  402. if err != nil {
  403. // Print the error, cast err to awserr.Error to get the Code and
  404. // Message from an error.
  405. fmt.Println(err.Error())
  406. return
  407. }
  408. // Pretty-print the response data.
  409. fmt.Println(resp)
  410. }
  411. func ExampleAutoScaling_DescribeLifecycleHookTypes() {
  412. svc := autoscaling.New(nil)
  413. var params *autoscaling.DescribeLifecycleHookTypesInput
  414. resp, err := svc.DescribeLifecycleHookTypes(params)
  415. if err != nil {
  416. // Print the error, cast err to awserr.Error to get the Code and
  417. // Message from an error.
  418. fmt.Println(err.Error())
  419. return
  420. }
  421. // Pretty-print the response data.
  422. fmt.Println(resp)
  423. }
  424. func ExampleAutoScaling_DescribeLifecycleHooks() {
  425. svc := autoscaling.New(nil)
  426. params := &autoscaling.DescribeLifecycleHooksInput{
  427. AutoScalingGroupName: aws.String("ResourceName"), // Required
  428. LifecycleHookNames: []*string{
  429. aws.String("AsciiStringMaxLen255"), // Required
  430. // More values...
  431. },
  432. }
  433. resp, err := svc.DescribeLifecycleHooks(params)
  434. if err != nil {
  435. // Print the error, cast err to awserr.Error to get the Code and
  436. // Message from an error.
  437. fmt.Println(err.Error())
  438. return
  439. }
  440. // Pretty-print the response data.
  441. fmt.Println(resp)
  442. }
  443. func ExampleAutoScaling_DescribeLoadBalancers() {
  444. svc := autoscaling.New(nil)
  445. params := &autoscaling.DescribeLoadBalancersInput{
  446. AutoScalingGroupName: aws.String("ResourceName"), // Required
  447. MaxRecords: aws.Int64(1),
  448. NextToken: aws.String("XmlString"),
  449. }
  450. resp, err := svc.DescribeLoadBalancers(params)
  451. if err != nil {
  452. // Print the error, cast err to awserr.Error to get the Code and
  453. // Message from an error.
  454. fmt.Println(err.Error())
  455. return
  456. }
  457. // Pretty-print the response data.
  458. fmt.Println(resp)
  459. }
  460. func ExampleAutoScaling_DescribeMetricCollectionTypes() {
  461. svc := autoscaling.New(nil)
  462. var params *autoscaling.DescribeMetricCollectionTypesInput
  463. resp, err := svc.DescribeMetricCollectionTypes(params)
  464. if err != nil {
  465. // Print the error, cast err to awserr.Error to get the Code and
  466. // Message from an error.
  467. fmt.Println(err.Error())
  468. return
  469. }
  470. // Pretty-print the response data.
  471. fmt.Println(resp)
  472. }
  473. func ExampleAutoScaling_DescribeNotificationConfigurations() {
  474. svc := autoscaling.New(nil)
  475. params := &autoscaling.DescribeNotificationConfigurationsInput{
  476. AutoScalingGroupNames: []*string{
  477. aws.String("ResourceName"), // Required
  478. // More values...
  479. },
  480. MaxRecords: aws.Int64(1),
  481. NextToken: aws.String("XmlString"),
  482. }
  483. resp, err := svc.DescribeNotificationConfigurations(params)
  484. if err != nil {
  485. // Print the error, cast err to awserr.Error to get the Code and
  486. // Message from an error.
  487. fmt.Println(err.Error())
  488. return
  489. }
  490. // Pretty-print the response data.
  491. fmt.Println(resp)
  492. }
  493. func ExampleAutoScaling_DescribePolicies() {
  494. svc := autoscaling.New(nil)
  495. params := &autoscaling.DescribePoliciesInput{
  496. AutoScalingGroupName: aws.String("ResourceName"),
  497. MaxRecords: aws.Int64(1),
  498. NextToken: aws.String("XmlString"),
  499. PolicyNames: []*string{
  500. aws.String("ResourceName"), // Required
  501. // More values...
  502. },
  503. PolicyTypes: []*string{
  504. aws.String("XmlStringMaxLen64"), // Required
  505. // More values...
  506. },
  507. }
  508. resp, err := svc.DescribePolicies(params)
  509. if err != nil {
  510. // Print the error, cast err to awserr.Error to get the Code and
  511. // Message from an error.
  512. fmt.Println(err.Error())
  513. return
  514. }
  515. // Pretty-print the response data.
  516. fmt.Println(resp)
  517. }
  518. func ExampleAutoScaling_DescribeScalingActivities() {
  519. svc := autoscaling.New(nil)
  520. params := &autoscaling.DescribeScalingActivitiesInput{
  521. ActivityIds: []*string{
  522. aws.String("XmlString"), // Required
  523. // More values...
  524. },
  525. AutoScalingGroupName: aws.String("ResourceName"),
  526. MaxRecords: aws.Int64(1),
  527. NextToken: aws.String("XmlString"),
  528. }
  529. resp, err := svc.DescribeScalingActivities(params)
  530. if err != nil {
  531. // Print the error, cast err to awserr.Error to get the Code and
  532. // Message from an error.
  533. fmt.Println(err.Error())
  534. return
  535. }
  536. // Pretty-print the response data.
  537. fmt.Println(resp)
  538. }
  539. func ExampleAutoScaling_DescribeScalingProcessTypes() {
  540. svc := autoscaling.New(nil)
  541. var params *autoscaling.DescribeScalingProcessTypesInput
  542. resp, err := svc.DescribeScalingProcessTypes(params)
  543. if err != nil {
  544. // Print the error, cast err to awserr.Error to get the Code and
  545. // Message from an error.
  546. fmt.Println(err.Error())
  547. return
  548. }
  549. // Pretty-print the response data.
  550. fmt.Println(resp)
  551. }
  552. func ExampleAutoScaling_DescribeScheduledActions() {
  553. svc := autoscaling.New(nil)
  554. params := &autoscaling.DescribeScheduledActionsInput{
  555. AutoScalingGroupName: aws.String("ResourceName"),
  556. EndTime: aws.Time(time.Now()),
  557. MaxRecords: aws.Int64(1),
  558. NextToken: aws.String("XmlString"),
  559. ScheduledActionNames: []*string{
  560. aws.String("ResourceName"), // Required
  561. // More values...
  562. },
  563. StartTime: aws.Time(time.Now()),
  564. }
  565. resp, err := svc.DescribeScheduledActions(params)
  566. if err != nil {
  567. // Print the error, cast err to awserr.Error to get the Code and
  568. // Message from an error.
  569. fmt.Println(err.Error())
  570. return
  571. }
  572. // Pretty-print the response data.
  573. fmt.Println(resp)
  574. }
  575. func ExampleAutoScaling_DescribeTags() {
  576. svc := autoscaling.New(nil)
  577. params := &autoscaling.DescribeTagsInput{
  578. Filters: []*autoscaling.Filter{
  579. { // Required
  580. Name: aws.String("XmlString"),
  581. Values: []*string{
  582. aws.String("XmlString"), // Required
  583. // More values...
  584. },
  585. },
  586. // More values...
  587. },
  588. MaxRecords: aws.Int64(1),
  589. NextToken: aws.String("XmlString"),
  590. }
  591. resp, err := svc.DescribeTags(params)
  592. if err != nil {
  593. // Print the error, cast err to awserr.Error to get the Code and
  594. // Message from an error.
  595. fmt.Println(err.Error())
  596. return
  597. }
  598. // Pretty-print the response data.
  599. fmt.Println(resp)
  600. }
  601. func ExampleAutoScaling_DescribeTerminationPolicyTypes() {
  602. svc := autoscaling.New(nil)
  603. var params *autoscaling.DescribeTerminationPolicyTypesInput
  604. resp, err := svc.DescribeTerminationPolicyTypes(params)
  605. if err != nil {
  606. // Print the error, cast err to awserr.Error to get the Code and
  607. // Message from an error.
  608. fmt.Println(err.Error())
  609. return
  610. }
  611. // Pretty-print the response data.
  612. fmt.Println(resp)
  613. }
  614. func ExampleAutoScaling_DetachInstances() {
  615. svc := autoscaling.New(nil)
  616. params := &autoscaling.DetachInstancesInput{
  617. AutoScalingGroupName: aws.String("ResourceName"), // Required
  618. ShouldDecrementDesiredCapacity: aws.Bool(true), // Required
  619. InstanceIds: []*string{
  620. aws.String("XmlStringMaxLen16"), // Required
  621. // More values...
  622. },
  623. }
  624. resp, err := svc.DetachInstances(params)
  625. if err != nil {
  626. // Print the error, cast err to awserr.Error to get the Code and
  627. // Message from an error.
  628. fmt.Println(err.Error())
  629. return
  630. }
  631. // Pretty-print the response data.
  632. fmt.Println(resp)
  633. }
  634. func ExampleAutoScaling_DetachLoadBalancers() {
  635. svc := autoscaling.New(nil)
  636. params := &autoscaling.DetachLoadBalancersInput{
  637. AutoScalingGroupName: aws.String("ResourceName"),
  638. LoadBalancerNames: []*string{
  639. aws.String("XmlStringMaxLen255"), // Required
  640. // More values...
  641. },
  642. }
  643. resp, err := svc.DetachLoadBalancers(params)
  644. if err != nil {
  645. // Print the error, cast err to awserr.Error to get the Code and
  646. // Message from an error.
  647. fmt.Println(err.Error())
  648. return
  649. }
  650. // Pretty-print the response data.
  651. fmt.Println(resp)
  652. }
  653. func ExampleAutoScaling_DisableMetricsCollection() {
  654. svc := autoscaling.New(nil)
  655. params := &autoscaling.DisableMetricsCollectionInput{
  656. AutoScalingGroupName: aws.String("ResourceName"), // Required
  657. Metrics: []*string{
  658. aws.String("XmlStringMaxLen255"), // Required
  659. // More values...
  660. },
  661. }
  662. resp, err := svc.DisableMetricsCollection(params)
  663. if err != nil {
  664. // Print the error, cast err to awserr.Error to get the Code and
  665. // Message from an error.
  666. fmt.Println(err.Error())
  667. return
  668. }
  669. // Pretty-print the response data.
  670. fmt.Println(resp)
  671. }
  672. func ExampleAutoScaling_EnableMetricsCollection() {
  673. svc := autoscaling.New(nil)
  674. params := &autoscaling.EnableMetricsCollectionInput{
  675. AutoScalingGroupName: aws.String("ResourceName"), // Required
  676. Granularity: aws.String("XmlStringMaxLen255"), // Required
  677. Metrics: []*string{
  678. aws.String("XmlStringMaxLen255"), // Required
  679. // More values...
  680. },
  681. }
  682. resp, err := svc.EnableMetricsCollection(params)
  683. if err != nil {
  684. // Print the error, cast err to awserr.Error to get the Code and
  685. // Message from an error.
  686. fmt.Println(err.Error())
  687. return
  688. }
  689. // Pretty-print the response data.
  690. fmt.Println(resp)
  691. }
  692. func ExampleAutoScaling_EnterStandby() {
  693. svc := autoscaling.New(nil)
  694. params := &autoscaling.EnterStandbyInput{
  695. AutoScalingGroupName: aws.String("ResourceName"), // Required
  696. ShouldDecrementDesiredCapacity: aws.Bool(true), // Required
  697. InstanceIds: []*string{
  698. aws.String("XmlStringMaxLen16"), // Required
  699. // More values...
  700. },
  701. }
  702. resp, err := svc.EnterStandby(params)
  703. if err != nil {
  704. // Print the error, cast err to awserr.Error to get the Code and
  705. // Message from an error.
  706. fmt.Println(err.Error())
  707. return
  708. }
  709. // Pretty-print the response data.
  710. fmt.Println(resp)
  711. }
  712. func ExampleAutoScaling_ExecutePolicy() {
  713. svc := autoscaling.New(nil)
  714. params := &autoscaling.ExecutePolicyInput{
  715. PolicyName: aws.String("ResourceName"), // Required
  716. AutoScalingGroupName: aws.String("ResourceName"),
  717. BreachThreshold: aws.Float64(1.0),
  718. HonorCooldown: aws.Bool(true),
  719. MetricValue: aws.Float64(1.0),
  720. }
  721. resp, err := svc.ExecutePolicy(params)
  722. if err != nil {
  723. // Print the error, cast err to awserr.Error to get the Code and
  724. // Message from an error.
  725. fmt.Println(err.Error())
  726. return
  727. }
  728. // Pretty-print the response data.
  729. fmt.Println(resp)
  730. }
  731. func ExampleAutoScaling_ExitStandby() {
  732. svc := autoscaling.New(nil)
  733. params := &autoscaling.ExitStandbyInput{
  734. AutoScalingGroupName: aws.String("ResourceName"), // Required
  735. InstanceIds: []*string{
  736. aws.String("XmlStringMaxLen16"), // Required
  737. // More values...
  738. },
  739. }
  740. resp, err := svc.ExitStandby(params)
  741. if err != nil {
  742. // Print the error, cast err to awserr.Error to get the Code and
  743. // Message from an error.
  744. fmt.Println(err.Error())
  745. return
  746. }
  747. // Pretty-print the response data.
  748. fmt.Println(resp)
  749. }
  750. func ExampleAutoScaling_PutLifecycleHook() {
  751. svc := autoscaling.New(nil)
  752. params := &autoscaling.PutLifecycleHookInput{
  753. AutoScalingGroupName: aws.String("ResourceName"), // Required
  754. LifecycleHookName: aws.String("AsciiStringMaxLen255"), // Required
  755. DefaultResult: aws.String("LifecycleActionResult"),
  756. HeartbeatTimeout: aws.Int64(1),
  757. LifecycleTransition: aws.String("LifecycleTransition"),
  758. NotificationMetadata: aws.String("XmlStringMaxLen1023"),
  759. NotificationTargetARN: aws.String("ResourceName"),
  760. RoleARN: aws.String("ResourceName"),
  761. }
  762. resp, err := svc.PutLifecycleHook(params)
  763. if err != nil {
  764. // Print the error, cast err to awserr.Error to get the Code and
  765. // Message from an error.
  766. fmt.Println(err.Error())
  767. return
  768. }
  769. // Pretty-print the response data.
  770. fmt.Println(resp)
  771. }
  772. func ExampleAutoScaling_PutNotificationConfiguration() {
  773. svc := autoscaling.New(nil)
  774. params := &autoscaling.PutNotificationConfigurationInput{
  775. AutoScalingGroupName: aws.String("ResourceName"), // Required
  776. NotificationTypes: []*string{ // Required
  777. aws.String("XmlStringMaxLen255"), // Required
  778. // More values...
  779. },
  780. TopicARN: aws.String("ResourceName"), // Required
  781. }
  782. resp, err := svc.PutNotificationConfiguration(params)
  783. if err != nil {
  784. // Print the error, cast err to awserr.Error to get the Code and
  785. // Message from an error.
  786. fmt.Println(err.Error())
  787. return
  788. }
  789. // Pretty-print the response data.
  790. fmt.Println(resp)
  791. }
  792. func ExampleAutoScaling_PutScalingPolicy() {
  793. svc := autoscaling.New(nil)
  794. params := &autoscaling.PutScalingPolicyInput{
  795. AdjustmentType: aws.String("XmlStringMaxLen255"), // Required
  796. AutoScalingGroupName: aws.String("ResourceName"), // Required
  797. PolicyName: aws.String("XmlStringMaxLen255"), // Required
  798. Cooldown: aws.Int64(1),
  799. EstimatedInstanceWarmup: aws.Int64(1),
  800. MetricAggregationType: aws.String("XmlStringMaxLen32"),
  801. MinAdjustmentMagnitude: aws.Int64(1),
  802. MinAdjustmentStep: aws.Int64(1),
  803. PolicyType: aws.String("XmlStringMaxLen64"),
  804. ScalingAdjustment: aws.Int64(1),
  805. StepAdjustments: []*autoscaling.StepAdjustment{
  806. { // Required
  807. ScalingAdjustment: aws.Int64(1), // Required
  808. MetricIntervalLowerBound: aws.Float64(1.0),
  809. MetricIntervalUpperBound: aws.Float64(1.0),
  810. },
  811. // More values...
  812. },
  813. }
  814. resp, err := svc.PutScalingPolicy(params)
  815. if err != nil {
  816. // Print the error, cast err to awserr.Error to get the Code and
  817. // Message from an error.
  818. fmt.Println(err.Error())
  819. return
  820. }
  821. // Pretty-print the response data.
  822. fmt.Println(resp)
  823. }
  824. func ExampleAutoScaling_PutScheduledUpdateGroupAction() {
  825. svc := autoscaling.New(nil)
  826. params := &autoscaling.PutScheduledUpdateGroupActionInput{
  827. AutoScalingGroupName: aws.String("ResourceName"), // Required
  828. ScheduledActionName: aws.String("XmlStringMaxLen255"), // Required
  829. DesiredCapacity: aws.Int64(1),
  830. EndTime: aws.Time(time.Now()),
  831. MaxSize: aws.Int64(1),
  832. MinSize: aws.Int64(1),
  833. Recurrence: aws.String("XmlStringMaxLen255"),
  834. StartTime: aws.Time(time.Now()),
  835. Time: aws.Time(time.Now()),
  836. }
  837. resp, err := svc.PutScheduledUpdateGroupAction(params)
  838. if err != nil {
  839. // Print the error, cast err to awserr.Error to get the Code and
  840. // Message from an error.
  841. fmt.Println(err.Error())
  842. return
  843. }
  844. // Pretty-print the response data.
  845. fmt.Println(resp)
  846. }
  847. func ExampleAutoScaling_RecordLifecycleActionHeartbeat() {
  848. svc := autoscaling.New(nil)
  849. params := &autoscaling.RecordLifecycleActionHeartbeatInput{
  850. AutoScalingGroupName: aws.String("ResourceName"), // Required
  851. LifecycleActionToken: aws.String("LifecycleActionToken"), // Required
  852. LifecycleHookName: aws.String("AsciiStringMaxLen255"), // Required
  853. }
  854. resp, err := svc.RecordLifecycleActionHeartbeat(params)
  855. if err != nil {
  856. // Print the error, cast err to awserr.Error to get the Code and
  857. // Message from an error.
  858. fmt.Println(err.Error())
  859. return
  860. }
  861. // Pretty-print the response data.
  862. fmt.Println(resp)
  863. }
  864. func ExampleAutoScaling_ResumeProcesses() {
  865. svc := autoscaling.New(nil)
  866. params := &autoscaling.ScalingProcessQuery{
  867. AutoScalingGroupName: aws.String("ResourceName"), // Required
  868. ScalingProcesses: []*string{
  869. aws.String("XmlStringMaxLen255"), // Required
  870. // More values...
  871. },
  872. }
  873. resp, err := svc.ResumeProcesses(params)
  874. if err != nil {
  875. // Print the error, cast err to awserr.Error to get the Code and
  876. // Message from an error.
  877. fmt.Println(err.Error())
  878. return
  879. }
  880. // Pretty-print the response data.
  881. fmt.Println(resp)
  882. }
  883. func ExampleAutoScaling_SetDesiredCapacity() {
  884. svc := autoscaling.New(nil)
  885. params := &autoscaling.SetDesiredCapacityInput{
  886. AutoScalingGroupName: aws.String("ResourceName"), // Required
  887. DesiredCapacity: aws.Int64(1), // Required
  888. HonorCooldown: aws.Bool(true),
  889. }
  890. resp, err := svc.SetDesiredCapacity(params)
  891. if err != nil {
  892. // Print the error, cast err to awserr.Error to get the Code and
  893. // Message from an error.
  894. fmt.Println(err.Error())
  895. return
  896. }
  897. // Pretty-print the response data.
  898. fmt.Println(resp)
  899. }
  900. func ExampleAutoScaling_SetInstanceHealth() {
  901. svc := autoscaling.New(nil)
  902. params := &autoscaling.SetInstanceHealthInput{
  903. HealthStatus: aws.String("XmlStringMaxLen32"), // Required
  904. InstanceId: aws.String("XmlStringMaxLen16"), // Required
  905. ShouldRespectGracePeriod: aws.Bool(true),
  906. }
  907. resp, err := svc.SetInstanceHealth(params)
  908. if err != nil {
  909. // Print the error, cast err to awserr.Error to get the Code and
  910. // Message from an error.
  911. fmt.Println(err.Error())
  912. return
  913. }
  914. // Pretty-print the response data.
  915. fmt.Println(resp)
  916. }
  917. func ExampleAutoScaling_SuspendProcesses() {
  918. svc := autoscaling.New(nil)
  919. params := &autoscaling.ScalingProcessQuery{
  920. AutoScalingGroupName: aws.String("ResourceName"), // Required
  921. ScalingProcesses: []*string{
  922. aws.String("XmlStringMaxLen255"), // Required
  923. // More values...
  924. },
  925. }
  926. resp, err := svc.SuspendProcesses(params)
  927. if err != nil {
  928. // Print the error, cast err to awserr.Error to get the Code and
  929. // Message from an error.
  930. fmt.Println(err.Error())
  931. return
  932. }
  933. // Pretty-print the response data.
  934. fmt.Println(resp)
  935. }
  936. func ExampleAutoScaling_TerminateInstanceInAutoScalingGroup() {
  937. svc := autoscaling.New(nil)
  938. params := &autoscaling.TerminateInstanceInAutoScalingGroupInput{
  939. InstanceId: aws.String("XmlStringMaxLen16"), // Required
  940. ShouldDecrementDesiredCapacity: aws.Bool(true), // Required
  941. }
  942. resp, err := svc.TerminateInstanceInAutoScalingGroup(params)
  943. if err != nil {
  944. // Print the error, cast err to awserr.Error to get the Code and
  945. // Message from an error.
  946. fmt.Println(err.Error())
  947. return
  948. }
  949. // Pretty-print the response data.
  950. fmt.Println(resp)
  951. }
  952. func ExampleAutoScaling_UpdateAutoScalingGroup() {
  953. svc := autoscaling.New(nil)
  954. params := &autoscaling.UpdateAutoScalingGroupInput{
  955. AutoScalingGroupName: aws.String("ResourceName"), // Required
  956. AvailabilityZones: []*string{
  957. aws.String("XmlStringMaxLen255"), // Required
  958. // More values...
  959. },
  960. DefaultCooldown: aws.Int64(1),
  961. DesiredCapacity: aws.Int64(1),
  962. HealthCheckGracePeriod: aws.Int64(1),
  963. HealthCheckType: aws.String("XmlStringMaxLen32"),
  964. LaunchConfigurationName: aws.String("ResourceName"),
  965. MaxSize: aws.Int64(1),
  966. MinSize: aws.Int64(1),
  967. PlacementGroup: aws.String("XmlStringMaxLen255"),
  968. TerminationPolicies: []*string{
  969. aws.String("XmlStringMaxLen1600"), // Required
  970. // More values...
  971. },
  972. VPCZoneIdentifier: aws.String("XmlStringMaxLen255"),
  973. }
  974. resp, err := svc.UpdateAutoScalingGroup(params)
  975. if err != nil {
  976. // Print the error, cast err to awserr.Error to get the Code and
  977. // Message from an error.
  978. fmt.Println(err.Error())
  979. return
  980. }
  981. // Pretty-print the response data.
  982. fmt.Println(resp)
  983. }