diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.js.snapshot/MediaConvertCreateJobTestDefaultTestDeployAssertA293ABFD.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.js.snapshot/MediaConvertCreateJobTestDefaultTestDeployAssertA293ABFD.assets.json new file mode 100644 index 0000000000000..b71b43be6260c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.js.snapshot/MediaConvertCreateJobTestDefaultTestDeployAssertA293ABFD.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "MediaConvertCreateJobTestDefaultTestDeployAssertA293ABFD.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.js.snapshot/MediaConvertCreateJobTestDefaultTestDeployAssertA293ABFD.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.js.snapshot/MediaConvertCreateJobTestDefaultTestDeployAssertA293ABFD.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.js.snapshot/MediaConvertCreateJobTestDefaultTestDeployAssertA293ABFD.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.js.snapshot/aws-cdk-mediaconvert-create-job-test-stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.js.snapshot/aws-cdk-mediaconvert-create-job-test-stack.assets.json new file mode 100644 index 0000000000000..b2e351f29fb70 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.js.snapshot/aws-cdk-mediaconvert-create-job-test-stack.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.0", + "files": { + "9e07e5cefbcab2a574b61d0f494491605c22eb68b448e7ef08793a25349fd211": { + "source": { + "path": "aws-cdk-mediaconvert-create-job-test-stack.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "9e07e5cefbcab2a574b61d0f494491605c22eb68b448e7ef08793a25349fd211.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.js.snapshot/aws-cdk-mediaconvert-create-job-test-stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.js.snapshot/aws-cdk-mediaconvert-create-job-test-stack.template.json new file mode 100644 index 0000000000000..73f5bc57ff91d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.js.snapshot/aws-cdk-mediaconvert-create-job-test-stack.template.json @@ -0,0 +1,115 @@ +{ + "Resources": { + "StateMachineRoleB840431D": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "StateMachineRoleDefaultPolicyDF1E6607": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "iam:PassRole", + "Condition": { + "StringLike": { + "iam:PassedToService": "mediaconvert.amazonaws.com" + } + }, + "Effect": "Allow", + "Resource": "arn:aws:iam::123456789012:role/MediaConvertRole" + }, + { + "Action": "mediaconvert:CreateJob", + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "StateMachineRoleDefaultPolicyDF1E6607", + "Roles": [ + { + "Ref": "StateMachineRoleB840431D" + } + ] + } + }, + "StateMachine2E01A3A5": { + "Type": "AWS::StepFunctions::StateMachine", + "Properties": { + "DefinitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"MediaConvertCreateJob\",\"States\":{\"MediaConvertCreateJob\":{\"End\":true,\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::mediaconvert:createJob\",\"Parameters\":{\"Role\":\"arn:aws:iam::123456789012:role/MediaConvertRole\",\"Settings\":{\"OutputGroups\":[{\"Outputs\":[{\"ContainerSettings\":{\"Container\":\"MP4\"},\"VideoDescription\":{\"CodecSettings\":{\"Codec\":\"H_264\",\"H264Settings\":{\"MaxBitrate\":1000,\"RateControlMode\":\"QVBR\",\"SceneChangeDetect\":\"TRANSITION_DETECTION\"}}},\"AudioDescriptions\":[{\"CodecSettings\":{\"Codec\":\"AAC\",\"AacSettings\":{\"Bitrate\":96000,\"CodingMode\":\"CODING_MODE_2_0\",\"SampleRate\":48000}}}]}],\"OutputGroupSettings\":{\"Type\":\"FILE_GROUP_SETTINGS\",\"FileGroupSettings\":{\"Destination\":\"s3://EXAMPLE-DESTINATION-BUCKET/\"}}}],\"Inputs\":[{\"AudioSelectors\":{\"Audio Selector 1\":{\"DefaultSelection\":\"DEFAULT\"}},\"FileInput\":\"s3://EXAMPLE-SOURCE-BUCKET/EXAMPLE-SOURCE_FILE\"}]}}}}}" + ] + ] + }, + "RoleArn": { + "Fn::GetAtt": [ + "StateMachineRoleB840431D", + "Arn" + ] + } + }, + "DependsOn": [ + "StateMachineRoleDefaultPolicyDF1E6607", + "StateMachineRoleB840431D" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.js.snapshot/cdk.out new file mode 100644 index 0000000000000..1f0068d32659a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"36.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.js.snapshot/integ.json new file mode 100644 index 0000000000000..39cebd3bc13b9 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "36.0.0", + "testCases": { + "MediaConvertCreateJobTest/DefaultTest": { + "stacks": [ + "aws-cdk-mediaconvert-create-job-test-stack" + ], + "assertionStack": "MediaConvertCreateJobTest/DefaultTest/DeployAssert", + "assertionStackName": "MediaConvertCreateJobTestDefaultTestDeployAssertA293ABFD" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.js.snapshot/manifest.json new file mode 100644 index 0000000000000..0f48ce2d848ea --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.js.snapshot/manifest.json @@ -0,0 +1,125 @@ +{ + "version": "36.0.0", + "artifacts": { + "aws-cdk-mediaconvert-create-job-test-stack.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "aws-cdk-mediaconvert-create-job-test-stack.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "aws-cdk-mediaconvert-create-job-test-stack": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "aws-cdk-mediaconvert-create-job-test-stack.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/9e07e5cefbcab2a574b61d0f494491605c22eb68b448e7ef08793a25349fd211.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "aws-cdk-mediaconvert-create-job-test-stack.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "aws-cdk-mediaconvert-create-job-test-stack.assets" + ], + "metadata": { + "/aws-cdk-mediaconvert-create-job-test-stack/StateMachine/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "StateMachineRoleB840431D" + } + ], + "/aws-cdk-mediaconvert-create-job-test-stack/StateMachine/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "StateMachineRoleDefaultPolicyDF1E6607" + } + ], + "/aws-cdk-mediaconvert-create-job-test-stack/StateMachine/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "StateMachine2E01A3A5" + } + ], + "/aws-cdk-mediaconvert-create-job-test-stack/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/aws-cdk-mediaconvert-create-job-test-stack/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "aws-cdk-mediaconvert-create-job-test-stack" + }, + "MediaConvertCreateJobTestDefaultTestDeployAssertA293ABFD.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "MediaConvertCreateJobTestDefaultTestDeployAssertA293ABFD.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "MediaConvertCreateJobTestDefaultTestDeployAssertA293ABFD": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "MediaConvertCreateJobTestDefaultTestDeployAssertA293ABFD.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "MediaConvertCreateJobTestDefaultTestDeployAssertA293ABFD.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "MediaConvertCreateJobTestDefaultTestDeployAssertA293ABFD.assets" + ], + "metadata": { + "/MediaConvertCreateJobTest/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/MediaConvertCreateJobTest/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "MediaConvertCreateJobTest/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.js.snapshot/tree.json new file mode 100644 index 0000000000000..3541c07d2a7af --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.js.snapshot/tree.json @@ -0,0 +1,250 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "aws-cdk-mediaconvert-create-job-test-stack": { + "id": "aws-cdk-mediaconvert-create-job-test-stack", + "path": "aws-cdk-mediaconvert-create-job-test-stack", + "children": { + "MediaConvertRole": { + "id": "MediaConvertRole", + "path": "aws-cdk-mediaconvert-create-job-test-stack/MediaConvertRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "MediaConvertCreateJob": { + "id": "MediaConvertCreateJob", + "path": "aws-cdk-mediaconvert-create-job-test-stack/MediaConvertCreateJob", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions_tasks.MediaConvertCreateJob", + "version": "0.0.0" + } + }, + "StateMachine": { + "id": "StateMachine", + "path": "aws-cdk-mediaconvert-create-job-test-stack/StateMachine", + "children": { + "Role": { + "id": "Role", + "path": "aws-cdk-mediaconvert-create-job-test-stack/StateMachine/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "aws-cdk-mediaconvert-create-job-test-stack/StateMachine/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-cdk-mediaconvert-create-job-test-stack/StateMachine/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "aws-cdk-mediaconvert-create-job-test-stack/StateMachine/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-mediaconvert-create-job-test-stack/StateMachine/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "iam:PassRole", + "Condition": { + "StringLike": { + "iam:PassedToService": "mediaconvert.amazonaws.com" + } + }, + "Effect": "Allow", + "Resource": "arn:aws:iam::123456789012:role/MediaConvertRole" + }, + { + "Action": "mediaconvert:CreateJob", + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "policyName": "StateMachineRoleDefaultPolicyDF1E6607", + "roles": [ + { + "Ref": "StateMachineRoleB840431D" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-cdk-mediaconvert-create-job-test-stack/StateMachine/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::StepFunctions::StateMachine", + "aws:cdk:cloudformation:props": { + "definitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"MediaConvertCreateJob\",\"States\":{\"MediaConvertCreateJob\":{\"End\":true,\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::mediaconvert:createJob\",\"Parameters\":{\"Role\":\"arn:aws:iam::123456789012:role/MediaConvertRole\",\"Settings\":{\"OutputGroups\":[{\"Outputs\":[{\"ContainerSettings\":{\"Container\":\"MP4\"},\"VideoDescription\":{\"CodecSettings\":{\"Codec\":\"H_264\",\"H264Settings\":{\"MaxBitrate\":1000,\"RateControlMode\":\"QVBR\",\"SceneChangeDetect\":\"TRANSITION_DETECTION\"}}},\"AudioDescriptions\":[{\"CodecSettings\":{\"Codec\":\"AAC\",\"AacSettings\":{\"Bitrate\":96000,\"CodingMode\":\"CODING_MODE_2_0\",\"SampleRate\":48000}}}]}],\"OutputGroupSettings\":{\"Type\":\"FILE_GROUP_SETTINGS\",\"FileGroupSettings\":{\"Destination\":\"s3://EXAMPLE-DESTINATION-BUCKET/\"}}}],\"Inputs\":[{\"AudioSelectors\":{\"Audio Selector 1\":{\"DefaultSelection\":\"DEFAULT\"}},\"FileInput\":\"s3://EXAMPLE-SOURCE-BUCKET/EXAMPLE-SOURCE_FILE\"}]}}}}}" + ] + ] + }, + "roleArn": { + "Fn::GetAtt": [ + "StateMachineRoleB840431D", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.CfnStateMachine", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.StateMachine", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "aws-cdk-mediaconvert-create-job-test-stack/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "aws-cdk-mediaconvert-create-job-test-stack/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "MediaConvertCreateJobTest": { + "id": "MediaConvertCreateJobTest", + "path": "MediaConvertCreateJobTest", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "MediaConvertCreateJobTest/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "MediaConvertCreateJobTest/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "MediaConvertCreateJobTest/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "MediaConvertCreateJobTest/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "MediaConvertCreateJobTest/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.ts new file mode 100644 index 0000000000000..ab5a94743c0a6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.ts @@ -0,0 +1,99 @@ +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import { App, Stack } from 'aws-cdk-lib'; +import { MediaConvertCreateJob } from 'aws-cdk-lib/aws-stepfunctions-tasks'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha/lib'; + +/* + * Creates a state machine that creates a MediaConvert Job. + * https://docs.aws.amazon.com/step-functions/latest/dg/connect-mediaconvert.html + * + * Stack verification steps: + * + * Before we execute the state machine, we need to update the following fields in the state machine definition + * Role: https://docs.aws.amazon.com/mediaconvert/latest/apireference/jobs.html#jobs-prop-createjobrequest-role + * Settings: https://docs.aws.amazon.com/mediaconvert/latest/apireference/jobs.html#jobs-prop-createjobrequest-settings + * + * Once updated, the generated state machine can be executed from the CLI (or Step Functions console) + * and runs with an execution status of `Succeeded` & output contains the MediaConvert Job ARN + * + * -- aws stepfunctions start-execution --state-machine-arn provides execution arn + * -- aws stepfunctions describe-execution --execution-arn returns a status of `Succeeded` + * + * We can also check for the MediaConvert Job status from the CLI (or Media Convert console) + * + * -- aws mediaconvert get-job --id + * + */ +const app = new App(); + +const stack = new Stack(app, 'aws-cdk-mediaconvert-create-job-test-stack'); + +const mediaConvertRole = iam.Role.fromRoleArn(stack, 'MediaConvertRole', 'arn:aws:iam::123456789012:role/MediaConvertRole'); + +const step = new MediaConvertCreateJob(stack, 'MediaConvertCreateJob', { + createJobRequest: { + Role: mediaConvertRole.roleArn, + Settings: { + OutputGroups: [ + { + Outputs: [ + { + ContainerSettings: { + Container: 'MP4', + }, + VideoDescription: { + CodecSettings: { + Codec: 'H_264', + H264Settings: { + MaxBitrate: 1000, + RateControlMode: 'QVBR', + SceneChangeDetect: 'TRANSITION_DETECTION', + }, + }, + }, + AudioDescriptions: [ + { + CodecSettings: { + Codec: 'AAC', + AacSettings: { + Bitrate: 96000, + CodingMode: 'CODING_MODE_2_0', + SampleRate: 48000, + }, + }, + }, + ], + }, + ], + OutputGroupSettings: { + Type: 'FILE_GROUP_SETTINGS', + FileGroupSettings: { + Destination: 's3://EXAMPLE-DESTINATION-BUCKET/', + }, + }, + }, + ], + Inputs: [ + { + AudioSelectors: { + 'Audio Selector 1': { + DefaultSelection: 'DEFAULT', + }, + }, + FileInput: 's3://EXAMPLE-SOURCE-BUCKET/EXAMPLE-SOURCE_FILE', + }, + ], + }, + }, +}); + +new sfn.StateMachine(stack, 'StateMachine', { + definition: step, +}); + +new IntegTest(app, 'MediaConvertCreateJobTest', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/README.md b/packages/aws-cdk-lib/aws-stepfunctions-tasks/README.md index c91da59daafb9..9ebdec529b092 100644 --- a/packages/aws-cdk-lib/aws-stepfunctions-tasks/README.md +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/README.md @@ -67,6 +67,8 @@ This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aw - [Start Job Run](#start-job-run-1) - [Lambda](#lambda) - [Invoke](#invoke) + - [MediaConvert](#mediaconvert) + - [Create Job](#create-job) - [SageMaker](#sagemaker) - [Create Training Job](#create-training-job) - [Create Transform Job](#create-transform-job) @@ -1290,6 +1292,81 @@ As a best practice, the `LambdaInvoke` task will retry on those errors with an i a back-off rate of 2 and 6 maximum attempts. Set the `retryOnServiceExceptions` prop to `false` to disable this behavior. +## MediaConvert + +Step Functions supports [AWS MediaConvert](https://docs.aws.amazon.com/step-functions/latest/dg/connect-mediaconvert.html) through the Optimized integration pattern. + +### CreateJob + +The [CreateJob](https://docs.aws.amazon.com/mediaconvert/latest/apireference/jobs.html#jobspost) API creates a new transcoding job. +For information about jobs and job settings, see the User Guide at http://docs.aws.amazon.com/mediaconvert/latest/ug/what-is.html + +You can call the `CreateJob` API from a `Task` state. Optionally you can specify the `integrationPattern`. + +Make sure you update the required fields - [Role](https://docs.aws.amazon.com/mediaconvert/latest/apireference/jobs.html#jobs-prop-createjobrequest-role) & +[Settings](https://docs.aws.amazon.com/mediaconvert/latest/apireference/jobs.html#jobs-prop-createjobrequest-settings) and refer +[CreateJobRequest](https://docs.aws.amazon.com/mediaconvert/latest/apireference/jobs.html#jobs-model-createjobrequest) for all other optional parameters. + +```ts +new tasks.MediaConvertCreateJob(this, 'CreateJob', { + createJobRequest: { + "Role": "arn:aws:iam::123456789012:role/MediaConvertRole", + "Settings": { + "OutputGroups": [ + { + "Outputs": [ + { + "ContainerSettings": { + "Container": "MP4" + }, + "VideoDescription": { + "CodecSettings": { + "Codec": "H_264", + "H264Settings": { + "MaxBitrate": 1000, + "RateControlMode": "QVBR", + "SceneChangeDetect": "TRANSITION_DETECTION" + } + } + }, + "AudioDescriptions": [ + { + "CodecSettings": { + "Codec": "AAC", + "AacSettings": { + "Bitrate": 96000, + "CodingMode": "CODING_MODE_2_0", + "SampleRate": 48000 + } + } + } + ] + } + ], + "OutputGroupSettings": { + "Type": "FILE_GROUP_SETTINGS", + "FileGroupSettings": { + "Destination": "s3://EXAMPLE-DESTINATION-BUCKET/" + } + } + } + ], + "Inputs": [ + { + "AudioSelectors": { + "Audio Selector 1": { + "DefaultSelection": "DEFAULT" + } + }, + "FileInput": "s3://EXAMPLE-SOURCE-BUCKET/EXAMPLE-SOURCE_FILE" + } + ] + } + }, + integrationPattern: sfn.IntegrationPattern.RUN_JOB, +}); +``` + ## SageMaker Step Functions supports [AWS SageMaker](https://docs.aws.amazon.com/step-functions/latest/dg/connect-sagemaker.html) through the service integration pattern. diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/index.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/index.ts index 78987f2a213f0..e845141811cc5 100644 --- a/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/index.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/index.ts @@ -55,3 +55,4 @@ export * from './eventbridge/put-events'; export * from './aws-sdk/call-aws-service'; export * from './bedrock/invoke-model'; export * from './http/invoke'; +export * from './mediaconvert/create-job'; diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/mediaconvert/create-job.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/mediaconvert/create-job.ts new file mode 100644 index 0000000000000..8c4ed6c5dc792 --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/mediaconvert/create-job.ts @@ -0,0 +1,108 @@ +import { Construct } from 'constructs'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import { Stack } from '../../../core'; +import * as cdk from '../../../core'; +import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; + +/** + * Properties for creating a MediaConvert Job + * + * See the CreateJob API for complete documentation + * @see https://docs.aws.amazon.com/mediaconvert/latest/apireference/jobs.html#jobspost + * + */ +export interface MediaConvertCreateJobProps extends sfn.TaskStateBaseProps { + + /** + * The input data for the MediaConvert Create Job invocation + */ + readonly createJobRequest: { [key: string]: any }; + +} + +/** + * A Step Functions Task to create a job in MediaConvert. + * + * The JobConfiguration/Request Syntax is defined in the Parameters in the Task State + * @see https://docs.aws.amazon.com/step-functions/latest/dg/connect-mediaconvert.html + * + * Response syntax: see CreateJobResponse schema + * https://docs.aws.amazon.com/mediaconvert/latest/apireference/jobs.html#jobs-response-examples + * + */ +export class MediaConvertCreateJob extends sfn.TaskStateBase { + + private static readonly SUPPORTED_INTEGRATION_PATTERNS: sfn.IntegrationPattern[] = [ + sfn.IntegrationPattern.REQUEST_RESPONSE, + sfn.IntegrationPattern.RUN_JOB, + ]; + + protected readonly taskMetrics: sfn.TaskMetricsConfig | undefined; + protected readonly taskPolicies: iam.PolicyStatement[] | undefined; + + private readonly integrationPattern: sfn.IntegrationPattern; + + constructor(scope: Construct, id: string, private readonly props: MediaConvertCreateJobProps) { + super(scope, id, props); + + this.integrationPattern = props.integrationPattern ?? sfn.IntegrationPattern.REQUEST_RESPONSE; + validatePatternSupported(this.integrationPattern, MediaConvertCreateJob.SUPPORTED_INTEGRATION_PATTERNS); + + cdk.requireProperty(props.createJobRequest, 'Role', this); + cdk.requireProperty(props.createJobRequest, 'Settings', this); + + this.taskPolicies = this.renderPolicyStatements(); + } + + private renderPolicyStatements(): iam.PolicyStatement[] { + const policyStatements = [ + new iam.PolicyStatement({ + actions: ['iam:PassRole'], + resources: [this.props.createJobRequest.Role], + conditions: { + StringLike: { 'iam:PassedToService': 'mediaconvert.amazonaws.com' }, + }, + }), + new iam.PolicyStatement({ + actions: ['mediaconvert:CreateJob'], + resources: ['*'], + }), + ]; + + if (this.props.integrationPattern == sfn.IntegrationPattern.RUN_JOB) { + policyStatements.push( + new iam.PolicyStatement({ + actions: ['mediaconvert:GetJob', 'mediaconvert:CancelJob'], + resources: ['*'], + }), + ); + policyStatements.push( + new iam.PolicyStatement({ + actions: ['events:PutTargets', 'events:PutRule', 'events:DescribeRule'], + resources: [ + Stack.of(this).formatArn({ + service: 'events', + resource: 'rule', + resourceName: 'StepFunctionsGetEventsForMediaConvertJobRule', + }), + ], + }), + ); + } + + return policyStatements; + } + + /** + * Provides the MediaConvert CreateJob Service Integration Task Configuration + * + * @internal + */ + protected _renderTask(): any { + return { + Resource: integrationResourceArn('mediaconvert', 'createJob', this.props.integrationPattern), + Parameters: this.props.createJobRequest, + }; + } +} diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/mediaconvert/create-job.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/mediaconvert/create-job.test.ts new file mode 100644 index 0000000000000..d2019892b4924 --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/mediaconvert/create-job.test.ts @@ -0,0 +1,243 @@ +import { Match, Template } from '../../../assertions'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; +import { MediaConvertCreateJob } from '../../lib'; + +let stack: cdk.Stack; + +beforeEach(() => { + stack = new cdk.Stack(); +}); + +describe('MediaConvert Create Job', () => { + + test('REQUEST_RESPONSE Integration Pattern', () => { + // WHEN + const task = new MediaConvertCreateJob(stack, 'MediaConvertCreateJob', { + createJobRequest: { + Role: 'arn:aws:iam::123456789012:role/MediaConvertRole', + Settings: { + OutputGroups: [], + Inputs: [], + }, + }, + }); + + // THEN + expect(stack.resolve(task.toStateJson())).toEqual({ + Type: 'Task', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:::mediaconvert:createJob', + ], + ], + }, + End: true, + Parameters: { + Role: 'arn:aws:iam::123456789012:role/MediaConvertRole', + Settings: { + OutputGroups: [], + Inputs: [], + }, + }, + }); + }); + + test('RUN_JOB Integration Pattern', () => { + // WHEN + const task = new MediaConvertCreateJob(stack, 'MediaConvertCreateJob', { + integrationPattern: sfn.IntegrationPattern.RUN_JOB, + createJobRequest: { + Role: 'arn:aws:iam::123456789012:role/MediaConvertRole', + Settings: { + OutputGroups: [], + Inputs: [], + }, + }, + }); + + // THEN + expect(stack.resolve(task.toStateJson())).toEqual({ + Type: 'Task', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:::mediaconvert:createJob.sync', + ], + ], + }, + End: true, + Parameters: { + Role: 'arn:aws:iam::123456789012:role/MediaConvertRole', + Settings: { + OutputGroups: [], + Inputs: [], + }, + }, + }); + }); + + test('Fails on Unsupported Integration Pattern', () => { + expect(() => { + // WHEN + const task = new MediaConvertCreateJob(stack, 'MediaConvertCreateJob', { + integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN, + createJobRequest: { + Settings: { + OutputGroups: [], + Inputs: [], + }, + }, + }); + // THEN + }).toThrow(/Unsupported service integration pattern. Supported Patterns: REQUEST_RESPONSE,RUN_JOB. Received: WAIT_FOR_TASK_TOKEN/); + }); + + test('Fails on role not specified', () => { + expect(() => { + // WHEN + const task = new MediaConvertCreateJob(stack, 'MediaConvertCreateJob', { + createJobRequest: { + Settings: { + OutputGroups: [], + Inputs: [], + }, + }, + }); + // THEN + }).toThrow(/Default\/MediaConvertCreateJob is missing required property: Role/); + }); + + test('Fails on settings not specified', () => { + expect(() => { + // WHEN + const task = new MediaConvertCreateJob(stack, 'MediaConvertCreateJob', { + createJobRequest: { + Role: 'arn:aws:iam::123456789012:role/MediaConvertRole', + }, + }); + // THEN + }).toThrow(/Default\/MediaConvertCreateJob is missing required property: Settings/); + }); + + test('Required Policy statements are generated in REQUEST_RESPONSE Integration', () => { + // WHEN + const task = new MediaConvertCreateJob(stack, 'MediaConvertCreateJob', { + createJobRequest: { + Role: 'arn:aws:iam::123456789012:role/MediaConvertRole', + Settings: { + OutputGroups: [], + Inputs: [], + }, + }, + }); + + new sfn.StateMachine(stack, 'StateMachine', { + definitionBody: sfn.DefinitionBody.fromChainable(task), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: Match.objectLike({ + Statement: Match.arrayWith([ + { + Action: 'iam:PassRole', + Effect: 'Allow', + Resource: 'arn:aws:iam::123456789012:role/MediaConvertRole', + Condition: { + StringLike: { + 'iam:PassedToService': 'mediaconvert.amazonaws.com', + }, + }, + }, + { + Action: 'mediaconvert:CreateJob', + Effect: 'Allow', + Resource: '*', + }, + ]), + }), + }); + }); + + test('Required Policy statements are generated in RUN_JOB Integration', () => { + // WHEN + const task = new MediaConvertCreateJob(stack, 'MediaConvertCreateJob', { + integrationPattern: sfn.IntegrationPattern.RUN_JOB, + createJobRequest: { + Role: 'arn:aws:iam::123456789012:role/MediaConvertRole', + Settings: { + OutputGroups: [], + Inputs: [], + }, + }, + }); + + new sfn.StateMachine(stack, 'StateMachine', { + definitionBody: sfn.DefinitionBody.fromChainable(task), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: Match.objectLike({ + Statement: Match.arrayWith([ + { + Action: 'iam:PassRole', + Effect: 'Allow', + Resource: 'arn:aws:iam::123456789012:role/MediaConvertRole', + Condition: { + StringLike: { + 'iam:PassedToService': 'mediaconvert.amazonaws.com', + }, + }, + }, + { + Action: 'mediaconvert:CreateJob', + Effect: 'Allow', + Resource: '*', + }, + { + Action: ['mediaconvert:GetJob', 'mediaconvert:CancelJob'], + Effect: 'Allow', + Resource: '*', + }, + { + Action: ['events:PutTargets', 'events:PutRule', 'events:DescribeRule'], + Effect: 'Allow', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':events:', + { + Ref: 'AWS::Region', + }, + ':', + { + Ref: 'AWS::AccountId', + }, + ':rule/StepFunctionsGetEventsForMediaConvertJobRule', + ], + ], + }, + }, + ]), + }), + }); + }); +}); \ No newline at end of file