Class: AWSCDK::Stage

Inherits:
Constructs::Construct
  • Object
show all
Defined in:
stage.rb

Overview

An abstract application modeling unit consisting of Stacks that should be deployed together.

Derive a subclass of Stage and use it to model a single instance of your application.

You can then instantiate your subclass multiple times to model multiple copies of your application which should be deployed to different environments.

Direct Known Subclasses

App

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, id, props = nil) ⇒ Stage

Returns a new instance of Stage.

Parameters:

  • scope (Constructs::Construct)
  • id (String)
  • props (AWSCDK::StageProps, nil) (defaults to: nil)


18
19
20
21
22
23
24
# File 'stage.rb', line 18

def initialize(scope, id, props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::StageProps.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("eyJmcW4iOiJhd3MtY2RrLWxpYi5TdGFnZVByb3BzIn0=")), "props") unless props.nil?
  Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props)
end

Class Method Details

.is_stage(x) ⇒ Boolean

Test whether the given construct is a stage.

Parameters:

  • x (Object)

Returns:

  • (Boolean)


47
48
49
50
# File 'stage.rb', line 47

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

.jsii_overridable_methodsObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'stage.rb', line 26

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :artifact_id => { kind: :property, name: "artifactId", is_optional: false },
    :asset_outdir => { kind: :property, name: "assetOutdir", is_optional: false },
    :outdir => { kind: :property, name: "outdir", is_optional: false },
    :policy_validation_beta1 => { kind: :property, name: "policyValidationBeta1", is_optional: false },
    :stage_name => { kind: :property, name: "stageName", is_optional: false },
    :account => { kind: :property, name: "account", is_optional: true },
    :parent_stage => { kind: :property, name: "parentStage", is_optional: true },
    :region => { kind: :property, name: "region", is_optional: true },
    :to_string => { kind: :method, name: "toString", is_optional: false },
    :with => { kind: :method, name: "with", is_optional: false },
    :synth => { kind: :method, name: "synth", is_optional: false },
  }
end

.of(construct) ⇒ AWSCDK::Stage?

Return the stage this construct is contained with, if available.

If called on a nested stage, returns its parent.

Parameters:

  • construct (Constructs::IConstruct)

Returns:

  • (AWSCDK::Stage, nil)


59
60
61
62
# File 'stage.rb', line 59

def self.of(construct)
  Jsii::Type.check_type(construct, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklDb25zdHJ1Y3QifQ==")), "construct")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.Stage", "of", [construct])
end

Instance Method Details

#accountString?

The default account for all resources defined within this stage.

Returns:

  • (String, nil)


118
119
120
# File 'stage.rb', line 118

def ()
  jsii_get_property("account")
end

#artifact_idString

Artifact ID of the assembly if it is a nested stage. The root stage (app) will return an empty string.

Derived from the construct path.

Returns:

  • (String)


76
77
78
# File 'stage.rb', line 76

def artifact_id()
  jsii_get_property("artifactId")
end

#asset_outdirString

The cloud assembly asset output directory.

Returns:

  • (String)


83
84
85
# File 'stage.rb', line 83

def asset_outdir()
  jsii_get_property("assetOutdir")
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


67
68
69
# File 'stage.rb', line 67

def node()
  jsii_get_property("node")
end

#outdirString

The cloud assembly output directory.

Returns:

  • (String)


90
91
92
# File 'stage.rb', line 90

def outdir()
  jsii_get_property("outdir")
end

#parent_stageAWSCDK::Stage?

The parent stage or undefined if this is the app.

*

Returns:

  • (AWSCDK::Stage, nil)


127
128
129
# File 'stage.rb', line 127

def parent_stage()
  jsii_get_property("parentStage")
end

#policy_validation_beta1Array<AWSCDK::IPolicyValidationPluginBeta1>

Note:

Default: - no validation plugins are used

Validation plugins to run during synthesis.

If any plugin reports any violation, synthesis will be interrupted and the report displayed to the user.



101
102
103
# File 'stage.rb', line 101

def policy_validation_beta1()
  jsii_get_property("policyValidationBeta1")
end

#regionString?

The default region for all resources defined within this stage.

Returns:

  • (String, nil)


134
135
136
# File 'stage.rb', line 134

def region()
  jsii_get_property("region")
end

#stage_nameString

The name of the stage.

Based on names of the parent stages separated by hypens.

Returns:

  • (String)


111
112
113
# File 'stage.rb', line 111

def stage_name()
  jsii_get_property("stageName")
end

#synth(options = nil) ⇒ AWSCDK::CXAPI::CloudAssembly

Synthesize this stage into a cloud assembly.

Once an assembly has been synthesized, it cannot be modified. Subsequent calls will return the same assembly.

Parameters:

Returns:



168
169
170
171
172
# File 'stage.rb', line 168

def synth(options = nil)
  options = options.is_a?(Hash) ? ::AWSCDK::StageSynthesisOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TdGFnZVN5bnRoZXNpc09wdGlvbnMifQ==")), "options") unless options.nil?
  jsii_call_method("synth", [options])
end

#to_stringString

Returns a string representation of this construct.

Returns:

  • (String)


141
142
143
# File 'stage.rb', line 141

def to_string()
  jsii_call_method("toString", [])
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



154
155
156
157
158
159
# File 'stage.rb', line 154

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