Skip to content

create_microvm_shell_auth_token

create_microvm_shell_auth_token(
    microvm_identifier: MicrovmIdentifier,
    expiration_in_minutes: PositiveInteger,
    *,
    config_overrides: Optional[LambdaMicrovmsClientConfig] = None,
) -> CreateMicrovmShellAuthTokenResponse

Creates a shell authentication token for interactive shell access to a running MicroVM. The MicroVM must have been run with the SHELL_INGRESS network connector attached.

Parameters:

  • microvm_identifier (MicrovmIdentifier) –

    The ID of the MicroVM to create a shell authentication token for.

  • expiration_in_minutes (PositiveInteger) –

    The duration in minutes before the shell authentication token expires.

Raises:

Source code in docs_src/capo_lambda_microvms/_services/lambda_microvms.py
def create_microvm_shell_auth_token(
    self,
    microvm_identifier: "capo_lambda_microvms.types.microvm_identifier.MicrovmIdentifier",
    expiration_in_minutes: "capo_lambda_microvms.types.positive_integer.PositiveInteger",
    *,
    config_overrides: Optional[LambdaMicrovmsClientConfig] = None,
) -> "capo_lambda_microvms.types.create_microvm_shell_auth_token_response.CreateMicrovmShellAuthTokenResponse":
    """<p>Creates a shell authentication token for interactive shell access to a running MicroVM. The MicroVM must have been run with the SHELL_INGRESS network connector attached.</p>

    Args:
        microvm_identifier: <p>The ID of the MicroVM to create a shell authentication token for.</p>
        expiration_in_minutes: <p>The duration in minutes before the shell authentication token expires.</p>

    Raises:
        capo_lambda_microvms.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_lambda_microvms.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry the request later.</p>
        capo_lambda_microvms.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Retry the request later.</p>
        capo_lambda_microvms.errors.validation_exception.ValidationException: <p>The input does not satisfy the constraints specified by the service.</p>
        capo_lambda_microvms.errors.conflict_exception.ConflictException: <p>The request could not be completed due to a conflict with the current state of the resource.</p>
        capo_lambda_microvms.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_lambda_microvms.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_lambda_microvms.types.create_microvm_shell_auth_token_request.CreateMicrovmShellAuthTokenRequest]",
    ) -> OperationResponse[
        "capo_lambda_microvms.types.create_microvm_shell_auth_token_response.CreateMicrovmShellAuthTokenResponse"
    ]:
        import capo_lambda_microvms._operations.lambda_microvms.create_microvm_shell_auth_token

        output, http_response = (
            capo_lambda_microvms._operations.lambda_microvms.create_microvm_shell_auth_token.create_microvm_shell_auth_token(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_lambda_microvms.types.create_microvm_shell_auth_token_response.CreateMicrovmShellAuthTokenResponse",
    ) -> dict[str, Any]:
        import capo_lambda_microvms.types.create_microvm_shell_auth_token_response

        return capo_lambda_microvms.types.create_microvm_shell_auth_token_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateMicrovmShellAuthToken", redact_output=_redact_output
        ),
    )
    input_: capo_lambda_microvms.types.create_microvm_shell_auth_token_request.CreateMicrovmShellAuthTokenRequest = {
        "microvm_identifier": microvm_identifier,
        "expiration_in_minutes": expiration_in_minutes,
    }

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