From 8aeaa08e618862d06673ef08952e64503b478d15 Mon Sep 17 00:00:00 2001 From: Elad Ben-Israel Date: Wed, 25 Jul 2018 16:11:02 +0300 Subject: [PATCH] codepipline: pipelineName and pipelineVersion attributes --- .../@aws-cdk/aws-codepipeline/lib/pipeline.ts | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/packages/@aws-cdk/aws-codepipeline/lib/pipeline.ts b/packages/@aws-cdk/aws-codepipeline/lib/pipeline.ts index ea13df08e80d1..fea1c7246ebcf 100644 --- a/packages/@aws-cdk/aws-codepipeline/lib/pipeline.ts +++ b/packages/@aws-cdk/aws-codepipeline/lib/pipeline.ts @@ -10,8 +10,17 @@ import validation = require('./validation'); /** * The ARN of a pipeline */ -export class PipelineArn extends cdk.Arn { -} +export class PipelineArn extends cdk.Arn { } + +/** + * The name of the pipeline. + */ +export class PipelineName extends cdk.Token { } + +/** + * The pipeline version. + */ +export class PipelineVersion extends cdk.Token { } export interface PipelineProps { /** @@ -62,6 +71,16 @@ export class Pipeline extends cdk.Construct implements events.IEventRuleTarget { */ public readonly pipelineArn: PipelineArn; + /** + * The name of the pipeline + */ + public readonly pipelineName: PipelineName; + + /** + * The version of the pipeline + */ + public readonly pipelineVersion: PipelineVersion; + /** * Bucket used to store output artifacts */ @@ -102,10 +121,13 @@ export class Pipeline extends cdk.Construct implements events.IEventRuleTarget { this.artifactBucket.grantReadWrite(this.role); + this.pipelineName = codePipeline.ref; + this.pipelineVersion = codePipeline.getAtt('Version'); + // Does not expose a Fn::GetAtt for the ARN so we'll have to make it ourselves this.pipelineArn = new PipelineArn(cdk.Arn.fromComponents({ service: 'codepipeline', - resource: codePipeline.ref + resource: this.pipelineName })); }