updateAnalysisPermissions method

Future<UpdateAnalysisPermissionsResponse> updateAnalysisPermissions({
  1. required String analysisId,
  2. required String awsAccountId,
  3. List<ResourcePermission>? grantPermissions,
  4. List<ResourcePermission>? revokePermissions,
})

Updates the read and write permissions for an analysis.

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

Parameter analysisId : The ID of the analysis whose permissions you're updating. The ID is part of the analysis URL.

Parameter awsAccountId : The ID of the AWS account that contains the analysis whose permissions you're updating. You must be using the AWS account that the analysis is in.

Parameter grantPermissions : A structure that describes the permissions to add and the principal to add them to.

Parameter revokePermissions : A structure that describes the permissions to remove and the principal to remove them from.

Implementation

Future<UpdateAnalysisPermissionsResponse> updateAnalysisPermissions({
  required String analysisId,
  required String awsAccountId,
  List<ResourcePermission>? grantPermissions,
  List<ResourcePermission>? revokePermissions,
}) async {
  ArgumentError.checkNotNull(analysisId, 'analysisId');
  _s.validateStringLength(
    'analysisId',
    analysisId,
    1,
    2048,
    isRequired: true,
  );
  ArgumentError.checkNotNull(awsAccountId, 'awsAccountId');
  _s.validateStringLength(
    'awsAccountId',
    awsAccountId,
    12,
    12,
    isRequired: true,
  );
  final $payload = <String, dynamic>{
    if (grantPermissions != null) 'GrantPermissions': grantPermissions,
    if (revokePermissions != null) 'RevokePermissions': revokePermissions,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri:
        '/accounts/${Uri.encodeComponent(awsAccountId)}/analyses/${Uri.encodeComponent(analysisId)}/permissions',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateAnalysisPermissionsResponse.fromJson(response);
}