MCPcopy Index your code
hub / github.com/zappa/Zappa / undeploy

Method undeploy

zappa/cli.py:1374–1425  ·  view source on GitHub ↗

Tear down an existing deployment.

(self, no_confirm=False, remove_logs=False)

Source from the content-addressed store, hash-verified

1372 os._exit(130)
1373
1374 def undeploy(self, no_confirm=False, remove_logs=False):
1375 """
1376 Tear down an existing deployment.
1377 """
1378
1379 if not no_confirm: # pragma: no cover
1380 confirm = input("Are you sure you want to undeploy? [y/n] ")
1381 if confirm != "y":
1382 return
1383
1384 if self.use_alb:
1385 self.zappa.undeploy_lambda_alb(self.lambda_name)
1386
1387 if self.use_apigateway:
1388 if remove_logs:
1389 self.zappa.remove_api_gateway_logs(self.lambda_name)
1390
1391 domain_name = self.stage_config.get("domain", None)
1392 base_path = self.stage_config.get("base_path", None)
1393
1394 # Only remove the api key when not specified
1395 if self.api_key_required and self.api_key is None:
1396 api_id = self.zappa.get_api_id(self.lambda_name)
1397 self.zappa.remove_api_key(api_id, self.api_stage)
1398
1399 self.zappa.undeploy_api_gateway(self.lambda_name, domain_name=domain_name, base_path=base_path)
1400
1401 self.unschedule() # removes event triggers, including warm up event.
1402
1403 self.zappa.delete_lambda_function(self.lambda_name)
1404 if remove_logs:
1405 self.zappa.remove_lambda_function_logs(self.lambda_name)
1406
1407 # Delete auto-created EFS resources
1408 # Check if any EFS entries were auto-created (no Arn in original config)
1409 raw_efs_config = self.stage_config.get("efs_config", None)
1410 if raw_efs_config:
1411 # Normalize to list to check for auto-created entries
1412 if raw_efs_config is True:
1413 has_auto_created = True
1414 elif isinstance(raw_efs_config, dict):
1415 has_auto_created = "Arn" not in raw_efs_config
1416 elif isinstance(raw_efs_config, list):
1417 has_auto_created = any("Arn" not in efs for efs in raw_efs_config)
1418 else:
1419 has_auto_created = False
1420
1421 if has_auto_created:
1422 click.echo("Deleting auto-created EFS resources...")
1423 self.zappa.delete_efs(self.lambda_name)
1424
1425 click.echo(click.style("Done", fg="green", bold=True) + "!")
1426
1427 def update_cognito_triggers(self):
1428 """

Callers 2

dispatch_commandMethod · 0.95
test_cli_awsMethod · 0.95

Calls 9

unscheduleMethod · 0.95
undeploy_lambda_albMethod · 0.80
get_api_idMethod · 0.80
remove_api_keyMethod · 0.80
undeploy_api_gatewayMethod · 0.80
delete_efsMethod · 0.80

Tested by 1

test_cli_awsMethod · 0.76