diff --git a/hcloud/servers/domain.py b/hcloud/servers/domain.py index d3ce84d..db8707b 100644 --- a/hcloud/servers/domain.py +++ b/hcloud/servers/domain.py @@ -40,6 +40,24 @@ class Server(BaseDomain): :param volumes: List[:class:`BoundVolume `] Volumes assigned to this server. """ + STATUS_RUNNING = "running" + """Server Status running""" + STATUS_INIT = "initializing" + """Server Status initializing""" + STATUS_STARTING = "starting" + """Server Status starting""" + STATUS_STOPPING = "stopping" + """Server Status stopping""" + STATUS_OFF = "off" + """Server Status off""" + STATUS_DELETING = "deleting" + """Server Status deleting""" + STATUS_MIGRATING = "migrating" + """Server Status migrating""" + STATUS_REBUILDING = "rebuilding" + """Server Status rebuilding""" + STATUS_UNKNOWN = "unknown" + """Server Status unknown""" __slots__ = ( "id", "name", @@ -62,7 +80,7 @@ class Server(BaseDomain): created = ISODateTime() - supported_fields = ("created", ) + supported_fields = ("created",) def __init__( self, diff --git a/hcloud/volumes/domain.py b/hcloud/volumes/domain.py index 4a89f40..20d932d 100644 --- a/hcloud/volumes/domain.py +++ b/hcloud/volumes/domain.py @@ -29,6 +29,11 @@ class Volume(BaseDomain, DomainIdentityMixin): :param format: str, None Filesystem of the volume if formatted on creation, None if not formatted on creation. """ + STATUS_CREATING = "creating" + """Volume Status creating""" + STATUS_AVAILABLE = "available" + """Volume Status available""" + created = ISODateTime() __slots__ = ( @@ -44,7 +49,7 @@ class Volume(BaseDomain, DomainIdentityMixin): "status" ) - supported_fields = ("created", ) + supported_fields = ("created",) def __init__( self, diff --git a/tests/unit/servers/test_client.py b/tests/unit/servers/test_client.py index dbed7e9..890c17e 100644 --- a/tests/unit/servers/test_client.py +++ b/tests/unit/servers/test_client.py @@ -85,7 +85,7 @@ def test_bound_server_init(self, response_full_server): @pytest.mark.parametrize( "params", [ - {"status": ["running"], + {"status": [Server.STATUS_RUNNING], "sort": "status", "page": 1, "per_page": 10}, @@ -109,7 +109,7 @@ def test_get_actions_list(self, hetzner_client, bound_server, response_get_actio @pytest.mark.parametrize( "params", [ - {"status": ["running"], + {"status": [Server.STATUS_RUNNING], "sort": "status"}, {}