examples_test.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package codepipeline_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/codepipeline"
  9. )
  10. var _ time.Duration
  11. var _ bytes.Buffer
  12. func ExampleCodePipeline_AcknowledgeJob() {
  13. svc := codepipeline.New(nil)
  14. params := &codepipeline.AcknowledgeJobInput{
  15. JobId: aws.String("JobId"), // Required
  16. Nonce: aws.String("Nonce"), // Required
  17. }
  18. resp, err := svc.AcknowledgeJob(params)
  19. if err != nil {
  20. // Print the error, cast err to awserr.Error to get the Code and
  21. // Message from an error.
  22. fmt.Println(err.Error())
  23. return
  24. }
  25. // Pretty-print the response data.
  26. fmt.Println(resp)
  27. }
  28. func ExampleCodePipeline_AcknowledgeThirdPartyJob() {
  29. svc := codepipeline.New(nil)
  30. params := &codepipeline.AcknowledgeThirdPartyJobInput{
  31. ClientToken: aws.String("ClientToken"), // Required
  32. JobId: aws.String("ThirdPartyJobId"), // Required
  33. Nonce: aws.String("Nonce"), // Required
  34. }
  35. resp, err := svc.AcknowledgeThirdPartyJob(params)
  36. if err != nil {
  37. // Print the error, cast err to awserr.Error to get the Code and
  38. // Message from an error.
  39. fmt.Println(err.Error())
  40. return
  41. }
  42. // Pretty-print the response data.
  43. fmt.Println(resp)
  44. }
  45. func ExampleCodePipeline_CreateCustomActionType() {
  46. svc := codepipeline.New(nil)
  47. params := &codepipeline.CreateCustomActionTypeInput{
  48. Category: aws.String("ActionCategory"), // Required
  49. InputArtifactDetails: &codepipeline.ArtifactDetails{ // Required
  50. MaximumCount: aws.Int64(1), // Required
  51. MinimumCount: aws.Int64(1), // Required
  52. },
  53. OutputArtifactDetails: &codepipeline.ArtifactDetails{ // Required
  54. MaximumCount: aws.Int64(1), // Required
  55. MinimumCount: aws.Int64(1), // Required
  56. },
  57. Provider: aws.String("ActionProvider"), // Required
  58. Version: aws.String("Version"), // Required
  59. ConfigurationProperties: []*codepipeline.ActionConfigurationProperty{
  60. { // Required
  61. Key: aws.Bool(true), // Required
  62. Name: aws.String("ActionConfigurationKey"), // Required
  63. Required: aws.Bool(true), // Required
  64. Secret: aws.Bool(true), // Required
  65. Description: aws.String("Description"),
  66. Queryable: aws.Bool(true),
  67. Type: aws.String("ActionConfigurationPropertyType"),
  68. },
  69. // More values...
  70. },
  71. Settings: &codepipeline.ActionTypeSettings{
  72. EntityUrlTemplate: aws.String("UrlTemplate"),
  73. ExecutionUrlTemplate: aws.String("UrlTemplate"),
  74. RevisionUrlTemplate: aws.String("UrlTemplate"),
  75. ThirdPartyConfigurationUrl: aws.String("Url"),
  76. },
  77. }
  78. resp, err := svc.CreateCustomActionType(params)
  79. if err != nil {
  80. // Print the error, cast err to awserr.Error to get the Code and
  81. // Message from an error.
  82. fmt.Println(err.Error())
  83. return
  84. }
  85. // Pretty-print the response data.
  86. fmt.Println(resp)
  87. }
  88. func ExampleCodePipeline_CreatePipeline() {
  89. svc := codepipeline.New(nil)
  90. params := &codepipeline.CreatePipelineInput{
  91. Pipeline: &codepipeline.PipelineDeclaration{ // Required
  92. ArtifactStore: &codepipeline.ArtifactStore{ // Required
  93. Location: aws.String("ArtifactStoreLocation"), // Required
  94. Type: aws.String("ArtifactStoreType"), // Required
  95. EncryptionKey: &codepipeline.EncryptionKey{
  96. Id: aws.String("EncryptionKeyId"), // Required
  97. Type: aws.String("EncryptionKeyType"), // Required
  98. },
  99. },
  100. Name: aws.String("PipelineName"), // Required
  101. RoleArn: aws.String("RoleArn"), // Required
  102. Stages: []*codepipeline.StageDeclaration{ // Required
  103. { // Required
  104. Actions: []*codepipeline.ActionDeclaration{ // Required
  105. { // Required
  106. ActionTypeId: &codepipeline.ActionTypeId{ // Required
  107. Category: aws.String("ActionCategory"), // Required
  108. Owner: aws.String("ActionOwner"), // Required
  109. Provider: aws.String("ActionProvider"), // Required
  110. Version: aws.String("Version"), // Required
  111. },
  112. Name: aws.String("ActionName"), // Required
  113. Configuration: map[string]*string{
  114. "Key": aws.String("ActionConfigurationValue"), // Required
  115. // More values...
  116. },
  117. InputArtifacts: []*codepipeline.InputArtifact{
  118. { // Required
  119. Name: aws.String("ArtifactName"), // Required
  120. },
  121. // More values...
  122. },
  123. OutputArtifacts: []*codepipeline.OutputArtifact{
  124. { // Required
  125. Name: aws.String("ArtifactName"), // Required
  126. },
  127. // More values...
  128. },
  129. RoleArn: aws.String("RoleArn"),
  130. RunOrder: aws.Int64(1),
  131. },
  132. // More values...
  133. },
  134. Name: aws.String("StageName"), // Required
  135. Blockers: []*codepipeline.BlockerDeclaration{
  136. { // Required
  137. Name: aws.String("BlockerName"), // Required
  138. Type: aws.String("BlockerType"), // Required
  139. },
  140. // More values...
  141. },
  142. },
  143. // More values...
  144. },
  145. Version: aws.Int64(1),
  146. },
  147. }
  148. resp, err := svc.CreatePipeline(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 ExampleCodePipeline_DeleteCustomActionType() {
  159. svc := codepipeline.New(nil)
  160. params := &codepipeline.DeleteCustomActionTypeInput{
  161. Category: aws.String("ActionCategory"), // Required
  162. Provider: aws.String("ActionProvider"), // Required
  163. Version: aws.String("Version"), // Required
  164. }
  165. resp, err := svc.DeleteCustomActionType(params)
  166. if err != nil {
  167. // Print the error, cast err to awserr.Error to get the Code and
  168. // Message from an error.
  169. fmt.Println(err.Error())
  170. return
  171. }
  172. // Pretty-print the response data.
  173. fmt.Println(resp)
  174. }
  175. func ExampleCodePipeline_DeletePipeline() {
  176. svc := codepipeline.New(nil)
  177. params := &codepipeline.DeletePipelineInput{
  178. Name: aws.String("PipelineName"), // Required
  179. }
  180. resp, err := svc.DeletePipeline(params)
  181. if err != nil {
  182. // Print the error, cast err to awserr.Error to get the Code and
  183. // Message from an error.
  184. fmt.Println(err.Error())
  185. return
  186. }
  187. // Pretty-print the response data.
  188. fmt.Println(resp)
  189. }
  190. func ExampleCodePipeline_DisableStageTransition() {
  191. svc := codepipeline.New(nil)
  192. params := &codepipeline.DisableStageTransitionInput{
  193. PipelineName: aws.String("PipelineName"), // Required
  194. Reason: aws.String("DisabledReason"), // Required
  195. StageName: aws.String("StageName"), // Required
  196. TransitionType: aws.String("StageTransitionType"), // Required
  197. }
  198. resp, err := svc.DisableStageTransition(params)
  199. if err != nil {
  200. // Print the error, cast err to awserr.Error to get the Code and
  201. // Message from an error.
  202. fmt.Println(err.Error())
  203. return
  204. }
  205. // Pretty-print the response data.
  206. fmt.Println(resp)
  207. }
  208. func ExampleCodePipeline_EnableStageTransition() {
  209. svc := codepipeline.New(nil)
  210. params := &codepipeline.EnableStageTransitionInput{
  211. PipelineName: aws.String("PipelineName"), // Required
  212. StageName: aws.String("StageName"), // Required
  213. TransitionType: aws.String("StageTransitionType"), // Required
  214. }
  215. resp, err := svc.EnableStageTransition(params)
  216. if err != nil {
  217. // Print the error, cast err to awserr.Error to get the Code and
  218. // Message from an error.
  219. fmt.Println(err.Error())
  220. return
  221. }
  222. // Pretty-print the response data.
  223. fmt.Println(resp)
  224. }
  225. func ExampleCodePipeline_GetJobDetails() {
  226. svc := codepipeline.New(nil)
  227. params := &codepipeline.GetJobDetailsInput{
  228. JobId: aws.String("JobId"), // Required
  229. }
  230. resp, err := svc.GetJobDetails(params)
  231. if err != nil {
  232. // Print the error, cast err to awserr.Error to get the Code and
  233. // Message from an error.
  234. fmt.Println(err.Error())
  235. return
  236. }
  237. // Pretty-print the response data.
  238. fmt.Println(resp)
  239. }
  240. func ExampleCodePipeline_GetPipeline() {
  241. svc := codepipeline.New(nil)
  242. params := &codepipeline.GetPipelineInput{
  243. Name: aws.String("PipelineName"), // Required
  244. Version: aws.Int64(1),
  245. }
  246. resp, err := svc.GetPipeline(params)
  247. if err != nil {
  248. // Print the error, cast err to awserr.Error to get the Code and
  249. // Message from an error.
  250. fmt.Println(err.Error())
  251. return
  252. }
  253. // Pretty-print the response data.
  254. fmt.Println(resp)
  255. }
  256. func ExampleCodePipeline_GetPipelineState() {
  257. svc := codepipeline.New(nil)
  258. params := &codepipeline.GetPipelineStateInput{
  259. Name: aws.String("PipelineName"), // Required
  260. }
  261. resp, err := svc.GetPipelineState(params)
  262. if err != nil {
  263. // Print the error, cast err to awserr.Error to get the Code and
  264. // Message from an error.
  265. fmt.Println(err.Error())
  266. return
  267. }
  268. // Pretty-print the response data.
  269. fmt.Println(resp)
  270. }
  271. func ExampleCodePipeline_GetThirdPartyJobDetails() {
  272. svc := codepipeline.New(nil)
  273. params := &codepipeline.GetThirdPartyJobDetailsInput{
  274. ClientToken: aws.String("ClientToken"), // Required
  275. JobId: aws.String("ThirdPartyJobId"), // Required
  276. }
  277. resp, err := svc.GetThirdPartyJobDetails(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 ExampleCodePipeline_ListActionTypes() {
  288. svc := codepipeline.New(nil)
  289. params := &codepipeline.ListActionTypesInput{
  290. ActionOwnerFilter: aws.String("ActionOwner"),
  291. NextToken: aws.String("NextToken"),
  292. }
  293. resp, err := svc.ListActionTypes(params)
  294. if err != nil {
  295. // Print the error, cast err to awserr.Error to get the Code and
  296. // Message from an error.
  297. fmt.Println(err.Error())
  298. return
  299. }
  300. // Pretty-print the response data.
  301. fmt.Println(resp)
  302. }
  303. func ExampleCodePipeline_ListPipelines() {
  304. svc := codepipeline.New(nil)
  305. params := &codepipeline.ListPipelinesInput{
  306. NextToken: aws.String("NextToken"),
  307. }
  308. resp, err := svc.ListPipelines(params)
  309. if err != nil {
  310. // Print the error, cast err to awserr.Error to get the Code and
  311. // Message from an error.
  312. fmt.Println(err.Error())
  313. return
  314. }
  315. // Pretty-print the response data.
  316. fmt.Println(resp)
  317. }
  318. func ExampleCodePipeline_PollForJobs() {
  319. svc := codepipeline.New(nil)
  320. params := &codepipeline.PollForJobsInput{
  321. ActionTypeId: &codepipeline.ActionTypeId{ // Required
  322. Category: aws.String("ActionCategory"), // Required
  323. Owner: aws.String("ActionOwner"), // Required
  324. Provider: aws.String("ActionProvider"), // Required
  325. Version: aws.String("Version"), // Required
  326. },
  327. MaxBatchSize: aws.Int64(1),
  328. QueryParam: map[string]*string{
  329. "Key": aws.String("ActionConfigurationQueryableValue"), // Required
  330. // More values...
  331. },
  332. }
  333. resp, err := svc.PollForJobs(params)
  334. if err != nil {
  335. // Print the error, cast err to awserr.Error to get the Code and
  336. // Message from an error.
  337. fmt.Println(err.Error())
  338. return
  339. }
  340. // Pretty-print the response data.
  341. fmt.Println(resp)
  342. }
  343. func ExampleCodePipeline_PollForThirdPartyJobs() {
  344. svc := codepipeline.New(nil)
  345. params := &codepipeline.PollForThirdPartyJobsInput{
  346. ActionTypeId: &codepipeline.ActionTypeId{ // Required
  347. Category: aws.String("ActionCategory"), // Required
  348. Owner: aws.String("ActionOwner"), // Required
  349. Provider: aws.String("ActionProvider"), // Required
  350. Version: aws.String("Version"), // Required
  351. },
  352. MaxBatchSize: aws.Int64(1),
  353. }
  354. resp, err := svc.PollForThirdPartyJobs(params)
  355. if err != nil {
  356. // Print the error, cast err to awserr.Error to get the Code and
  357. // Message from an error.
  358. fmt.Println(err.Error())
  359. return
  360. }
  361. // Pretty-print the response data.
  362. fmt.Println(resp)
  363. }
  364. func ExampleCodePipeline_PutActionRevision() {
  365. svc := codepipeline.New(nil)
  366. params := &codepipeline.PutActionRevisionInput{
  367. ActionName: aws.String("ActionName"), // Required
  368. ActionRevision: &codepipeline.ActionRevision{ // Required
  369. Created: aws.Time(time.Now()), // Required
  370. RevisionId: aws.String("RevisionId"), // Required
  371. RevisionChangeId: aws.String("RevisionChangeId"),
  372. },
  373. PipelineName: aws.String("PipelineName"), // Required
  374. StageName: aws.String("StageName"), // Required
  375. }
  376. resp, err := svc.PutActionRevision(params)
  377. if err != nil {
  378. // Print the error, cast err to awserr.Error to get the Code and
  379. // Message from an error.
  380. fmt.Println(err.Error())
  381. return
  382. }
  383. // Pretty-print the response data.
  384. fmt.Println(resp)
  385. }
  386. func ExampleCodePipeline_PutJobFailureResult() {
  387. svc := codepipeline.New(nil)
  388. params := &codepipeline.PutJobFailureResultInput{
  389. FailureDetails: &codepipeline.FailureDetails{ // Required
  390. Message: aws.String("Message"), // Required
  391. Type: aws.String("FailureType"), // Required
  392. ExternalExecutionId: aws.String("ExecutionId"),
  393. },
  394. JobId: aws.String("JobId"), // Required
  395. }
  396. resp, err := svc.PutJobFailureResult(params)
  397. if err != nil {
  398. // Print the error, cast err to awserr.Error to get the Code and
  399. // Message from an error.
  400. fmt.Println(err.Error())
  401. return
  402. }
  403. // Pretty-print the response data.
  404. fmt.Println(resp)
  405. }
  406. func ExampleCodePipeline_PutJobSuccessResult() {
  407. svc := codepipeline.New(nil)
  408. params := &codepipeline.PutJobSuccessResultInput{
  409. JobId: aws.String("JobId"), // Required
  410. ContinuationToken: aws.String("ContinuationToken"),
  411. CurrentRevision: &codepipeline.CurrentRevision{
  412. ChangeIdentifier: aws.String("RevisionChangeIdentifier"), // Required
  413. Revision: aws.String("Revision"), // Required
  414. },
  415. ExecutionDetails: &codepipeline.ExecutionDetails{
  416. ExternalExecutionId: aws.String("ExecutionId"),
  417. PercentComplete: aws.Int64(1),
  418. Summary: aws.String("ExecutionSummary"),
  419. },
  420. }
  421. resp, err := svc.PutJobSuccessResult(params)
  422. if err != nil {
  423. // Print the error, cast err to awserr.Error to get the Code and
  424. // Message from an error.
  425. fmt.Println(err.Error())
  426. return
  427. }
  428. // Pretty-print the response data.
  429. fmt.Println(resp)
  430. }
  431. func ExampleCodePipeline_PutThirdPartyJobFailureResult() {
  432. svc := codepipeline.New(nil)
  433. params := &codepipeline.PutThirdPartyJobFailureResultInput{
  434. ClientToken: aws.String("ClientToken"), // Required
  435. FailureDetails: &codepipeline.FailureDetails{ // Required
  436. Message: aws.String("Message"), // Required
  437. Type: aws.String("FailureType"), // Required
  438. ExternalExecutionId: aws.String("ExecutionId"),
  439. },
  440. JobId: aws.String("ThirdPartyJobId"), // Required
  441. }
  442. resp, err := svc.PutThirdPartyJobFailureResult(params)
  443. if err != nil {
  444. // Print the error, cast err to awserr.Error to get the Code and
  445. // Message from an error.
  446. fmt.Println(err.Error())
  447. return
  448. }
  449. // Pretty-print the response data.
  450. fmt.Println(resp)
  451. }
  452. func ExampleCodePipeline_PutThirdPartyJobSuccessResult() {
  453. svc := codepipeline.New(nil)
  454. params := &codepipeline.PutThirdPartyJobSuccessResultInput{
  455. ClientToken: aws.String("ClientToken"), // Required
  456. JobId: aws.String("ThirdPartyJobId"), // Required
  457. ContinuationToken: aws.String("ContinuationToken"),
  458. CurrentRevision: &codepipeline.CurrentRevision{
  459. ChangeIdentifier: aws.String("RevisionChangeIdentifier"), // Required
  460. Revision: aws.String("Revision"), // Required
  461. },
  462. ExecutionDetails: &codepipeline.ExecutionDetails{
  463. ExternalExecutionId: aws.String("ExecutionId"),
  464. PercentComplete: aws.Int64(1),
  465. Summary: aws.String("ExecutionSummary"),
  466. },
  467. }
  468. resp, err := svc.PutThirdPartyJobSuccessResult(params)
  469. if err != nil {
  470. // Print the error, cast err to awserr.Error to get the Code and
  471. // Message from an error.
  472. fmt.Println(err.Error())
  473. return
  474. }
  475. // Pretty-print the response data.
  476. fmt.Println(resp)
  477. }
  478. func ExampleCodePipeline_StartPipelineExecution() {
  479. svc := codepipeline.New(nil)
  480. params := &codepipeline.StartPipelineExecutionInput{
  481. Name: aws.String("PipelineName"), // Required
  482. }
  483. resp, err := svc.StartPipelineExecution(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 ExampleCodePipeline_UpdatePipeline() {
  494. svc := codepipeline.New(nil)
  495. params := &codepipeline.UpdatePipelineInput{
  496. Pipeline: &codepipeline.PipelineDeclaration{ // Required
  497. ArtifactStore: &codepipeline.ArtifactStore{ // Required
  498. Location: aws.String("ArtifactStoreLocation"), // Required
  499. Type: aws.String("ArtifactStoreType"), // Required
  500. EncryptionKey: &codepipeline.EncryptionKey{
  501. Id: aws.String("EncryptionKeyId"), // Required
  502. Type: aws.String("EncryptionKeyType"), // Required
  503. },
  504. },
  505. Name: aws.String("PipelineName"), // Required
  506. RoleArn: aws.String("RoleArn"), // Required
  507. Stages: []*codepipeline.StageDeclaration{ // Required
  508. { // Required
  509. Actions: []*codepipeline.ActionDeclaration{ // Required
  510. { // Required
  511. ActionTypeId: &codepipeline.ActionTypeId{ // Required
  512. Category: aws.String("ActionCategory"), // Required
  513. Owner: aws.String("ActionOwner"), // Required
  514. Provider: aws.String("ActionProvider"), // Required
  515. Version: aws.String("Version"), // Required
  516. },
  517. Name: aws.String("ActionName"), // Required
  518. Configuration: map[string]*string{
  519. "Key": aws.String("ActionConfigurationValue"), // Required
  520. // More values...
  521. },
  522. InputArtifacts: []*codepipeline.InputArtifact{
  523. { // Required
  524. Name: aws.String("ArtifactName"), // Required
  525. },
  526. // More values...
  527. },
  528. OutputArtifacts: []*codepipeline.OutputArtifact{
  529. { // Required
  530. Name: aws.String("ArtifactName"), // Required
  531. },
  532. // More values...
  533. },
  534. RoleArn: aws.String("RoleArn"),
  535. RunOrder: aws.Int64(1),
  536. },
  537. // More values...
  538. },
  539. Name: aws.String("StageName"), // Required
  540. Blockers: []*codepipeline.BlockerDeclaration{
  541. { // Required
  542. Name: aws.String("BlockerName"), // Required
  543. Type: aws.String("BlockerType"), // Required
  544. },
  545. // More values...
  546. },
  547. },
  548. // More values...
  549. },
  550. Version: aws.Int64(1),
  551. },
  552. }
  553. resp, err := svc.UpdatePipeline(params)
  554. if err != nil {
  555. // Print the error, cast err to awserr.Error to get the Code and
  556. // Message from an error.
  557. fmt.Println(err.Error())
  558. return
  559. }
  560. // Pretty-print the response data.
  561. fmt.Println(resp)
  562. }