examples_test.go 27 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package codedeploy_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/codedeploy"
  10. )
  11. var _ time.Duration
  12. var _ bytes.Buffer
  13. func ExampleCodeDeploy_AddTagsToOnPremisesInstances() {
  14. sess, err := session.NewSession()
  15. if err != nil {
  16. fmt.Println("failed to create session,", err)
  17. return
  18. }
  19. svc := codedeploy.New(sess)
  20. params := &codedeploy.AddTagsToOnPremisesInstancesInput{
  21. InstanceNames: []*string{ // Required
  22. aws.String("InstanceName"), // Required
  23. // More values...
  24. },
  25. Tags: []*codedeploy.Tag{ // Required
  26. { // Required
  27. Key: aws.String("Key"),
  28. Value: aws.String("Value"),
  29. },
  30. // More values...
  31. },
  32. }
  33. resp, err := svc.AddTagsToOnPremisesInstances(params)
  34. if err != nil {
  35. // Print the error, cast err to awserr.Error to get the Code and
  36. // Message from an error.
  37. fmt.Println(err.Error())
  38. return
  39. }
  40. // Pretty-print the response data.
  41. fmt.Println(resp)
  42. }
  43. func ExampleCodeDeploy_BatchGetApplicationRevisions() {
  44. sess, err := session.NewSession()
  45. if err != nil {
  46. fmt.Println("failed to create session,", err)
  47. return
  48. }
  49. svc := codedeploy.New(sess)
  50. params := &codedeploy.BatchGetApplicationRevisionsInput{
  51. ApplicationName: aws.String("ApplicationName"), // Required
  52. Revisions: []*codedeploy.RevisionLocation{ // Required
  53. { // Required
  54. GitHubLocation: &codedeploy.GitHubLocation{
  55. CommitId: aws.String("CommitId"),
  56. Repository: aws.String("Repository"),
  57. },
  58. RevisionType: aws.String("RevisionLocationType"),
  59. S3Location: &codedeploy.S3Location{
  60. Bucket: aws.String("S3Bucket"),
  61. BundleType: aws.String("BundleType"),
  62. ETag: aws.String("ETag"),
  63. Key: aws.String("S3Key"),
  64. Version: aws.String("VersionId"),
  65. },
  66. },
  67. // More values...
  68. },
  69. }
  70. resp, err := svc.BatchGetApplicationRevisions(params)
  71. if err != nil {
  72. // Print the error, cast err to awserr.Error to get the Code and
  73. // Message from an error.
  74. fmt.Println(err.Error())
  75. return
  76. }
  77. // Pretty-print the response data.
  78. fmt.Println(resp)
  79. }
  80. func ExampleCodeDeploy_BatchGetApplications() {
  81. sess, err := session.NewSession()
  82. if err != nil {
  83. fmt.Println("failed to create session,", err)
  84. return
  85. }
  86. svc := codedeploy.New(sess)
  87. params := &codedeploy.BatchGetApplicationsInput{
  88. ApplicationNames: []*string{
  89. aws.String("ApplicationName"), // Required
  90. // More values...
  91. },
  92. }
  93. resp, err := svc.BatchGetApplications(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 ExampleCodeDeploy_BatchGetDeploymentGroups() {
  104. sess, err := session.NewSession()
  105. if err != nil {
  106. fmt.Println("failed to create session,", err)
  107. return
  108. }
  109. svc := codedeploy.New(sess)
  110. params := &codedeploy.BatchGetDeploymentGroupsInput{
  111. ApplicationName: aws.String("ApplicationName"), // Required
  112. DeploymentGroupNames: []*string{ // Required
  113. aws.String("DeploymentGroupName"), // Required
  114. // More values...
  115. },
  116. }
  117. resp, err := svc.BatchGetDeploymentGroups(params)
  118. if err != nil {
  119. // Print the error, cast err to awserr.Error to get the Code and
  120. // Message from an error.
  121. fmt.Println(err.Error())
  122. return
  123. }
  124. // Pretty-print the response data.
  125. fmt.Println(resp)
  126. }
  127. func ExampleCodeDeploy_BatchGetDeploymentInstances() {
  128. sess, err := session.NewSession()
  129. if err != nil {
  130. fmt.Println("failed to create session,", err)
  131. return
  132. }
  133. svc := codedeploy.New(sess)
  134. params := &codedeploy.BatchGetDeploymentInstancesInput{
  135. DeploymentId: aws.String("DeploymentId"), // Required
  136. InstanceIds: []*string{ // Required
  137. aws.String("InstanceId"), // Required
  138. // More values...
  139. },
  140. }
  141. resp, err := svc.BatchGetDeploymentInstances(params)
  142. if err != nil {
  143. // Print the error, cast err to awserr.Error to get the Code and
  144. // Message from an error.
  145. fmt.Println(err.Error())
  146. return
  147. }
  148. // Pretty-print the response data.
  149. fmt.Println(resp)
  150. }
  151. func ExampleCodeDeploy_BatchGetDeployments() {
  152. sess, err := session.NewSession()
  153. if err != nil {
  154. fmt.Println("failed to create session,", err)
  155. return
  156. }
  157. svc := codedeploy.New(sess)
  158. params := &codedeploy.BatchGetDeploymentsInput{
  159. DeploymentIds: []*string{
  160. aws.String("DeploymentId"), // Required
  161. // More values...
  162. },
  163. }
  164. resp, err := svc.BatchGetDeployments(params)
  165. if err != nil {
  166. // Print the error, cast err to awserr.Error to get the Code and
  167. // Message from an error.
  168. fmt.Println(err.Error())
  169. return
  170. }
  171. // Pretty-print the response data.
  172. fmt.Println(resp)
  173. }
  174. func ExampleCodeDeploy_BatchGetOnPremisesInstances() {
  175. sess, err := session.NewSession()
  176. if err != nil {
  177. fmt.Println("failed to create session,", err)
  178. return
  179. }
  180. svc := codedeploy.New(sess)
  181. params := &codedeploy.BatchGetOnPremisesInstancesInput{
  182. InstanceNames: []*string{
  183. aws.String("InstanceName"), // Required
  184. // More values...
  185. },
  186. }
  187. resp, err := svc.BatchGetOnPremisesInstances(params)
  188. if err != nil {
  189. // Print the error, cast err to awserr.Error to get the Code and
  190. // Message from an error.
  191. fmt.Println(err.Error())
  192. return
  193. }
  194. // Pretty-print the response data.
  195. fmt.Println(resp)
  196. }
  197. func ExampleCodeDeploy_CreateApplication() {
  198. sess, err := session.NewSession()
  199. if err != nil {
  200. fmt.Println("failed to create session,", err)
  201. return
  202. }
  203. svc := codedeploy.New(sess)
  204. params := &codedeploy.CreateApplicationInput{
  205. ApplicationName: aws.String("ApplicationName"), // Required
  206. }
  207. resp, err := svc.CreateApplication(params)
  208. if err != nil {
  209. // Print the error, cast err to awserr.Error to get the Code and
  210. // Message from an error.
  211. fmt.Println(err.Error())
  212. return
  213. }
  214. // Pretty-print the response data.
  215. fmt.Println(resp)
  216. }
  217. func ExampleCodeDeploy_CreateDeployment() {
  218. sess, err := session.NewSession()
  219. if err != nil {
  220. fmt.Println("failed to create session,", err)
  221. return
  222. }
  223. svc := codedeploy.New(sess)
  224. params := &codedeploy.CreateDeploymentInput{
  225. ApplicationName: aws.String("ApplicationName"), // Required
  226. AutoRollbackConfiguration: &codedeploy.AutoRollbackConfiguration{
  227. Enabled: aws.Bool(true),
  228. Events: []*string{
  229. aws.String("AutoRollbackEvent"), // Required
  230. // More values...
  231. },
  232. },
  233. DeploymentConfigName: aws.String("DeploymentConfigName"),
  234. DeploymentGroupName: aws.String("DeploymentGroupName"),
  235. Description: aws.String("Description"),
  236. IgnoreApplicationStopFailures: aws.Bool(true),
  237. Revision: &codedeploy.RevisionLocation{
  238. GitHubLocation: &codedeploy.GitHubLocation{
  239. CommitId: aws.String("CommitId"),
  240. Repository: aws.String("Repository"),
  241. },
  242. RevisionType: aws.String("RevisionLocationType"),
  243. S3Location: &codedeploy.S3Location{
  244. Bucket: aws.String("S3Bucket"),
  245. BundleType: aws.String("BundleType"),
  246. ETag: aws.String("ETag"),
  247. Key: aws.String("S3Key"),
  248. Version: aws.String("VersionId"),
  249. },
  250. },
  251. UpdateOutdatedInstancesOnly: aws.Bool(true),
  252. }
  253. resp, err := svc.CreateDeployment(params)
  254. if err != nil {
  255. // Print the error, cast err to awserr.Error to get the Code and
  256. // Message from an error.
  257. fmt.Println(err.Error())
  258. return
  259. }
  260. // Pretty-print the response data.
  261. fmt.Println(resp)
  262. }
  263. func ExampleCodeDeploy_CreateDeploymentConfig() {
  264. sess, err := session.NewSession()
  265. if err != nil {
  266. fmt.Println("failed to create session,", err)
  267. return
  268. }
  269. svc := codedeploy.New(sess)
  270. params := &codedeploy.CreateDeploymentConfigInput{
  271. DeploymentConfigName: aws.String("DeploymentConfigName"), // Required
  272. MinimumHealthyHosts: &codedeploy.MinimumHealthyHosts{
  273. Type: aws.String("MinimumHealthyHostsType"),
  274. Value: aws.Int64(1),
  275. },
  276. }
  277. resp, err := svc.CreateDeploymentConfig(params)
  278. if err != nil {
  279. // Print the error, cast err to awserr.Error to get the Code and
  280. // Message from an error.
  281. fmt.Println(err.Error())
  282. return
  283. }
  284. // Pretty-print the response data.
  285. fmt.Println(resp)
  286. }
  287. func ExampleCodeDeploy_CreateDeploymentGroup() {
  288. sess, err := session.NewSession()
  289. if err != nil {
  290. fmt.Println("failed to create session,", err)
  291. return
  292. }
  293. svc := codedeploy.New(sess)
  294. params := &codedeploy.CreateDeploymentGroupInput{
  295. ApplicationName: aws.String("ApplicationName"), // Required
  296. DeploymentGroupName: aws.String("DeploymentGroupName"), // Required
  297. ServiceRoleArn: aws.String("Role"), // Required
  298. AlarmConfiguration: &codedeploy.AlarmConfiguration{
  299. Alarms: []*codedeploy.Alarm{
  300. { // Required
  301. Name: aws.String("AlarmName"),
  302. },
  303. // More values...
  304. },
  305. Enabled: aws.Bool(true),
  306. IgnorePollAlarmFailure: aws.Bool(true),
  307. },
  308. AutoRollbackConfiguration: &codedeploy.AutoRollbackConfiguration{
  309. Enabled: aws.Bool(true),
  310. Events: []*string{
  311. aws.String("AutoRollbackEvent"), // Required
  312. // More values...
  313. },
  314. },
  315. AutoScalingGroups: []*string{
  316. aws.String("AutoScalingGroupName"), // Required
  317. // More values...
  318. },
  319. DeploymentConfigName: aws.String("DeploymentConfigName"),
  320. Ec2TagFilters: []*codedeploy.EC2TagFilter{
  321. { // Required
  322. Key: aws.String("Key"),
  323. Type: aws.String("EC2TagFilterType"),
  324. Value: aws.String("Value"),
  325. },
  326. // More values...
  327. },
  328. OnPremisesInstanceTagFilters: []*codedeploy.TagFilter{
  329. { // Required
  330. Key: aws.String("Key"),
  331. Type: aws.String("TagFilterType"),
  332. Value: aws.String("Value"),
  333. },
  334. // More values...
  335. },
  336. TriggerConfigurations: []*codedeploy.TriggerConfig{
  337. { // Required
  338. TriggerEvents: []*string{
  339. aws.String("TriggerEventType"), // Required
  340. // More values...
  341. },
  342. TriggerName: aws.String("TriggerName"),
  343. TriggerTargetArn: aws.String("TriggerTargetArn"),
  344. },
  345. // More values...
  346. },
  347. }
  348. resp, err := svc.CreateDeploymentGroup(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 ExampleCodeDeploy_DeleteApplication() {
  359. sess, err := session.NewSession()
  360. if err != nil {
  361. fmt.Println("failed to create session,", err)
  362. return
  363. }
  364. svc := codedeploy.New(sess)
  365. params := &codedeploy.DeleteApplicationInput{
  366. ApplicationName: aws.String("ApplicationName"), // Required
  367. }
  368. resp, err := svc.DeleteApplication(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 ExampleCodeDeploy_DeleteDeploymentConfig() {
  379. sess, err := session.NewSession()
  380. if err != nil {
  381. fmt.Println("failed to create session,", err)
  382. return
  383. }
  384. svc := codedeploy.New(sess)
  385. params := &codedeploy.DeleteDeploymentConfigInput{
  386. DeploymentConfigName: aws.String("DeploymentConfigName"), // Required
  387. }
  388. resp, err := svc.DeleteDeploymentConfig(params)
  389. if err != nil {
  390. // Print the error, cast err to awserr.Error to get the Code and
  391. // Message from an error.
  392. fmt.Println(err.Error())
  393. return
  394. }
  395. // Pretty-print the response data.
  396. fmt.Println(resp)
  397. }
  398. func ExampleCodeDeploy_DeleteDeploymentGroup() {
  399. sess, err := session.NewSession()
  400. if err != nil {
  401. fmt.Println("failed to create session,", err)
  402. return
  403. }
  404. svc := codedeploy.New(sess)
  405. params := &codedeploy.DeleteDeploymentGroupInput{
  406. ApplicationName: aws.String("ApplicationName"), // Required
  407. DeploymentGroupName: aws.String("DeploymentGroupName"), // Required
  408. }
  409. resp, err := svc.DeleteDeploymentGroup(params)
  410. if err != nil {
  411. // Print the error, cast err to awserr.Error to get the Code and
  412. // Message from an error.
  413. fmt.Println(err.Error())
  414. return
  415. }
  416. // Pretty-print the response data.
  417. fmt.Println(resp)
  418. }
  419. func ExampleCodeDeploy_DeregisterOnPremisesInstance() {
  420. sess, err := session.NewSession()
  421. if err != nil {
  422. fmt.Println("failed to create session,", err)
  423. return
  424. }
  425. svc := codedeploy.New(sess)
  426. params := &codedeploy.DeregisterOnPremisesInstanceInput{
  427. InstanceName: aws.String("InstanceName"), // Required
  428. }
  429. resp, err := svc.DeregisterOnPremisesInstance(params)
  430. if err != nil {
  431. // Print the error, cast err to awserr.Error to get the Code and
  432. // Message from an error.
  433. fmt.Println(err.Error())
  434. return
  435. }
  436. // Pretty-print the response data.
  437. fmt.Println(resp)
  438. }
  439. func ExampleCodeDeploy_GetApplication() {
  440. sess, err := session.NewSession()
  441. if err != nil {
  442. fmt.Println("failed to create session,", err)
  443. return
  444. }
  445. svc := codedeploy.New(sess)
  446. params := &codedeploy.GetApplicationInput{
  447. ApplicationName: aws.String("ApplicationName"), // Required
  448. }
  449. resp, err := svc.GetApplication(params)
  450. if err != nil {
  451. // Print the error, cast err to awserr.Error to get the Code and
  452. // Message from an error.
  453. fmt.Println(err.Error())
  454. return
  455. }
  456. // Pretty-print the response data.
  457. fmt.Println(resp)
  458. }
  459. func ExampleCodeDeploy_GetApplicationRevision() {
  460. sess, err := session.NewSession()
  461. if err != nil {
  462. fmt.Println("failed to create session,", err)
  463. return
  464. }
  465. svc := codedeploy.New(sess)
  466. params := &codedeploy.GetApplicationRevisionInput{
  467. ApplicationName: aws.String("ApplicationName"), // Required
  468. Revision: &codedeploy.RevisionLocation{ // Required
  469. GitHubLocation: &codedeploy.GitHubLocation{
  470. CommitId: aws.String("CommitId"),
  471. Repository: aws.String("Repository"),
  472. },
  473. RevisionType: aws.String("RevisionLocationType"),
  474. S3Location: &codedeploy.S3Location{
  475. Bucket: aws.String("S3Bucket"),
  476. BundleType: aws.String("BundleType"),
  477. ETag: aws.String("ETag"),
  478. Key: aws.String("S3Key"),
  479. Version: aws.String("VersionId"),
  480. },
  481. },
  482. }
  483. resp, err := svc.GetApplicationRevision(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 ExampleCodeDeploy_GetDeployment() {
  494. sess, err := session.NewSession()
  495. if err != nil {
  496. fmt.Println("failed to create session,", err)
  497. return
  498. }
  499. svc := codedeploy.New(sess)
  500. params := &codedeploy.GetDeploymentInput{
  501. DeploymentId: aws.String("DeploymentId"), // Required
  502. }
  503. resp, err := svc.GetDeployment(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 ExampleCodeDeploy_GetDeploymentConfig() {
  514. sess, err := session.NewSession()
  515. if err != nil {
  516. fmt.Println("failed to create session,", err)
  517. return
  518. }
  519. svc := codedeploy.New(sess)
  520. params := &codedeploy.GetDeploymentConfigInput{
  521. DeploymentConfigName: aws.String("DeploymentConfigName"), // Required
  522. }
  523. resp, err := svc.GetDeploymentConfig(params)
  524. if err != nil {
  525. // Print the error, cast err to awserr.Error to get the Code and
  526. // Message from an error.
  527. fmt.Println(err.Error())
  528. return
  529. }
  530. // Pretty-print the response data.
  531. fmt.Println(resp)
  532. }
  533. func ExampleCodeDeploy_GetDeploymentGroup() {
  534. sess, err := session.NewSession()
  535. if err != nil {
  536. fmt.Println("failed to create session,", err)
  537. return
  538. }
  539. svc := codedeploy.New(sess)
  540. params := &codedeploy.GetDeploymentGroupInput{
  541. ApplicationName: aws.String("ApplicationName"), // Required
  542. DeploymentGroupName: aws.String("DeploymentGroupName"), // Required
  543. }
  544. resp, err := svc.GetDeploymentGroup(params)
  545. if err != nil {
  546. // Print the error, cast err to awserr.Error to get the Code and
  547. // Message from an error.
  548. fmt.Println(err.Error())
  549. return
  550. }
  551. // Pretty-print the response data.
  552. fmt.Println(resp)
  553. }
  554. func ExampleCodeDeploy_GetDeploymentInstance() {
  555. sess, err := session.NewSession()
  556. if err != nil {
  557. fmt.Println("failed to create session,", err)
  558. return
  559. }
  560. svc := codedeploy.New(sess)
  561. params := &codedeploy.GetDeploymentInstanceInput{
  562. DeploymentId: aws.String("DeploymentId"), // Required
  563. InstanceId: aws.String("InstanceId"), // Required
  564. }
  565. resp, err := svc.GetDeploymentInstance(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 ExampleCodeDeploy_GetOnPremisesInstance() {
  576. sess, err := session.NewSession()
  577. if err != nil {
  578. fmt.Println("failed to create session,", err)
  579. return
  580. }
  581. svc := codedeploy.New(sess)
  582. params := &codedeploy.GetOnPremisesInstanceInput{
  583. InstanceName: aws.String("InstanceName"), // Required
  584. }
  585. resp, err := svc.GetOnPremisesInstance(params)
  586. if err != nil {
  587. // Print the error, cast err to awserr.Error to get the Code and
  588. // Message from an error.
  589. fmt.Println(err.Error())
  590. return
  591. }
  592. // Pretty-print the response data.
  593. fmt.Println(resp)
  594. }
  595. func ExampleCodeDeploy_ListApplicationRevisions() {
  596. sess, err := session.NewSession()
  597. if err != nil {
  598. fmt.Println("failed to create session,", err)
  599. return
  600. }
  601. svc := codedeploy.New(sess)
  602. params := &codedeploy.ListApplicationRevisionsInput{
  603. ApplicationName: aws.String("ApplicationName"), // Required
  604. Deployed: aws.String("ListStateFilterAction"),
  605. NextToken: aws.String("NextToken"),
  606. S3Bucket: aws.String("S3Bucket"),
  607. S3KeyPrefix: aws.String("S3Key"),
  608. SortBy: aws.String("ApplicationRevisionSortBy"),
  609. SortOrder: aws.String("SortOrder"),
  610. }
  611. resp, err := svc.ListApplicationRevisions(params)
  612. if err != nil {
  613. // Print the error, cast err to awserr.Error to get the Code and
  614. // Message from an error.
  615. fmt.Println(err.Error())
  616. return
  617. }
  618. // Pretty-print the response data.
  619. fmt.Println(resp)
  620. }
  621. func ExampleCodeDeploy_ListApplications() {
  622. sess, err := session.NewSession()
  623. if err != nil {
  624. fmt.Println("failed to create session,", err)
  625. return
  626. }
  627. svc := codedeploy.New(sess)
  628. params := &codedeploy.ListApplicationsInput{
  629. NextToken: aws.String("NextToken"),
  630. }
  631. resp, err := svc.ListApplications(params)
  632. if err != nil {
  633. // Print the error, cast err to awserr.Error to get the Code and
  634. // Message from an error.
  635. fmt.Println(err.Error())
  636. return
  637. }
  638. // Pretty-print the response data.
  639. fmt.Println(resp)
  640. }
  641. func ExampleCodeDeploy_ListDeploymentConfigs() {
  642. sess, err := session.NewSession()
  643. if err != nil {
  644. fmt.Println("failed to create session,", err)
  645. return
  646. }
  647. svc := codedeploy.New(sess)
  648. params := &codedeploy.ListDeploymentConfigsInput{
  649. NextToken: aws.String("NextToken"),
  650. }
  651. resp, err := svc.ListDeploymentConfigs(params)
  652. if err != nil {
  653. // Print the error, cast err to awserr.Error to get the Code and
  654. // Message from an error.
  655. fmt.Println(err.Error())
  656. return
  657. }
  658. // Pretty-print the response data.
  659. fmt.Println(resp)
  660. }
  661. func ExampleCodeDeploy_ListDeploymentGroups() {
  662. sess, err := session.NewSession()
  663. if err != nil {
  664. fmt.Println("failed to create session,", err)
  665. return
  666. }
  667. svc := codedeploy.New(sess)
  668. params := &codedeploy.ListDeploymentGroupsInput{
  669. ApplicationName: aws.String("ApplicationName"), // Required
  670. NextToken: aws.String("NextToken"),
  671. }
  672. resp, err := svc.ListDeploymentGroups(params)
  673. if err != nil {
  674. // Print the error, cast err to awserr.Error to get the Code and
  675. // Message from an error.
  676. fmt.Println(err.Error())
  677. return
  678. }
  679. // Pretty-print the response data.
  680. fmt.Println(resp)
  681. }
  682. func ExampleCodeDeploy_ListDeploymentInstances() {
  683. sess, err := session.NewSession()
  684. if err != nil {
  685. fmt.Println("failed to create session,", err)
  686. return
  687. }
  688. svc := codedeploy.New(sess)
  689. params := &codedeploy.ListDeploymentInstancesInput{
  690. DeploymentId: aws.String("DeploymentId"), // Required
  691. InstanceStatusFilter: []*string{
  692. aws.String("InstanceStatus"), // Required
  693. // More values...
  694. },
  695. NextToken: aws.String("NextToken"),
  696. }
  697. resp, err := svc.ListDeploymentInstances(params)
  698. if err != nil {
  699. // Print the error, cast err to awserr.Error to get the Code and
  700. // Message from an error.
  701. fmt.Println(err.Error())
  702. return
  703. }
  704. // Pretty-print the response data.
  705. fmt.Println(resp)
  706. }
  707. func ExampleCodeDeploy_ListDeployments() {
  708. sess, err := session.NewSession()
  709. if err != nil {
  710. fmt.Println("failed to create session,", err)
  711. return
  712. }
  713. svc := codedeploy.New(sess)
  714. params := &codedeploy.ListDeploymentsInput{
  715. ApplicationName: aws.String("ApplicationName"),
  716. CreateTimeRange: &codedeploy.TimeRange{
  717. End: aws.Time(time.Now()),
  718. Start: aws.Time(time.Now()),
  719. },
  720. DeploymentGroupName: aws.String("DeploymentGroupName"),
  721. IncludeOnlyStatuses: []*string{
  722. aws.String("DeploymentStatus"), // Required
  723. // More values...
  724. },
  725. NextToken: aws.String("NextToken"),
  726. }
  727. resp, err := svc.ListDeployments(params)
  728. if err != nil {
  729. // Print the error, cast err to awserr.Error to get the Code and
  730. // Message from an error.
  731. fmt.Println(err.Error())
  732. return
  733. }
  734. // Pretty-print the response data.
  735. fmt.Println(resp)
  736. }
  737. func ExampleCodeDeploy_ListOnPremisesInstances() {
  738. sess, err := session.NewSession()
  739. if err != nil {
  740. fmt.Println("failed to create session,", err)
  741. return
  742. }
  743. svc := codedeploy.New(sess)
  744. params := &codedeploy.ListOnPremisesInstancesInput{
  745. NextToken: aws.String("NextToken"),
  746. RegistrationStatus: aws.String("RegistrationStatus"),
  747. TagFilters: []*codedeploy.TagFilter{
  748. { // Required
  749. Key: aws.String("Key"),
  750. Type: aws.String("TagFilterType"),
  751. Value: aws.String("Value"),
  752. },
  753. // More values...
  754. },
  755. }
  756. resp, err := svc.ListOnPremisesInstances(params)
  757. if err != nil {
  758. // Print the error, cast err to awserr.Error to get the Code and
  759. // Message from an error.
  760. fmt.Println(err.Error())
  761. return
  762. }
  763. // Pretty-print the response data.
  764. fmt.Println(resp)
  765. }
  766. func ExampleCodeDeploy_RegisterApplicationRevision() {
  767. sess, err := session.NewSession()
  768. if err != nil {
  769. fmt.Println("failed to create session,", err)
  770. return
  771. }
  772. svc := codedeploy.New(sess)
  773. params := &codedeploy.RegisterApplicationRevisionInput{
  774. ApplicationName: aws.String("ApplicationName"), // Required
  775. Revision: &codedeploy.RevisionLocation{ // Required
  776. GitHubLocation: &codedeploy.GitHubLocation{
  777. CommitId: aws.String("CommitId"),
  778. Repository: aws.String("Repository"),
  779. },
  780. RevisionType: aws.String("RevisionLocationType"),
  781. S3Location: &codedeploy.S3Location{
  782. Bucket: aws.String("S3Bucket"),
  783. BundleType: aws.String("BundleType"),
  784. ETag: aws.String("ETag"),
  785. Key: aws.String("S3Key"),
  786. Version: aws.String("VersionId"),
  787. },
  788. },
  789. Description: aws.String("Description"),
  790. }
  791. resp, err := svc.RegisterApplicationRevision(params)
  792. if err != nil {
  793. // Print the error, cast err to awserr.Error to get the Code and
  794. // Message from an error.
  795. fmt.Println(err.Error())
  796. return
  797. }
  798. // Pretty-print the response data.
  799. fmt.Println(resp)
  800. }
  801. func ExampleCodeDeploy_RegisterOnPremisesInstance() {
  802. sess, err := session.NewSession()
  803. if err != nil {
  804. fmt.Println("failed to create session,", err)
  805. return
  806. }
  807. svc := codedeploy.New(sess)
  808. params := &codedeploy.RegisterOnPremisesInstanceInput{
  809. IamUserArn: aws.String("IamUserArn"), // Required
  810. InstanceName: aws.String("InstanceName"), // Required
  811. }
  812. resp, err := svc.RegisterOnPremisesInstance(params)
  813. if err != nil {
  814. // Print the error, cast err to awserr.Error to get the Code and
  815. // Message from an error.
  816. fmt.Println(err.Error())
  817. return
  818. }
  819. // Pretty-print the response data.
  820. fmt.Println(resp)
  821. }
  822. func ExampleCodeDeploy_RemoveTagsFromOnPremisesInstances() {
  823. sess, err := session.NewSession()
  824. if err != nil {
  825. fmt.Println("failed to create session,", err)
  826. return
  827. }
  828. svc := codedeploy.New(sess)
  829. params := &codedeploy.RemoveTagsFromOnPremisesInstancesInput{
  830. InstanceNames: []*string{ // Required
  831. aws.String("InstanceName"), // Required
  832. // More values...
  833. },
  834. Tags: []*codedeploy.Tag{ // Required
  835. { // Required
  836. Key: aws.String("Key"),
  837. Value: aws.String("Value"),
  838. },
  839. // More values...
  840. },
  841. }
  842. resp, err := svc.RemoveTagsFromOnPremisesInstances(params)
  843. if err != nil {
  844. // Print the error, cast err to awserr.Error to get the Code and
  845. // Message from an error.
  846. fmt.Println(err.Error())
  847. return
  848. }
  849. // Pretty-print the response data.
  850. fmt.Println(resp)
  851. }
  852. func ExampleCodeDeploy_StopDeployment() {
  853. sess, err := session.NewSession()
  854. if err != nil {
  855. fmt.Println("failed to create session,", err)
  856. return
  857. }
  858. svc := codedeploy.New(sess)
  859. params := &codedeploy.StopDeploymentInput{
  860. DeploymentId: aws.String("DeploymentId"), // Required
  861. AutoRollbackEnabled: aws.Bool(true),
  862. }
  863. resp, err := svc.StopDeployment(params)
  864. if err != nil {
  865. // Print the error, cast err to awserr.Error to get the Code and
  866. // Message from an error.
  867. fmt.Println(err.Error())
  868. return
  869. }
  870. // Pretty-print the response data.
  871. fmt.Println(resp)
  872. }
  873. func ExampleCodeDeploy_UpdateApplication() {
  874. sess, err := session.NewSession()
  875. if err != nil {
  876. fmt.Println("failed to create session,", err)
  877. return
  878. }
  879. svc := codedeploy.New(sess)
  880. params := &codedeploy.UpdateApplicationInput{
  881. ApplicationName: aws.String("ApplicationName"),
  882. NewApplicationName: aws.String("ApplicationName"),
  883. }
  884. resp, err := svc.UpdateApplication(params)
  885. if err != nil {
  886. // Print the error, cast err to awserr.Error to get the Code and
  887. // Message from an error.
  888. fmt.Println(err.Error())
  889. return
  890. }
  891. // Pretty-print the response data.
  892. fmt.Println(resp)
  893. }
  894. func ExampleCodeDeploy_UpdateDeploymentGroup() {
  895. sess, err := session.NewSession()
  896. if err != nil {
  897. fmt.Println("failed to create session,", err)
  898. return
  899. }
  900. svc := codedeploy.New(sess)
  901. params := &codedeploy.UpdateDeploymentGroupInput{
  902. ApplicationName: aws.String("ApplicationName"), // Required
  903. CurrentDeploymentGroupName: aws.String("DeploymentGroupName"), // Required
  904. AlarmConfiguration: &codedeploy.AlarmConfiguration{
  905. Alarms: []*codedeploy.Alarm{
  906. { // Required
  907. Name: aws.String("AlarmName"),
  908. },
  909. // More values...
  910. },
  911. Enabled: aws.Bool(true),
  912. IgnorePollAlarmFailure: aws.Bool(true),
  913. },
  914. AutoRollbackConfiguration: &codedeploy.AutoRollbackConfiguration{
  915. Enabled: aws.Bool(true),
  916. Events: []*string{
  917. aws.String("AutoRollbackEvent"), // Required
  918. // More values...
  919. },
  920. },
  921. AutoScalingGroups: []*string{
  922. aws.String("AutoScalingGroupName"), // Required
  923. // More values...
  924. },
  925. DeploymentConfigName: aws.String("DeploymentConfigName"),
  926. Ec2TagFilters: []*codedeploy.EC2TagFilter{
  927. { // Required
  928. Key: aws.String("Key"),
  929. Type: aws.String("EC2TagFilterType"),
  930. Value: aws.String("Value"),
  931. },
  932. // More values...
  933. },
  934. NewDeploymentGroupName: aws.String("DeploymentGroupName"),
  935. OnPremisesInstanceTagFilters: []*codedeploy.TagFilter{
  936. { // Required
  937. Key: aws.String("Key"),
  938. Type: aws.String("TagFilterType"),
  939. Value: aws.String("Value"),
  940. },
  941. // More values...
  942. },
  943. ServiceRoleArn: aws.String("Role"),
  944. TriggerConfigurations: []*codedeploy.TriggerConfig{
  945. { // Required
  946. TriggerEvents: []*string{
  947. aws.String("TriggerEventType"), // Required
  948. // More values...
  949. },
  950. TriggerName: aws.String("TriggerName"),
  951. TriggerTargetArn: aws.String("TriggerTargetArn"),
  952. },
  953. // More values...
  954. },
  955. }
  956. resp, err := svc.UpdateDeploymentGroup(params)
  957. if err != nil {
  958. // Print the error, cast err to awserr.Error to get the Code and
  959. // Message from an error.
  960. fmt.Println(err.Error())
  961. return
  962. }
  963. // Pretty-print the response data.
  964. fmt.Println(resp)
  965. }