Skip to content

get_cluster_session_credentials

get_cluster_session_credentials(
    *,
    config_overrides: Optional[EMRClientConfig] = None,
    cluster_id: Optional[XmlStringMaxLen256] = None,
    execution_role_arn: Optional[ArnType] = None,
) -> GetClusterSessionCredentialsOutput

Provides temporary, HTTP basic credentials that are associated with a given runtime IAM role and used by a cluster with fine-grained access control activated. You can use these credentials to connect to cluster endpoints that support username and password authentication.

Parameters:

  • cluster_id (Optional[XmlStringMaxLen256], default: None ) –

    The unique identifier of the cluster.

  • execution_role_arn (Optional[ArnType], default: None ) –

    The Amazon Resource Name (ARN) of the runtime role for interactive workload submission on the cluster. The runtime role can be a cross-account IAM role. The runtime role ARN is a combination of account ID, role name, and role type using the following format: arn:partition:service:region:account:resource.

Raises:

  • InternalServerError –

    Indicates that an error occurred while processing the request and that the request was not completed.

  • InvalidRequestException –

    This exception occurs when there is something wrong with user input.

  • UnknownServiceError –

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

Source code in docs_src/capo_emr/_services/emr.py
def get_cluster_session_credentials(
    self,
    *,
    config_overrides: Optional[EMRClientConfig] = None,
    cluster_id: Optional[
        "capo_emr.types.xml_string_max_len256.XmlStringMaxLen256"
    ] = None,
    execution_role_arn: Optional["capo_emr.types.arn_type.ArnType"] = None,
) -> "capo_emr.types.get_cluster_session_credentials_output.GetClusterSessionCredentialsOutput":
    """<p>Provides temporary, HTTP basic credentials that are associated with a given runtime IAM role and used by a cluster with fine-grained access control activated. You can use these credentials to connect to cluster endpoints that support username and password authentication.</p>

    Args:
        cluster_id: <p>The unique identifier of the cluster.</p>
        execution_role_arn: <p>The Amazon Resource Name (ARN) of the runtime role for interactive workload submission on the cluster. The runtime role can be a cross-account IAM role. The runtime role ARN is a combination of account ID, role name, and role type using the following format: <code>arn:partition:service:region:account:resource</code>.</p>

    Raises:
        capo_emr.errors.internal_server_error.InternalServerError: <p>Indicates that an error occurred while processing the request and that the request was not completed.</p>
        capo_emr.errors.invalid_request_exception.InvalidRequestException: <p>This exception occurs when there is something wrong with user input.</p>
        capo_emr.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_emr.types.get_cluster_session_credentials_input.GetClusterSessionCredentialsInput]",
    ) -> OperationResponse[
        "capo_emr.types.get_cluster_session_credentials_output.GetClusterSessionCredentialsOutput"
    ]:
        import capo_emr._operations.elastic_map_reduce.get_cluster_session_credentials

        output, http_response = (
            capo_emr._operations.elastic_map_reduce.get_cluster_session_credentials.get_cluster_session_credentials(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_emr.types.get_cluster_session_credentials_output.GetClusterSessionCredentialsOutput",
    ) -> dict[str, Any]:
        import capo_emr.types.get_cluster_session_credentials_output

        return (
            capo_emr.types.get_cluster_session_credentials_output.redact_sensitive(
                output
            )
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "GetClusterSessionCredentials", redact_output=_redact_output
        ),
    )
    input_: capo_emr.types.get_cluster_session_credentials_input.GetClusterSessionCredentialsInput = {}
    if cluster_id is not None:
        input_["cluster_id"] = cluster_id
    if execution_role_arn is not None:
        input_["execution_role_arn"] = execution_role_arn

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output