Skip to content

get_environment async

get_environment(
    id: EnvironmentId,
    *,
    config_overrides: Optional[AsyncWorkSpacesThinClientClientConfig] = None,
) -> GetEnvironmentResponse

Returns information for an environment.

Parameters:

  • id (EnvironmentId) –

    The ID of the environment for which to return information.

Raises:

Source code in docs_src/capo_workspaces_thin_client/_services/async_work_spaces_thin_client.py
async def get_environment(
    self,
    id: "capo_workspaces_thin_client.types.environment_id.EnvironmentId",
    *,
    config_overrides: Optional[AsyncWorkSpacesThinClientClientConfig] = None,
) -> "capo_workspaces_thin_client.types.get_environment_response.GetEnvironmentResponse":
    """<p>Returns information for an environment.</p>

    Args:
        id: <p>The ID of the environment for which to return information.</p>

    Raises:
        capo_workspaces_thin_client.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_workspaces_thin_client.errors.internal_server_exception.InternalServerException: <p>The server encountered an internal error and is unable to complete the request.</p>
        capo_workspaces_thin_client.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request was not found.</p>
        capo_workspaces_thin_client.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_workspaces_thin_client.errors.validation_exception.ValidationException: <p>The input fails to satisfy the specified constraints.</p>
        capo_workspaces_thin_client.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_workspaces_thin_client.types.get_environment_request.GetEnvironmentRequest]",
    ) -> AsyncOperationResponse[
        "capo_workspaces_thin_client.types.get_environment_response.GetEnvironmentResponse"
    ]:
        import capo_workspaces_thin_client._operations.thin_client.get_environment

        (
            output,
            http_response,
        ) = await capo_workspaces_thin_client._operations.thin_client.get_environment.async_get_environment(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_workspaces_thin_client.types.get_environment_response.GetEnvironmentResponse",
    ) -> dict[str, Any]:
        import capo_workspaces_thin_client.types.get_environment_response

        return capo_workspaces_thin_client.types.get_environment_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("GetEnvironment", redact_output=_redact_output),
    )
    input_: capo_workspaces_thin_client.types.get_environment_request.GetEnvironmentRequest = {
        "id": id
    }

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