associateAccessPolicy method
Associates an access policy and its scope to an access entry. For more information about associating access policies, see Associating and disassociating access policies to and from access entries in the Amazon EKS User Guide.
May throw InvalidParameterException.
May throw InvalidRequestException.
May throw ResourceNotFoundException.
May throw ServerException.
Parameter accessScope :
The scope for the AccessPolicy. You can scope access policies
to an entire cluster or to specific Kubernetes namespaces.
Parameter clusterName :
The name of your cluster.
Parameter policyArn :
The ARN of the AccessPolicy that you're associating. For a
list of ARNs, use ListAccessPolicies.
Parameter principalArn :
The Amazon Resource Name (ARN) of the IAM user or role for the
AccessEntry that you're associating the access policy to.
Implementation
Future<AssociateAccessPolicyResponse> associateAccessPolicy({
required AccessScope accessScope,
required String clusterName,
required String policyArn,
required String principalArn,
}) async {
final $payload = <String, dynamic>{
'accessScope': accessScope,
'policyArn': policyArn,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/clusters/${Uri.encodeComponent(clusterName)}/access-entries/${Uri.encodeComponent(principalArn)}/access-policies',
exceptionFnMap: _exceptionFns,
);
return AssociateAccessPolicyResponse.fromJson(response);
}