Skip to content

create_cli_token async

create_cli_token(
    name: EnvironmentName, *, config_overrides: Optional[AsyncMWAAClientConfig] = None
) -> CreateCliTokenResponse

Creates a CLI token for the Airflow CLI. To learn more, see Creating an Apache Airflow CLI token.

Parameters:

  • name (EnvironmentName) –

    The name of the Amazon MWAA environment. For example, MyMWAAEnvironment.

Raises:

Source code in docs_src/capo_mwaa/_services/async_mwaa.py
async def create_cli_token(
    self,
    name: "capo_mwaa.types.environment_name.EnvironmentName",
    *,
    config_overrides: Optional[AsyncMWAAClientConfig] = None,
) -> "capo_mwaa.types.create_cli_token_response.CreateCliTokenResponse":
    """<p>Creates a CLI token for the Airflow CLI. To learn more, see <a href="https://docs.aws.amazon.com/mwaa/latest/userguide/call-mwaa-apis-cli.html">Creating an Apache Airflow CLI token</a>.</p>

    Args:
        name: <p>The name of the Amazon MWAA environment. For example, <code>MyMWAAEnvironment</code>.</p>

    Raises:
        capo_mwaa.errors.resource_not_found_exception.ResourceNotFoundException: <p>ResourceNotFoundException: The resource is not available.</p>
        capo_mwaa.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_mwaa.types.create_cli_token_request.CreateCliTokenRequest]",
    ) -> AsyncOperationResponse[
        "capo_mwaa.types.create_cli_token_response.CreateCliTokenResponse"
    ]:
        import capo_mwaa._operations.amazon_mwaa.create_cli_token

        (
            output,
            http_response,
        ) = await capo_mwaa._operations.amazon_mwaa.create_cli_token.async_create_cli_token(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_mwaa.types.create_cli_token_response.CreateCliTokenResponse",
    ) -> dict[str, Any]:
        import capo_mwaa.types.create_cli_token_response

        return capo_mwaa.types.create_cli_token_response.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateCliToken", redact_output=_redact_output),
    )
    input_: capo_mwaa.types.create_cli_token_request.CreateCliTokenRequest = {
        "name": name
    }

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