Workflow

class aws_cdk.aws_imagebuilder_alpha.Workflow(scope, id, *, data, workflow_type, change_description=None, description=None, kms_key=None, tags=None, workflow_name=None, workflow_version=None)

Bases: Resource

(experimental) Represents an EC2 Image Builder Workflow.

See:

https://docs.aws.amazon.com/imagebuilder/latest/userguide/manage-image-workflows.html

Stability:

experimental

ExampleMetadata:

infused

Example:

workflow = imagebuilder.Workflow(self, "EncryptedWorkflow",
    workflow_type=imagebuilder.WorkflowType.BUILD,
    kms_key=kms.Key(self, "WorkflowKey"),
    data=imagebuilder.WorkflowData.from_json_object({
        "schema_version": imagebuilder.WorkflowSchemaVersion.V1_0,
        "steps": [{
            "name": "LaunchBuildInstance",
            "action": imagebuilder.WorkflowAction.LAUNCH_INSTANCE,
            "on_failure": imagebuilder.WorkflowOnFailure.ABORT,
            "inputs": {
                "wait_for": "ssmAgent"
            }
        }, {
            "name": "CreateImage",
            "action": imagebuilder.WorkflowAction.CREATE_IMAGE,
            "on_failure": imagebuilder.WorkflowOnFailure.ABORT,
            "inputs": {
                "instance_id": "i-123"
            }
        }, {
            "name": "TerminateInstance",
            "action": imagebuilder.WorkflowAction.TERMINATE_INSTANCE,
            "on_failure": imagebuilder.WorkflowOnFailure.CONTINUE,
            "inputs": {
                "instance_id": "i-123"
            }
        }
        ],
        "outputs": [{
            "name": "ImageId",
            "value": "$.stepOutputs.CreateImage.imageId"
        }
        ]
    })
)
Parameters:
  • scope (Construct)

  • id (str)

  • data (WorkflowData) – (experimental) The workflow document content that defines the image creation process.

  • workflow_type (WorkflowType) – (experimental) The phase in the image build process for which the workflow resource is responsible.

  • change_description (Optional[str]) – (experimental) The change description of the workflow. Describes what change has been made in this version of the workflow, or what makes this version different from other versions. Default: None

  • description (Optional[str]) – (experimental) The description of the workflow. Default: None

  • kms_key (Optional[IKey]) – (experimental) The KMS key used to encrypt this workflow. Default: - an Image Builder owned key will be used to encrypt the workflow.

  • tags (Optional[Mapping[str, str]]) – (experimental) The tags to apply to the workflow. Default: None

  • workflow_name (Optional[str]) – (experimental) The name of the workflow. Default: - a name is generated

  • workflow_version (Optional[str]) – (experimental) The version of the workflow. Default: 1.0.0

Stability:

experimental

Methods

apply_removal_policy(policy)

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters:

policy (RemovalPolicy)

Return type:

None

grant(grantee, *actions)

(experimental) Grant custom actions to the given grantee for the workflow.

Parameters:
  • grantee (IGrantable) – The principal.

  • actions (str) – The list of actions.

Stability:

experimental

Return type:

Grant

grant_read(grantee)

(experimental) Grant read permissions to the given grantee for the workflow.

Parameters:

grantee (IGrantable) – The principal.

Stability:

experimental

Return type:

Grant

to_string()

Returns a string representation of this construct.

Return type:

str

Attributes

PROPERTY_INJECTION_ID = '@aws-cdk.aws-imagebuilder-alpha.Workflow'
env

The environment this resource belongs to.

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.

node

The tree node.

stack

The stack in which this resource is defined.

workflow_arn

(experimental) The ARN of the workflow.

Stability:

experimental

workflow_name

(experimental) The name of the workflow.

Stability:

experimental

workflow_type

(experimental) The type of the workflow.

Stability:

experimental

workflow_version

(experimental) The version of the workflow.

Stability:

experimental

Static Methods

classmethod from_workflow_arn(scope, id, workflow_arn)

(experimental) Import an existing workflow given its ARN.

Parameters:
  • scope (Construct)

  • id (str)

  • workflow_arn (str)

Stability:

experimental

Return type:

IWorkflow

classmethod from_workflow_attributes(scope, id, *, workflow_arn=None, workflow_name=None, workflow_type=None, workflow_version=None)

(experimental) Import an existing workflow by providing its attributes.

The provided name must be normalized by converting all alphabetical characters to lowercase, and replacing all spaces and underscores with hyphens. You may not provide a dynamic expression for the workflowArn or workflowType

Parameters:
  • scope (Construct)

  • id (str)

  • workflow_arn (Optional[str]) – (experimental) The ARN of the workflow. Default: - the ARN is automatically constructed if a workflowName and workflowType is provided, otherwise a workflowArn is required

  • workflow_name (Optional[str]) – (experimental) The name of the workflow. Default: - the name is automatically constructed if a workflowArn is provided, otherwise a workflowName is required

  • workflow_type (Optional[WorkflowType]) – (experimental) The type of the workflow. Default: - the type is automatically constructed if a workflowArn is provided, otherwise a workflowType is required

  • workflow_version (Optional[str]) – (experimental) The version of the workflow. Default: x.x.x

Stability:

experimental

Return type:

IWorkflow

classmethod is_construct(x)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters:

x (Any) – Any object.

Return type:

bool

Returns:

true if x is an object created from a class which extends Construct.

classmethod is_owned_resource(construct)

Returns true if the construct was created by CDK, and false otherwise.

Parameters:

construct (IConstruct)

Return type:

bool

classmethod is_resource(construct)

Check whether the given construct is a Resource.

Parameters:

construct (IConstruct)

Return type:

bool

classmethod is_workflow(x)

(experimental) Return whether the given object is a Workflow.

Parameters:

x (Any)

Stability:

experimental

Return type:

bool