CLI GetPipelineで使用する - AWS SDKコードの例

Doc AWS SDK ExamplesWord リポジトリには、さらに多くの GitHub の例があります。 AWS SDK

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

CLI GetPipelineで使用する

以下のコード例は、GetPipeline の使用方法を示しています。

CLI
AWS CLI

パイプラインの構造を表示するには

この例では、 MyFirstPipeline という名前のパイプラインの構造を返します。

コマンド:

aws codepipeline get-pipeline --name MyFirstPipeline

出力:

{ "pipeline": { "roleArn": "arn:aws:iam::111111111111:role/AWS-CodePipeline-Service", "stages": [ { "name": "Source", "actions": [ { "inputArtifacts": [], "name": "Source", "actionTypeId": { "category": "Source", "owner": "AWS", "version": "1", "provider": "S3" }, "outputArtifacts": [ { "name": "MyApp" } ], "configuration": { "S3Bucket": "awscodepipeline-demo-bucket", "S3ObjectKey": "aws-codepipeline-s3-aws-codedeploy_linux.zip" }, "runOrder": 1 } ] }, { "name": "Beta", "actions": [ { "inputArtifacts": [ { "name": "MyApp" } ], "name": "CodePipelineDemoFleet", "actionTypeId": { "category": "Deploy", "owner": "AWS", "version": "1", "provider": "CodeDeploy" }, "outputArtifacts": [], "configuration": { "ApplicationName": "CodePipelineDemoApplication", "DeploymentGroupName": "CodePipelineDemoFleet" }, "runOrder": 1 } ] } ], "artifactStore": { "type": "S3", "location": "codepipeline-us-east-1-11EXAMPLE11" }, "name": "MyFirstPipeline", "version": 1 } }
  • API の詳細については、AWS CLI 「 コマンドリファレンス」のGetPipeline」を参照してください。

PowerShell
ツール for PowerShell

例 1: この例では、指定されたパイプラインに関する一般的な情報を取得します。

Get-CPPipeline -Name CodePipelineDemo -Version 1

出力:

ArtifactStore : Amazon.CodePipeline.Model.ArtifactStore Name : CodePipelineDemo RoleArn : arn:aws:iam::80398EXAMPLE:role/CodePipelineServiceRole Stages : {Source, Build, Beta, TestStage} Version : 1

例 2: この例では、指定されたパイプラインに関する詳細情報を取得します。

$pipeline = Get-CPPipeline -Name CodePipelineDemo Write-Output ("Name = " + $pipeline.Name) Write-Output ("RoleArn = " + $pipeline.RoleArn) Write-Output ("Version = " + $pipeline.Version) Write-Output ("ArtifactStore:") Write-Output (" Location = " + $pipeline.ArtifactStore.Location) Write-Output (" Type = " + $pipeline.ArtifactStore.Type.Value) Write-Output ("Stages:") ForEach ($stage in $pipeline.Stages) { Write-Output (" Name = " + $stage.Name) Write-Output (" Actions:") ForEach ($action in $stage.Actions) { Write-Output (" Name = " + $action.Name) Write-Output (" Category = " + $action.ActionTypeId.Category) Write-Output (" Owner = " + $action.ActionTypeId.Owner) Write-Output (" Provider = " + $action.ActionTypeId.Provider) Write-Output (" Version = " + $action.ActionTypeId.Version) Write-Output (" Configuration:") ForEach ($key in $action.Configuration.Keys) { $value = $action.Configuration.$key Write-Output (" " + $key + " = " + $value) } Write-Output (" InputArtifacts:") ForEach ($ia in $action.InputArtifacts) { Write-Output (" " + $ia.Name) } ForEach ($oa in $action.OutputArtifacts) { Write-Output (" " + $oa.Name) } Write-Output (" RunOrder = " + $action.RunOrder) } }

出力:

Name = CodePipelineDemo RoleArn = arn:aws:iam::80398EXAMPLE:role/CodePipelineServiceRole Version = 3 ArtifactStore: Location = MyBucketName Type = S3 Stages: Name = Source Actions: Name = Source Category = Source Owner = ThirdParty Provider = GitHub Version = 1 Configuration: Branch = master OAuthToken = **** Owner = my-user-name Repo = MyRepoName InputArtifacts: MyApp RunOrder = 1 Name = Build Actions: Name = Build Category = Build Owner = Custom Provider = MyCustomProviderName Version = 1 Configuration: ProjectName = MyProjectName InputArtifacts: MyApp MyAppBuild RunOrder = 1 Name = Beta Actions: Name = CodePipelineDemoFleet Category = Deploy Owner = AWS Provider = CodeDeploy Version = 1 Configuration: ApplicationName = CodePipelineDemoApplication DeploymentGroupName = CodePipelineDemoFleet InputArtifacts: MyAppBuild RunOrder = 1 Name = TestStage Actions: Name = MyJenkinsTestAction Category = Test Owner = Custom Provider = MyCustomTestProvider Version = 1 Configuration: ProjectName = MyJenkinsProjectName InputArtifacts: MyAppBuild RunOrder = 1
  • APIの詳細については、「コマンドレットリファレンス」のGetPipeline」を参照してください。 AWS Tools for PowerShell