Skip to content

get_environment

get_environment(
    application_id: Name,
    environment_id: Name,
    *,
    config_overrides: Optional[AppConfigClientConfig] = None,
) -> Environment

Retrieves information about an environment. An environment is a deployment group of AppConfig applications, such as applications in a Production environment or in an EU_Region environment. Each configuration deployment targets an environment. You can enable one or more Amazon CloudWatch alarms for an environment. If an alarm is triggered during a deployment, AppConfig roles back the configuration.

Parameters:

  • application_id (Name) –

    The ID of the application that includes the environment you want to get.

  • environment_id (Name) –

    The ID of the environment that you want to get.

Raises:

Examples:

To retrieve environment details The following get-environment example returns the details and state of the specified environment.

>>> client.get_environment(application_id='339ohji', environment_id='54j1r29')
Source code in docs_src/capo_appconfig/_services/app_config.py
def get_environment(
    self,
    application_id: "capo_appconfig.types.name.Name",
    environment_id: "capo_appconfig.types.name.Name",
    *,
    config_overrides: Optional[AppConfigClientConfig] = None,
) -> "capo_appconfig.types.environment.Environment":
    """<p>Retrieves information about an environment. An environment is a deployment group of AppConfig applications, such as applications in a <code>Production</code> environment or in an <code>EU_Region</code> environment. Each configuration deployment targets an environment. You can enable one or more Amazon CloudWatch alarms for an environment. If an alarm is triggered during a deployment, AppConfig roles back the configuration.</p>

    Args:
        application_id: <p>The ID of the application that includes the environment you want to get.</p>
        environment_id: <p>The ID of the environment that you want to get.</p>

    Raises:
        capo_appconfig.errors.bad_request_exception.BadRequestException: <p>The input fails to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_appconfig.errors.internal_server_exception.InternalServerException: <p>There was an internal failure in the AppConfig service.</p>
        capo_appconfig.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource could not be found.</p>
        capo_appconfig.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To retrieve environment details
        The following get-environment example returns the details and state of the specified environment.

        >>> client.get_environment(application_id='339ohji', environment_id='54j1r29')
    """

    def _handler(
        req: "OperationRequest[capo_appconfig.types.get_environment_request.GetEnvironmentRequest]",
    ) -> OperationResponse["capo_appconfig.types.environment.Environment"]:
        import capo_appconfig._operations.amazon_app_config.get_environment

        output, http_response = (
            capo_appconfig._operations.amazon_app_config.get_environment.get_environment(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetEnvironment")
    )
    input_: capo_appconfig.types.get_environment_request.GetEnvironmentRequest = {
        "application_id": application_id,
        "environment_id": environment_id,
    }

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