Skip to content

Commit 29ac719

Browse files
committed
WIP
1 parent 7c14f24 commit 29ac719

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

datacrunch/constants.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ def __init__(self):
5555
return
5656

5757

58+
class Locations:
59+
FIN_01 = "FIN-01"
60+
ICE_01 = "ICE-01"
61+
62+
def __init__(self):
63+
return
64+
65+
5866
class ErrorCodes:
5967
INVALID_REQUEST = "invalid_request"
6068
UNAUTHORIZED_REQUEST = "unauthorized_request"
@@ -85,6 +93,9 @@ def __init__(self, base_url, version):
8593
self.volume_types: VolumeTypes = VolumeTypes()
8694
"""Available volume types"""
8795

96+
self.locations: Locations = Locations()
97+
"""Available locations"""
98+
8899
self.error_codes: ErrorCodes = ErrorCodes()
89100
"""Available error codes"""
90101

datacrunch/instances/instances.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def __init__(self,
2424
storage: dict,
2525
os_volume_id: str,
2626
gpu_memory: dict,
27-
location: str = "FIN1",
27+
location: str = "FIN-01",
2828
startup_script_id: str = None,
2929
is_spot: bool = False
3030
) -> None:
@@ -62,7 +62,7 @@ def __init__(self,
6262
:type id: str
6363
:param memory: gpu memory details
6464
:type memory: dict
65-
:param location: datacenter location, defaults to "FIN1"
65+
:param location: datacenter location, defaults to "FIN-01"
6666
:type location: str, optional
6767
:param startup_script_id: startup script id, defaults to None
6868
:type startup_script_id: str, optional
@@ -268,6 +268,7 @@ def __str__(self) -> str:
268268
"""
269269
return stringify_class_object_properties(self)
270270

271+
271272
class InstancesService:
272273
"""A service for interacting with the instances endpoint"""
273274

@@ -295,7 +296,8 @@ def get(self, status: str = None) -> List[Instance]:
295296
ip=instance_dict['ip'],
296297
status=instance_dict['status'],
297298
created_at=instance_dict['created_at'],
298-
ssh_key_ids=instance_dict['ssh_key_ids'] if 'ssh_key_ids' in instance_dict else [],
299+
ssh_key_ids=instance_dict['ssh_key_ids'] if 'ssh_key_ids' in instance_dict else [
300+
],
299301
startup_script_id=instance_dict['startup_script_id'] if 'startup_script_id' in instance_dict else None,
300302
cpu=instance_dict['cpu'],
301303
gpu=instance_dict['gpu'],
@@ -328,7 +330,8 @@ def get_by_id(self, id: str) -> Instance:
328330
ip=instance_dict['ip'],
329331
status=instance_dict['status'],
330332
created_at=instance_dict['created_at'],
331-
ssh_key_ids=instance_dict['ssh_key_ids'] if 'ssh_key_ids' in instance_dict else [],
333+
ssh_key_ids=instance_dict['ssh_key_ids'] if 'ssh_key_ids' in instance_dict else [
334+
],
332335
startup_script_id=instance_dict['startup_script_id'] if 'startup_script_id' in instance_dict else None,
333336
cpu=instance_dict['cpu'],
334337
gpu=instance_dict['gpu'],
@@ -346,7 +349,7 @@ def create(self,
346349
hostname: str,
347350
description: str,
348351
ssh_key_ids: list = [],
349-
location: str = "FIN1",
352+
location: str = "FIN-01",
350353
startup_script_id: str = None,
351354
volumes: List[Dict] = None,
352355
existing_volumes: List[str] = None,
@@ -365,7 +368,7 @@ def create(self,
365368
:type hostname: str
366369
:param description: instance description
367370
:type description: str
368-
:param location: datacenter location, defaults to "FIN1"
371+
:param location: datacenter location, defaults to "FIN-01"
369372
:type location: str, optional
370373
:param startup_script_id: startup script id, defaults to None
371374
:type startup_script_id: str, optional

datacrunch/volumes/volumes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def __init__(self,
1717
is_os_volume: bool,
1818
created_at: str,
1919
target: str = None,
20-
location: str = "FIN1",
20+
location: str = "FIN-01",
2121
instance_id: str = None,
2222
ssh_key_ids: List[str] = [],
2323
deleted_at: str = None,
@@ -40,7 +40,7 @@ def __init__(self,
4040
:type created_at: str
4141
:param target: target device e.g. vda
4242
:type target: str, optional
43-
:param location: datacenter location, defaults to "FIN1"
43+
:param location: datacenter location, defaults to "FIN-01"
4444
:type location: str, optional
4545
:param instance_id: the instance id the volume is attached to, None if detached
4646
:type instance_id: str

0 commit comments

Comments
 (0)