Skip to content

list_backend_environments

list_backend_environments(
    app_id: AppId,
    *,
    config_overrides: Optional[AmplifyClientConfig] = None,
    environment_name: Optional[EnvironmentName] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[MaxResults] = None,
) -> ListBackendEnvironmentsResult

Lists the backend environments for an Amplify app.

This API is available only to Amplify Gen 1 applications where the backend is created using Amplify Studio or the Amplify command line interface (CLI). This API isn’t available to Amplify Gen 2 applications. When you deploy an application with Amplify Gen 2, you provision the app's backend infrastructure using Typescript code.

Parameters:

  • app_id (AppId) –

    The unique ID for an Amplify app.

  • environment_name (Optional[EnvironmentName], default: None ) –

    The name of the backend environment

  • next_token (Optional[NextToken], default: None ) –

    A pagination token. Set to null to start listing backend environments from the start. If a non-null pagination token is returned in a result, pass its value in here to list more backend environments.

  • max_results (Optional[MaxResults], default: None ) –

    The maximum number of records to list in a single response.

Raises:

Source code in docs_src/capo_amplify/_services/amplify.py
def list_backend_environments(
    self,
    app_id: "capo_amplify.types.app_id.AppId",
    *,
    config_overrides: Optional[AmplifyClientConfig] = None,
    environment_name: Optional[
        "capo_amplify.types.environment_name.EnvironmentName"
    ] = None,
    next_token: Optional["capo_amplify.types.next_token.NextToken"] = None,
    max_results: Optional["capo_amplify.types.max_results.MaxResults"] = None,
) -> "capo_amplify.types.list_backend_environments_result.ListBackendEnvironmentsResult":
    """<p>Lists the backend environments for an Amplify app. </p> <p>This API is available only to Amplify Gen 1 applications where the backend is created using Amplify Studio or the Amplify command line interface (CLI). This API isn’t available to Amplify Gen 2 applications. When you deploy an application with Amplify Gen 2, you provision the app's backend infrastructure using Typescript code.</p>

    Args:
        app_id: <p>The unique ID for an Amplify app. </p>
        environment_name: <p>The name of the backend environment </p>
        next_token: <p>A pagination token. Set to null to start listing backend environments from the start. If a non-null pagination token is returned in a result, pass its value in here to list more backend environments. </p>
        max_results: <p>The maximum number of records to list in a single response. </p>

    Raises:
        capo_amplify.errors.bad_request_exception.BadRequestException: <p>A request contains unexpected data. </p>
        capo_amplify.errors.internal_failure_exception.InternalFailureException: <p>The service failed to perform an operation due to an internal issue. </p>
        capo_amplify.errors.unauthorized_exception.UnauthorizedException: <p>An operation failed due to a lack of access. </p>
        capo_amplify.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_amplify.types.list_backend_environments_request.ListBackendEnvironmentsRequest]",
    ) -> OperationResponse[
        "capo_amplify.types.list_backend_environments_result.ListBackendEnvironmentsResult"
    ]:
        import capo_amplify._operations.amplify.list_backend_environments

        output, http_response = (
            capo_amplify._operations.amplify.list_backend_environments.list_backend_environments(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListBackendEnvironments")
    )
    input_: capo_amplify.types.list_backend_environments_request.ListBackendEnvironmentsRequest = {
        "app_id": app_id
    }
    if environment_name is not None:
        input_["environment_name"] = environment_name
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

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