examples_test.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786
  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/service/codedeploy"
  9. )
  10. var _ time.Duration
  11. var _ bytes.Buffer
  12. func ExampleCodeDeploy_AddTagsToOnPremisesInstances() {
  13. svc := codedeploy.New(nil)
  14. params := &codedeploy.AddTagsToOnPremisesInstancesInput{
  15. InstanceNames: []*string{ // Required
  16. aws.String("InstanceName"), // Required
  17. // More values...
  18. },
  19. Tags: []*codedeploy.Tag{ // Required
  20. { // Required
  21. Key: aws.String("Key"),
  22. Value: aws.String("Value"),
  23. },
  24. // More values...
  25. },
  26. }
  27. resp, err := svc.AddTagsToOnPremisesInstances(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 ExampleCodeDeploy_BatchGetApplications() {
  38. svc := codedeploy.New(nil)
  39. params := &codedeploy.BatchGetApplicationsInput{
  40. ApplicationNames: []*string{
  41. aws.String("ApplicationName"), // Required
  42. // More values...
  43. },
  44. }
  45. resp, err := svc.BatchGetApplications(params)
  46. if err != nil {
  47. // Print the error, cast err to awserr.Error to get the Code and
  48. // Message from an error.
  49. fmt.Println(err.Error())
  50. return
  51. }
  52. // Pretty-print the response data.
  53. fmt.Println(resp)
  54. }
  55. func ExampleCodeDeploy_BatchGetDeployments() {
  56. svc := codedeploy.New(nil)
  57. params := &codedeploy.BatchGetDeploymentsInput{
  58. DeploymentIds: []*string{
  59. aws.String("DeploymentId"), // Required
  60. // More values...
  61. },
  62. }
  63. resp, err := svc.BatchGetDeployments(params)
  64. if err != nil {
  65. // Print the error, cast err to awserr.Error to get the Code and
  66. // Message from an error.
  67. fmt.Println(err.Error())
  68. return
  69. }
  70. // Pretty-print the response data.
  71. fmt.Println(resp)
  72. }
  73. func ExampleCodeDeploy_BatchGetOnPremisesInstances() {
  74. svc := codedeploy.New(nil)
  75. params := &codedeploy.BatchGetOnPremisesInstancesInput{
  76. InstanceNames: []*string{
  77. aws.String("InstanceName"), // Required
  78. // More values...
  79. },
  80. }
  81. resp, err := svc.BatchGetOnPremisesInstances(params)
  82. if err != nil {
  83. // Print the error, cast err to awserr.Error to get the Code and
  84. // Message from an error.
  85. fmt.Println(err.Error())
  86. return
  87. }
  88. // Pretty-print the response data.
  89. fmt.Println(resp)
  90. }
  91. func ExampleCodeDeploy_CreateApplication() {
  92. svc := codedeploy.New(nil)
  93. params := &codedeploy.CreateApplicationInput{
  94. ApplicationName: aws.String("ApplicationName"), // Required
  95. }
  96. resp, err := svc.CreateApplication(params)
  97. if err != nil {
  98. // Print the error, cast err to awserr.Error to get the Code and
  99. // Message from an error.
  100. fmt.Println(err.Error())
  101. return
  102. }
  103. // Pretty-print the response data.
  104. fmt.Println(resp)
  105. }
  106. func ExampleCodeDeploy_CreateDeployment() {
  107. svc := codedeploy.New(nil)
  108. params := &codedeploy.CreateDeploymentInput{
  109. ApplicationName: aws.String("ApplicationName"), // Required
  110. DeploymentConfigName: aws.String("DeploymentConfigName"),
  111. DeploymentGroupName: aws.String("DeploymentGroupName"),
  112. Description: aws.String("Description"),
  113. IgnoreApplicationStopFailures: aws.Bool(true),
  114. Revision: &codedeploy.RevisionLocation{
  115. GitHubLocation: &codedeploy.GitHubLocation{
  116. CommitId: aws.String("CommitId"),
  117. Repository: aws.String("Repository"),
  118. },
  119. RevisionType: aws.String("RevisionLocationType"),
  120. S3Location: &codedeploy.S3Location{
  121. Bucket: aws.String("S3Bucket"),
  122. BundleType: aws.String("BundleType"),
  123. ETag: aws.String("ETag"),
  124. Key: aws.String("S3Key"),
  125. Version: aws.String("VersionId"),
  126. },
  127. },
  128. }
  129. resp, err := svc.CreateDeployment(params)
  130. if err != nil {
  131. // Print the error, cast err to awserr.Error to get the Code and
  132. // Message from an error.
  133. fmt.Println(err.Error())
  134. return
  135. }
  136. // Pretty-print the response data.
  137. fmt.Println(resp)
  138. }
  139. func ExampleCodeDeploy_CreateDeploymentConfig() {
  140. svc := codedeploy.New(nil)
  141. params := &codedeploy.CreateDeploymentConfigInput{
  142. DeploymentConfigName: aws.String("DeploymentConfigName"), // Required
  143. MinimumHealthyHosts: &codedeploy.MinimumHealthyHosts{
  144. Type: aws.String("MinimumHealthyHostsType"),
  145. Value: aws.Int64(1),
  146. },
  147. }
  148. resp, err := svc.CreateDeploymentConfig(params)
  149. if err != nil {
  150. // Print the error, cast err to awserr.Error to get the Code and
  151. // Message from an error.
  152. fmt.Println(err.Error())
  153. return
  154. }
  155. // Pretty-print the response data.
  156. fmt.Println(resp)
  157. }
  158. func ExampleCodeDeploy_CreateDeploymentGroup() {
  159. svc := codedeploy.New(nil)
  160. params := &codedeploy.CreateDeploymentGroupInput{
  161. ApplicationName: aws.String("ApplicationName"), // Required
  162. DeploymentGroupName: aws.String("DeploymentGroupName"), // Required
  163. ServiceRoleArn: aws.String("Role"), // Required
  164. AutoScalingGroups: []*string{
  165. aws.String("AutoScalingGroupName"), // Required
  166. // More values...
  167. },
  168. DeploymentConfigName: aws.String("DeploymentConfigName"),
  169. Ec2TagFilters: []*codedeploy.EC2TagFilter{
  170. { // Required
  171. Key: aws.String("Key"),
  172. Type: aws.String("EC2TagFilterType"),
  173. Value: aws.String("Value"),
  174. },
  175. // More values...
  176. },
  177. OnPremisesInstanceTagFilters: []*codedeploy.TagFilter{
  178. { // Required
  179. Key: aws.String("Key"),
  180. Type: aws.String("TagFilterType"),
  181. Value: aws.String("Value"),
  182. },
  183. // More values...
  184. },
  185. }
  186. resp, err := svc.CreateDeploymentGroup(params)
  187. if err != nil {
  188. // Print the error, cast err to awserr.Error to get the Code and
  189. // Message from an error.
  190. fmt.Println(err.Error())
  191. return
  192. }
  193. // Pretty-print the response data.
  194. fmt.Println(resp)
  195. }
  196. func ExampleCodeDeploy_DeleteApplication() {
  197. svc := codedeploy.New(nil)
  198. params := &codedeploy.DeleteApplicationInput{
  199. ApplicationName: aws.String("ApplicationName"), // Required
  200. }
  201. resp, err := svc.DeleteApplication(params)
  202. if err != nil {
  203. // Print the error, cast err to awserr.Error to get the Code and
  204. // Message from an error.
  205. fmt.Println(err.Error())
  206. return
  207. }
  208. // Pretty-print the response data.
  209. fmt.Println(resp)
  210. }
  211. func ExampleCodeDeploy_DeleteDeploymentConfig() {
  212. svc := codedeploy.New(nil)
  213. params := &codedeploy.DeleteDeploymentConfigInput{
  214. DeploymentConfigName: aws.String("DeploymentConfigName"), // Required
  215. }
  216. resp, err := svc.DeleteDeploymentConfig(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 ExampleCodeDeploy_DeleteDeploymentGroup() {
  227. svc := codedeploy.New(nil)
  228. params := &codedeploy.DeleteDeploymentGroupInput{
  229. ApplicationName: aws.String("ApplicationName"), // Required
  230. DeploymentGroupName: aws.String("DeploymentGroupName"), // Required
  231. }
  232. resp, err := svc.DeleteDeploymentGroup(params)
  233. if err != nil {
  234. // Print the error, cast err to awserr.Error to get the Code and
  235. // Message from an error.
  236. fmt.Println(err.Error())
  237. return
  238. }
  239. // Pretty-print the response data.
  240. fmt.Println(resp)
  241. }
  242. func ExampleCodeDeploy_DeregisterOnPremisesInstance() {
  243. svc := codedeploy.New(nil)
  244. params := &codedeploy.DeregisterOnPremisesInstanceInput{
  245. InstanceName: aws.String("InstanceName"), // Required
  246. }
  247. resp, err := svc.DeregisterOnPremisesInstance(params)
  248. if err != nil {
  249. // Print the error, cast err to awserr.Error to get the Code and
  250. // Message from an error.
  251. fmt.Println(err.Error())
  252. return
  253. }
  254. // Pretty-print the response data.
  255. fmt.Println(resp)
  256. }
  257. func ExampleCodeDeploy_GetApplication() {
  258. svc := codedeploy.New(nil)
  259. params := &codedeploy.GetApplicationInput{
  260. ApplicationName: aws.String("ApplicationName"), // Required
  261. }
  262. resp, err := svc.GetApplication(params)
  263. if err != nil {
  264. // Print the error, cast err to awserr.Error to get the Code and
  265. // Message from an error.
  266. fmt.Println(err.Error())
  267. return
  268. }
  269. // Pretty-print the response data.
  270. fmt.Println(resp)
  271. }
  272. func ExampleCodeDeploy_GetApplicationRevision() {
  273. svc := codedeploy.New(nil)
  274. params := &codedeploy.GetApplicationRevisionInput{
  275. ApplicationName: aws.String("ApplicationName"), // Required
  276. Revision: &codedeploy.RevisionLocation{ // Required
  277. GitHubLocation: &codedeploy.GitHubLocation{
  278. CommitId: aws.String("CommitId"),
  279. Repository: aws.String("Repository"),
  280. },
  281. RevisionType: aws.String("RevisionLocationType"),
  282. S3Location: &codedeploy.S3Location{
  283. Bucket: aws.String("S3Bucket"),
  284. BundleType: aws.String("BundleType"),
  285. ETag: aws.String("ETag"),
  286. Key: aws.String("S3Key"),
  287. Version: aws.String("VersionId"),
  288. },
  289. },
  290. }
  291. resp, err := svc.GetApplicationRevision(params)
  292. if err != nil {
  293. // Print the error, cast err to awserr.Error to get the Code and
  294. // Message from an error.
  295. fmt.Println(err.Error())
  296. return
  297. }
  298. // Pretty-print the response data.
  299. fmt.Println(resp)
  300. }
  301. func ExampleCodeDeploy_GetDeployment() {
  302. svc := codedeploy.New(nil)
  303. params := &codedeploy.GetDeploymentInput{
  304. DeploymentId: aws.String("DeploymentId"), // Required
  305. }
  306. resp, err := svc.GetDeployment(params)
  307. if err != nil {
  308. // Print the error, cast err to awserr.Error to get the Code and
  309. // Message from an error.
  310. fmt.Println(err.Error())
  311. return
  312. }
  313. // Pretty-print the response data.
  314. fmt.Println(resp)
  315. }
  316. func ExampleCodeDeploy_GetDeploymentConfig() {
  317. svc := codedeploy.New(nil)
  318. params := &codedeploy.GetDeploymentConfigInput{
  319. DeploymentConfigName: aws.String("DeploymentConfigName"), // Required
  320. }
  321. resp, err := svc.GetDeploymentConfig(params)
  322. if err != nil {
  323. // Print the error, cast err to awserr.Error to get the Code and
  324. // Message from an error.
  325. fmt.Println(err.Error())
  326. return
  327. }
  328. // Pretty-print the response data.
  329. fmt.Println(resp)
  330. }
  331. func ExampleCodeDeploy_GetDeploymentGroup() {
  332. svc := codedeploy.New(nil)
  333. params := &codedeploy.GetDeploymentGroupInput{
  334. ApplicationName: aws.String("ApplicationName"), // Required
  335. DeploymentGroupName: aws.String("DeploymentGroupName"), // Required
  336. }
  337. resp, err := svc.GetDeploymentGroup(params)
  338. if err != nil {
  339. // Print the error, cast err to awserr.Error to get the Code and
  340. // Message from an error.
  341. fmt.Println(err.Error())
  342. return
  343. }
  344. // Pretty-print the response data.
  345. fmt.Println(resp)
  346. }
  347. func ExampleCodeDeploy_GetDeploymentInstance() {
  348. svc := codedeploy.New(nil)
  349. params := &codedeploy.GetDeploymentInstanceInput{
  350. DeploymentId: aws.String("DeploymentId"), // Required
  351. InstanceId: aws.String("InstanceId"), // Required
  352. }
  353. resp, err := svc.GetDeploymentInstance(params)
  354. if err != nil {
  355. // Print the error, cast err to awserr.Error to get the Code and
  356. // Message from an error.
  357. fmt.Println(err.Error())
  358. return
  359. }
  360. // Pretty-print the response data.
  361. fmt.Println(resp)
  362. }
  363. func ExampleCodeDeploy_GetOnPremisesInstance() {
  364. svc := codedeploy.New(nil)
  365. params := &codedeploy.GetOnPremisesInstanceInput{
  366. InstanceName: aws.String("InstanceName"), // Required
  367. }
  368. resp, err := svc.GetOnPremisesInstance(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_ListApplicationRevisions() {
  379. svc := codedeploy.New(nil)
  380. params := &codedeploy.ListApplicationRevisionsInput{
  381. ApplicationName: aws.String("ApplicationName"), // Required
  382. Deployed: aws.String("ListStateFilterAction"),
  383. NextToken: aws.String("NextToken"),
  384. S3Bucket: aws.String("S3Bucket"),
  385. S3KeyPrefix: aws.String("S3Key"),
  386. SortBy: aws.String("ApplicationRevisionSortBy"),
  387. SortOrder: aws.String("SortOrder"),
  388. }
  389. resp, err := svc.ListApplicationRevisions(params)
  390. if err != nil {
  391. // Print the error, cast err to awserr.Error to get the Code and
  392. // Message from an error.
  393. fmt.Println(err.Error())
  394. return
  395. }
  396. // Pretty-print the response data.
  397. fmt.Println(resp)
  398. }
  399. func ExampleCodeDeploy_ListApplications() {
  400. svc := codedeploy.New(nil)
  401. params := &codedeploy.ListApplicationsInput{
  402. NextToken: aws.String("NextToken"),
  403. }
  404. resp, err := svc.ListApplications(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_ListDeploymentConfigs() {
  415. svc := codedeploy.New(nil)
  416. params := &codedeploy.ListDeploymentConfigsInput{
  417. NextToken: aws.String("NextToken"),
  418. }
  419. resp, err := svc.ListDeploymentConfigs(params)
  420. if err != nil {
  421. // Print the error, cast err to awserr.Error to get the Code and
  422. // Message from an error.
  423. fmt.Println(err.Error())
  424. return
  425. }
  426. // Pretty-print the response data.
  427. fmt.Println(resp)
  428. }
  429. func ExampleCodeDeploy_ListDeploymentGroups() {
  430. svc := codedeploy.New(nil)
  431. params := &codedeploy.ListDeploymentGroupsInput{
  432. ApplicationName: aws.String("ApplicationName"), // Required
  433. NextToken: aws.String("NextToken"),
  434. }
  435. resp, err := svc.ListDeploymentGroups(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 ExampleCodeDeploy_ListDeploymentInstances() {
  446. svc := codedeploy.New(nil)
  447. params := &codedeploy.ListDeploymentInstancesInput{
  448. DeploymentId: aws.String("DeploymentId"), // Required
  449. InstanceStatusFilter: []*string{
  450. aws.String("InstanceStatus"), // Required
  451. // More values...
  452. },
  453. NextToken: aws.String("NextToken"),
  454. }
  455. resp, err := svc.ListDeploymentInstances(params)
  456. if err != nil {
  457. // Print the error, cast err to awserr.Error to get the Code and
  458. // Message from an error.
  459. fmt.Println(err.Error())
  460. return
  461. }
  462. // Pretty-print the response data.
  463. fmt.Println(resp)
  464. }
  465. func ExampleCodeDeploy_ListDeployments() {
  466. svc := codedeploy.New(nil)
  467. params := &codedeploy.ListDeploymentsInput{
  468. ApplicationName: aws.String("ApplicationName"),
  469. CreateTimeRange: &codedeploy.TimeRange{
  470. End: aws.Time(time.Now()),
  471. Start: aws.Time(time.Now()),
  472. },
  473. DeploymentGroupName: aws.String("DeploymentGroupName"),
  474. IncludeOnlyStatuses: []*string{
  475. aws.String("DeploymentStatus"), // Required
  476. // More values...
  477. },
  478. NextToken: aws.String("NextToken"),
  479. }
  480. resp, err := svc.ListDeployments(params)
  481. if err != nil {
  482. // Print the error, cast err to awserr.Error to get the Code and
  483. // Message from an error.
  484. fmt.Println(err.Error())
  485. return
  486. }
  487. // Pretty-print the response data.
  488. fmt.Println(resp)
  489. }
  490. func ExampleCodeDeploy_ListOnPremisesInstances() {
  491. svc := codedeploy.New(nil)
  492. params := &codedeploy.ListOnPremisesInstancesInput{
  493. NextToken: aws.String("NextToken"),
  494. RegistrationStatus: aws.String("RegistrationStatus"),
  495. TagFilters: []*codedeploy.TagFilter{
  496. { // Required
  497. Key: aws.String("Key"),
  498. Type: aws.String("TagFilterType"),
  499. Value: aws.String("Value"),
  500. },
  501. // More values...
  502. },
  503. }
  504. resp, err := svc.ListOnPremisesInstances(params)
  505. if err != nil {
  506. // Print the error, cast err to awserr.Error to get the Code and
  507. // Message from an error.
  508. fmt.Println(err.Error())
  509. return
  510. }
  511. // Pretty-print the response data.
  512. fmt.Println(resp)
  513. }
  514. func ExampleCodeDeploy_RegisterApplicationRevision() {
  515. svc := codedeploy.New(nil)
  516. params := &codedeploy.RegisterApplicationRevisionInput{
  517. ApplicationName: aws.String("ApplicationName"), // Required
  518. Revision: &codedeploy.RevisionLocation{ // Required
  519. GitHubLocation: &codedeploy.GitHubLocation{
  520. CommitId: aws.String("CommitId"),
  521. Repository: aws.String("Repository"),
  522. },
  523. RevisionType: aws.String("RevisionLocationType"),
  524. S3Location: &codedeploy.S3Location{
  525. Bucket: aws.String("S3Bucket"),
  526. BundleType: aws.String("BundleType"),
  527. ETag: aws.String("ETag"),
  528. Key: aws.String("S3Key"),
  529. Version: aws.String("VersionId"),
  530. },
  531. },
  532. Description: aws.String("Description"),
  533. }
  534. resp, err := svc.RegisterApplicationRevision(params)
  535. if err != nil {
  536. // Print the error, cast err to awserr.Error to get the Code and
  537. // Message from an error.
  538. fmt.Println(err.Error())
  539. return
  540. }
  541. // Pretty-print the response data.
  542. fmt.Println(resp)
  543. }
  544. func ExampleCodeDeploy_RegisterOnPremisesInstance() {
  545. svc := codedeploy.New(nil)
  546. params := &codedeploy.RegisterOnPremisesInstanceInput{
  547. IamUserArn: aws.String("IamUserArn"), // Required
  548. InstanceName: aws.String("InstanceName"), // Required
  549. }
  550. resp, err := svc.RegisterOnPremisesInstance(params)
  551. if err != nil {
  552. // Print the error, cast err to awserr.Error to get the Code and
  553. // Message from an error.
  554. fmt.Println(err.Error())
  555. return
  556. }
  557. // Pretty-print the response data.
  558. fmt.Println(resp)
  559. }
  560. func ExampleCodeDeploy_RemoveTagsFromOnPremisesInstances() {
  561. svc := codedeploy.New(nil)
  562. params := &codedeploy.RemoveTagsFromOnPremisesInstancesInput{
  563. InstanceNames: []*string{ // Required
  564. aws.String("InstanceName"), // Required
  565. // More values...
  566. },
  567. Tags: []*codedeploy.Tag{ // Required
  568. { // Required
  569. Key: aws.String("Key"),
  570. Value: aws.String("Value"),
  571. },
  572. // More values...
  573. },
  574. }
  575. resp, err := svc.RemoveTagsFromOnPremisesInstances(params)
  576. if err != nil {
  577. // Print the error, cast err to awserr.Error to get the Code and
  578. // Message from an error.
  579. fmt.Println(err.Error())
  580. return
  581. }
  582. // Pretty-print the response data.
  583. fmt.Println(resp)
  584. }
  585. func ExampleCodeDeploy_StopDeployment() {
  586. svc := codedeploy.New(nil)
  587. params := &codedeploy.StopDeploymentInput{
  588. DeploymentId: aws.String("DeploymentId"), // Required
  589. }
  590. resp, err := svc.StopDeployment(params)
  591. if err != nil {
  592. // Print the error, cast err to awserr.Error to get the Code and
  593. // Message from an error.
  594. fmt.Println(err.Error())
  595. return
  596. }
  597. // Pretty-print the response data.
  598. fmt.Println(resp)
  599. }
  600. func ExampleCodeDeploy_UpdateApplication() {
  601. svc := codedeploy.New(nil)
  602. params := &codedeploy.UpdateApplicationInput{
  603. ApplicationName: aws.String("ApplicationName"),
  604. NewApplicationName: aws.String("ApplicationName"),
  605. }
  606. resp, err := svc.UpdateApplication(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_UpdateDeploymentGroup() {
  617. svc := codedeploy.New(nil)
  618. params := &codedeploy.UpdateDeploymentGroupInput{
  619. ApplicationName: aws.String("ApplicationName"), // Required
  620. CurrentDeploymentGroupName: aws.String("DeploymentGroupName"), // Required
  621. AutoScalingGroups: []*string{
  622. aws.String("AutoScalingGroupName"), // Required
  623. // More values...
  624. },
  625. DeploymentConfigName: aws.String("DeploymentConfigName"),
  626. Ec2TagFilters: []*codedeploy.EC2TagFilter{
  627. { // Required
  628. Key: aws.String("Key"),
  629. Type: aws.String("EC2TagFilterType"),
  630. Value: aws.String("Value"),
  631. },
  632. // More values...
  633. },
  634. NewDeploymentGroupName: aws.String("DeploymentGroupName"),
  635. OnPremisesInstanceTagFilters: []*codedeploy.TagFilter{
  636. { // Required
  637. Key: aws.String("Key"),
  638. Type: aws.String("TagFilterType"),
  639. Value: aws.String("Value"),
  640. },
  641. // More values...
  642. },
  643. ServiceRoleArn: aws.String("Role"),
  644. }
  645. resp, err := svc.UpdateDeploymentGroup(params)
  646. if err != nil {
  647. // Print the error, cast err to awserr.Error to get the Code and
  648. // Message from an error.
  649. fmt.Println(err.Error())
  650. return
  651. }
  652. // Pretty-print the response data.
  653. fmt.Println(resp)
  654. }