createDataGrant method

Future<CreateDataGrantResponse> createDataGrant({
  1. required GrantDistributionScope grantDistributionScope,
  2. required String name,
  3. required String receiverPrincipal,
  4. required String sourceDataSetId,
  5. String? description,
  6. DateTime? endsAt,
  7. Map<String, String>? tags,
})

This operation creates a data grant.

May throw AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceLimitExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter grantDistributionScope : The distribution scope of the data grant.

Parameter name : The name of the data grant.

Parameter receiverPrincipal : The Amazon Web Services account ID of the data grant receiver.

Parameter sourceDataSetId : The ID of the data set used to create the data grant.

Parameter description : The description of the data grant.

Parameter endsAt : The timestamp of when access to the associated data set ends.

Parameter tags : The tags to add to the data grant. A tag is a key-value pair.

Implementation

Future<CreateDataGrantResponse> createDataGrant({
  required GrantDistributionScope grantDistributionScope,
  required String name,
  required String receiverPrincipal,
  required String sourceDataSetId,
  String? description,
  DateTime? endsAt,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'GrantDistributionScope': grantDistributionScope.value,
    'Name': name,
    'ReceiverPrincipal': receiverPrincipal,
    'SourceDataSetId': sourceDataSetId,
    if (description != null) 'Description': description,
    if (endsAt != null) 'EndsAt': iso8601ToJson(endsAt),
    if (tags != null) 'Tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/v1/data-grants',
    exceptionFnMap: _exceptionFns,
  );
  return CreateDataGrantResponse.fromJson(response);
}