updateDataSourcePermissions method

Future<UpdateDataSourcePermissionsResponse> updateDataSourcePermissions({
  1. required String awsAccountId,
  2. required String dataSourceId,
  3. List<ResourcePermission>? grantPermissions,
  4. List<ResourcePermission>? revokePermissions,
})

Updates the permissions to a data source.

May throw AccessDeniedException. May throw ConflictException. May throw InvalidParameterValueException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw InternalFailureException.

Parameter awsAccountId : The AWS account ID.

Parameter dataSourceId : The ID of the data source. This ID is unique per AWS Region for each AWS account.

Parameter grantPermissions : A list of resource permissions that you want to grant on the data source.

Parameter revokePermissions : A list of resource permissions that you want to revoke on the data source.

Implementation

Future<UpdateDataSourcePermissionsResponse> updateDataSourcePermissions({
  required String awsAccountId,
  required String dataSourceId,
  List<ResourcePermission>? grantPermissions,
  List<ResourcePermission>? revokePermissions,
}) async {
  ArgumentError.checkNotNull(awsAccountId, 'awsAccountId');
  _s.validateStringLength(
    'awsAccountId',
    awsAccountId,
    12,
    12,
    isRequired: true,
  );
  ArgumentError.checkNotNull(dataSourceId, 'dataSourceId');
  final $payload = <String, dynamic>{
    if (grantPermissions != null) 'GrantPermissions': grantPermissions,
    if (revokePermissions != null) 'RevokePermissions': revokePermissions,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/accounts/${Uri.encodeComponent(awsAccountId)}/data-sources/${Uri.encodeComponent(dataSourceId)}/permissions',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateDataSourcePermissionsResponse.fromJson(response);
}