24 lines
559 B
Python
24 lines
559 B
Python
from hcloud import Client
|
|
|
|
api_token = ""
|
|
with open("token.txt", "r") as file:
|
|
api_token = file.read().strip()
|
|
|
|
client = Client(
|
|
token=api_token
|
|
)
|
|
INDEKS = "s444455"
|
|
|
|
servers = client.servers.get_all()
|
|
for i in servers:
|
|
if i.data_model.name.startswith(INDEKS):
|
|
action = client.servers.delete(i)
|
|
print("Cleaning servers: done")
|
|
|
|
load_balancers = client.load_balancers.get_all()
|
|
|
|
for lb in load_balancers:
|
|
if lb.data_model.name.startswith(INDEKS):
|
|
action = client.load_balancers.delete(lb)
|
|
print(f'Cleaning load balanced: done')
|