2023-04-19 12:10:31 +00:00
|
|
|
class Image:
|
2023-04-20 14:29:01 +00:00
|
|
|
def __init__(self, id, token, name, vpn_ip):
|
2023-04-19 12:10:31 +00:00
|
|
|
self.id = id
|
|
|
|
self.name = name
|
|
|
|
self.token = token
|
2023-04-20 14:29:01 +00:00
|
|
|
self.vpn_ip = vpn_ip
|
2023-04-19 12:10:31 +00:00
|
|
|
|
|
|
|
class ImageManager:
|
|
|
|
def __init__(self):
|
|
|
|
self.images = []
|
|
|
|
|
|
|
|
def add_image(self, machine):
|
|
|
|
self.images.append(machine)
|
|
|
|
|
|
|
|
def remove_image(self, machine):
|
|
|
|
self.images.remove(machine)
|
|
|
|
|
|
|
|
def get_image_by_token(self, token):
|
|
|
|
for image in self.images:
|
|
|
|
if image.token == token:
|
|
|
|
return image
|
|
|
|
return None
|