aws / aws-sdk-java-v2

The official AWS SDK for Java - Version 2
Apache License 2.0
2.21k stars 854 forks source link

Create JobSettings from JobTemplateSettings object - mediaconvert #1579

Closed MkJha closed 4 years ago

MkJha commented 4 years ago

Use case :: Fetch the job template, override/add a few configuration like input file, output drm settings and create a JobSettings from the JobTemplateSettings in order to create a job.

Basically how to convert template objects <->JobObjects

debora-ito commented 4 years ago

@MkJha I'm not fully clear on the question here. If you want to create a job based on a job template with specific settings for that job, you can call createJob() specifying the job template and the job settings.

Let us know if this is not what you had in mind.

MkJha commented 4 years ago

I want to use template to create the job, but i need to configure/overwrite the template's input - input location(which is not configured on the template) in the client request without changing the template on the aws server.

debora-ito commented 4 years ago

You can specify the job template you want to use in the CreateJobRequest, something like:

CreateJobRequest createJobRequest = CreateJobRequest.builder()
        .jobTemplate(TEMPLATE_NAME)
        .settings(JobSettings.builder()
                .inputs(Input.builder()
                        ...
                        .build())
                .build())
        .build();

This example shows how to fill the CreateJobRequest with input information: https://github.com/awsdocs/aws-doc-sdk-examples/blob/master/javav2/example_code/mediaconvert/src/main/java/com/example/mediaconvert/CreateJob.java

MkJha commented 4 years ago

I have referred the same, as i have mentioned i am retaining most of the template and overriding a few details. For other things like OutputGroup , i use copy method and override the details. But in case of input, template input and job settings input object type are different. Is there any way to use copy in this case?

debora-ito commented 4 years ago

I believe that if you provide a JobTemplate that has input settings to the CreateJobRequest, you don't have to explicitly copy the input settings, you only have to provide the settings you want to override. This is all based in the JobTemplateSettings javadocs:

JobTemplateSettings contains all the transcode settings saved in the template that will be applied to jobs created from it.

That's why there isn't a copy operation from a JobTemplate input to a Job input.

Have you tried using the template like described? If you are experiecing issues, can you provide a minimal reproducible example?

debora-ito commented 4 years ago

Closing this due to inactivity, please reopen if you have any further questions.