Skip to content
v2.273.0

Experimental

@aws-cdk/aws-imagebuilder-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

WorkflowData Class ​

Helper class for referencing and uploading workflow data.

Example ​

ts
const workflow = new imagebuilder.Workflow(this, 'EncryptedWorkflow', {
  workflowType: imagebuilder.WorkflowType.BUILD,
  kmsKey: new kms.Key(this, 'WorkflowKey'),
  data: imagebuilder.WorkflowData.fromJsonObject({
    schemaVersion: imagebuilder.WorkflowSchemaVersion.V1_0,
    steps: [
      {
        name: 'LaunchBuildInstance',
        action: imagebuilder.WorkflowAction.LAUNCH_INSTANCE,
        onFailure: imagebuilder.WorkflowOnFailure.ABORT,
        inputs: {
          waitFor: 'ssmAgent',
        },
      },
      {
        name: 'CreateImage',
        action: imagebuilder.WorkflowAction.CREATE_IMAGE,
        onFailure: imagebuilder.WorkflowOnFailure.ABORT,
        inputs: {
          'instanceId': 'i-123',
        },
      },
      {
        name: 'TerminateInstance',
        action: imagebuilder.WorkflowAction.TERMINATE_INSTANCE,
        onFailure: imagebuilder.WorkflowOnFailure.CONTINUE,
        inputs: {
          'instanceId': 'i-123',
        },
      },
    ],
    outputs: [
      {
        name: 'ImageId',
        value: '$.stepOutputs.CreateImage.imageId',
      },
    ],
  }),
});

Initializer ​

ts
new WorkflowData()
python
WorkflowData()
java
new WorkflowData()
csharp
new WorkflowData()
go
NewWorkflowData()

Methods ​

fromAsset(scope: Construct, id: string, path: string, options?: AssetOptions): S3WorkflowData@staticmethod def from_asset(scope: Construct, id: str, path: str, options: typing.Optional[AssetOptions] = None) -> S3WorkflowDatapublic static S3WorkflowData fromAsset(Construct scope, String id, String path, AssetOptions options)public static S3WorkflowData FromAsset(Construct scope, string id, string path, AssetOptions? options = null)func FromAsset(Scope Construct, Id *string, Path *string, Options AssetOptions) S3WorkflowDatastatic#
Uploads workflow data from a local file to S3 to use as the workflow data.
4 parameters

Parameters

  • scopescopescopescopeScope — The construct scope.
  • ididididId — Identifier of the construct.
  • pathpathpathpathPath — The local path to the workflow data file.
  • optionsoptionsoptionsoptionsOptions — S3 asset upload options.
fromInline(data: string): WorkflowData // chainable@staticmethod def from_inline(data: str) -> WorkflowDatapublic static WorkflowData fromInline(String data)public static WorkflowData FromInline(string data)func FromInline(Data *string) WorkflowDatastatic#
Uses an inline JSON or YAML string as the workflow data.
1 parameter

Parameters

  • datadatadatadataData — An inline JSON or YAML string representing the workflow data.
fromJsonObject(data: { [key: string]: any }): WorkflowData // chainable@staticmethod def from_json_object(data: typing.Mapping[str, Any]) -> WorkflowDatapublic static WorkflowData fromJsonObject(Map<String, Object> data)public static WorkflowData FromJsonObject(IDictionary<string, object> data)func FromJsonObject(Data *map[string]interface{}) WorkflowDatastatic#
Uses an inline JSON object as the workflow data.
1 parameter

Parameters

  • datadatadatadataData — An inline JSON object representing the workflow data.
fromS3(bucket: IBucket, key: string): S3WorkflowData@staticmethod def from_s3(bucket: IBucket, key: str) -> S3WorkflowDatapublic static S3WorkflowData fromS3(IBucket bucket, String key)public static S3WorkflowData FromS3(IBucket bucket, string key)func FromS3(Bucket IBucket, Key *string) S3WorkflowDatastatic#
References workflow data from a pre-existing S3 object.
2 parameters

Parameters

  • bucketbucketbucketbucketBucket — The S3 bucket where the workflow data is stored.
  • keykeykeykeyKey — The S3 key of the workflow data file.
render(): WorkflowDataConfigdef render(self, ) -> WorkflowDataConfigpublic WorkflowDataConfig render()public WorkflowDataConfig Render()func Render() WorkflowDataConfig#
The rendered workflow data value, for use in CloudFormation.
  • For inline workflows, data is the workflow text
  • For S3-backed workflows, uri is the S3 URL