verda 0.1.0__py3-none-any.whl → 1.17.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,50 @@
1
+ BALANCE_ENDPOINT = '/balance'
2
+
3
+
4
+ class Balance:
5
+ """A balance model class."""
6
+
7
+ def __init__(self, amount: float, currency: str) -> None:
8
+ """Initialize a new Balance object.
9
+
10
+ :param amount: Balance amount
11
+ :type amount: float
12
+ :param currency: currency code
13
+ :type currency: str
14
+ """
15
+ self._amount = amount
16
+ self._currency = currency
17
+
18
+ @property
19
+ def amount(self) -> float:
20
+ """Get the balance amount.
21
+
22
+ :return: amount
23
+ :rtype: float
24
+ """
25
+ return self._amount
26
+
27
+ @property
28
+ def currency(self) -> str:
29
+ """Get the currency code.
30
+
31
+ :return: currency code
32
+ :rtype: str
33
+ """
34
+ return self._currency
35
+
36
+
37
+ class BalanceService:
38
+ """A service for interacting with the balance endpoint."""
39
+
40
+ def __init__(self, http_client) -> None:
41
+ self._http_client = http_client
42
+
43
+ def get(self) -> Balance:
44
+ """Get the client's current balance.
45
+
46
+ :return: Balance object containing the amount and currency.
47
+ :rtype: Balance
48
+ """
49
+ balance = self._http_client.get(BALANCE_ENDPOINT).json()
50
+ return Balance(balance['amount'], balance['currency'])
verda/constants.py ADDED
@@ -0,0 +1,126 @@
1
+ class Actions:
2
+ """Instance actions."""
3
+
4
+ START = 'start'
5
+ SHUTDOWN = 'shutdown'
6
+ DELETE = 'delete'
7
+ HIBERNATE = 'hibernate'
8
+ RESTORE = 'restore'
9
+
10
+ def __init__(self):
11
+ return
12
+
13
+
14
+ class VolumeActions:
15
+ """Storage volume actions."""
16
+
17
+ ATTACH = 'attach'
18
+ DETACH = 'detach'
19
+ RENAME = 'rename'
20
+ INCREASE_SIZE = 'resize'
21
+ DELETE = 'delete'
22
+ CLONE = 'clone'
23
+
24
+ def __init__(self):
25
+ return
26
+
27
+
28
+ class InstanceStatus:
29
+ """Instance status."""
30
+
31
+ ORDERED = 'ordered'
32
+ RUNNING = 'running'
33
+ PROVISIONING = 'provisioning'
34
+ OFFLINE = 'offline'
35
+ STARTING_HIBERNATION = 'starting_hibernation'
36
+ HIBERNATING = 'hibernating'
37
+ RESTORING = 'restoring'
38
+ ERROR = 'error'
39
+
40
+ def __init__(self):
41
+ return
42
+
43
+
44
+ class VolumeStatus:
45
+ """Storage volume status."""
46
+
47
+ ORDERED = 'ordered'
48
+ CREATING = 'creating'
49
+ ATTACHED = 'attached'
50
+ DETACHED = 'detached'
51
+ DELETING = 'deleting'
52
+ DELETED = 'deleted'
53
+ CLONING = 'cloning'
54
+
55
+ def __init__(self):
56
+ return
57
+
58
+
59
+ class VolumeTypes:
60
+ """Storage volume types."""
61
+
62
+ NVMe = 'NVMe'
63
+ HDD = 'HDD'
64
+ SFS = 'NVMe_Shared'
65
+
66
+ def __init__(self):
67
+ return
68
+
69
+
70
+ class Locations:
71
+ """Datacenter locations."""
72
+
73
+ FIN_01: str = 'FIN-01'
74
+ FIN_02: str = 'FIN-02'
75
+ FIN_03: str = 'FIN-03'
76
+ ICE_01: str = 'ICE-01'
77
+
78
+ def __init__(self):
79
+ return
80
+
81
+
82
+ class ErrorCodes:
83
+ """Error codes."""
84
+
85
+ INVALID_REQUEST = 'invalid_request'
86
+ UNAUTHORIZED_REQUEST = 'unauthorized_request'
87
+ INSUFFICIENT_FUNDS = 'insufficient_funds'
88
+ FORBIDDEN_ACTION = 'forbidden_action'
89
+ NOT_FOUND = 'not_found'
90
+ SERVER_ERROR = 'server_error'
91
+ SERVICE_UNAVAILABLE = 'service_unavailable'
92
+
93
+ def __init__(self):
94
+ return
95
+
96
+
97
+ class Constants:
98
+ """Constants."""
99
+
100
+ def __init__(self, base_url, version):
101
+ self.instance_actions: Actions = Actions()
102
+ """Available actions to perform on an instance"""
103
+
104
+ self.volume_actions: VolumeActions = VolumeActions()
105
+ """Available actions to perform on a volume"""
106
+
107
+ self.instance_status: InstanceStatus = InstanceStatus()
108
+ """Possible instance statuses"""
109
+
110
+ self.volume_status: VolumeStatus = VolumeStatus()
111
+ """Possible volume statuses"""
112
+
113
+ self.volume_types: VolumeTypes = VolumeTypes()
114
+ """Available volume types"""
115
+
116
+ self.locations: Locations = Locations()
117
+ """Available locations"""
118
+
119
+ self.error_codes: ErrorCodes = ErrorCodes()
120
+ """Available error codes"""
121
+
122
+ self.base_url: str = base_url
123
+ """Verda Public API URL"""
124
+
125
+ self.version: str = version
126
+ """Current SDK Version"""
@@ -0,0 +1,33 @@
1
+ from .containers import (
2
+ AWSECRCredentials,
3
+ BaseRegistryCredentials,
4
+ ComputeResource,
5
+ Container,
6
+ ContainerDeploymentStatus,
7
+ ContainerRegistryCredentials,
8
+ ContainerRegistrySettings,
9
+ ContainerRegistryType,
10
+ ContainersService,
11
+ CustomRegistryCredentials,
12
+ Deployment,
13
+ DockerHubCredentials,
14
+ EntrypointOverridesSettings,
15
+ EnvVar,
16
+ EnvVarType,
17
+ GCRCredentials,
18
+ GeneralStorageMount,
19
+ GithubCredentials,
20
+ HealthcheckSettings,
21
+ QueueLoadScalingTrigger,
22
+ RegistryCredential,
23
+ ReplicaInfo,
24
+ ScalingOptions,
25
+ ScalingPolicy,
26
+ ScalingTriggers,
27
+ Secret,
28
+ SecretMount,
29
+ SharedFileSystemMount,
30
+ UtilizationScalingTrigger,
31
+ VolumeMount,
32
+ VolumeMountType,
33
+ )