assumeRoleForPodIdentity method

Future<AssumeRoleForPodIdentityResponse> assumeRoleForPodIdentity({
  1. required String clusterName,
  2. required String token,
  3. String? eksNodeName,
  4. String? instanceId,
  5. String? zone,
})

The Amazon EKS Auth API and the AssumeRoleForPodIdentity action are only used by the EKS Pod Identity Agent.

We recommend that applications use the Amazon Web Services SDKs to connect to Amazon Web Services services; if credentials from an EKS Pod Identity association are available in the pod, the latest versions of the SDKs use them automatically.

May throw AccessDeniedException. May throw ExpiredTokenException. May throw InternalServerException. May throw InvalidParameterException. May throw InvalidRequestException. May throw InvalidTokenException. May throw ResourceNotFoundException. May throw ServiceUnavailableException. May throw ThrottlingException.

Parameter clusterName : The name of the cluster for the request.

Parameter token : The token of the Kubernetes service account for the pod.

Parameter eksNodeName : The Kubernetes node name of the worker node where the pod is running.

Parameter instanceId : The Amazon EC2 instance ID of the worker node where the pod is running.

Parameter zone : The Availability Zone ID of the worker node where the pod is running.

Implementation

Future<AssumeRoleForPodIdentityResponse> assumeRoleForPodIdentity({
  required String clusterName,
  required String token,
  String? eksNodeName,
  String? instanceId,
  String? zone,
}) async {
  final $payload = <String, dynamic>{
    'token': token,
    if (eksNodeName != null) 'eksNodeName': eksNodeName,
    if (instanceId != null) 'instanceId': instanceId,
    if (zone != null) 'zone': zone,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/clusters/${Uri.encodeComponent(clusterName)}/assume-role-for-pod-identity',
    exceptionFnMap: _exceptionFns,
  );
  return AssumeRoleForPodIdentityResponse.fromJson(response);
}