Class: AWSCDK::Pipelines::PipelineBase

Inherits:
Constructs::Construct
  • Object
show all
Defined in:
pipelines/pipeline_base.rb

Overview

A generic CDK Pipelines pipeline.

Different deployment systems will provide subclasses of Pipeline that generate the deployment infrastructure necessary to deploy CDK apps, specific to that system.

This library comes with the CodePipeline class, which uses AWS CodePipeline to deploy CDK apps.

The actual pipeline infrastructure is constructed (by invoking the engine) when build_pipeline() is called, or when app.synth() is called (whichever happens first).

Direct Known Subclasses

CodePipeline

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, id, props) ⇒ PipelineBase

Returns a new instance of PipelineBase.

Parameters:



21
22
23
24
25
26
27
# File 'pipelines/pipeline_base.rb', line 21

def initialize(scope, id, props)
  props = props.is_a?(Hash) ? ::AWSCDK::Pipelines::PipelineBaseProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5waXBlbGluZXMuUGlwZWxpbmVCYXNlUHJvcHMifQ==")), "props")
  Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props)
end

Class Method Details

.is_pipeline(x) ⇒ Boolean

Return whether the given object extends PipelineBase.

We do attribute detection since we can't reliably use 'instanceof'.

Parameters:

  • x (Object)

Returns:

  • (Boolean)


50
51
52
53
# File 'pipelines/pipeline_base.rb', line 50

def self.is_pipeline(x)
  Jsii::Type.check_type(x, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "x")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.pipelines.PipelineBase", "isPipeline", [x])
end

.jsii_overridable_methodsObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'pipelines/pipeline_base.rb', line 29

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :cloud_assembly_file_set => { kind: :property, name: "cloudAssemblyFileSet", is_optional: false },
    :synth => { kind: :property, name: "synth", is_optional: false },
    :waves => { kind: :property, name: "waves", is_optional: false },
    :to_string => { kind: :method, name: "toString", is_optional: false },
    :with => { kind: :method, name: "with", is_optional: false },
    :add_stage => { kind: :method, name: "addStage", is_optional: false },
    :add_wave => { kind: :method, name: "addWave", is_optional: false },
    :build_pipeline => { kind: :method, name: "buildPipeline", is_optional: false },
    :do_build_pipeline => { kind: :method, name: "doBuildPipeline", is_optional: false },
  }
end

Instance Method Details

#add_stage(stage, options = nil) ⇒ AWSCDK::Pipelines::StageDeployment

Deploy a single Stage by itself.

Add a Stage to the pipeline, to be deployed in sequence with other Stages added to the pipeline. All Stacks in the stage will be deployed in an order automatically determined by their relative dependencies.

Parameters:

Returns:



117
118
119
120
121
122
# File 'pipelines/pipeline_base.rb', line 117

def add_stage(stage, options = nil)
  Jsii::Type.check_type(stage, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TdGFnZSJ9")), "stage")
  options = options.is_a?(Hash) ? ::AWSCDK::Pipelines::AddStageOpts.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5waXBlbGluZXMuQWRkU3RhZ2VPcHRzIn0=")), "options") unless options.nil?
  jsii_call_method("addStage", [stage, options])
end

#add_wave(id, options = nil) ⇒ AWSCDK::Pipelines::Wave

Add a Wave to the pipeline, for deploying multiple Stages in parallel.

Use the return object of this method to deploy multiple stages in parallel.

Example:

pipeline = nil # AWSCDK::Pipelines::CodePipeline


wave = pipeline.add_wave("MyWave")
wave.add_stage(MyApplicationStage.new(self, "Stage1"))
wave.add_stage(MyApplicationStage.new(self, "Stage2"))

Parameters:

Returns:



142
143
144
145
146
147
# File 'pipelines/pipeline_base.rb', line 142

def add_wave(id, options = nil)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  options = options.is_a?(Hash) ? ::AWSCDK::Pipelines::WaveOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5waXBlbGluZXMuV2F2ZU9wdGlvbnMifQ==")), "options") unless options.nil?
  jsii_call_method("addWave", [id, options])
end

#build_pipelinevoid

This method returns an undefined value.

Send the current pipeline definition to the engine, and construct the pipeline.

It is not possible to modify the pipeline after calling this method.



154
155
156
# File 'pipelines/pipeline_base.rb', line 154

def build_pipeline()
  jsii_call_method("buildPipeline", [])
end

#cloud_assembly_file_setAWSCDK::Pipelines::FileSet

The FileSet tha contains the cloud assembly.

This is the primary output of the synth step.



67
68
69
# File 'pipelines/pipeline_base.rb', line 67

def cloud_assembly_file_set()
  jsii_get_property("cloudAssemblyFileSet")
end

#do_build_pipelinevoid

This method returns an undefined value.

Implemented by subclasses to do the actual pipeline construction.



161
162
163
# File 'pipelines/pipeline_base.rb', line 161

def do_build_pipeline()
  jsii_call_method("doBuildPipeline", [])
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


58
59
60
# File 'pipelines/pipeline_base.rb', line 58

def node()
  jsii_get_property("node")
end

#synthAWSCDK::Pipelines::IFileSetProducer

The build step that produces the CDK Cloud Assembly.



74
75
76
# File 'pipelines/pipeline_base.rb', line 74

def synth()
  jsii_get_property("synth")
end

#to_stringString

Returns a string representation of this construct.

Returns:

  • (String)


88
89
90
# File 'pipelines/pipeline_base.rb', line 88

def to_string()
  jsii_call_method("toString", [])
end

#wavesArray<AWSCDK::Pipelines::Wave>

The waves in this pipeline.

Returns:



81
82
83
# File 'pipelines/pipeline_base.rb', line 81

def waves()
  jsii_get_property("waves")
end

#with(*mixins) ⇒ Constructs::IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

Parameters:

  • mixins (Array<Constructs::IMixin>)

    The mixins to apply.

Returns:

  • (Constructs::IConstruct)

    This construct for chaining



101
102
103
104
105
106
# File 'pipelines/pipeline_base.rb', line 101

def with(*mixins)
  mixins.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]")
  end
  jsii_call_method("with", [*mixins])
end