Class: AWSCDK::App
- Inherits:
-
Stage
- Object
- Stage
- AWSCDK::App
- Defined in:
- app.rb
Overview
A construct which represents an entire CDK app. This construct is normally the root of the construct tree.
You would normally define an App instance in your program's entrypoint,
then define constructs where the app is used as the parent scope.
After all the child constructs are defined within the app, you should call
app.synth() which will emit a "cloud assembly" from this app into the
directory specified by outdir. Cloud assemblies includes artifacts such as
CloudFormation templates and assets that are needed to deploy this app into
the AWS cloud.
Class Method Summary collapse
-
.is_app(obj) ⇒ Boolean
Checks if an object is an instance of the
Appclass. - .jsii_overridable_methods ⇒ Object
-
.of(construct) ⇒ AWSCDK::Stage?
Return the app that is the root of the construct tree, if available.
Instance Method Summary collapse
-
#account ⇒ String?
The default account for all resources defined within this stage.
-
#artifact_id ⇒ String
Artifact ID of the assembly if it is a nested stage.
-
#asset_outdir ⇒ String
The cloud assembly asset output directory.
-
#initialize(props = nil) ⇒ App
constructor
Initializes a CDK application.
-
#node ⇒ Constructs::Node
The tree node.
-
#outdir ⇒ String
The cloud assembly output directory.
-
#parent_stage ⇒ AWSCDK::Stage?
The parent stage or
undefinedif this is the app. -
#policy_validation_beta1 ⇒ Array<AWSCDK::IPolicyValidationPluginBeta1>
Validation plugins to run during synthesis.
-
#region ⇒ String?
The default region for all resources defined within this stage.
-
#stage_name ⇒ String
The name of the stage.
-
#synth(options = nil) ⇒ AWSCDK::CXAPI::CloudAssembly
Synthesize this App into a cloud assembly.
-
#to_string ⇒ String
Returns a string representation of this construct.
-
#with(*mixins) ⇒ Constructs::IConstruct
Applies one or more mixins to this construct.
Constructor Details
#initialize(props = nil) ⇒ App
Initializes a CDK application.
22 23 24 25 26 |
# File 'app.rb', line 22 def initialize(props = nil) props = props.is_a?(Hash) ? ::AWSCDK::AppProps.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5BcHBQcm9wcyJ9")), "props") unless props.nil? Jsii::Object.instance_method(:initialize).bind(self).call(props) end |
Class Method Details
.is_app(obj) ⇒ Boolean
Checks if an object is an instance of the App class.
58 59 60 61 |
# File 'app.rb', line 58 def self.is_app(obj) Jsii::Type.check_type(obj, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "obj") Jsii::Kernel.instance.call_static("aws-cdk-lib.App", "isApp", [obj]) end |
.jsii_overridable_methods ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app.rb', line 28 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 app that is the root of the construct tree, if available.
49 50 51 52 |
# File 'app.rb', line 49 def self.of(construct) Jsii::Type.check_type(construct, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklDb25zdHJ1Y3QifQ==")), "construct") Jsii::Kernel.instance.call_static("aws-cdk-lib.App", "of", [construct]) end |
Instance Method Details
#account ⇒ String?
The default account for all resources defined within this stage.
117 118 119 |
# File 'app.rb', line 117 def account() jsii_get_property("account") end |
#artifact_id ⇒ String
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.
75 76 77 |
# File 'app.rb', line 75 def artifact_id() jsii_get_property("artifactId") end |
#asset_outdir ⇒ String
The cloud assembly asset output directory.
82 83 84 |
# File 'app.rb', line 82 def asset_outdir() jsii_get_property("assetOutdir") end |
#node ⇒ Constructs::Node
The tree node.
66 67 68 |
# File 'app.rb', line 66 def node() jsii_get_property("node") end |
#outdir ⇒ String
The cloud assembly output directory.
89 90 91 |
# File 'app.rb', line 89 def outdir() jsii_get_property("outdir") end |
#parent_stage ⇒ AWSCDK::Stage?
The parent stage or undefined if this is the app.
*
126 127 128 |
# File 'app.rb', line 126 def parent_stage() jsii_get_property("parentStage") end |
#policy_validation_beta1 ⇒ Array<AWSCDK::IPolicyValidationPluginBeta1>
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.
100 101 102 |
# File 'app.rb', line 100 def policy_validation_beta1() jsii_get_property("policyValidationBeta1") end |
#region ⇒ String?
The default region for all resources defined within this stage.
133 134 135 |
# File 'app.rb', line 133 def region() jsii_get_property("region") end |
#stage_name ⇒ String
The name of the stage.
Based on names of the parent stages separated by hypens.
110 111 112 |
# File 'app.rb', line 110 def stage_name() jsii_get_property("stageName") end |
#synth(options = nil) ⇒ AWSCDK::CXAPI::CloudAssembly
Synthesize this App into a cloud assembly.
Once an assembly has been synthesized, it cannot be modified. Subsequent calls will return the same assembly.
167 168 169 170 171 |
# File 'app.rb', line 167 def synth( = nil) = .is_a?(Hash) ? ::AWSCDK::StageSynthesisOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TdGFnZVN5bnRoZXNpc09wdGlvbnMifQ==")), "options") unless .nil? jsii_call_method("synth", []) end |
#to_string ⇒ String
Returns a string representation of this construct.
140 141 142 |
# File 'app.rb', line 140 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.
153 154 155 156 157 158 |
# File 'app.rb', line 153 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 |