from hcloud import Client from hcloud.load_balancers.domain import ( LoadBalancerService, LoadBalancerServiceHttp, LoadBalancerHealthCheck, LoadBalancerHealtCheckHttp, LoadBalancerTarget ) from hcloud.load_balancer_types.domain import LoadBalancerType client = Client( token="KccUEiddxtzGoLWSNC3V8tylq7MYHCjdnShtgasQ8jSbHqCjGoaa6Rq7yoz4uS23" ) PREFIX = "478815" servers = client.servers.get_all() for s in servers: if s.data_model.name.startswith(PREFIX): action = client.servers.delete(s) print(f"Usuwanie serwera {s.data_model.name} ({s.data_model.public_net.ipv4.ip}): {action.data_model.status}") loadbalancers = client.load_balancers.get_all() for l in loadbalancers: if l.data_model.name.startswith(PREFIX): action = client.load_balancers.delete(l) print(f"Usuwanie load balancera")