examples_test.go 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101
  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. DeploymentConfigName: aws.String("DeploymentConfigName"),
  227. DeploymentGroupName: aws.String("DeploymentGroupName"),
  228. Description: aws.String("Description"),
  229. IgnoreApplicationStopFailures: aws.Bool(true),
  230. Revision: &codedeploy.RevisionLocation{
  231. GitHubLocation: &codedeploy.GitHubLocation{
  232. CommitId: aws.String("CommitId"),
  233. Repository: aws.String("Repository"),
  234. },
  235. RevisionType: aws.String("RevisionLocationType"),
  236. S3Location: &codedeploy.S3Location{
  237. Bucket: aws.String("S3Bucket"),
  238. BundleType: aws.String("BundleType"),
  239. ETag: aws.String("ETag"),
  240. Key: aws.String("S3Key"),
  241. Version: aws.String("VersionId"),
  242. },
  243. },
  244. }
  245. resp, err := svc.CreateDeployment(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 ExampleCodeDeploy_CreateDeploymentConfig() {
  256. sess, err := session.NewSession()
  257. if err != nil {
  258. fmt.Println("failed to create session,", err)
  259. return
  260. }
  261. svc := codedeploy.New(sess)
  262. params := &codedeploy.CreateDeploymentConfigInput{
  263. DeploymentConfigName: aws.String("DeploymentConfigName"), // Required
  264. MinimumHealthyHosts: &codedeploy.MinimumHealthyHosts{
  265. Type: aws.String("MinimumHealthyHostsType"),
  266. Value: aws.Int64(1),
  267. },
  268. }
  269. resp, err := svc.CreateDeploymentConfig(params)
  270. if err != nil {
  271. // Print the error, cast err to awserr.Error to get the Code and
  272. // Message from an error.
  273. fmt.Println(err.Error())
  274. return
  275. }
  276. // Pretty-print the response data.
  277. fmt.Println(resp)
  278. }
  279. func ExampleCodeDeploy_CreateDeploymentGroup() {
  280. sess, err := session.NewSession()
  281. if err != nil {
  282. fmt.Println("failed to create session,", err)
  283. return
  284. }
  285. svc := codedeploy.New(sess)
  286. params := &codedeploy.CreateDeploymentGroupInput{
  287. ApplicationName: aws.String("ApplicationName"), // Required
  288. DeploymentGroupName: aws.String("DeploymentGroupName"), // Required
  289. ServiceRoleArn: aws.String("Role"), // Required
  290. AutoScalingGroups: []*string{
  291. aws.String("AutoScalingGroupName"), // Required
  292. // More values...
  293. },
  294. DeploymentConfigName: aws.String("DeploymentConfigName"),
  295. Ec2TagFilters: []*codedeploy.EC2TagFilter{
  296. { // Required
  297. Key: aws.String("Key"),
  298. Type: aws.String("EC2TagFilterType"),
  299. Value: aws.String("Value"),
  300. },
  301. // More values...
  302. },
  303. OnPremisesInstanceTagFilters: []*codedeploy.TagFilter{
  304. { // Required
  305. Key: aws.String("Key"),
  306. Type: aws.String("TagFilterType"),
  307. Value: aws.String("Value"),
  308. },
  309. // More values...
  310. },
  311. TriggerConfigurations: []*codedeploy.TriggerConfig{
  312. { // Required
  313. TriggerEvents: []*string{
  314. aws.String("TriggerEventType"), // Required
  315. // More values...
  316. },
  317. TriggerName: aws.String("TriggerName"),
  318. TriggerTargetArn: aws.String("TriggerTargetArn"),
  319. },
  320. // More values...
  321. },
  322. }
  323. resp, err := svc.CreateDeploymentGroup(params)
  324. if err != nil {
  325. // Print the error, cast err to awserr.Error to get the Code and
  326. // Message from an error.
  327. fmt.Println(err.Error())
  328. return
  329. }
  330. // Pretty-print the response data.
  331. fmt.Println(resp)
  332. }
  333. func ExampleCodeDeploy_DeleteApplication() {
  334. sess, err := session.NewSession()
  335. if err != nil {
  336. fmt.Println("failed to create session,", err)
  337. return
  338. }
  339. svc := codedeploy.New(sess)
  340. params := &codedeploy.DeleteApplicationInput{
  341. ApplicationName: aws.String("ApplicationName"), // Required
  342. }
  343. resp, err := svc.DeleteApplication(params)
  344. if err != nil {
  345. // Print the error, cast err to awserr.Error to get the Code and
  346. // Message from an error.
  347. fmt.Println(err.Error())
  348. return
  349. }
  350. // Pretty-print the response data.
  351. fmt.Println(resp)
  352. }
  353. func ExampleCodeDeploy_DeleteDeploymentConfig() {
  354. sess, err := session.NewSession()
  355. if err != nil {
  356. fmt.Println("failed to create session,", err)
  357. return
  358. }
  359. svc := codedeploy.New(sess)
  360. params := &codedeploy.DeleteDeploymentConfigInput{
  361. DeploymentConfigName: aws.String("DeploymentConfigName"), // Required
  362. }
  363. resp, err := svc.DeleteDeploymentConfig(params)
  364. if err != nil {
  365. // Print the error, cast err to awserr.Error to get the Code and
  366. // Message from an error.
  367. fmt.Println(err.Error())
  368. return
  369. }
  370. // Pretty-print the response data.
  371. fmt.Println(resp)
  372. }
  373. func ExampleCodeDeploy_DeleteDeploymentGroup() {
  374. sess, err := session.NewSession()
  375. if err != nil {
  376. fmt.Println("failed to create session,", err)
  377. return
  378. }
  379. svc := codedeploy.New(sess)
  380. params := &codedeploy.DeleteDeploymentGroupInput{
  381. ApplicationName: aws.String("ApplicationName"), // Required
  382. DeploymentGroupName: aws.String("DeploymentGroupName"), // Required
  383. }
  384. resp, err := svc.DeleteDeploymentGroup(params)
  385. if err != nil {
  386. // Print the error, cast err to awserr.Error to get the Code and
  387. // Message from an error.
  388. fmt.Println(err.Error())
  389. return
  390. }
  391. // Pretty-print the response data.
  392. fmt.Println(resp)
  393. }
  394. func ExampleCodeDeploy_DeregisterOnPremisesInstance() {
  395. sess, err := session.NewSession()
  396. if err != nil {
  397. fmt.Println("failed to create session,", err)
  398. return
  399. }
  400. svc := codedeploy.New(sess)
  401. params := &codedeploy.DeregisterOnPremisesInstanceInput{
  402. InstanceName: aws.String("InstanceName"), // Required
  403. }
  404. resp, err := svc.DeregisterOnPremisesInstance(params)
  405. if err != nil {
  406. // Print the error, cast err to awserr.Error to get the Code and
  407. // Message from an error.
  408. fmt.Println(err.Error())
  409. return
  410. }
  411. // Pretty-print the response data.
  412. fmt.Println(resp)
  413. }
  414. func ExampleCodeDeploy_GetApplication() {
  415. sess, err := session.NewSession()
  416. if err != nil {
  417. fmt.Println("failed to create session,", err)
  418. return
  419. }
  420. svc := codedeploy.New(sess)
  421. params := &codedeploy.GetApplicationInput{
  422. ApplicationName: aws.String("ApplicationName"), // Required
  423. }
  424. resp, err := svc.GetApplication(params)
  425. if err != nil {
  426. // Print the error, cast err to awserr.Error to get the Code and
  427. // Message from an error.
  428. fmt.Println(err.Error())
  429. return
  430. }
  431. // Pretty-print the response data.
  432. fmt.Println(resp)
  433. }
  434. func ExampleCodeDeploy_GetApplicationRevision() {
  435. sess, err := session.NewSession()
  436. if err != nil {
  437. fmt.Println("failed to create session,", err)
  438. return
  439. }
  440. svc := codedeploy.New(sess)
  441. params := &codedeploy.GetApplicationRevisionInput{
  442. ApplicationName: aws.String("ApplicationName"), // Required
  443. Revision: &codedeploy.RevisionLocation{ // Required
  444. GitHubLocation: &codedeploy.GitHubLocation{
  445. CommitId: aws.String("CommitId"),
  446. Repository: aws.String("Repository"),
  447. },
  448. RevisionType: aws.String("RevisionLocationType"),
  449. S3Location: &codedeploy.S3Location{
  450. Bucket: aws.String("S3Bucket"),
  451. BundleType: aws.String("BundleType"),
  452. ETag: aws.String("ETag"),
  453. Key: aws.String("S3Key"),
  454. Version: aws.String("VersionId"),
  455. },
  456. },
  457. }
  458. resp, err := svc.GetApplicationRevision(params)
  459. if err != nil {
  460. // Print the error, cast err to awserr.Error to get the Code and
  461. // Message from an error.
  462. fmt.Println(err.Error())
  463. return
  464. }
  465. // Pretty-print the response data.
  466. fmt.Println(resp)
  467. }
  468. func ExampleCodeDeploy_GetDeployment() {
  469. sess, err := session.NewSession()
  470. if err != nil {
  471. fmt.Println("failed to create session,", err)
  472. return
  473. }
  474. svc := codedeploy.New(sess)
  475. params := &codedeploy.GetDeploymentInput{
  476. DeploymentId: aws.String("DeploymentId"), // Required
  477. }
  478. resp, err := svc.GetDeployment(params)
  479. if err != nil {
  480. // Print the error, cast err to awserr.Error to get the Code and
  481. // Message from an error.
  482. fmt.Println(err.Error())
  483. return
  484. }
  485. // Pretty-print the response data.
  486. fmt.Println(resp)
  487. }
  488. func ExampleCodeDeploy_GetDeploymentConfig() {
  489. sess, err := session.NewSession()
  490. if err != nil {
  491. fmt.Println("failed to create session,", err)
  492. return
  493. }
  494. svc := codedeploy.New(sess)
  495. params := &codedeploy.GetDeploymentConfigInput{
  496. DeploymentConfigName: aws.String("DeploymentConfigName"), // Required
  497. }
  498. resp, err := svc.GetDeploymentConfig(params)
  499. if err != nil {
  500. // Print the error, cast err to awserr.Error to get the Code and
  501. // Message from an error.
  502. fmt.Println(err.Error())
  503. return
  504. }
  505. // Pretty-print the response data.
  506. fmt.Println(resp)
  507. }
  508. func ExampleCodeDeploy_GetDeploymentGroup() {
  509. sess, err := session.NewSession()
  510. if err != nil {
  511. fmt.Println("failed to create session,", err)
  512. return
  513. }
  514. svc := codedeploy.New(sess)
  515. params := &codedeploy.GetDeploymentGroupInput{
  516. ApplicationName: aws.String("ApplicationName"), // Required
  517. DeploymentGroupName: aws.String("DeploymentGroupName"), // Required
  518. }
  519. resp, err := svc.GetDeploymentGroup(params)
  520. if err != nil {
  521. // Print the error, cast err to awserr.Error to get the Code and
  522. // Message from an error.
  523. fmt.Println(err.Error())
  524. return
  525. }
  526. // Pretty-print the response data.
  527. fmt.Println(resp)
  528. }
  529. func ExampleCodeDeploy_GetDeploymentInstance() {
  530. sess, err := session.NewSession()
  531. if err != nil {
  532. fmt.Println("failed to create session,", err)
  533. return
  534. }
  535. svc := codedeploy.New(sess)
  536. params := &codedeploy.GetDeploymentInstanceInput{
  537. DeploymentId: aws.String("DeploymentId"), // Required
  538. InstanceId: aws.String("InstanceId"), // Required
  539. }
  540. resp, err := svc.GetDeploymentInstance(params)
  541. if err != nil {
  542. // Print the error, cast err to awserr.Error to get the Code and
  543. // Message from an error.
  544. fmt.Println(err.Error())
  545. return
  546. }
  547. // Pretty-print the response data.
  548. fmt.Println(resp)
  549. }
  550. func ExampleCodeDeploy_GetOnPremisesInstance() {
  551. sess, err := session.NewSession()
  552. if err != nil {
  553. fmt.Println("failed to create session,", err)
  554. return
  555. }
  556. svc := codedeploy.New(sess)
  557. params := &codedeploy.GetOnPremisesInstanceInput{
  558. InstanceName: aws.String("InstanceName"), // Required
  559. }
  560. resp, err := svc.GetOnPremisesInstance(params)
  561. if err != nil {
  562. // Print the error, cast err to awserr.Error to get the Code and
  563. // Message from an error.
  564. fmt.Println(err.Error())
  565. return
  566. }
  567. // Pretty-print the response data.
  568. fmt.Println(resp)
  569. }
  570. func ExampleCodeDeploy_ListApplicationRevisions() {
  571. sess, err := session.NewSession()
  572. if err != nil {
  573. fmt.Println("failed to create session,", err)
  574. return
  575. }
  576. svc := codedeploy.New(sess)
  577. params := &codedeploy.ListApplicationRevisionsInput{
  578. ApplicationName: aws.String("ApplicationName"), // Required
  579. Deployed: aws.String("ListStateFilterAction"),
  580. NextToken: aws.String("NextToken"),
  581. S3Bucket: aws.String("S3Bucket"),
  582. S3KeyPrefix: aws.String("S3Key"),
  583. SortBy: aws.String("ApplicationRevisionSortBy"),
  584. SortOrder: aws.String("SortOrder"),
  585. }
  586. resp, err := svc.ListApplicationRevisions(params)
  587. if err != nil {
  588. // Print the error, cast err to awserr.Error to get the Code and
  589. // Message from an error.
  590. fmt.Println(err.Error())
  591. return
  592. }
  593. // Pretty-print the response data.
  594. fmt.Println(resp)
  595. }
  596. func ExampleCodeDeploy_ListApplications() {
  597. sess, err := session.NewSession()
  598. if err != nil {
  599. fmt.Println("failed to create session,", err)
  600. return
  601. }
  602. svc := codedeploy.New(sess)
  603. params := &codedeploy.ListApplicationsInput{
  604. NextToken: aws.String("NextToken"),
  605. }
  606. resp, err := svc.ListApplications(params)
  607. if err != nil {
  608. // Print the error, cast err to awserr.Error to get the Code and
  609. // Message from an error.
  610. fmt.Println(err.Error())
  611. return
  612. }
  613. // Pretty-print the response data.
  614. fmt.Println(resp)
  615. }
  616. func ExampleCodeDeploy_ListDeploymentConfigs() {
  617. sess, err := session.NewSession()
  618. if err != nil {
  619. fmt.Println("failed to create session,", err)
  620. return
  621. }
  622. svc := codedeploy.New(sess)
  623. params := &codedeploy.ListDeploymentConfigsInput{
  624. NextToken: aws.String("NextToken"),
  625. }
  626. resp, err := svc.ListDeploymentConfigs(params)
  627. if err != nil {
  628. // Print the error, cast err to awserr.Error to get the Code and
  629. // Message from an error.
  630. fmt.Println(err.Error())
  631. return
  632. }
  633. // Pretty-print the response data.
  634. fmt.Println(resp)
  635. }
  636. func ExampleCodeDeploy_ListDeploymentGroups() {
  637. sess, err := session.NewSession()
  638. if err != nil {
  639. fmt.Println("failed to create session,", err)
  640. return
  641. }
  642. svc := codedeploy.New(sess)
  643. params := &codedeploy.ListDeploymentGroupsInput{
  644. ApplicationName: aws.String("ApplicationName"), // Required
  645. NextToken: aws.String("NextToken"),
  646. }
  647. resp, err := svc.ListDeploymentGroups(params)
  648. if err != nil {
  649. // Print the error, cast err to awserr.Error to get the Code and
  650. // Message from an error.
  651. fmt.Println(err.Error())
  652. return
  653. }
  654. // Pretty-print the response data.
  655. fmt.Println(resp)
  656. }
  657. func ExampleCodeDeploy_ListDeploymentInstances() {
  658. sess, err := session.NewSession()
  659. if err != nil {
  660. fmt.Println("failed to create session,", err)
  661. return
  662. }
  663. svc := codedeploy.New(sess)
  664. params := &codedeploy.ListDeploymentInstancesInput{
  665. DeploymentId: aws.String("DeploymentId"), // Required
  666. InstanceStatusFilter: []*string{
  667. aws.String("InstanceStatus"), // Required
  668. // More values...
  669. },
  670. NextToken: aws.String("NextToken"),
  671. }
  672. resp, err := svc.ListDeploymentInstances(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_ListDeployments() {
  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.ListDeploymentsInput{
  690. ApplicationName: aws.String("ApplicationName"),
  691. CreateTimeRange: &codedeploy.TimeRange{
  692. End: aws.Time(time.Now()),
  693. Start: aws.Time(time.Now()),
  694. },
  695. DeploymentGroupName: aws.String("DeploymentGroupName"),
  696. IncludeOnlyStatuses: []*string{
  697. aws.String("DeploymentStatus"), // Required
  698. // More values...
  699. },
  700. NextToken: aws.String("NextToken"),
  701. }
  702. resp, err := svc.ListDeployments(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 ExampleCodeDeploy_ListOnPremisesInstances() {
  713. sess, err := session.NewSession()
  714. if err != nil {
  715. fmt.Println("failed to create session,", err)
  716. return
  717. }
  718. svc := codedeploy.New(sess)
  719. params := &codedeploy.ListOnPremisesInstancesInput{
  720. NextToken: aws.String("NextToken"),
  721. RegistrationStatus: aws.String("RegistrationStatus"),
  722. TagFilters: []*codedeploy.TagFilter{
  723. { // Required
  724. Key: aws.String("Key"),
  725. Type: aws.String("TagFilterType"),
  726. Value: aws.String("Value"),
  727. },
  728. // More values...
  729. },
  730. }
  731. resp, err := svc.ListOnPremisesInstances(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 ExampleCodeDeploy_RegisterApplicationRevision() {
  742. sess, err := session.NewSession()
  743. if err != nil {
  744. fmt.Println("failed to create session,", err)
  745. return
  746. }
  747. svc := codedeploy.New(sess)
  748. params := &codedeploy.RegisterApplicationRevisionInput{
  749. ApplicationName: aws.String("ApplicationName"), // Required
  750. Revision: &codedeploy.RevisionLocation{ // Required
  751. GitHubLocation: &codedeploy.GitHubLocation{
  752. CommitId: aws.String("CommitId"),
  753. Repository: aws.String("Repository"),
  754. },
  755. RevisionType: aws.String("RevisionLocationType"),
  756. S3Location: &codedeploy.S3Location{
  757. Bucket: aws.String("S3Bucket"),
  758. BundleType: aws.String("BundleType"),
  759. ETag: aws.String("ETag"),
  760. Key: aws.String("S3Key"),
  761. Version: aws.String("VersionId"),
  762. },
  763. },
  764. Description: aws.String("Description"),
  765. }
  766. resp, err := svc.RegisterApplicationRevision(params)
  767. if err != nil {
  768. // Print the error, cast err to awserr.Error to get the Code and
  769. // Message from an error.
  770. fmt.Println(err.Error())
  771. return
  772. }
  773. // Pretty-print the response data.
  774. fmt.Println(resp)
  775. }
  776. func ExampleCodeDeploy_RegisterOnPremisesInstance() {
  777. sess, err := session.NewSession()
  778. if err != nil {
  779. fmt.Println("failed to create session,", err)
  780. return
  781. }
  782. svc := codedeploy.New(sess)
  783. params := &codedeploy.RegisterOnPremisesInstanceInput{
  784. IamUserArn: aws.String("IamUserArn"), // Required
  785. InstanceName: aws.String("InstanceName"), // Required
  786. }
  787. resp, err := svc.RegisterOnPremisesInstance(params)
  788. if err != nil {
  789. // Print the error, cast err to awserr.Error to get the Code and
  790. // Message from an error.
  791. fmt.Println(err.Error())
  792. return
  793. }
  794. // Pretty-print the response data.
  795. fmt.Println(resp)
  796. }
  797. func ExampleCodeDeploy_RemoveTagsFromOnPremisesInstances() {
  798. sess, err := session.NewSession()
  799. if err != nil {
  800. fmt.Println("failed to create session,", err)
  801. return
  802. }
  803. svc := codedeploy.New(sess)
  804. params := &codedeploy.RemoveTagsFromOnPremisesInstancesInput{
  805. InstanceNames: []*string{ // Required
  806. aws.String("InstanceName"), // Required
  807. // More values...
  808. },
  809. Tags: []*codedeploy.Tag{ // Required
  810. { // Required
  811. Key: aws.String("Key"),
  812. Value: aws.String("Value"),
  813. },
  814. // More values...
  815. },
  816. }
  817. resp, err := svc.RemoveTagsFromOnPremisesInstances(params)
  818. if err != nil {
  819. // Print the error, cast err to awserr.Error to get the Code and
  820. // Message from an error.
  821. fmt.Println(err.Error())
  822. return
  823. }
  824. // Pretty-print the response data.
  825. fmt.Println(resp)
  826. }
  827. func ExampleCodeDeploy_StopDeployment() {
  828. sess, err := session.NewSession()
  829. if err != nil {
  830. fmt.Println("failed to create session,", err)
  831. return
  832. }
  833. svc := codedeploy.New(sess)
  834. params := &codedeploy.StopDeploymentInput{
  835. DeploymentId: aws.String("DeploymentId"), // Required
  836. }
  837. resp, err := svc.StopDeployment(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 ExampleCodeDeploy_UpdateApplication() {
  848. sess, err := session.NewSession()
  849. if err != nil {
  850. fmt.Println("failed to create session,", err)
  851. return
  852. }
  853. svc := codedeploy.New(sess)
  854. params := &codedeploy.UpdateApplicationInput{
  855. ApplicationName: aws.String("ApplicationName"),
  856. NewApplicationName: aws.String("ApplicationName"),
  857. }
  858. resp, err := svc.UpdateApplication(params)
  859. if err != nil {
  860. // Print the error, cast err to awserr.Error to get the Code and
  861. // Message from an error.
  862. fmt.Println(err.Error())
  863. return
  864. }
  865. // Pretty-print the response data.
  866. fmt.Println(resp)
  867. }
  868. func ExampleCodeDeploy_UpdateDeploymentGroup() {
  869. sess, err := session.NewSession()
  870. if err != nil {
  871. fmt.Println("failed to create session,", err)
  872. return
  873. }
  874. svc := codedeploy.New(sess)
  875. params := &codedeploy.UpdateDeploymentGroupInput{
  876. ApplicationName: aws.String("ApplicationName"), // Required
  877. CurrentDeploymentGroupName: aws.String("DeploymentGroupName"), // Required
  878. AutoScalingGroups: []*string{
  879. aws.String("AutoScalingGroupName"), // Required
  880. // More values...
  881. },
  882. DeploymentConfigName: aws.String("DeploymentConfigName"),
  883. Ec2TagFilters: []*codedeploy.EC2TagFilter{
  884. { // Required
  885. Key: aws.String("Key"),
  886. Type: aws.String("EC2TagFilterType"),
  887. Value: aws.String("Value"),
  888. },
  889. // More values...
  890. },
  891. NewDeploymentGroupName: aws.String("DeploymentGroupName"),
  892. OnPremisesInstanceTagFilters: []*codedeploy.TagFilter{
  893. { // Required
  894. Key: aws.String("Key"),
  895. Type: aws.String("TagFilterType"),
  896. Value: aws.String("Value"),
  897. },
  898. // More values...
  899. },
  900. ServiceRoleArn: aws.String("Role"),
  901. TriggerConfigurations: []*codedeploy.TriggerConfig{
  902. { // Required
  903. TriggerEvents: []*string{
  904. aws.String("TriggerEventType"), // Required
  905. // More values...
  906. },
  907. TriggerName: aws.String("TriggerName"),
  908. TriggerTargetArn: aws.String("TriggerTargetArn"),
  909. },
  910. // More values...
  911. },
  912. }
  913. resp, err := svc.UpdateDeploymentGroup(params)
  914. if err != nil {
  915. // Print the error, cast err to awserr.Error to get the Code and
  916. // Message from an error.
  917. fmt.Println(err.Error())
  918. return
  919. }
  920. // Pretty-print the response data.
  921. fmt.Println(resp)
  922. }