examples_test.go 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592
  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/aws/session"
  9. "github.com/aws/aws-sdk-go/service/autoscaling"
  10. )
  11. var _ time.Duration
  12. var _ bytes.Buffer
  13. func ExampleAutoScaling_AttachInstances() {
  14. sess, err := session.NewSession()
  15. if err != nil {
  16. fmt.Println("failed to create session,", err)
  17. return
  18. }
  19. svc := autoscaling.New(sess)
  20. params := &autoscaling.AttachInstancesInput{
  21. AutoScalingGroupName: aws.String("ResourceName"), // Required
  22. InstanceIds: []*string{
  23. aws.String("XmlStringMaxLen19"), // Required
  24. // More values...
  25. },
  26. }
  27. resp, err := svc.AttachInstances(params)
  28. if err != nil {
  29. // Print the error, cast err to awserr.Error to get the Code and
  30. // Message from an error.
  31. fmt.Println(err.Error())
  32. return
  33. }
  34. // Pretty-print the response data.
  35. fmt.Println(resp)
  36. }
  37. func ExampleAutoScaling_AttachLoadBalancerTargetGroups() {
  38. sess, err := session.NewSession()
  39. if err != nil {
  40. fmt.Println("failed to create session,", err)
  41. return
  42. }
  43. svc := autoscaling.New(sess)
  44. params := &autoscaling.AttachLoadBalancerTargetGroupsInput{
  45. AutoScalingGroupName: aws.String("ResourceName"), // Required
  46. TargetGroupARNs: []*string{ // Required
  47. aws.String("XmlStringMaxLen511"), // Required
  48. // More values...
  49. },
  50. }
  51. resp, err := svc.AttachLoadBalancerTargetGroups(params)
  52. if err != nil {
  53. // Print the error, cast err to awserr.Error to get the Code and
  54. // Message from an error.
  55. fmt.Println(err.Error())
  56. return
  57. }
  58. // Pretty-print the response data.
  59. fmt.Println(resp)
  60. }
  61. func ExampleAutoScaling_AttachLoadBalancers() {
  62. sess, err := session.NewSession()
  63. if err != nil {
  64. fmt.Println("failed to create session,", err)
  65. return
  66. }
  67. svc := autoscaling.New(sess)
  68. params := &autoscaling.AttachLoadBalancersInput{
  69. AutoScalingGroupName: aws.String("ResourceName"), // Required
  70. LoadBalancerNames: []*string{ // Required
  71. aws.String("XmlStringMaxLen255"), // Required
  72. // More values...
  73. },
  74. }
  75. resp, err := svc.AttachLoadBalancers(params)
  76. if err != nil {
  77. // Print the error, cast err to awserr.Error to get the Code and
  78. // Message from an error.
  79. fmt.Println(err.Error())
  80. return
  81. }
  82. // Pretty-print the response data.
  83. fmt.Println(resp)
  84. }
  85. func ExampleAutoScaling_CompleteLifecycleAction() {
  86. sess, err := session.NewSession()
  87. if err != nil {
  88. fmt.Println("failed to create session,", err)
  89. return
  90. }
  91. svc := autoscaling.New(sess)
  92. params := &autoscaling.CompleteLifecycleActionInput{
  93. AutoScalingGroupName: aws.String("ResourceName"), // Required
  94. LifecycleActionResult: aws.String("LifecycleActionResult"), // Required
  95. LifecycleHookName: aws.String("AsciiStringMaxLen255"), // Required
  96. InstanceId: aws.String("XmlStringMaxLen19"),
  97. LifecycleActionToken: aws.String("LifecycleActionToken"),
  98. }
  99. resp, err := svc.CompleteLifecycleAction(params)
  100. if err != nil {
  101. // Print the error, cast err to awserr.Error to get the Code and
  102. // Message from an error.
  103. fmt.Println(err.Error())
  104. return
  105. }
  106. // Pretty-print the response data.
  107. fmt.Println(resp)
  108. }
  109. func ExampleAutoScaling_CreateAutoScalingGroup() {
  110. sess, err := session.NewSession()
  111. if err != nil {
  112. fmt.Println("failed to create session,", err)
  113. return
  114. }
  115. svc := autoscaling.New(sess)
  116. params := &autoscaling.CreateAutoScalingGroupInput{
  117. AutoScalingGroupName: aws.String("XmlStringMaxLen255"), // Required
  118. MaxSize: aws.Int64(1), // Required
  119. MinSize: aws.Int64(1), // Required
  120. AvailabilityZones: []*string{
  121. aws.String("XmlStringMaxLen255"), // Required
  122. // More values...
  123. },
  124. DefaultCooldown: aws.Int64(1),
  125. DesiredCapacity: aws.Int64(1),
  126. HealthCheckGracePeriod: aws.Int64(1),
  127. HealthCheckType: aws.String("XmlStringMaxLen32"),
  128. InstanceId: aws.String("XmlStringMaxLen19"),
  129. LaunchConfigurationName: aws.String("ResourceName"),
  130. LoadBalancerNames: []*string{
  131. aws.String("XmlStringMaxLen255"), // Required
  132. // More values...
  133. },
  134. NewInstancesProtectedFromScaleIn: aws.Bool(true),
  135. PlacementGroup: aws.String("XmlStringMaxLen255"),
  136. Tags: []*autoscaling.Tag{
  137. { // Required
  138. Key: aws.String("TagKey"), // Required
  139. PropagateAtLaunch: aws.Bool(true),
  140. ResourceId: aws.String("XmlString"),
  141. ResourceType: aws.String("XmlString"),
  142. Value: aws.String("TagValue"),
  143. },
  144. // More values...
  145. },
  146. TargetGroupARNs: []*string{
  147. aws.String("XmlStringMaxLen511"), // Required
  148. // More values...
  149. },
  150. TerminationPolicies: []*string{
  151. aws.String("XmlStringMaxLen1600"), // Required
  152. // More values...
  153. },
  154. VPCZoneIdentifier: aws.String("XmlStringMaxLen2047"),
  155. }
  156. resp, err := svc.CreateAutoScalingGroup(params)
  157. if err != nil {
  158. // Print the error, cast err to awserr.Error to get the Code and
  159. // Message from an error.
  160. fmt.Println(err.Error())
  161. return
  162. }
  163. // Pretty-print the response data.
  164. fmt.Println(resp)
  165. }
  166. func ExampleAutoScaling_CreateLaunchConfiguration() {
  167. sess, err := session.NewSession()
  168. if err != nil {
  169. fmt.Println("failed to create session,", err)
  170. return
  171. }
  172. svc := autoscaling.New(sess)
  173. params := &autoscaling.CreateLaunchConfigurationInput{
  174. LaunchConfigurationName: aws.String("XmlStringMaxLen255"), // Required
  175. AssociatePublicIpAddress: aws.Bool(true),
  176. BlockDeviceMappings: []*autoscaling.BlockDeviceMapping{
  177. { // Required
  178. DeviceName: aws.String("XmlStringMaxLen255"), // Required
  179. Ebs: &autoscaling.Ebs{
  180. DeleteOnTermination: aws.Bool(true),
  181. Encrypted: aws.Bool(true),
  182. Iops: aws.Int64(1),
  183. SnapshotId: aws.String("XmlStringMaxLen255"),
  184. VolumeSize: aws.Int64(1),
  185. VolumeType: aws.String("BlockDeviceEbsVolumeType"),
  186. },
  187. NoDevice: aws.Bool(true),
  188. VirtualName: aws.String("XmlStringMaxLen255"),
  189. },
  190. // More values...
  191. },
  192. ClassicLinkVPCId: aws.String("XmlStringMaxLen255"),
  193. ClassicLinkVPCSecurityGroups: []*string{
  194. aws.String("XmlStringMaxLen255"), // Required
  195. // More values...
  196. },
  197. EbsOptimized: aws.Bool(true),
  198. IamInstanceProfile: aws.String("XmlStringMaxLen1600"),
  199. ImageId: aws.String("XmlStringMaxLen255"),
  200. InstanceId: aws.String("XmlStringMaxLen19"),
  201. InstanceMonitoring: &autoscaling.InstanceMonitoring{
  202. Enabled: aws.Bool(true),
  203. },
  204. InstanceType: aws.String("XmlStringMaxLen255"),
  205. KernelId: aws.String("XmlStringMaxLen255"),
  206. KeyName: aws.String("XmlStringMaxLen255"),
  207. PlacementTenancy: aws.String("XmlStringMaxLen64"),
  208. RamdiskId: aws.String("XmlStringMaxLen255"),
  209. SecurityGroups: []*string{
  210. aws.String("XmlString"), // Required
  211. // More values...
  212. },
  213. SpotPrice: aws.String("SpotPrice"),
  214. UserData: aws.String("XmlStringUserData"),
  215. }
  216. resp, err := svc.CreateLaunchConfiguration(params)
  217. if err != nil {
  218. // Print the error, cast err to awserr.Error to get the Code and
  219. // Message from an error.
  220. fmt.Println(err.Error())
  221. return
  222. }
  223. // Pretty-print the response data.
  224. fmt.Println(resp)
  225. }
  226. func ExampleAutoScaling_CreateOrUpdateTags() {
  227. sess, err := session.NewSession()
  228. if err != nil {
  229. fmt.Println("failed to create session,", err)
  230. return
  231. }
  232. svc := autoscaling.New(sess)
  233. params := &autoscaling.CreateOrUpdateTagsInput{
  234. Tags: []*autoscaling.Tag{ // Required
  235. { // Required
  236. Key: aws.String("TagKey"), // Required
  237. PropagateAtLaunch: aws.Bool(true),
  238. ResourceId: aws.String("XmlString"),
  239. ResourceType: aws.String("XmlString"),
  240. Value: aws.String("TagValue"),
  241. },
  242. // More values...
  243. },
  244. }
  245. resp, err := svc.CreateOrUpdateTags(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 ExampleAutoScaling_DeleteAutoScalingGroup() {
  256. sess, err := session.NewSession()
  257. if err != nil {
  258. fmt.Println("failed to create session,", err)
  259. return
  260. }
  261. svc := autoscaling.New(sess)
  262. params := &autoscaling.DeleteAutoScalingGroupInput{
  263. AutoScalingGroupName: aws.String("ResourceName"), // Required
  264. ForceDelete: aws.Bool(true),
  265. }
  266. resp, err := svc.DeleteAutoScalingGroup(params)
  267. if err != nil {
  268. // Print the error, cast err to awserr.Error to get the Code and
  269. // Message from an error.
  270. fmt.Println(err.Error())
  271. return
  272. }
  273. // Pretty-print the response data.
  274. fmt.Println(resp)
  275. }
  276. func ExampleAutoScaling_DeleteLaunchConfiguration() {
  277. sess, err := session.NewSession()
  278. if err != nil {
  279. fmt.Println("failed to create session,", err)
  280. return
  281. }
  282. svc := autoscaling.New(sess)
  283. params := &autoscaling.DeleteLaunchConfigurationInput{
  284. LaunchConfigurationName: aws.String("ResourceName"), // Required
  285. }
  286. resp, err := svc.DeleteLaunchConfiguration(params)
  287. if err != nil {
  288. // Print the error, cast err to awserr.Error to get the Code and
  289. // Message from an error.
  290. fmt.Println(err.Error())
  291. return
  292. }
  293. // Pretty-print the response data.
  294. fmt.Println(resp)
  295. }
  296. func ExampleAutoScaling_DeleteLifecycleHook() {
  297. sess, err := session.NewSession()
  298. if err != nil {
  299. fmt.Println("failed to create session,", err)
  300. return
  301. }
  302. svc := autoscaling.New(sess)
  303. params := &autoscaling.DeleteLifecycleHookInput{
  304. AutoScalingGroupName: aws.String("ResourceName"), // Required
  305. LifecycleHookName: aws.String("AsciiStringMaxLen255"), // Required
  306. }
  307. resp, err := svc.DeleteLifecycleHook(params)
  308. if err != nil {
  309. // Print the error, cast err to awserr.Error to get the Code and
  310. // Message from an error.
  311. fmt.Println(err.Error())
  312. return
  313. }
  314. // Pretty-print the response data.
  315. fmt.Println(resp)
  316. }
  317. func ExampleAutoScaling_DeleteNotificationConfiguration() {
  318. sess, err := session.NewSession()
  319. if err != nil {
  320. fmt.Println("failed to create session,", err)
  321. return
  322. }
  323. svc := autoscaling.New(sess)
  324. params := &autoscaling.DeleteNotificationConfigurationInput{
  325. AutoScalingGroupName: aws.String("ResourceName"), // Required
  326. TopicARN: aws.String("ResourceName"), // Required
  327. }
  328. resp, err := svc.DeleteNotificationConfiguration(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_DeletePolicy() {
  339. sess, err := session.NewSession()
  340. if err != nil {
  341. fmt.Println("failed to create session,", err)
  342. return
  343. }
  344. svc := autoscaling.New(sess)
  345. params := &autoscaling.DeletePolicyInput{
  346. PolicyName: aws.String("ResourceName"), // Required
  347. AutoScalingGroupName: aws.String("ResourceName"),
  348. }
  349. resp, err := svc.DeletePolicy(params)
  350. if err != nil {
  351. // Print the error, cast err to awserr.Error to get the Code and
  352. // Message from an error.
  353. fmt.Println(err.Error())
  354. return
  355. }
  356. // Pretty-print the response data.
  357. fmt.Println(resp)
  358. }
  359. func ExampleAutoScaling_DeleteScheduledAction() {
  360. sess, err := session.NewSession()
  361. if err != nil {
  362. fmt.Println("failed to create session,", err)
  363. return
  364. }
  365. svc := autoscaling.New(sess)
  366. params := &autoscaling.DeleteScheduledActionInput{
  367. AutoScalingGroupName: aws.String("ResourceName"), // Required
  368. ScheduledActionName: aws.String("ResourceName"), // Required
  369. }
  370. resp, err := svc.DeleteScheduledAction(params)
  371. if err != nil {
  372. // Print the error, cast err to awserr.Error to get the Code and
  373. // Message from an error.
  374. fmt.Println(err.Error())
  375. return
  376. }
  377. // Pretty-print the response data.
  378. fmt.Println(resp)
  379. }
  380. func ExampleAutoScaling_DeleteTags() {
  381. sess, err := session.NewSession()
  382. if err != nil {
  383. fmt.Println("failed to create session,", err)
  384. return
  385. }
  386. svc := autoscaling.New(sess)
  387. params := &autoscaling.DeleteTagsInput{
  388. Tags: []*autoscaling.Tag{ // Required
  389. { // Required
  390. Key: aws.String("TagKey"), // Required
  391. PropagateAtLaunch: aws.Bool(true),
  392. ResourceId: aws.String("XmlString"),
  393. ResourceType: aws.String("XmlString"),
  394. Value: aws.String("TagValue"),
  395. },
  396. // More values...
  397. },
  398. }
  399. resp, err := svc.DeleteTags(params)
  400. if err != nil {
  401. // Print the error, cast err to awserr.Error to get the Code and
  402. // Message from an error.
  403. fmt.Println(err.Error())
  404. return
  405. }
  406. // Pretty-print the response data.
  407. fmt.Println(resp)
  408. }
  409. func ExampleAutoScaling_DescribeAccountLimits() {
  410. sess, err := session.NewSession()
  411. if err != nil {
  412. fmt.Println("failed to create session,", err)
  413. return
  414. }
  415. svc := autoscaling.New(sess)
  416. var params *autoscaling.DescribeAccountLimitsInput
  417. resp, err := svc.DescribeAccountLimits(params)
  418. if err != nil {
  419. // Print the error, cast err to awserr.Error to get the Code and
  420. // Message from an error.
  421. fmt.Println(err.Error())
  422. return
  423. }
  424. // Pretty-print the response data.
  425. fmt.Println(resp)
  426. }
  427. func ExampleAutoScaling_DescribeAdjustmentTypes() {
  428. sess, err := session.NewSession()
  429. if err != nil {
  430. fmt.Println("failed to create session,", err)
  431. return
  432. }
  433. svc := autoscaling.New(sess)
  434. var params *autoscaling.DescribeAdjustmentTypesInput
  435. resp, err := svc.DescribeAdjustmentTypes(params)
  436. if err != nil {
  437. // Print the error, cast err to awserr.Error to get the Code and
  438. // Message from an error.
  439. fmt.Println(err.Error())
  440. return
  441. }
  442. // Pretty-print the response data.
  443. fmt.Println(resp)
  444. }
  445. func ExampleAutoScaling_DescribeAutoScalingGroups() {
  446. sess, err := session.NewSession()
  447. if err != nil {
  448. fmt.Println("failed to create session,", err)
  449. return
  450. }
  451. svc := autoscaling.New(sess)
  452. params := &autoscaling.DescribeAutoScalingGroupsInput{
  453. AutoScalingGroupNames: []*string{
  454. aws.String("ResourceName"), // Required
  455. // More values...
  456. },
  457. MaxRecords: aws.Int64(1),
  458. NextToken: aws.String("XmlString"),
  459. }
  460. resp, err := svc.DescribeAutoScalingGroups(params)
  461. if err != nil {
  462. // Print the error, cast err to awserr.Error to get the Code and
  463. // Message from an error.
  464. fmt.Println(err.Error())
  465. return
  466. }
  467. // Pretty-print the response data.
  468. fmt.Println(resp)
  469. }
  470. func ExampleAutoScaling_DescribeAutoScalingInstances() {
  471. sess, err := session.NewSession()
  472. if err != nil {
  473. fmt.Println("failed to create session,", err)
  474. return
  475. }
  476. svc := autoscaling.New(sess)
  477. params := &autoscaling.DescribeAutoScalingInstancesInput{
  478. InstanceIds: []*string{
  479. aws.String("XmlStringMaxLen19"), // Required
  480. // More values...
  481. },
  482. MaxRecords: aws.Int64(1),
  483. NextToken: aws.String("XmlString"),
  484. }
  485. resp, err := svc.DescribeAutoScalingInstances(params)
  486. if err != nil {
  487. // Print the error, cast err to awserr.Error to get the Code and
  488. // Message from an error.
  489. fmt.Println(err.Error())
  490. return
  491. }
  492. // Pretty-print the response data.
  493. fmt.Println(resp)
  494. }
  495. func ExampleAutoScaling_DescribeAutoScalingNotificationTypes() {
  496. sess, err := session.NewSession()
  497. if err != nil {
  498. fmt.Println("failed to create session,", err)
  499. return
  500. }
  501. svc := autoscaling.New(sess)
  502. var params *autoscaling.DescribeAutoScalingNotificationTypesInput
  503. resp, err := svc.DescribeAutoScalingNotificationTypes(params)
  504. if err != nil {
  505. // Print the error, cast err to awserr.Error to get the Code and
  506. // Message from an error.
  507. fmt.Println(err.Error())
  508. return
  509. }
  510. // Pretty-print the response data.
  511. fmt.Println(resp)
  512. }
  513. func ExampleAutoScaling_DescribeLaunchConfigurations() {
  514. sess, err := session.NewSession()
  515. if err != nil {
  516. fmt.Println("failed to create session,", err)
  517. return
  518. }
  519. svc := autoscaling.New(sess)
  520. params := &autoscaling.DescribeLaunchConfigurationsInput{
  521. LaunchConfigurationNames: []*string{
  522. aws.String("ResourceName"), // Required
  523. // More values...
  524. },
  525. MaxRecords: aws.Int64(1),
  526. NextToken: aws.String("XmlString"),
  527. }
  528. resp, err := svc.DescribeLaunchConfigurations(params)
  529. if err != nil {
  530. // Print the error, cast err to awserr.Error to get the Code and
  531. // Message from an error.
  532. fmt.Println(err.Error())
  533. return
  534. }
  535. // Pretty-print the response data.
  536. fmt.Println(resp)
  537. }
  538. func ExampleAutoScaling_DescribeLifecycleHookTypes() {
  539. sess, err := session.NewSession()
  540. if err != nil {
  541. fmt.Println("failed to create session,", err)
  542. return
  543. }
  544. svc := autoscaling.New(sess)
  545. var params *autoscaling.DescribeLifecycleHookTypesInput
  546. resp, err := svc.DescribeLifecycleHookTypes(params)
  547. if err != nil {
  548. // Print the error, cast err to awserr.Error to get the Code and
  549. // Message from an error.
  550. fmt.Println(err.Error())
  551. return
  552. }
  553. // Pretty-print the response data.
  554. fmt.Println(resp)
  555. }
  556. func ExampleAutoScaling_DescribeLifecycleHooks() {
  557. sess, err := session.NewSession()
  558. if err != nil {
  559. fmt.Println("failed to create session,", err)
  560. return
  561. }
  562. svc := autoscaling.New(sess)
  563. params := &autoscaling.DescribeLifecycleHooksInput{
  564. AutoScalingGroupName: aws.String("ResourceName"), // Required
  565. LifecycleHookNames: []*string{
  566. aws.String("AsciiStringMaxLen255"), // Required
  567. // More values...
  568. },
  569. }
  570. resp, err := svc.DescribeLifecycleHooks(params)
  571. if err != nil {
  572. // Print the error, cast err to awserr.Error to get the Code and
  573. // Message from an error.
  574. fmt.Println(err.Error())
  575. return
  576. }
  577. // Pretty-print the response data.
  578. fmt.Println(resp)
  579. }
  580. func ExampleAutoScaling_DescribeLoadBalancerTargetGroups() {
  581. sess, err := session.NewSession()
  582. if err != nil {
  583. fmt.Println("failed to create session,", err)
  584. return
  585. }
  586. svc := autoscaling.New(sess)
  587. params := &autoscaling.DescribeLoadBalancerTargetGroupsInput{
  588. AutoScalingGroupName: aws.String("ResourceName"), // Required
  589. MaxRecords: aws.Int64(1),
  590. NextToken: aws.String("XmlString"),
  591. }
  592. resp, err := svc.DescribeLoadBalancerTargetGroups(params)
  593. if err != nil {
  594. // Print the error, cast err to awserr.Error to get the Code and
  595. // Message from an error.
  596. fmt.Println(err.Error())
  597. return
  598. }
  599. // Pretty-print the response data.
  600. fmt.Println(resp)
  601. }
  602. func ExampleAutoScaling_DescribeLoadBalancers() {
  603. sess, err := session.NewSession()
  604. if err != nil {
  605. fmt.Println("failed to create session,", err)
  606. return
  607. }
  608. svc := autoscaling.New(sess)
  609. params := &autoscaling.DescribeLoadBalancersInput{
  610. AutoScalingGroupName: aws.String("ResourceName"), // Required
  611. MaxRecords: aws.Int64(1),
  612. NextToken: aws.String("XmlString"),
  613. }
  614. resp, err := svc.DescribeLoadBalancers(params)
  615. if err != nil {
  616. // Print the error, cast err to awserr.Error to get the Code and
  617. // Message from an error.
  618. fmt.Println(err.Error())
  619. return
  620. }
  621. // Pretty-print the response data.
  622. fmt.Println(resp)
  623. }
  624. func ExampleAutoScaling_DescribeMetricCollectionTypes() {
  625. sess, err := session.NewSession()
  626. if err != nil {
  627. fmt.Println("failed to create session,", err)
  628. return
  629. }
  630. svc := autoscaling.New(sess)
  631. var params *autoscaling.DescribeMetricCollectionTypesInput
  632. resp, err := svc.DescribeMetricCollectionTypes(params)
  633. if err != nil {
  634. // Print the error, cast err to awserr.Error to get the Code and
  635. // Message from an error.
  636. fmt.Println(err.Error())
  637. return
  638. }
  639. // Pretty-print the response data.
  640. fmt.Println(resp)
  641. }
  642. func ExampleAutoScaling_DescribeNotificationConfigurations() {
  643. sess, err := session.NewSession()
  644. if err != nil {
  645. fmt.Println("failed to create session,", err)
  646. return
  647. }
  648. svc := autoscaling.New(sess)
  649. params := &autoscaling.DescribeNotificationConfigurationsInput{
  650. AutoScalingGroupNames: []*string{
  651. aws.String("ResourceName"), // Required
  652. // More values...
  653. },
  654. MaxRecords: aws.Int64(1),
  655. NextToken: aws.String("XmlString"),
  656. }
  657. resp, err := svc.DescribeNotificationConfigurations(params)
  658. if err != nil {
  659. // Print the error, cast err to awserr.Error to get the Code and
  660. // Message from an error.
  661. fmt.Println(err.Error())
  662. return
  663. }
  664. // Pretty-print the response data.
  665. fmt.Println(resp)
  666. }
  667. func ExampleAutoScaling_DescribePolicies() {
  668. sess, err := session.NewSession()
  669. if err != nil {
  670. fmt.Println("failed to create session,", err)
  671. return
  672. }
  673. svc := autoscaling.New(sess)
  674. params := &autoscaling.DescribePoliciesInput{
  675. AutoScalingGroupName: aws.String("ResourceName"),
  676. MaxRecords: aws.Int64(1),
  677. NextToken: aws.String("XmlString"),
  678. PolicyNames: []*string{
  679. aws.String("ResourceName"), // Required
  680. // More values...
  681. },
  682. PolicyTypes: []*string{
  683. aws.String("XmlStringMaxLen64"), // Required
  684. // More values...
  685. },
  686. }
  687. resp, err := svc.DescribePolicies(params)
  688. if err != nil {
  689. // Print the error, cast err to awserr.Error to get the Code and
  690. // Message from an error.
  691. fmt.Println(err.Error())
  692. return
  693. }
  694. // Pretty-print the response data.
  695. fmt.Println(resp)
  696. }
  697. func ExampleAutoScaling_DescribeScalingActivities() {
  698. sess, err := session.NewSession()
  699. if err != nil {
  700. fmt.Println("failed to create session,", err)
  701. return
  702. }
  703. svc := autoscaling.New(sess)
  704. params := &autoscaling.DescribeScalingActivitiesInput{
  705. ActivityIds: []*string{
  706. aws.String("XmlString"), // Required
  707. // More values...
  708. },
  709. AutoScalingGroupName: aws.String("ResourceName"),
  710. MaxRecords: aws.Int64(1),
  711. NextToken: aws.String("XmlString"),
  712. }
  713. resp, err := svc.DescribeScalingActivities(params)
  714. if err != nil {
  715. // Print the error, cast err to awserr.Error to get the Code and
  716. // Message from an error.
  717. fmt.Println(err.Error())
  718. return
  719. }
  720. // Pretty-print the response data.
  721. fmt.Println(resp)
  722. }
  723. func ExampleAutoScaling_DescribeScalingProcessTypes() {
  724. sess, err := session.NewSession()
  725. if err != nil {
  726. fmt.Println("failed to create session,", err)
  727. return
  728. }
  729. svc := autoscaling.New(sess)
  730. var params *autoscaling.DescribeScalingProcessTypesInput
  731. resp, err := svc.DescribeScalingProcessTypes(params)
  732. if err != nil {
  733. // Print the error, cast err to awserr.Error to get the Code and
  734. // Message from an error.
  735. fmt.Println(err.Error())
  736. return
  737. }
  738. // Pretty-print the response data.
  739. fmt.Println(resp)
  740. }
  741. func ExampleAutoScaling_DescribeScheduledActions() {
  742. sess, err := session.NewSession()
  743. if err != nil {
  744. fmt.Println("failed to create session,", err)
  745. return
  746. }
  747. svc := autoscaling.New(sess)
  748. params := &autoscaling.DescribeScheduledActionsInput{
  749. AutoScalingGroupName: aws.String("ResourceName"),
  750. EndTime: aws.Time(time.Now()),
  751. MaxRecords: aws.Int64(1),
  752. NextToken: aws.String("XmlString"),
  753. ScheduledActionNames: []*string{
  754. aws.String("ResourceName"), // Required
  755. // More values...
  756. },
  757. StartTime: aws.Time(time.Now()),
  758. }
  759. resp, err := svc.DescribeScheduledActions(params)
  760. if err != nil {
  761. // Print the error, cast err to awserr.Error to get the Code and
  762. // Message from an error.
  763. fmt.Println(err.Error())
  764. return
  765. }
  766. // Pretty-print the response data.
  767. fmt.Println(resp)
  768. }
  769. func ExampleAutoScaling_DescribeTags() {
  770. sess, err := session.NewSession()
  771. if err != nil {
  772. fmt.Println("failed to create session,", err)
  773. return
  774. }
  775. svc := autoscaling.New(sess)
  776. params := &autoscaling.DescribeTagsInput{
  777. Filters: []*autoscaling.Filter{
  778. { // Required
  779. Name: aws.String("XmlString"),
  780. Values: []*string{
  781. aws.String("XmlString"), // Required
  782. // More values...
  783. },
  784. },
  785. // More values...
  786. },
  787. MaxRecords: aws.Int64(1),
  788. NextToken: aws.String("XmlString"),
  789. }
  790. resp, err := svc.DescribeTags(params)
  791. if err != nil {
  792. // Print the error, cast err to awserr.Error to get the Code and
  793. // Message from an error.
  794. fmt.Println(err.Error())
  795. return
  796. }
  797. // Pretty-print the response data.
  798. fmt.Println(resp)
  799. }
  800. func ExampleAutoScaling_DescribeTerminationPolicyTypes() {
  801. sess, err := session.NewSession()
  802. if err != nil {
  803. fmt.Println("failed to create session,", err)
  804. return
  805. }
  806. svc := autoscaling.New(sess)
  807. var params *autoscaling.DescribeTerminationPolicyTypesInput
  808. resp, err := svc.DescribeTerminationPolicyTypes(params)
  809. if err != nil {
  810. // Print the error, cast err to awserr.Error to get the Code and
  811. // Message from an error.
  812. fmt.Println(err.Error())
  813. return
  814. }
  815. // Pretty-print the response data.
  816. fmt.Println(resp)
  817. }
  818. func ExampleAutoScaling_DetachInstances() {
  819. sess, err := session.NewSession()
  820. if err != nil {
  821. fmt.Println("failed to create session,", err)
  822. return
  823. }
  824. svc := autoscaling.New(sess)
  825. params := &autoscaling.DetachInstancesInput{
  826. AutoScalingGroupName: aws.String("ResourceName"), // Required
  827. ShouldDecrementDesiredCapacity: aws.Bool(true), // Required
  828. InstanceIds: []*string{
  829. aws.String("XmlStringMaxLen19"), // Required
  830. // More values...
  831. },
  832. }
  833. resp, err := svc.DetachInstances(params)
  834. if err != nil {
  835. // Print the error, cast err to awserr.Error to get the Code and
  836. // Message from an error.
  837. fmt.Println(err.Error())
  838. return
  839. }
  840. // Pretty-print the response data.
  841. fmt.Println(resp)
  842. }
  843. func ExampleAutoScaling_DetachLoadBalancerTargetGroups() {
  844. sess, err := session.NewSession()
  845. if err != nil {
  846. fmt.Println("failed to create session,", err)
  847. return
  848. }
  849. svc := autoscaling.New(sess)
  850. params := &autoscaling.DetachLoadBalancerTargetGroupsInput{
  851. AutoScalingGroupName: aws.String("ResourceName"), // Required
  852. TargetGroupARNs: []*string{ // Required
  853. aws.String("XmlStringMaxLen511"), // Required
  854. // More values...
  855. },
  856. }
  857. resp, err := svc.DetachLoadBalancerTargetGroups(params)
  858. if err != nil {
  859. // Print the error, cast err to awserr.Error to get the Code and
  860. // Message from an error.
  861. fmt.Println(err.Error())
  862. return
  863. }
  864. // Pretty-print the response data.
  865. fmt.Println(resp)
  866. }
  867. func ExampleAutoScaling_DetachLoadBalancers() {
  868. sess, err := session.NewSession()
  869. if err != nil {
  870. fmt.Println("failed to create session,", err)
  871. return
  872. }
  873. svc := autoscaling.New(sess)
  874. params := &autoscaling.DetachLoadBalancersInput{
  875. AutoScalingGroupName: aws.String("ResourceName"), // Required
  876. LoadBalancerNames: []*string{ // Required
  877. aws.String("XmlStringMaxLen255"), // Required
  878. // More values...
  879. },
  880. }
  881. resp, err := svc.DetachLoadBalancers(params)
  882. if err != nil {
  883. // Print the error, cast err to awserr.Error to get the Code and
  884. // Message from an error.
  885. fmt.Println(err.Error())
  886. return
  887. }
  888. // Pretty-print the response data.
  889. fmt.Println(resp)
  890. }
  891. func ExampleAutoScaling_DisableMetricsCollection() {
  892. sess, err := session.NewSession()
  893. if err != nil {
  894. fmt.Println("failed to create session,", err)
  895. return
  896. }
  897. svc := autoscaling.New(sess)
  898. params := &autoscaling.DisableMetricsCollectionInput{
  899. AutoScalingGroupName: aws.String("ResourceName"), // Required
  900. Metrics: []*string{
  901. aws.String("XmlStringMaxLen255"), // Required
  902. // More values...
  903. },
  904. }
  905. resp, err := svc.DisableMetricsCollection(params)
  906. if err != nil {
  907. // Print the error, cast err to awserr.Error to get the Code and
  908. // Message from an error.
  909. fmt.Println(err.Error())
  910. return
  911. }
  912. // Pretty-print the response data.
  913. fmt.Println(resp)
  914. }
  915. func ExampleAutoScaling_EnableMetricsCollection() {
  916. sess, err := session.NewSession()
  917. if err != nil {
  918. fmt.Println("failed to create session,", err)
  919. return
  920. }
  921. svc := autoscaling.New(sess)
  922. params := &autoscaling.EnableMetricsCollectionInput{
  923. AutoScalingGroupName: aws.String("ResourceName"), // Required
  924. Granularity: aws.String("XmlStringMaxLen255"), // Required
  925. Metrics: []*string{
  926. aws.String("XmlStringMaxLen255"), // Required
  927. // More values...
  928. },
  929. }
  930. resp, err := svc.EnableMetricsCollection(params)
  931. if err != nil {
  932. // Print the error, cast err to awserr.Error to get the Code and
  933. // Message from an error.
  934. fmt.Println(err.Error())
  935. return
  936. }
  937. // Pretty-print the response data.
  938. fmt.Println(resp)
  939. }
  940. func ExampleAutoScaling_EnterStandby() {
  941. sess, err := session.NewSession()
  942. if err != nil {
  943. fmt.Println("failed to create session,", err)
  944. return
  945. }
  946. svc := autoscaling.New(sess)
  947. params := &autoscaling.EnterStandbyInput{
  948. AutoScalingGroupName: aws.String("ResourceName"), // Required
  949. ShouldDecrementDesiredCapacity: aws.Bool(true), // Required
  950. InstanceIds: []*string{
  951. aws.String("XmlStringMaxLen19"), // Required
  952. // More values...
  953. },
  954. }
  955. resp, err := svc.EnterStandby(params)
  956. if err != nil {
  957. // Print the error, cast err to awserr.Error to get the Code and
  958. // Message from an error.
  959. fmt.Println(err.Error())
  960. return
  961. }
  962. // Pretty-print the response data.
  963. fmt.Println(resp)
  964. }
  965. func ExampleAutoScaling_ExecutePolicy() {
  966. sess, err := session.NewSession()
  967. if err != nil {
  968. fmt.Println("failed to create session,", err)
  969. return
  970. }
  971. svc := autoscaling.New(sess)
  972. params := &autoscaling.ExecutePolicyInput{
  973. PolicyName: aws.String("ResourceName"), // Required
  974. AutoScalingGroupName: aws.String("ResourceName"),
  975. BreachThreshold: aws.Float64(1.0),
  976. HonorCooldown: aws.Bool(true),
  977. MetricValue: aws.Float64(1.0),
  978. }
  979. resp, err := svc.ExecutePolicy(params)
  980. if err != nil {
  981. // Print the error, cast err to awserr.Error to get the Code and
  982. // Message from an error.
  983. fmt.Println(err.Error())
  984. return
  985. }
  986. // Pretty-print the response data.
  987. fmt.Println(resp)
  988. }
  989. func ExampleAutoScaling_ExitStandby() {
  990. sess, err := session.NewSession()
  991. if err != nil {
  992. fmt.Println("failed to create session,", err)
  993. return
  994. }
  995. svc := autoscaling.New(sess)
  996. params := &autoscaling.ExitStandbyInput{
  997. AutoScalingGroupName: aws.String("ResourceName"), // Required
  998. InstanceIds: []*string{
  999. aws.String("XmlStringMaxLen19"), // Required
  1000. // More values...
  1001. },
  1002. }
  1003. resp, err := svc.ExitStandby(params)
  1004. if err != nil {
  1005. // Print the error, cast err to awserr.Error to get the Code and
  1006. // Message from an error.
  1007. fmt.Println(err.Error())
  1008. return
  1009. }
  1010. // Pretty-print the response data.
  1011. fmt.Println(resp)
  1012. }
  1013. func ExampleAutoScaling_PutLifecycleHook() {
  1014. sess, err := session.NewSession()
  1015. if err != nil {
  1016. fmt.Println("failed to create session,", err)
  1017. return
  1018. }
  1019. svc := autoscaling.New(sess)
  1020. params := &autoscaling.PutLifecycleHookInput{
  1021. AutoScalingGroupName: aws.String("ResourceName"), // Required
  1022. LifecycleHookName: aws.String("AsciiStringMaxLen255"), // Required
  1023. DefaultResult: aws.String("LifecycleActionResult"),
  1024. HeartbeatTimeout: aws.Int64(1),
  1025. LifecycleTransition: aws.String("LifecycleTransition"),
  1026. NotificationMetadata: aws.String("XmlStringMaxLen1023"),
  1027. NotificationTargetARN: aws.String("NotificationTargetResourceName"),
  1028. RoleARN: aws.String("ResourceName"),
  1029. }
  1030. resp, err := svc.PutLifecycleHook(params)
  1031. if err != nil {
  1032. // Print the error, cast err to awserr.Error to get the Code and
  1033. // Message from an error.
  1034. fmt.Println(err.Error())
  1035. return
  1036. }
  1037. // Pretty-print the response data.
  1038. fmt.Println(resp)
  1039. }
  1040. func ExampleAutoScaling_PutNotificationConfiguration() {
  1041. sess, err := session.NewSession()
  1042. if err != nil {
  1043. fmt.Println("failed to create session,", err)
  1044. return
  1045. }
  1046. svc := autoscaling.New(sess)
  1047. params := &autoscaling.PutNotificationConfigurationInput{
  1048. AutoScalingGroupName: aws.String("ResourceName"), // Required
  1049. NotificationTypes: []*string{ // Required
  1050. aws.String("XmlStringMaxLen255"), // Required
  1051. // More values...
  1052. },
  1053. TopicARN: aws.String("ResourceName"), // Required
  1054. }
  1055. resp, err := svc.PutNotificationConfiguration(params)
  1056. if err != nil {
  1057. // Print the error, cast err to awserr.Error to get the Code and
  1058. // Message from an error.
  1059. fmt.Println(err.Error())
  1060. return
  1061. }
  1062. // Pretty-print the response data.
  1063. fmt.Println(resp)
  1064. }
  1065. func ExampleAutoScaling_PutScalingPolicy() {
  1066. sess, err := session.NewSession()
  1067. if err != nil {
  1068. fmt.Println("failed to create session,", err)
  1069. return
  1070. }
  1071. svc := autoscaling.New(sess)
  1072. params := &autoscaling.PutScalingPolicyInput{
  1073. AdjustmentType: aws.String("XmlStringMaxLen255"), // Required
  1074. AutoScalingGroupName: aws.String("ResourceName"), // Required
  1075. PolicyName: aws.String("XmlStringMaxLen255"), // Required
  1076. Cooldown: aws.Int64(1),
  1077. EstimatedInstanceWarmup: aws.Int64(1),
  1078. MetricAggregationType: aws.String("XmlStringMaxLen32"),
  1079. MinAdjustmentMagnitude: aws.Int64(1),
  1080. MinAdjustmentStep: aws.Int64(1),
  1081. PolicyType: aws.String("XmlStringMaxLen64"),
  1082. ScalingAdjustment: aws.Int64(1),
  1083. StepAdjustments: []*autoscaling.StepAdjustment{
  1084. { // Required
  1085. ScalingAdjustment: aws.Int64(1), // Required
  1086. MetricIntervalLowerBound: aws.Float64(1.0),
  1087. MetricIntervalUpperBound: aws.Float64(1.0),
  1088. },
  1089. // More values...
  1090. },
  1091. }
  1092. resp, err := svc.PutScalingPolicy(params)
  1093. if err != nil {
  1094. // Print the error, cast err to awserr.Error to get the Code and
  1095. // Message from an error.
  1096. fmt.Println(err.Error())
  1097. return
  1098. }
  1099. // Pretty-print the response data.
  1100. fmt.Println(resp)
  1101. }
  1102. func ExampleAutoScaling_PutScheduledUpdateGroupAction() {
  1103. sess, err := session.NewSession()
  1104. if err != nil {
  1105. fmt.Println("failed to create session,", err)
  1106. return
  1107. }
  1108. svc := autoscaling.New(sess)
  1109. params := &autoscaling.PutScheduledUpdateGroupActionInput{
  1110. AutoScalingGroupName: aws.String("ResourceName"), // Required
  1111. ScheduledActionName: aws.String("XmlStringMaxLen255"), // Required
  1112. DesiredCapacity: aws.Int64(1),
  1113. EndTime: aws.Time(time.Now()),
  1114. MaxSize: aws.Int64(1),
  1115. MinSize: aws.Int64(1),
  1116. Recurrence: aws.String("XmlStringMaxLen255"),
  1117. StartTime: aws.Time(time.Now()),
  1118. Time: aws.Time(time.Now()),
  1119. }
  1120. resp, err := svc.PutScheduledUpdateGroupAction(params)
  1121. if err != nil {
  1122. // Print the error, cast err to awserr.Error to get the Code and
  1123. // Message from an error.
  1124. fmt.Println(err.Error())
  1125. return
  1126. }
  1127. // Pretty-print the response data.
  1128. fmt.Println(resp)
  1129. }
  1130. func ExampleAutoScaling_RecordLifecycleActionHeartbeat() {
  1131. sess, err := session.NewSession()
  1132. if err != nil {
  1133. fmt.Println("failed to create session,", err)
  1134. return
  1135. }
  1136. svc := autoscaling.New(sess)
  1137. params := &autoscaling.RecordLifecycleActionHeartbeatInput{
  1138. AutoScalingGroupName: aws.String("ResourceName"), // Required
  1139. LifecycleHookName: aws.String("AsciiStringMaxLen255"), // Required
  1140. InstanceId: aws.String("XmlStringMaxLen19"),
  1141. LifecycleActionToken: aws.String("LifecycleActionToken"),
  1142. }
  1143. resp, err := svc.RecordLifecycleActionHeartbeat(params)
  1144. if err != nil {
  1145. // Print the error, cast err to awserr.Error to get the Code and
  1146. // Message from an error.
  1147. fmt.Println(err.Error())
  1148. return
  1149. }
  1150. // Pretty-print the response data.
  1151. fmt.Println(resp)
  1152. }
  1153. func ExampleAutoScaling_ResumeProcesses() {
  1154. sess, err := session.NewSession()
  1155. if err != nil {
  1156. fmt.Println("failed to create session,", err)
  1157. return
  1158. }
  1159. svc := autoscaling.New(sess)
  1160. params := &autoscaling.ScalingProcessQuery{
  1161. AutoScalingGroupName: aws.String("ResourceName"), // Required
  1162. ScalingProcesses: []*string{
  1163. aws.String("XmlStringMaxLen255"), // Required
  1164. // More values...
  1165. },
  1166. }
  1167. resp, err := svc.ResumeProcesses(params)
  1168. if err != nil {
  1169. // Print the error, cast err to awserr.Error to get the Code and
  1170. // Message from an error.
  1171. fmt.Println(err.Error())
  1172. return
  1173. }
  1174. // Pretty-print the response data.
  1175. fmt.Println(resp)
  1176. }
  1177. func ExampleAutoScaling_SetDesiredCapacity() {
  1178. sess, err := session.NewSession()
  1179. if err != nil {
  1180. fmt.Println("failed to create session,", err)
  1181. return
  1182. }
  1183. svc := autoscaling.New(sess)
  1184. params := &autoscaling.SetDesiredCapacityInput{
  1185. AutoScalingGroupName: aws.String("ResourceName"), // Required
  1186. DesiredCapacity: aws.Int64(1), // Required
  1187. HonorCooldown: aws.Bool(true),
  1188. }
  1189. resp, err := svc.SetDesiredCapacity(params)
  1190. if err != nil {
  1191. // Print the error, cast err to awserr.Error to get the Code and
  1192. // Message from an error.
  1193. fmt.Println(err.Error())
  1194. return
  1195. }
  1196. // Pretty-print the response data.
  1197. fmt.Println(resp)
  1198. }
  1199. func ExampleAutoScaling_SetInstanceHealth() {
  1200. sess, err := session.NewSession()
  1201. if err != nil {
  1202. fmt.Println("failed to create session,", err)
  1203. return
  1204. }
  1205. svc := autoscaling.New(sess)
  1206. params := &autoscaling.SetInstanceHealthInput{
  1207. HealthStatus: aws.String("XmlStringMaxLen32"), // Required
  1208. InstanceId: aws.String("XmlStringMaxLen19"), // Required
  1209. ShouldRespectGracePeriod: aws.Bool(true),
  1210. }
  1211. resp, err := svc.SetInstanceHealth(params)
  1212. if err != nil {
  1213. // Print the error, cast err to awserr.Error to get the Code and
  1214. // Message from an error.
  1215. fmt.Println(err.Error())
  1216. return
  1217. }
  1218. // Pretty-print the response data.
  1219. fmt.Println(resp)
  1220. }
  1221. func ExampleAutoScaling_SetInstanceProtection() {
  1222. sess, err := session.NewSession()
  1223. if err != nil {
  1224. fmt.Println("failed to create session,", err)
  1225. return
  1226. }
  1227. svc := autoscaling.New(sess)
  1228. params := &autoscaling.SetInstanceProtectionInput{
  1229. AutoScalingGroupName: aws.String("ResourceName"), // Required
  1230. InstanceIds: []*string{ // Required
  1231. aws.String("XmlStringMaxLen19"), // Required
  1232. // More values...
  1233. },
  1234. ProtectedFromScaleIn: aws.Bool(true), // Required
  1235. }
  1236. resp, err := svc.SetInstanceProtection(params)
  1237. if err != nil {
  1238. // Print the error, cast err to awserr.Error to get the Code and
  1239. // Message from an error.
  1240. fmt.Println(err.Error())
  1241. return
  1242. }
  1243. // Pretty-print the response data.
  1244. fmt.Println(resp)
  1245. }
  1246. func ExampleAutoScaling_SuspendProcesses() {
  1247. sess, err := session.NewSession()
  1248. if err != nil {
  1249. fmt.Println("failed to create session,", err)
  1250. return
  1251. }
  1252. svc := autoscaling.New(sess)
  1253. params := &autoscaling.ScalingProcessQuery{
  1254. AutoScalingGroupName: aws.String("ResourceName"), // Required
  1255. ScalingProcesses: []*string{
  1256. aws.String("XmlStringMaxLen255"), // Required
  1257. // More values...
  1258. },
  1259. }
  1260. resp, err := svc.SuspendProcesses(params)
  1261. if err != nil {
  1262. // Print the error, cast err to awserr.Error to get the Code and
  1263. // Message from an error.
  1264. fmt.Println(err.Error())
  1265. return
  1266. }
  1267. // Pretty-print the response data.
  1268. fmt.Println(resp)
  1269. }
  1270. func ExampleAutoScaling_TerminateInstanceInAutoScalingGroup() {
  1271. sess, err := session.NewSession()
  1272. if err != nil {
  1273. fmt.Println("failed to create session,", err)
  1274. return
  1275. }
  1276. svc := autoscaling.New(sess)
  1277. params := &autoscaling.TerminateInstanceInAutoScalingGroupInput{
  1278. InstanceId: aws.String("XmlStringMaxLen19"), // Required
  1279. ShouldDecrementDesiredCapacity: aws.Bool(true), // Required
  1280. }
  1281. resp, err := svc.TerminateInstanceInAutoScalingGroup(params)
  1282. if err != nil {
  1283. // Print the error, cast err to awserr.Error to get the Code and
  1284. // Message from an error.
  1285. fmt.Println(err.Error())
  1286. return
  1287. }
  1288. // Pretty-print the response data.
  1289. fmt.Println(resp)
  1290. }
  1291. func ExampleAutoScaling_UpdateAutoScalingGroup() {
  1292. sess, err := session.NewSession()
  1293. if err != nil {
  1294. fmt.Println("failed to create session,", err)
  1295. return
  1296. }
  1297. svc := autoscaling.New(sess)
  1298. params := &autoscaling.UpdateAutoScalingGroupInput{
  1299. AutoScalingGroupName: aws.String("ResourceName"), // Required
  1300. AvailabilityZones: []*string{
  1301. aws.String("XmlStringMaxLen255"), // Required
  1302. // More values...
  1303. },
  1304. DefaultCooldown: aws.Int64(1),
  1305. DesiredCapacity: aws.Int64(1),
  1306. HealthCheckGracePeriod: aws.Int64(1),
  1307. HealthCheckType: aws.String("XmlStringMaxLen32"),
  1308. LaunchConfigurationName: aws.String("ResourceName"),
  1309. MaxSize: aws.Int64(1),
  1310. MinSize: aws.Int64(1),
  1311. NewInstancesProtectedFromScaleIn: aws.Bool(true),
  1312. PlacementGroup: aws.String("XmlStringMaxLen255"),
  1313. TerminationPolicies: []*string{
  1314. aws.String("XmlStringMaxLen1600"), // Required
  1315. // More values...
  1316. },
  1317. VPCZoneIdentifier: aws.String("XmlStringMaxLen2047"),
  1318. }
  1319. resp, err := svc.UpdateAutoScalingGroup(params)
  1320. if err != nil {
  1321. // Print the error, cast err to awserr.Error to get the Code and
  1322. // Message from an error.
  1323. fmt.Println(err.Error())
  1324. return
  1325. }
  1326. // Pretty-print the response data.
  1327. fmt.Println(resp)
  1328. }