'Tear down an exiting deployment.'

def undeploy(self, no_confirm=False, remove_logs=False):

    if (not no_confirm):
        confirm = input(u'Are    you    sure    you    want    to    undeploy?    [y/n]    ')
        if (confirm != u'y'):
            return
    if self.use_apigateway:
        if remove_logs:
            self.zappa.remove_api_gateway_logs(self.lambda_name)
        domain_name = self.stage_config.get(u'domain', None)
        if (self.api_key_required and (self.api_key is None)):
            api_id = self.zappa.get_api_id(self.lambda_name)
            self.zappa.remove_api_key(api_id, self.api_stage)
        gateway_id = self.zappa.undeploy_api_gateway(self.lambda_name, domain_name=domain_name)
    self.unschedule()
    self.zappa.delete_lambda_function(self.lambda_name)
    if remove_logs:
        self.zappa.remove_lambda_function_logs(self.lambda_name)
    click.echo((click.style(u'Done', fg=u'green', bold=True) + u'!'))
