updateIAMPolicyAssignment method

Future<UpdateIAMPolicyAssignmentResponse> updateIAMPolicyAssignment({
  1. required String assignmentName,
  2. required String awsAccountId,
  3. required String namespace,
  4. AssignmentStatus? assignmentStatus,
  5. Map<String, List<String>>? identities,
  6. String? policyArn,
})

Updates an existing IAM policy assignment. This operation updates only the optional parameter or parameters that are specified in the request. This overwrites all of the users included in Identities.

May throw AccessDeniedException. May throw InvalidParameterValueException. May throw ResourceExistsException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ConcurrentUpdatingException. May throw InternalFailureException.

Parameter assignmentName : The name of the assignment, also called a rule. This name must be unique within an AWS account.

Parameter awsAccountId : The ID of the AWS account that contains the IAM policy assignment.

Parameter namespace : The namespace of the assignment.

Parameter assignmentStatus : The status of the assignment. Possible values are as follows:

  • ENABLED - Anything specified in this assignment is used when creating the data source.
  • DISABLED - This assignment isn't used when creating the data source.
  • DRAFT - This assignment is an unfinished draft and isn't used when creating the data source.

Parameter identities : The QuickSight users, groups, or both that you want to assign the policy to.

Parameter policyArn : The ARN for the IAM policy to apply to the QuickSight users and groups specified in this assignment.

Implementation

Future<UpdateIAMPolicyAssignmentResponse> updateIAMPolicyAssignment({
  required String assignmentName,
  required String awsAccountId,
  required String namespace,
  AssignmentStatus? assignmentStatus,
  Map<String, List<String>>? identities,
  String? policyArn,
}) async {
  ArgumentError.checkNotNull(assignmentName, 'assignmentName');
  _s.validateStringLength(
    'assignmentName',
    assignmentName,
    1,
    1152921504606846976,
    isRequired: true,
  );
  ArgumentError.checkNotNull(awsAccountId, 'awsAccountId');
  _s.validateStringLength(
    'awsAccountId',
    awsAccountId,
    12,
    12,
    isRequired: true,
  );
  ArgumentError.checkNotNull(namespace, 'namespace');
  _s.validateStringLength(
    'namespace',
    namespace,
    0,
    64,
    isRequired: true,
  );
  final $payload = <String, dynamic>{
    if (assignmentStatus != null)
      'AssignmentStatus': assignmentStatus.toValue(),
    if (identities != null) 'Identities': identities,
    if (policyArn != null) 'PolicyArn': policyArn,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri:
        '/accounts/${Uri.encodeComponent(awsAccountId)}/namespaces/${Uri.encodeComponent(namespace)}/iam-policy-assignments/${Uri.encodeComponent(assignmentName)}',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateIAMPolicyAssignmentResponse.fromJson(response);
}