Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(stepfunctions-tasks): support for the step functions mediaconvert optimized integration for createJob api #30300

Conversation

PavanRangudu
Copy link
Contributor

Step Functions recently released an Optimized Integration for MediaConvert CreateJob API and these changes add support for the MediaConvert CreateJob task to Step Functions state machines.

Issue # (if applicable)

Closes #30299

Reason for this change

The aws-stepfunctions-tasks now needs to support creating MediaConvert CreateJob tasks

Description of changes

Added a new L2 construct for MediaConvert Create-Job Task: packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/mediaconvert/create-job.ts

Description of how you validated changes

Unit test - packages/aws-cdk-lib/aws-stepfunctions-tasks/test/mediaconvert/create-job.test.ts
Integration test - packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.ts

Verified the State Machine with MediaConvert CreateJob Task with all the necessary permissions

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added the beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK label May 22, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team May 22, 2024 01:56
@github-actions github-actions bot added the p2 label May 22, 2024
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label May 22, 2024
Copy link
Contributor

@GavinZZ GavinZZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good, left some questions.

const policyStatements = [
new iam.PolicyStatement({
actions: ['iam:PassRole'],
resources: ['*'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way we can constraint the resource to not be a *?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I think about it, we can constraint the resource to the Role specified in the createJobRequest like below:

resources: [this.props.createJobRequest.Role],
conditions: {
StringLike: { 'iam:PassedToService': 'mediaconvert.amazonaws.com' },
},

Updating in next revision.

Comment on lines +41 to +42
protected readonly taskMetrics: sfn.TaskMetricsConfig | undefined;
protected readonly taskPolicies: iam.PolicyStatement[] | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is taskMetrics used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

taskMetrics is an abstract member of TaskStateBase class (packages/aws-cdk-lib/aws-stepfunctions/lib/states/task-base.ts) that can be used to attach any metrics for the task. We are not planning to add any metrics specific to this MediaConvertCreateJob task.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If not used in MediaConvertCreateJob, I think we can safely remove this line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the line gives TS18052 Non-abstract class 'MediaConvertCreateJob' does not implement all abstract members of 'TaskStateBase' error

* 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this link correct? I opened this link, but not sure if it's related to the create job api.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the link https://docs.aws.amazon.com/mediaconvert/latest/apireference/jobs.html#jobspost talks about the POST Operation CREATEJOB API that creates a new transcoding job in MediaConvert service.

Copy link
Contributor

@GavinZZ GavinZZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: d4508af
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Contributor

mergify bot commented May 24, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 823cab3 into aws:main May 24, 2024
10 checks passed
This was referenced May 27, 2024
atanaspam pushed a commit to atanaspam/aws-cdk that referenced this pull request Jun 3, 2024
…t optimized integration for createJob api (aws#30300)

Step Functions recently released an [Optimized Integration for MediaConvert CreateJob API](https://docs.aws.amazon.com/step-functions/latest/dg/connect-mediaconvert.html) and these changes add support for the MediaConvert CreateJob task to Step Functions state machines.

### Issue # (if applicable)

Closes [aws#30299](aws#30299) 

### Reason for this change

The aws-stepfunctions-tasks now needs to support creating MediaConvert CreateJob tasks

### Description of changes

Added a new L2 construct for MediaConvert Create-Job Task: ``packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/mediaconvert/create-job.ts`` 

### Description of how you validated changes

Unit test - ``packages/aws-cdk-lib/aws-stepfunctions-tasks/test/mediaconvert/create-job.test.ts``
Integration test - ``packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.ts``

Verified the State Machine with MediaConvert CreateJob Task with all the necessary permissions

### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
vdahlberg pushed a commit to vdahlberg/aws-cdk that referenced this pull request Jun 10, 2024
…t optimized integration for createJob api (aws#30300)

Step Functions recently released an [Optimized Integration for MediaConvert CreateJob API](https://docs.aws.amazon.com/step-functions/latest/dg/connect-mediaconvert.html) and these changes add support for the MediaConvert CreateJob task to Step Functions state machines.

### Issue # (if applicable)

Closes [aws#30299](aws#30299) 

### Reason for this change

The aws-stepfunctions-tasks now needs to support creating MediaConvert CreateJob tasks

### Description of changes

Added a new L2 construct for MediaConvert Create-Job Task: ``packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/mediaconvert/create-job.ts`` 

### Description of how you validated changes

Unit test - ``packages/aws-cdk-lib/aws-stepfunctions-tasks/test/mediaconvert/create-job.test.ts``
Integration test - ``packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/mediaconvert/test/integ.create-job.ts``

Verified the State Machine with MediaConvert CreateJob Task with all the necessary permissions

### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK p2 pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws-stepfunctions-tasks: Support for integration with MediaConvert CreateJob API
3 participants