Skip to content

assume_role_for_pod_identity async

assume_role_for_pod_identity(
    cluster_name: ClusterName,
    token: JwtToken,
    *,
    config_overrides: Optional[AsyncEKSAuthClientConfig] = None,
    eks_node_name: Optional[str] = None,
    instance_id: Optional[str] = None,
    zone: Optional[str] = None,
) -> AssumeRoleForPodIdentityResponse

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.

Parameters:

  • cluster_name (ClusterName) –

    The name of the cluster for the request.

  • token (JwtToken) –

    The token of the Kubernetes service account for the pod.

  • eks_node_name (Optional[str], default: None ) –

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

  • instance_id (Optional[str], default: None ) –

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

  • zone (Optional[str], default: None ) –

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

Raises:

  • AccessDeniedException –

    You don't have permissions to perform the requested operation. The IAM principal making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access management in the IAM User Guide.

  • ExpiredTokenException –

    The specified Kubernetes service account token is expired.

  • InternalServerException –

    These errors are usually caused by a server-side issue.

  • InvalidParameterException –

    The specified parameter is invalid. Review the available parameters for the API request.

  • InvalidRequestException –

    This exception is thrown if the request contains a semantic error. The precise meaning will depend on the API, and will be documented in the error message.

  • InvalidTokenException –

    The specified Kubernetes service account token is invalid.

  • ResourceNotFoundException –

    The specified resource could not be found.

  • ServiceUnavailableException –

    The service is unavailable. Back off and retry the operation.

  • ThrottlingException –

    The request was denied because your request rate is too high. Reduce the frequency of requests.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_eks_auth/_services/async_eks_auth.py
async def assume_role_for_pod_identity(
    self,
    cluster_name: "capo_eks_auth.types.cluster_name.ClusterName",
    token: "capo_eks_auth.types.jwt_token.JwtToken",
    *,
    config_overrides: Optional[AsyncEKSAuthClientConfig] = None,
    eks_node_name: Optional[str] = None,
    instance_id: Optional[str] = None,
    zone: Optional[str] = None,
) -> "capo_eks_auth.types.assume_role_for_pod_identity_response.AssumeRoleForPodIdentityResponse":
    """<p>The Amazon EKS Auth API and the <code>AssumeRoleForPodIdentity</code> action are only used by the EKS Pod Identity Agent.</p> <p>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.</p>

    Args:
        cluster_name: <p>The name of the cluster for the request.</p>
        token: <p>The token of the Kubernetes service account for the pod.</p>
        eks_node_name: <p>The Kubernetes node name of the worker node where the pod is running.</p>
        instance_id: <p>The Amazon EC2 instance ID of the worker node where the pod is running.</p>
        zone: <p>The Availability Zone ID of the worker node where the pod is running.</p>

    Raises:
        capo_eks_auth.errors.access_denied_exception.AccessDeniedException: <p>You don't have permissions to perform the requested operation. The IAM principal making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access management</a> in the <i>IAM User Guide</i>. </p>
        capo_eks_auth.errors.expired_token_exception.ExpiredTokenException: <p>The specified Kubernetes service account token is expired.</p>
        capo_eks_auth.errors.internal_server_exception.InternalServerException: <p>These errors are usually caused by a server-side issue.</p>
        capo_eks_auth.errors.invalid_parameter_exception.InvalidParameterException: <p>The specified parameter is invalid. Review the available parameters for the API request.</p>
        capo_eks_auth.errors.invalid_request_exception.InvalidRequestException: <p>This exception is thrown if the request contains a semantic error. The precise meaning will depend on the API, and will be documented in the error message.</p>
        capo_eks_auth.errors.invalid_token_exception.InvalidTokenException: <p>The specified Kubernetes service account token is invalid.</p>
        capo_eks_auth.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource could not be found.</p>
        capo_eks_auth.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is unavailable. Back off and retry the operation.</p>
        capo_eks_auth.errors.throttling_exception.ThrottlingException: <p>The request was denied because your request rate is too high. Reduce the frequency of requests.</p>
        capo_eks_auth.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_eks_auth.types.assume_role_for_pod_identity_request.AssumeRoleForPodIdentityRequest]",
    ) -> AsyncOperationResponse[
        "capo_eks_auth.types.assume_role_for_pod_identity_response.AssumeRoleForPodIdentityResponse"
    ]:
        import capo_eks_auth._operations.eks_auth_frontend.assume_role_for_pod_identity

        (
            output,
            http_response,
        ) = await capo_eks_auth._operations.eks_auth_frontend.assume_role_for_pod_identity.async_assume_role_for_pod_identity(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_eks_auth.types.assume_role_for_pod_identity_request.AssumeRoleForPodIdentityRequest",
    ) -> dict[str, Any]:
        import capo_eks_auth.types.assume_role_for_pod_identity_request

        return capo_eks_auth.types.assume_role_for_pod_identity_request.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_eks_auth.types.assume_role_for_pod_identity_response.AssumeRoleForPodIdentityResponse",
    ) -> dict[str, Any]:
        import capo_eks_auth.types.assume_role_for_pod_identity_response

        return capo_eks_auth.types.assume_role_for_pod_identity_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "AssumeRoleForPodIdentity",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_eks_auth.types.assume_role_for_pod_identity_request.AssumeRoleForPodIdentityRequest = {
        "cluster_name": cluster_name,
        "token": token,
    }
    if eks_node_name is not None:
        input_["eks_node_name"] = eks_node_name
    if instance_id is not None:
        input_["instance_id"] = instance_id
    if zone is not None:
        input_["zone"] = zone

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output