forked from gabanox/reto-2-python-generation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
44 lines (39 loc) · 1.17 KB
/
main.py
File metadata and controls
44 lines (39 loc) · 1.17 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# src/main.py
from .aws_client import create_ec2_client
from .instances_cli import (
list_instances,
create_instance,
stop_instance,
# start_instance,
# reboot_instance,
# terminate_instance,
# filter_instances_by_state,
)
def print_menu():
print("\n=== Cloud Instance Manager ===")
print("1. Listar instancias")
print("2. Crear instancia")
print("3. Detener instancia")
print("4. Iniciar instancia (TODO)")
print("5. Reiniciar instancia (TODO)")
print("6. Terminar instancia (TODO)")
print("7. Filtrar instancias por estado (TODO)")
print("0. Salir")
def main():
ec2_client = create_ec2_client()
while True:
print_menu()
opcion = input("Selecciona una opción: ").strip()
if opcion == "1":
list_instances(ec2_client)
elif opcion == "2":
create_instance(ec2_client)
elif opcion == "3":
stop_instance(ec2_client)
elif opcion == "0":
print("Saliendo del administrador de instancias. ¡Hasta luego!")
break
else:
print("Opción no válida. Intenta nuevamente.")
if __name__ == "__main__":
main()