createIAMPolicyAssignment method
Creates an assignment with one specified IAM policy, identified by its Amazon Resource Name (ARN). This policy assignment is attached to the specified groups or users of Amazon Quick Sight. Assignment names are unique per Amazon Web Services account. To avoid overwriting rules in other namespaces, use assignment names that are unique.
May throw AccessDeniedException.
May throw ConcurrentUpdatingException.
May throw InternalFailureException.
May throw InvalidParameterValueException.
May throw ResourceExistsException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
Parameter assignmentName :
The name of the assignment, also called a rule. The name must be unique
within the Amazon Web Services account.
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 awsAccountId :
The ID of the Amazon Web Services account where you want to assign an IAM
policy to Amazon Quick Sight users or groups.
Parameter namespace :
The namespace that contains the assignment.
Parameter identities :
The Amazon Quick Sight users, groups, or both that you want to assign the
policy to.
Parameter policyArn :
The ARN for the IAM policy to apply to the Amazon Quick Sight users and
groups specified in this assignment.
Implementation
Future<CreateIAMPolicyAssignmentResponse> createIAMPolicyAssignment({
required String assignmentName,
required AssignmentStatus assignmentStatus,
required String awsAccountId,
required String namespace,
Map<String, List<String>>? identities,
String? policyArn,
}) async {
final $payload = <String, dynamic>{
'AssignmentName': assignmentName,
'AssignmentStatus': assignmentStatus.value,
if (identities != null) 'Identities': identities,
if (policyArn != null) 'PolicyArn': policyArn,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/accounts/${Uri.encodeComponent(awsAccountId)}/namespaces/${Uri.encodeComponent(namespace)}/iam-policy-assignments',
exceptionFnMap: _exceptionFns,
);
return CreateIAMPolicyAssignmentResponse.fromJson(response);
}