Class: AWSCDK::CXAPI::CloudAssembly
- Inherits:
-
Jsii::Object
- Object
- Jsii::Object
- AWSCDK::CXAPI::CloudAssembly
- Includes:
- AWSCDK::CloudAssemblySchema::ICloudAssembly
- Defined in:
- cxapi/cloud_assembly.rb
Overview
Represents a deployable cloud application.
Class Method Summary collapse
-
.cleanup_temporary_directories ⇒ void
Cleans up any temporary assembly directories that got created in this process.
-
.is_cloud_assembly(x) ⇒ Boolean
Return whether the given object is a CloudAssembly.
- .jsii_overridable_methods ⇒ Object
Instance Method Summary collapse
-
#artifacts ⇒ Array<AWSCDK::CXAPI::CloudArtifact>
All artifacts included in this assembly.
-
#directory ⇒ String
The root directory of the cloud assembly.
-
#get_nested_assembly(artifact_id) ⇒ AWSCDK::CXAPI::CloudAssembly
Returns a nested assembly.
-
#get_nested_assembly_artifact(artifact_id) ⇒ AWSCDK::CXAPI::NestedCloudAssemblyArtifact
Returns a nested assembly artifact.
-
#get_stack_artifact(artifact_id) ⇒ AWSCDK::CXAPI::CloudFormationStackArtifact
Returns a CloudFormation stack artifact from this assembly.
-
#get_stack_by_name(stack_name) ⇒ AWSCDK::CXAPI::CloudFormationStackArtifact
Returns a CloudFormation stack artifact from this assembly.
-
#initialize(directory, load_options = nil) ⇒ CloudAssembly
constructor
Reads a cloud assembly from the specified directory.
-
#manifest ⇒ AWSCDK::CloudAssemblySchema::AssemblyManifest
The raw assembly manifest.
-
#nested_assemblies ⇒ Array<AWSCDK::CXAPI::NestedCloudAssemblyArtifact>
The nested assembly artifacts in this assembly.
-
#runtime ⇒ AWSCDK::CloudAssemblySchema::RuntimeInfo
Runtime information such as module versions used to synthesize this assembly.
- #stacks ⇒ Array<AWSCDK::CXAPI::CloudFormationStackArtifact>
-
#stacks_recursively ⇒ Array<AWSCDK::CXAPI::CloudFormationStackArtifact>
Returns all the stacks, including the ones in nested assemblies.
-
#tree ⇒ AWSCDK::CXAPI::TreeCloudArtifact?
Returns the tree metadata artifact from this assembly.
-
#try_get_artifact(id) ⇒ AWSCDK::CXAPI::CloudArtifact?
Attempts to find an artifact with a specific identity.
-
#version ⇒ String
The schema version of the assembly manifest.
Constructor Details
#initialize(directory, load_options = nil) ⇒ CloudAssembly
Reads a cloud assembly from the specified directory.
13 14 15 16 17 18 |
# File 'cxapi/cloud_assembly.rb', line 13 def initialize(directory, = nil) = .is_a?(Hash) ? ::AWSCDK::CloudAssemblySchema::LoadManifestOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(directory, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "directory") Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5jbG91ZF9hc3NlbWJseV9zY2hlbWEuTG9hZE1hbmlmZXN0T3B0aW9ucyJ9")), "loadOptions") unless .nil? Jsii::Object.instance_method(:initialize).bind(self).call(directory, ) end |
Class Method Details
.cleanup_temporary_directories ⇒ void
This method returns an undefined value.
Cleans up any temporary assembly directories that got created in this process.
If a Cloud Assembly is emitted to a temporary directory, its directory gets added to a list. This function iterates over that list and deletes each directory in it, to free up disk space.
This function will normally be called automatically during Node process
exit and so you don't need to call this. However, some test environments do
not properly trigger Node's exit event. Notably: Jest does not trigger
the exit event (https://github.com/jestjs/jest/issues/10927).
Cleaning up temporary directories in jest
For Jest, you have to make sure this function is called at the end of the test suite instead:
import { CloudAssembly } from 'aws-cdk-lib/cx-api';
afterAll(CloudAssembly.cleanupTemporaryDirectories);
Alternatively, you can use the setup_files_after_env feature and use a
provided helper script to automatically inject the above into every
test file, so you don't have to do it by hand.
$ npx jest --setupFilesAfterEnv aws-cdk-lib/testhelpers/jest-autoclean
Or put the following into jest.config.js:
module.exports = {
// ...
setupFilesAfterEnv: ['aws-cdk-lib/testhelpers/jest-cleanup'],
};
79 80 81 |
# File 'cxapi/cloud_assembly.rb', line 79 def self.cleanup_temporary_directories() Jsii::Kernel.instance.call_static("aws-cdk-lib.cx_api.CloudAssembly", "cleanupTemporaryDirectories", []) end |
.is_cloud_assembly(x) ⇒ Boolean
Return whether the given object is a CloudAssembly.
We do attribute detection since we can't reliably use 'instanceof'.
89 90 91 92 |
# File 'cxapi/cloud_assembly.rb', line 89 def self.is_cloud_assembly(x) Jsii::Type.check_type(x, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "x") Jsii::Kernel.instance.call_static("aws-cdk-lib.cx_api.CloudAssembly", "isCloudAssembly", [x]) end |
.jsii_overridable_methods ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'cxapi/cloud_assembly.rb', line 20 def self.jsii_overridable_methods { :artifacts => { kind: :property, name: "artifacts", is_optional: false }, :directory => { kind: :property, name: "directory", is_optional: false }, :manifest => { kind: :property, name: "manifest", is_optional: false }, :nested_assemblies => { kind: :property, name: "nestedAssemblies", is_optional: false }, :runtime => { kind: :property, name: "runtime", is_optional: false }, :stacks => { kind: :property, name: "stacks", is_optional: false }, :stacks_recursively => { kind: :property, name: "stacksRecursively", is_optional: false }, :version => { kind: :property, name: "version", is_optional: false }, :get_nested_assembly => { kind: :method, name: "getNestedAssembly", is_optional: false }, :get_nested_assembly_artifact => { kind: :method, name: "getNestedAssemblyArtifact", is_optional: false }, :get_stack_artifact => { kind: :method, name: "getStackArtifact", is_optional: false }, :get_stack_by_name => { kind: :method, name: "getStackByName", is_optional: false }, :tree => { kind: :method, name: "tree", is_optional: false }, :try_get_artifact => { kind: :method, name: "tryGetArtifact", is_optional: false }, } end |
Instance Method Details
#artifacts ⇒ Array<AWSCDK::CXAPI::CloudArtifact>
All artifacts included in this assembly.
97 98 99 |
# File 'cxapi/cloud_assembly.rb', line 97 def artifacts() jsii_get_property("artifacts") end |
#directory ⇒ String
The root directory of the cloud assembly.
104 105 106 |
# File 'cxapi/cloud_assembly.rb', line 104 def directory() jsii_get_property("directory") end |
#get_nested_assembly(artifact_id) ⇒ AWSCDK::CXAPI::CloudAssembly
Returns a nested assembly.
152 153 154 155 |
# File 'cxapi/cloud_assembly.rb', line 152 def get_nested_assembly(artifact_id) Jsii::Type.check_type(artifact_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "artifactId") jsii_call_method("getNestedAssembly", [artifact_id]) end |
#get_nested_assembly_artifact(artifact_id) ⇒ AWSCDK::CXAPI::NestedCloudAssemblyArtifact
Returns a nested assembly artifact.
161 162 163 164 |
# File 'cxapi/cloud_assembly.rb', line 161 def get_nested_assembly_artifact(artifact_id) Jsii::Type.check_type(artifact_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "artifactId") jsii_call_method("getNestedAssemblyArtifact", [artifact_id]) end |
#get_stack_artifact(artifact_id) ⇒ AWSCDK::CXAPI::CloudFormationStackArtifact
Returns a CloudFormation stack artifact from this assembly.
170 171 172 173 |
# File 'cxapi/cloud_assembly.rb', line 170 def get_stack_artifact(artifact_id) Jsii::Type.check_type(artifact_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "artifactId") jsii_call_method("getStackArtifact", [artifact_id]) end |
#get_stack_by_name(stack_name) ⇒ AWSCDK::CXAPI::CloudFormationStackArtifact
Returns a CloudFormation stack artifact from this assembly.
Will only search the current assembly.
181 182 183 184 |
# File 'cxapi/cloud_assembly.rb', line 181 def get_stack_by_name(stack_name) Jsii::Type.check_type(stack_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "stackName") jsii_call_method("getStackByName", [stack_name]) end |
#manifest ⇒ AWSCDK::CloudAssemblySchema::AssemblyManifest
The raw assembly manifest.
111 112 113 |
# File 'cxapi/cloud_assembly.rb', line 111 def manifest() jsii_get_property("manifest") end |
#nested_assemblies ⇒ Array<AWSCDK::CXAPI::NestedCloudAssemblyArtifact>
The nested assembly artifacts in this assembly.
118 119 120 |
# File 'cxapi/cloud_assembly.rb', line 118 def nested_assemblies() jsii_get_property("nestedAssemblies") end |
#runtime ⇒ AWSCDK::CloudAssemblySchema::RuntimeInfo
Runtime information such as module versions used to synthesize this assembly.
125 126 127 |
# File 'cxapi/cloud_assembly.rb', line 125 def runtime() jsii_get_property("runtime") end |
#stacks ⇒ Array<AWSCDK::CXAPI::CloudFormationStackArtifact>
130 131 132 |
# File 'cxapi/cloud_assembly.rb', line 130 def stacks() jsii_get_property("stacks") end |
#stacks_recursively ⇒ Array<AWSCDK::CXAPI::CloudFormationStackArtifact>
Returns all the stacks, including the ones in nested assemblies.
137 138 139 |
# File 'cxapi/cloud_assembly.rb', line 137 def stacks_recursively() jsii_get_property("stacksRecursively") end |
#tree ⇒ AWSCDK::CXAPI::TreeCloudArtifact?
Returns the tree metadata artifact from this assembly.
189 190 191 |
# File 'cxapi/cloud_assembly.rb', line 189 def tree() jsii_call_method("tree", []) end |
#try_get_artifact(id) ⇒ AWSCDK::CXAPI::CloudArtifact?
Attempts to find an artifact with a specific identity.
197 198 199 200 |
# File 'cxapi/cloud_assembly.rb', line 197 def try_get_artifact(id) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") jsii_call_method("tryGetArtifact", [id]) end |
#version ⇒ String
The schema version of the assembly manifest.
144 145 146 |
# File 'cxapi/cloud_assembly.rb', line 144 def version() jsii_get_property("version") end |