createJob method

Future<CreateJobResponse> createJob({
  1. required String role,
  2. required JobSettings settings,
  3. AccelerationSettings? accelerationSettings,
  4. BillingTagsSource? billingTagsSource,
  5. String? clientRequestToken,
  6. List<HopDestination>? hopDestinations,
  7. String? jobTemplate,
  8. int? priority,
  9. String? queue,
  10. SimulateReservedQueue? simulateReservedQueue,
  11. StatusUpdateInterval? statusUpdateInterval,
  12. Map<String, String>? tags,
  13. Map<String, String>? userMetadata,
})

Create 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

May throw BadRequestException. May throw InternalServerErrorException. May throw ForbiddenException. May throw NotFoundException. May throw TooManyRequestsException. May throw ConflictException.

Parameter role : Required. The IAM role you use for creating this job. For details about permissions, see the User Guide topic at the User Guide at https://docs.aws.amazon.com/mediaconvert/latest/ug/iam-role.html.

Parameter settings : JobSettings contains all the transcode settings for a job.

Parameter accelerationSettings : Optional. Accelerated transcoding can significantly speed up jobs with long, visually complex content. Outputs that use this feature incur pro-tier pricing. For information about feature limitations, see the AWS Elemental MediaConvert User Guide.

Parameter billingTagsSource : Optional. Choose a tag type that AWS Billing and Cost Management will use to sort your AWS Elemental MediaConvert costs on any billing report that you set up. Any transcoding outputs that don't have an associated tag will appear in your billing report unsorted. If you don't choose a valid value for this field, your job outputs will appear on the billing report unsorted.

Parameter clientRequestToken : Optional. Idempotency token for CreateJob operation.

Parameter hopDestinations : Optional. Use queue hopping to avoid overly long waits in the backlog of the queue that you submit your job to. Specify an alternate queue and the maximum time that your job will wait in the initial queue before hopping. For more information about this feature, see the AWS Elemental MediaConvert User Guide.

Parameter jobTemplate : Optional. When you create a job, you can either specify a job template or specify the transcoding settings individually.

Parameter priority : Optional. Specify the relative priority for this job. In any given queue, the service begins processing the job with the highest value first. When more than one job has the same priority, the service begins processing the job that you submitted first. If you don't specify a priority, the service uses the default value 0.

Parameter queue : Optional. When you create a job, you can specify a queue to send it to. If you don't specify, the job will go to the default queue. For more about queues, see the User Guide topic at https://docs.aws.amazon.com/mediaconvert/latest/ug/what-is.html.

Parameter simulateReservedQueue : Optional. Enable this setting when you run a test job to estimate how many reserved transcoding slots (RTS) you need. When this is enabled, MediaConvert runs your job from an on-demand queue with similar performance to what you will see with one RTS in a reserved queue. This setting is disabled by default.

Parameter statusUpdateInterval : Optional. Specify how often MediaConvert sends STATUS_UPDATE events to Amazon CloudWatch Events. Set the interval, in seconds, between status updates. MediaConvert sends an update at this interval from the time the service begins processing your job to the time it completes the transcode or encounters an error.

Parameter tags : Optional. The tags that you want to add to the resource. You can tag resources with a key-value pair or with only a key. Use standard AWS tags on your job for automatic integration with AWS services and for custom integrations and workflows.

Parameter userMetadata : Optional. User-defined metadata that you want to associate with an MediaConvert job. You specify metadata in key/value pairs. Use only for existing integrations or workflows that rely on job metadata tags. Otherwise, we recommend that you use standard AWS tags.

Implementation

Future<CreateJobResponse> createJob({
  required String role,
  required JobSettings settings,
  AccelerationSettings? accelerationSettings,
  BillingTagsSource? billingTagsSource,
  String? clientRequestToken,
  List<HopDestination>? hopDestinations,
  String? jobTemplate,
  int? priority,
  String? queue,
  SimulateReservedQueue? simulateReservedQueue,
  StatusUpdateInterval? statusUpdateInterval,
  Map<String, String>? tags,
  Map<String, String>? userMetadata,
}) async {
  ArgumentError.checkNotNull(role, 'role');
  ArgumentError.checkNotNull(settings, 'settings');
  _s.validateNumRange(
    'priority',
    priority,
    -50,
    50,
  );
  final $payload = <String, dynamic>{
    'role': role,
    'settings': settings,
    if (accelerationSettings != null)
      'accelerationSettings': accelerationSettings,
    if (billingTagsSource != null)
      'billingTagsSource': billingTagsSource.toValue(),
    'clientRequestToken': clientRequestToken ?? _s.generateIdempotencyToken(),
    if (hopDestinations != null) 'hopDestinations': hopDestinations,
    if (jobTemplate != null) 'jobTemplate': jobTemplate,
    if (priority != null) 'priority': priority,
    if (queue != null) 'queue': queue,
    if (simulateReservedQueue != null)
      'simulateReservedQueue': simulateReservedQueue.toValue(),
    if (statusUpdateInterval != null)
      'statusUpdateInterval': statusUpdateInterval.toValue(),
    if (tags != null) 'tags': tags,
    if (userMetadata != null) 'userMetadata': userMetadata,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/2017-08-29/jobs',
    exceptionFnMap: _exceptionFns,
    headers: {
      'Content-Type': 'application/json',
    },
  );

  return CreateJobResponse.fromJson(response);
}