Class CloudAssembly

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.cxapi.CloudAssembly
All Implemented Interfaces:
ICloudAssembly, software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.120.0 (build 192dc88)", date="2025-12-05T22:26:47.746Z") @Stability(Stable) public class CloudAssembly extends software.amazon.jsii.JsiiObject implements ICloudAssembly
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 software.amazon.awscdk.cxapi.*;
 CloudAssembly cloudAssembly = CloudAssembly.Builder.create("directory")
         .skipEnumCheck(false)
         .skipVersionCheck(false)
         .topoSort(false)
         .build();
 
  • Constructor Details

    • CloudAssembly

      protected CloudAssembly(software.amazon.jsii.JsiiObjectRef objRef)
    • CloudAssembly

      protected CloudAssembly(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CloudAssembly

      @Stability(Stable) public CloudAssembly(@NotNull String directory, @Nullable LoadManifestOptions loadOptions)
      Reads a cloud assembly from the specified directory.

      Parameters:
      directory - The root directory of the assembly. This parameter is required.
      loadOptions -
    • CloudAssembly

      @Stability(Stable) public CloudAssembly(@NotNull String directory)
      Reads a cloud assembly from the specified directory.

      Parameters:
      directory - The root directory of the assembly. This parameter is required.
  • Method Details

    • cleanupTemporaryDirectories

      @Stability(Stable) public static void cleanupTemporaryDirectories()
      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 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-cleanup'],
       };
       
    • isCloudAssembly

      @Stability(Stable) @NotNull public static Boolean isCloudAssembly(@NotNull Object x)
      Return whether the given object is a CloudAssembly.

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

      Parameters:
      x - This parameter is required.
    • getNestedAssembly

      @Stability(Stable) @NotNull public CloudAssembly getNestedAssembly(@NotNull String artifactId)
      Returns a nested assembly.

      Parameters:
      artifactId - The artifact ID of the nested assembly. This parameter is required.
    • getNestedAssemblyArtifact

      @Stability(Stable) @NotNull public NestedCloudAssemblyArtifact getNestedAssemblyArtifact(@NotNull String artifactId)
      Returns a nested assembly artifact.

      Parameters:
      artifactId - The artifact ID of the nested assembly. This parameter is required.
    • getStackArtifact

      @Stability(Stable) @NotNull public CloudFormationStackArtifact getStackArtifact(@NotNull String artifactId)
      Returns a CloudFormation stack artifact from this assembly.

      Parameters:
      artifactId - the artifact id of the stack (can be obtained through stack.artifactId). This parameter is required.
      Returns:
      a CloudFormationStackArtifact object.
    • getStackByName

      @Stability(Stable) @NotNull public CloudFormationStackArtifact getStackByName(@NotNull String stackName)
      Returns a CloudFormation stack artifact from this assembly.

      Will only search the current assembly.

      Parameters:
      stackName - the name of the CloudFormation stack. This parameter is required.
      Returns:
      a CloudFormationStackArtifact object.
    • tree

      @Stability(Stable) @Nullable public TreeCloudArtifact tree()
      Returns the tree metadata artifact from this assembly.

      Returns:
      a TreeCloudArtifact object if there is one defined in the manifest, undefined otherwise.
    • tryGetArtifact

      @Stability(Stable) @Nullable public CloudArtifact tryGetArtifact(@NotNull String id)
      Attempts to find an artifact with a specific identity.

      Parameters:
      id - The artifact ID. This parameter is required.
      Returns:
      A CloudArtifact object or undefined if the artifact does not exist in this assembly.
    • getArtifacts

      @Stability(Stable) @NotNull public List<CloudArtifact> getArtifacts()
      All artifacts included in this assembly.
    • getDirectory

      @Stability(Stable) @NotNull public String getDirectory()
      The root directory of the cloud assembly.
      Specified by:
      getDirectory in interface ICloudAssembly
    • getManifest

      @Stability(Stable) @NotNull public AssemblyManifest getManifest()
      The raw assembly manifest.
    • getNestedAssemblies

      @Stability(Stable) @NotNull public List<NestedCloudAssemblyArtifact> getNestedAssemblies()
      The nested assembly artifacts in this assembly.
    • getRuntime

      @Stability(Stable) @NotNull public RuntimeInfo getRuntime()
      Runtime information such as module versions used to synthesize this assembly.
    • getStacks

      @Stability(Stable) @NotNull public List<CloudFormationStackArtifact> getStacks()
      Returns:
      all the CloudFormation stack artifacts that are included in this assembly.
    • getStacksRecursively

      @Stability(Stable) @NotNull public List<CloudFormationStackArtifact> getStacksRecursively()
      Returns all the stacks, including the ones in nested assemblies.
    • getVersion

      @Stability(Stable) @NotNull public String getVersion()
      The schema version of the assembly manifest.