Skip to content

delete_application

delete_application(
    application_name: ApplicationName,
    *,
    config_overrides: Optional[ElasticBeanstalkClientConfig] = None,
    terminate_env_by_force: Optional[TerminateEnvForce] = None,
) -> None

Deletes the specified application along with all associated versions and configurations. The application versions will not be deleted from your Amazon S3 bucket.

You cannot delete an application that has a running environment.

Parameters:

  • application_name (ApplicationName) –

    The name of the application to delete.

  • terminate_env_by_force (Optional[TerminateEnvForce], default: None ) –

    When set to true, running environments will be terminated before deleting the application.

Raises:

  • OperationInProgressException –

    Unable to perform the specified operation because another operation that effects an element in this activity is already in progress.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

To delete an application The following operation deletes an application named my-app:

>>> client.delete_application(application_name='my-app')
Source code in docs_src/capo_elastic_beanstalk/_services/elastic_beanstalk.py
def delete_application(
    self,
    application_name: "capo_elastic_beanstalk.types.application_name.ApplicationName",
    *,
    config_overrides: Optional[ElasticBeanstalkClientConfig] = None,
    terminate_env_by_force: Optional[
        "capo_elastic_beanstalk.types.terminate_env_force.TerminateEnvForce"
    ] = None,
) -> None:
    """<p>Deletes the specified application along with all associated versions and configurations. The application versions will not be deleted from your Amazon S3 bucket.</p> <note> <p>You cannot delete an application that has a running environment.</p> </note>

    Args:
        application_name: <p>The name of the application to delete.</p>
        terminate_env_by_force: <p>When set to true, running environments will be terminated before deleting the application.</p>

    Raises:
        capo_elastic_beanstalk.errors.operation_in_progress_exception.OperationInProgressException: <p>Unable to perform the specified operation because another operation that effects an element in this activity is already in progress.</p>
        capo_elastic_beanstalk.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To delete an application
        The following operation deletes an application named my-app:

        >>> client.delete_application(application_name='my-app')
    """

    def _handler(
        req: "OperationRequest[capo_elastic_beanstalk.types.delete_application_message.DeleteApplicationMessage]",
    ) -> OperationResponse[None]:
        import capo_elastic_beanstalk._operations.aws_elastic_beanstalk_service.delete_application

        output, http_response = (
            capo_elastic_beanstalk._operations.aws_elastic_beanstalk_service.delete_application.delete_application(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteApplication")
    )
    input_: capo_elastic_beanstalk.types.delete_application_message.DeleteApplicationMessage = {
        "application_name": application_name
    }
    if terminate_env_by_force is not None:
        input_["terminate_env_by_force"] = terminate_env_by_force

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