forked from GoogleCloudPlatform/python-docs-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete_project.py
More file actions
25 lines (19 loc) · 769 Bytes
/
Copy pathdelete_project.py
File metadata and controls
25 lines (19 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import argparse
from utils import build_client
def run(id):
client = build_client()
project = client.projects().delete(projectId=id)
if project['lifecycleState'] == 'DELETE_REQUESTED':
print("Project {} successfully deleted".format(id))
else:
print("""Project {} was not scheduled for deletion:
either the project is associated with a billing account,
or is not currently active""".format(id))
parser = argparse.ArgumentParser(description='Delete a Google Cloud Project')
parser.add_argument('--id',
type=str,
required=True,
help='Unique Id of the project to delete')
if __name__ == '__main__':
args = parser.parse_args()
run(args.id)