CloudAssembly Class
Represents a deployable cloud application.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { cx_api } from 'aws-cdk-lib';
const cloudAssembly = new cx_api.CloudAssembly('directory', /* all optional props */ {
skipEnumCheck: false,
skipVersionCheck: false,
topoSort: false,
validateSchema: false,
});
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import cx_api
cloud_assembly = cx_api.CloudAssembly("directory",
skip_enum_check=False,
skip_version_check=False,
topo_sort=False,
validate_schema=False
)
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.cxapi.*;
CloudAssembly cloudAssembly = CloudAssembly.Builder.create("directory")
.skipEnumCheck(false)
.skipVersionCheck(false)
.topoSort(false)
.validateSchema(false)
.build();
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.CXAPI;
var cloudAssembly = new CloudAssembly("directory", new LoadManifestOptions {
SkipEnumCheck = false,
SkipVersionCheck = false,
TopoSort = false,
ValidateSchema = false
});
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
cloudAssembly := awscdk.Cx_api.NewCloudAssembly(jsii.String("directory"), &LoadManifestOptions{
SkipEnumCheck: jsii.Boolean(false),
SkipVersionCheck: jsii.Boolean(false),
TopoSort: jsii.Boolean(false),
ValidateSchema: jsii.Boolean(false),
})
Initializer
new CloudAssembly(directory: string, loadOptions?: LoadManifestOptions)
CloudAssembly(directory: str, load_options: typing.Optional[LoadManifestOptions] = None)
new CloudAssembly(String directory, LoadManifestOptions loadOptions)
new CloudAssembly(string directory, LoadManifestOptions? loadOptions = null)
NewCloudAssembly(Directory *string, LoadOptions LoadManifestOptions)
Properties
artifactsCloudArtifact[]artifactstyping.List[CloudArtifact]artifactsList<CloudArtifact>ArtifactsCloudArtifact[]Artifacts*[]CloudArtifact#manifestAssemblyManifestmanifestAssemblyManifestmanifestAssemblyManifestManifestAssemblyManifestManifestAssemblyManifest#nestedAssembliesNestedCloudAssemblyArtifact[]nested_assembliestyping.List[NestedCloudAssemblyArtifact]nestedAssembliesList<NestedCloudAssemblyArtifact>NestedAssembliesNestedCloudAssemblyArtifact[]NestedAssemblies*[]NestedCloudAssemblyArtifact#stacksCloudFormationStackArtifact[]stackstyping.List[CloudFormationStackArtifact]stacksList<CloudFormationStackArtifact>StacksCloudFormationStackArtifact[]Stacks*[]CloudFormationStackArtifact#stacksRecursivelyCloudFormationStackArtifact[]stacks_recursivelytyping.List[CloudFormationStackArtifact]stacksRecursivelyList<CloudFormationStackArtifact>StacksRecursivelyCloudFormationStackArtifact[]StacksRecursively*[]CloudFormationStackArtifact#Methods
cleanupTemporaryDirectories(): void@staticmethod def cleanup_temporary_directories() -> Nonepublic static void cleanupTemporaryDirectories()public static void CleanupTemporaryDirectories()func CleanupTemporaryDirectories()static#notes
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 setupFilesAfterEnv 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-autoclean'],
};
getNestedAssembly(artifactId: string): CloudAssembly // chainabledef get_nested_assembly(self, artifact_id: str) -> CloudAssemblypublic CloudAssembly getNestedAssembly(String artifactId)public CloudAssembly GetNestedAssembly(string artifactId)func GetNestedAssembly(ArtifactId *string) CloudAssembly#1 parameter
Parameters
artifactIdartifact_idartifactIdartifactIdArtifactId— - The artifact ID of the nested assembly.
getNestedAssemblyArtifact(artifactId: string): NestedCloudAssemblyArtifactdef get_nested_assembly_artifact(self, artifact_id: str) -> NestedCloudAssemblyArtifactpublic NestedCloudAssemblyArtifact getNestedAssemblyArtifact(String artifactId)public NestedCloudAssemblyArtifact GetNestedAssemblyArtifact(string artifactId)func GetNestedAssemblyArtifact(ArtifactId *string) NestedCloudAssemblyArtifact#1 parameter
Parameters
artifactIdartifact_idartifactIdartifactIdArtifactId— - The artifact ID of the nested assembly.
getStackArtifact(artifactId: string): CloudFormationStackArtifactdef get_stack_artifact(self, artifact_id: str) -> CloudFormationStackArtifactpublic CloudFormationStackArtifact getStackArtifact(String artifactId)public CloudFormationStackArtifact GetStackArtifact(string artifactId)func GetStackArtifact(ArtifactId *string) CloudFormationStackArtifact#1 parameter · returns
Parameters
artifactIdartifact_idartifactIdartifactIdArtifactId— - the artifact id of the stack (can be obtained throughstack.artifactId).
Returns: a CloudFormationStackArtifact object.
getStackByName(stackName: string): CloudFormationStackArtifactdef get_stack_by_name(self, stack_name: str) -> CloudFormationStackArtifactpublic CloudFormationStackArtifact getStackByName(String stackName)public CloudFormationStackArtifact GetStackByName(string stackName)func GetStackByName(StackName *string) CloudFormationStackArtifact#Will only search the current assembly.
1 parameter · returns
Parameters
stackNamestack_namestackNamestackNameStackName— - the name of the CloudFormation stack.
Returns: a CloudFormationStackArtifact object.
isCloudAssembly(x: any): boolean@staticmethod def is_cloud_assembly(x: Any) -> boolpublic static Boolean isCloudAssembly(Object x)public static bool IsCloudAssembly(object x)func IsCloudAssembly(X interface{}) *boolstatic#We do attribute detection since we can't reliably use 'instanceof'.
tree(): TreeCloudArtifactdef tree(self, ) -> TreeCloudArtifactpublic TreeCloudArtifact tree()public TreeCloudArtifact Tree()func Tree() TreeCloudArtifact#returns
Returns: a TreeCloudArtifact object if there is one defined in the manifest, undefined otherwise.
tryGetArtifact(id: string): CloudArtifactdef try_get_artifact(self, id: str) -> CloudArtifactpublic CloudArtifact tryGetArtifact(String id)public CloudArtifact TryGetArtifact(string id)func TryGetArtifact(Id *string) CloudArtifact#1 parameter · returns
Parameters
ididididId— - The artifact ID.
Returns: A CloudArtifact object or undefined if the artifact does not exist in this assembly.