createHarvestJob method

Future<CreateHarvestJobResponse> createHarvestJob({
  1. required String channelGroupName,
  2. required String channelName,
  3. required Destination destination,
  4. required HarvestedManifests harvestedManifests,
  5. required String originEndpointName,
  6. required HarvesterScheduleConfiguration scheduleConfiguration,
  7. String? clientToken,
  8. String? description,
  9. String? harvestJobName,
  10. Map<String, String>? tags,
})

Creates a new harvest job to export content from a MediaPackage v2 channel to an S3 bucket.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter channelGroupName : The name of the channel group containing the channel from which to harvest content.

Parameter channelName : The name of the channel from which to harvest content.

Parameter destination : The S3 destination where the harvested content will be placed.

Parameter harvestedManifests : A list of manifests to be harvested.

Parameter originEndpointName : The name of the origin endpoint from which to harvest content.

Parameter scheduleConfiguration : The configuration for when the harvest job should run, including start and end times.

Parameter clientToken : A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

Parameter description : An optional description for the harvest job.

Parameter harvestJobName : A name for the harvest job. This name must be unique within the channel.

Parameter tags : A collection of tags associated with the harvest job.

Implementation

Future<CreateHarvestJobResponse> createHarvestJob({
  required String channelGroupName,
  required String channelName,
  required Destination destination,
  required HarvestedManifests harvestedManifests,
  required String originEndpointName,
  required HarvesterScheduleConfiguration scheduleConfiguration,
  String? clientToken,
  String? description,
  String? harvestJobName,
  Map<String, String>? tags,
}) async {
  final headers = <String, String>{
    if (clientToken != null) 'x-amzn-client-token': clientToken.toString(),
  };
  final $payload = <String, dynamic>{
    'Destination': destination,
    'HarvestedManifests': harvestedManifests,
    'ScheduleConfiguration': scheduleConfiguration,
    if (description != null) 'Description': description,
    if (harvestJobName != null) 'HarvestJobName': harvestJobName,
    if (tags != null) 'Tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/channelGroup/${Uri.encodeComponent(channelGroupName)}/channel/${Uri.encodeComponent(channelName)}/originEndpoint/${Uri.encodeComponent(originEndpointName)}/harvestJob',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return CreateHarvestJobResponse.fromJson(response);
}