createAsset method

Future<CreateAssetResponse> createAsset({
  1. required String id,
  2. required String packagingGroupId,
  3. required String sourceArn,
  4. required String sourceRoleArn,
  5. String? resourceId,
  6. Map<String, String>? tags,
})

Creates a new MediaPackage VOD Asset resource.

May throw UnprocessableEntityException. May throw InternalServerErrorException. May throw ForbiddenException. May throw NotFoundException. May throw ServiceUnavailableException. May throw TooManyRequestsException.

Parameter id : The unique identifier for the Asset.

Parameter packagingGroupId : The ID of the PackagingGroup for the Asset.

Parameter sourceArn : ARN of the source object in S3.

Parameter sourceRoleArn : The IAM role ARN used to access the source S3 bucket.

Parameter resourceId : The resource ID to include in SPEKE key requests.

Implementation

Future<CreateAssetResponse> createAsset({
  required String id,
  required String packagingGroupId,
  required String sourceArn,
  required String sourceRoleArn,
  String? resourceId,
  Map<String, String>? tags,
}) async {
  ArgumentError.checkNotNull(id, 'id');
  ArgumentError.checkNotNull(packagingGroupId, 'packagingGroupId');
  ArgumentError.checkNotNull(sourceArn, 'sourceArn');
  ArgumentError.checkNotNull(sourceRoleArn, 'sourceRoleArn');
  final $payload = <String, dynamic>{
    'id': id,
    'packagingGroupId': packagingGroupId,
    'sourceArn': sourceArn,
    'sourceRoleArn': sourceRoleArn,
    if (resourceId != null) 'resourceId': resourceId,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/assets',
    exceptionFnMap: _exceptionFns,
  );
  return CreateAssetResponse.fromJson(response);
}