Skip to content

Commit

Permalink
codepipline: pipelineName and pipelineVersion attributes (#408)
Browse files Browse the repository at this point in the history
Add `pipelineName` and `pipelineVersion` attributes to `Pipeline`
  • Loading branch information
Elad Ben-Israel authored Jul 25, 2018
1 parent e9497f1 commit cda89b5
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions packages/@aws-cdk/aws-codepipeline/lib/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
/**
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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
}));
}

Expand Down

0 comments on commit cda89b5

Please sign in to comment.