gcore 0.1.0a1__py3-none-any.whl → 0.2.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.
Potentially problematic release.
This version of gcore might be problematic. Click here for more details.
- gcore/__init__.py +5 -0
- gcore/_client.py +9 -0
- gcore/_utils/_proxy.py +4 -1
- gcore/_utils/_resources_proxy.py +24 -0
- gcore/_version.py +1 -1
- gcore/resources/__init__.py +14 -0
- gcore/resources/cloud/baremetal/servers.py +234 -0
- gcore/resources/cloud/billing_reservations.py +24 -0
- gcore/resources/cloud/file_shares/file_shares.py +16 -0
- gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +352 -2
- gcore/resources/cloud/gpu_baremetal_clusters/images.py +204 -0
- gcore/resources/cloud/gpu_baremetal_clusters/servers.py +80 -0
- gcore/resources/cloud/inference/deployments/deployments.py +322 -4
- gcore/resources/cloud/instances/images.py +316 -0
- gcore/resources/cloud/instances/instances.py +472 -0
- gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py +282 -0
- gcore/resources/cloud/load_balancers/l7_policies/rules.py +326 -0
- gcore/resources/cloud/load_balancers/listeners.py +371 -6
- gcore/resources/cloud/load_balancers/load_balancers.py +364 -0
- gcore/resources/cloud/load_balancers/pools/health_monitors.py +24 -0
- gcore/resources/cloud/load_balancers/pools/members.py +28 -0
- gcore/resources/cloud/load_balancers/pools/pools.py +388 -8
- gcore/resources/cloud/networks/networks.py +72 -16
- gcore/resources/cloud/secrets.py +56 -11
- gcore/resources/cloud/tasks.py +107 -96
- gcore/resources/waap/__init__.py +33 -0
- gcore/resources/waap/domains/__init__.py +33 -0
- gcore/resources/waap/domains/domains.py +515 -0
- gcore/resources/waap/domains/settings.py +271 -0
- gcore/resources/waap/waap.py +102 -0
- gcore/types/cloud/__init__.py +1 -0
- gcore/types/cloud/billing_reservation_list_params.py +5 -0
- gcore/types/cloud/container_probe_config_create_param.py +1 -2
- gcore/types/cloud/file_share.py +3 -0
- gcore/types/cloud/file_share_list_params.py +7 -1
- gcore/types/cloud/gpu_baremetal_cluster_create_params.py +20 -0
- gcore/types/cloud/inference/deployment_update_params.py +203 -6
- gcore/types/cloud/inference/inference.py +3 -1
- gcore/types/cloud/load_balancer_listener_detail.py +13 -13
- gcore/types/cloud/load_balancer_pool.py +13 -13
- gcore/types/cloud/load_balancer_pool_list.py +99 -4
- gcore/types/cloud/load_balancers/listener_create_params.py +2 -0
- gcore/types/cloud/load_balancers/listener_get_params.py +3 -1
- gcore/types/cloud/load_balancers/listener_list_params.py +4 -2
- gcore/types/cloud/load_balancers/listener_update_params.py +2 -0
- gcore/types/cloud/load_balancers/pool_create_params.py +2 -0
- gcore/types/cloud/load_balancers/pool_list_params.py +5 -6
- gcore/types/cloud/load_balancers/pool_update_params.py +2 -0
- gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py +2 -0
- gcore/types/cloud/load_balancers/pools/member_add_params.py +2 -0
- gcore/types/cloud/network.py +21 -21
- gcore/types/cloud/network_create_params.py +2 -0
- gcore/types/cloud/network_details.py +24 -23
- gcore/types/cloud/network_list_params.py +15 -10
- gcore/types/cloud/network_update_params.py +2 -0
- gcore/types/cloud/quota_get_all_response.py +18 -0
- gcore/types/cloud/quota_get_by_region_response.py +18 -0
- gcore/types/cloud/quotas/request_create_params.py +9 -0
- gcore/types/cloud/quotas/request_get_response.py +9 -0
- gcore/types/cloud/quotas/request_list_response.py +9 -0
- gcore/types/cloud/secret_list_params.py +24 -0
- gcore/types/cloud/task.py +0 -3
- gcore/types/cloud/task_list_params.py +8 -2
- gcore/types/waap/__init__.py +12 -0
- gcore/types/waap/domain_list_params.py +30 -0
- gcore/types/waap/domain_update_params.py +12 -0
- gcore/types/waap/domains/__init__.py +5 -0
- gcore/types/waap/domains/setting_update_params.py +41 -0
- gcore/types/waap/waap_api_urls.py +15 -0
- gcore/types/waap/waap_detailed_domain.py +37 -0
- gcore/types/waap/waap_domain_ddos_settings.py +31 -0
- gcore/types/waap/waap_domain_settings.py +15 -0
- gcore/types/waap/waap_domain_status.py +7 -0
- gcore/types/waap/waap_summary_domain.py +26 -0
- {gcore-0.1.0a1.dist-info → gcore-0.2.0.dist-info}/METADATA +4 -7
- {gcore-0.1.0a1.dist-info → gcore-0.2.0.dist-info}/RECORD +78 -60
- {gcore-0.1.0a1.dist-info → gcore-0.2.0.dist-info}/WHEEL +0 -0
- {gcore-0.1.0a1.dist-info → gcore-0.2.0.dist-info}/licenses/LICENSE +0 -0
gcore/__init__.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
+
import typing as _t
|
|
4
|
+
|
|
3
5
|
from . import types
|
|
4
6
|
from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes
|
|
5
7
|
from ._utils import file_from_path
|
|
@@ -68,6 +70,9 @@ __all__ = [
|
|
|
68
70
|
"DefaultAsyncHttpxClient",
|
|
69
71
|
]
|
|
70
72
|
|
|
73
|
+
if not _t.TYPE_CHECKING:
|
|
74
|
+
from ._utils._resources_proxy import resources as resources
|
|
75
|
+
|
|
71
76
|
_setup_logging()
|
|
72
77
|
|
|
73
78
|
# Update the __module__ attribute for exported symbols so that
|
gcore/_client.py
CHANGED
|
@@ -28,6 +28,7 @@ from ._base_client import (
|
|
|
28
28
|
SyncAPIClient,
|
|
29
29
|
AsyncAPIClient,
|
|
30
30
|
)
|
|
31
|
+
from .resources.waap import waap
|
|
31
32
|
from .resources.cloud import cloud
|
|
32
33
|
|
|
33
34
|
__all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Gcore", "AsyncGcore", "Client", "AsyncClient"]
|
|
@@ -35,6 +36,7 @@ __all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Gcore", "A
|
|
|
35
36
|
|
|
36
37
|
class Gcore(SyncAPIClient):
|
|
37
38
|
cloud: cloud.CloudResource
|
|
39
|
+
waap: waap.WaapResource
|
|
38
40
|
with_raw_response: GcoreWithRawResponse
|
|
39
41
|
with_streaming_response: GcoreWithStreamedResponse
|
|
40
42
|
|
|
@@ -114,6 +116,7 @@ class Gcore(SyncAPIClient):
|
|
|
114
116
|
)
|
|
115
117
|
|
|
116
118
|
self.cloud = cloud.CloudResource(self)
|
|
119
|
+
self.waap = waap.WaapResource(self)
|
|
117
120
|
self.with_raw_response = GcoreWithRawResponse(self)
|
|
118
121
|
self.with_streaming_response = GcoreWithStreamedResponse(self)
|
|
119
122
|
|
|
@@ -248,6 +251,7 @@ class Gcore(SyncAPIClient):
|
|
|
248
251
|
|
|
249
252
|
class AsyncGcore(AsyncAPIClient):
|
|
250
253
|
cloud: cloud.AsyncCloudResource
|
|
254
|
+
waap: waap.AsyncWaapResource
|
|
251
255
|
with_raw_response: AsyncGcoreWithRawResponse
|
|
252
256
|
with_streaming_response: AsyncGcoreWithStreamedResponse
|
|
253
257
|
|
|
@@ -327,6 +331,7 @@ class AsyncGcore(AsyncAPIClient):
|
|
|
327
331
|
)
|
|
328
332
|
|
|
329
333
|
self.cloud = cloud.AsyncCloudResource(self)
|
|
334
|
+
self.waap = waap.AsyncWaapResource(self)
|
|
330
335
|
self.with_raw_response = AsyncGcoreWithRawResponse(self)
|
|
331
336
|
self.with_streaming_response = AsyncGcoreWithStreamedResponse(self)
|
|
332
337
|
|
|
@@ -462,21 +467,25 @@ class AsyncGcore(AsyncAPIClient):
|
|
|
462
467
|
class GcoreWithRawResponse:
|
|
463
468
|
def __init__(self, client: Gcore) -> None:
|
|
464
469
|
self.cloud = cloud.CloudResourceWithRawResponse(client.cloud)
|
|
470
|
+
self.waap = waap.WaapResourceWithRawResponse(client.waap)
|
|
465
471
|
|
|
466
472
|
|
|
467
473
|
class AsyncGcoreWithRawResponse:
|
|
468
474
|
def __init__(self, client: AsyncGcore) -> None:
|
|
469
475
|
self.cloud = cloud.AsyncCloudResourceWithRawResponse(client.cloud)
|
|
476
|
+
self.waap = waap.AsyncWaapResourceWithRawResponse(client.waap)
|
|
470
477
|
|
|
471
478
|
|
|
472
479
|
class GcoreWithStreamedResponse:
|
|
473
480
|
def __init__(self, client: Gcore) -> None:
|
|
474
481
|
self.cloud = cloud.CloudResourceWithStreamingResponse(client.cloud)
|
|
482
|
+
self.waap = waap.WaapResourceWithStreamingResponse(client.waap)
|
|
475
483
|
|
|
476
484
|
|
|
477
485
|
class AsyncGcoreWithStreamedResponse:
|
|
478
486
|
def __init__(self, client: AsyncGcore) -> None:
|
|
479
487
|
self.cloud = cloud.AsyncCloudResourceWithStreamingResponse(client.cloud)
|
|
488
|
+
self.waap = waap.AsyncWaapResourceWithStreamingResponse(client.waap)
|
|
480
489
|
|
|
481
490
|
|
|
482
491
|
Client = Gcore
|
gcore/_utils/_proxy.py
CHANGED
|
@@ -46,7 +46,10 @@ class LazyProxy(Generic[T], ABC):
|
|
|
46
46
|
@property # type: ignore
|
|
47
47
|
@override
|
|
48
48
|
def __class__(self) -> type: # pyright: ignore
|
|
49
|
-
|
|
49
|
+
try:
|
|
50
|
+
proxied = self.__get_proxied__()
|
|
51
|
+
except Exception:
|
|
52
|
+
return type(self)
|
|
50
53
|
if issubclass(type(proxied), LazyProxy):
|
|
51
54
|
return type(proxied)
|
|
52
55
|
return proxied.__class__
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
from typing_extensions import override
|
|
5
|
+
|
|
6
|
+
from ._proxy import LazyProxy
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ResourcesProxy(LazyProxy[Any]):
|
|
10
|
+
"""A proxy for the `gcore.resources` module.
|
|
11
|
+
|
|
12
|
+
This is used so that we can lazily import `gcore.resources` only when
|
|
13
|
+
needed *and* so that users can just import `gcore` and reference `gcore.resources`
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
@override
|
|
17
|
+
def __load__(self) -> Any:
|
|
18
|
+
import importlib
|
|
19
|
+
|
|
20
|
+
mod = importlib.import_module("gcore.resources")
|
|
21
|
+
return mod
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
resources = ResourcesProxy().__as_proxied__()
|
gcore/_version.py
CHANGED
gcore/resources/__init__.py
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
+
from .waap import (
|
|
4
|
+
WaapResource,
|
|
5
|
+
AsyncWaapResource,
|
|
6
|
+
WaapResourceWithRawResponse,
|
|
7
|
+
AsyncWaapResourceWithRawResponse,
|
|
8
|
+
WaapResourceWithStreamingResponse,
|
|
9
|
+
AsyncWaapResourceWithStreamingResponse,
|
|
10
|
+
)
|
|
3
11
|
from .cloud import (
|
|
4
12
|
CloudResource,
|
|
5
13
|
AsyncCloudResource,
|
|
@@ -16,4 +24,10 @@ __all__ = [
|
|
|
16
24
|
"AsyncCloudResourceWithRawResponse",
|
|
17
25
|
"CloudResourceWithStreamingResponse",
|
|
18
26
|
"AsyncCloudResourceWithStreamingResponse",
|
|
27
|
+
"WaapResource",
|
|
28
|
+
"AsyncWaapResource",
|
|
29
|
+
"WaapResourceWithRawResponse",
|
|
30
|
+
"AsyncWaapResourceWithRawResponse",
|
|
31
|
+
"WaapResourceWithStreamingResponse",
|
|
32
|
+
"AsyncWaapResourceWithStreamingResponse",
|
|
19
33
|
]
|
|
@@ -387,7 +387,124 @@ class ServersResource(SyncAPIResource):
|
|
|
387
387
|
cast_to=TaskIDList,
|
|
388
388
|
)
|
|
389
389
|
|
|
390
|
+
def create_and_poll(
|
|
391
|
+
self,
|
|
392
|
+
*,
|
|
393
|
+
project_id: int | None = None,
|
|
394
|
+
region_id: int | None = None,
|
|
395
|
+
flavor: str,
|
|
396
|
+
interfaces: Iterable[server_create_params.Interface],
|
|
397
|
+
app_config: Optional[object] | NotGiven = NOT_GIVEN,
|
|
398
|
+
apptemplate_id: str | NotGiven = NOT_GIVEN,
|
|
399
|
+
ddos_profile: server_create_params.DDOSProfile | NotGiven = NOT_GIVEN,
|
|
400
|
+
image_id: str | NotGiven = NOT_GIVEN,
|
|
401
|
+
name: str | NotGiven = NOT_GIVEN,
|
|
402
|
+
name_template: str | NotGiven = NOT_GIVEN,
|
|
403
|
+
password: str | NotGiven = NOT_GIVEN,
|
|
404
|
+
ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
405
|
+
tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
|
|
406
|
+
user_data: str | NotGiven = NOT_GIVEN,
|
|
407
|
+
username: str | NotGiven = NOT_GIVEN,
|
|
408
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
409
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
410
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
411
|
+
extra_headers: Headers | None = None,
|
|
412
|
+
extra_query: Query | None = None,
|
|
413
|
+
extra_body: Body | None = None,
|
|
414
|
+
) -> BaremetalServer:
|
|
415
|
+
"""
|
|
416
|
+
Create a bare metal server and wait for it to be ready.
|
|
417
|
+
"""
|
|
418
|
+
response = self.create(
|
|
419
|
+
project_id=project_id,
|
|
420
|
+
region_id=region_id,
|
|
421
|
+
flavor=flavor,
|
|
422
|
+
interfaces=interfaces,
|
|
423
|
+
app_config=app_config,
|
|
424
|
+
apptemplate_id=apptemplate_id,
|
|
425
|
+
ddos_profile=ddos_profile,
|
|
426
|
+
image_id=image_id,
|
|
427
|
+
name=name,
|
|
428
|
+
name_template=name_template,
|
|
429
|
+
password=password,
|
|
430
|
+
ssh_key_name=ssh_key_name,
|
|
431
|
+
tags=tags,
|
|
432
|
+
user_data=user_data,
|
|
433
|
+
username=username,
|
|
434
|
+
extra_headers=extra_headers,
|
|
435
|
+
extra_query=extra_query,
|
|
436
|
+
extra_body=extra_body,
|
|
437
|
+
)
|
|
438
|
+
if not response.tasks or len(response.tasks) != 1:
|
|
439
|
+
raise ValueError(f"Expected exactly one task to be created")
|
|
440
|
+
task = self._client.cloud.tasks.poll(
|
|
441
|
+
response.tasks[0],
|
|
442
|
+
extra_headers=extra_headers,
|
|
443
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
444
|
+
)
|
|
445
|
+
if not task.created_resources or not task.created_resources.instances:
|
|
446
|
+
raise ValueError("No server was created")
|
|
447
|
+
server_id = task.created_resources.instances[0]
|
|
448
|
+
servers = self.list(
|
|
449
|
+
project_id=project_id,
|
|
450
|
+
region_id=region_id,
|
|
451
|
+
uuid=server_id,
|
|
452
|
+
extra_headers=extra_headers,
|
|
453
|
+
extra_query=extra_query,
|
|
454
|
+
extra_body=extra_body,
|
|
455
|
+
)
|
|
456
|
+
if len(servers.results) != 1:
|
|
457
|
+
raise ValueError(f"Server {server_id} not found")
|
|
458
|
+
return servers.results[0]
|
|
390
459
|
|
|
460
|
+
def rebuild_and_poll(
|
|
461
|
+
self,
|
|
462
|
+
server_id: str,
|
|
463
|
+
*,
|
|
464
|
+
project_id: int | None = None,
|
|
465
|
+
region_id: int | None = None,
|
|
466
|
+
image_id: str | NotGiven = NOT_GIVEN,
|
|
467
|
+
user_data: str | NotGiven = NOT_GIVEN,
|
|
468
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
469
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
470
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
471
|
+
extra_headers: Headers | None = None,
|
|
472
|
+
extra_query: Query | None = None,
|
|
473
|
+
extra_body: Body | None = None,
|
|
474
|
+
) -> BaremetalServer:
|
|
475
|
+
"""
|
|
476
|
+
Rebuild a bare metal server and wait for it to be ready. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
477
|
+
"""
|
|
478
|
+
response = self.rebuild(
|
|
479
|
+
server_id=server_id,
|
|
480
|
+
project_id=project_id,
|
|
481
|
+
region_id=region_id,
|
|
482
|
+
image_id=image_id,
|
|
483
|
+
user_data=user_data,
|
|
484
|
+
extra_headers=extra_headers,
|
|
485
|
+
extra_query=extra_query,
|
|
486
|
+
extra_body=extra_body,
|
|
487
|
+
)
|
|
488
|
+
if not response.tasks:
|
|
489
|
+
raise ValueError("Expected at least one task to be created")
|
|
490
|
+
self._client.cloud.tasks.poll(
|
|
491
|
+
response.tasks[0],
|
|
492
|
+
extra_headers=extra_headers,
|
|
493
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
494
|
+
)
|
|
495
|
+
servers = self.list(
|
|
496
|
+
project_id=project_id,
|
|
497
|
+
region_id=region_id,
|
|
498
|
+
uuid=server_id,
|
|
499
|
+
extra_headers=extra_headers,
|
|
500
|
+
extra_query=extra_query,
|
|
501
|
+
extra_body=extra_body,
|
|
502
|
+
)
|
|
503
|
+
if len(servers.results) != 1:
|
|
504
|
+
raise ValueError(f"Server {server_id} not found")
|
|
505
|
+
return servers.results[0]
|
|
506
|
+
|
|
507
|
+
|
|
391
508
|
class AsyncServersResource(AsyncAPIResource):
|
|
392
509
|
@cached_property
|
|
393
510
|
def with_raw_response(self) -> AsyncServersResourceWithRawResponse:
|
|
@@ -747,6 +864,123 @@ class AsyncServersResource(AsyncAPIResource):
|
|
|
747
864
|
cast_to=TaskIDList,
|
|
748
865
|
)
|
|
749
866
|
|
|
867
|
+
async def create_and_poll(
|
|
868
|
+
self,
|
|
869
|
+
*,
|
|
870
|
+
project_id: int | None = None,
|
|
871
|
+
region_id: int | None = None,
|
|
872
|
+
flavor: str,
|
|
873
|
+
interfaces: Iterable[server_create_params.Interface],
|
|
874
|
+
app_config: Optional[object] | NotGiven = NOT_GIVEN,
|
|
875
|
+
apptemplate_id: str | NotGiven = NOT_GIVEN,
|
|
876
|
+
ddos_profile: server_create_params.DDOSProfile | NotGiven = NOT_GIVEN,
|
|
877
|
+
image_id: str | NotGiven = NOT_GIVEN,
|
|
878
|
+
name: str | NotGiven = NOT_GIVEN,
|
|
879
|
+
name_template: str | NotGiven = NOT_GIVEN,
|
|
880
|
+
password: str | NotGiven = NOT_GIVEN,
|
|
881
|
+
ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
882
|
+
tags: TagUpdateMapParam | NotGiven = NOT_GIVEN,
|
|
883
|
+
user_data: str | NotGiven = NOT_GIVEN,
|
|
884
|
+
username: str | NotGiven = NOT_GIVEN,
|
|
885
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
886
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
887
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
888
|
+
extra_headers: Headers | None = None,
|
|
889
|
+
extra_query: Query | None = None,
|
|
890
|
+
extra_body: Body | None = None,
|
|
891
|
+
) -> BaremetalServer:
|
|
892
|
+
"""
|
|
893
|
+
Create a bare metal server and wait for it to be ready.
|
|
894
|
+
"""
|
|
895
|
+
response = await self.create(
|
|
896
|
+
project_id=project_id,
|
|
897
|
+
region_id=region_id,
|
|
898
|
+
flavor=flavor,
|
|
899
|
+
interfaces=interfaces,
|
|
900
|
+
app_config=app_config,
|
|
901
|
+
apptemplate_id=apptemplate_id,
|
|
902
|
+
ddos_profile=ddos_profile,
|
|
903
|
+
image_id=image_id,
|
|
904
|
+
name=name,
|
|
905
|
+
name_template=name_template,
|
|
906
|
+
password=password,
|
|
907
|
+
ssh_key_name=ssh_key_name,
|
|
908
|
+
tags=tags,
|
|
909
|
+
user_data=user_data,
|
|
910
|
+
username=username,
|
|
911
|
+
extra_headers=extra_headers,
|
|
912
|
+
extra_query=extra_query,
|
|
913
|
+
extra_body=extra_body,
|
|
914
|
+
)
|
|
915
|
+
if not response.tasks or len(response.tasks) != 1:
|
|
916
|
+
raise ValueError(f"Expected exactly one task to be created")
|
|
917
|
+
task =await self._client.cloud.tasks.poll(
|
|
918
|
+
response.tasks[0],
|
|
919
|
+
extra_headers=extra_headers,
|
|
920
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
921
|
+
)
|
|
922
|
+
if not task.created_resources or not task.created_resources.instances:
|
|
923
|
+
raise ValueError("No server was created")
|
|
924
|
+
server_id = task.created_resources.instances[0]
|
|
925
|
+
servers = await self.list(
|
|
926
|
+
project_id=project_id,
|
|
927
|
+
region_id=region_id,
|
|
928
|
+
uuid=server_id,
|
|
929
|
+
extra_headers=extra_headers,
|
|
930
|
+
extra_query=extra_query,
|
|
931
|
+
extra_body=extra_body,
|
|
932
|
+
)
|
|
933
|
+
if len(servers.results) != 1:
|
|
934
|
+
raise ValueError(f"Server {server_id} not found")
|
|
935
|
+
return servers.results[0]
|
|
936
|
+
|
|
937
|
+
async def rebuild_and_poll(
|
|
938
|
+
self,
|
|
939
|
+
server_id: str,
|
|
940
|
+
*,
|
|
941
|
+
project_id: int | None = None,
|
|
942
|
+
region_id: int | None = None,
|
|
943
|
+
image_id: str | NotGiven = NOT_GIVEN,
|
|
944
|
+
user_data: str | NotGiven = NOT_GIVEN,
|
|
945
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
946
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
947
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
948
|
+
extra_headers: Headers | None = None,
|
|
949
|
+
extra_query: Query | None = None,
|
|
950
|
+
extra_body: Body | None = None,
|
|
951
|
+
) -> BaremetalServer:
|
|
952
|
+
"""
|
|
953
|
+
Rebuild a bare metal server and wait for it to be ready. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
954
|
+
"""
|
|
955
|
+
response = await self.rebuild(
|
|
956
|
+
server_id=server_id,
|
|
957
|
+
project_id=project_id,
|
|
958
|
+
region_id=region_id,
|
|
959
|
+
image_id=image_id,
|
|
960
|
+
user_data=user_data,
|
|
961
|
+
extra_headers=extra_headers,
|
|
962
|
+
extra_query=extra_query,
|
|
963
|
+
extra_body=extra_body,
|
|
964
|
+
)
|
|
965
|
+
if not response.tasks:
|
|
966
|
+
raise ValueError("Expected at least one task to be created")
|
|
967
|
+
await self._client.cloud.tasks.poll(
|
|
968
|
+
response.tasks[0],
|
|
969
|
+
extra_headers=extra_headers,
|
|
970
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
971
|
+
)
|
|
972
|
+
servers = await self.list(
|
|
973
|
+
project_id=project_id,
|
|
974
|
+
region_id=region_id,
|
|
975
|
+
uuid=server_id,
|
|
976
|
+
extra_headers=extra_headers,
|
|
977
|
+
extra_query=extra_query,
|
|
978
|
+
extra_body=extra_body,
|
|
979
|
+
)
|
|
980
|
+
if len(servers.results) != 1:
|
|
981
|
+
raise ValueError(f"Server {server_id} not found")
|
|
982
|
+
return servers.results[0]
|
|
983
|
+
|
|
750
984
|
|
|
751
985
|
class ServersResourceWithRawResponse:
|
|
752
986
|
def __init__(self, servers: ServersResource) -> None:
|
|
@@ -58,6 +58,15 @@ class BillingReservationsResource(SyncAPIResource):
|
|
|
58
58
|
limit: int | NotGiven = NOT_GIVEN,
|
|
59
59
|
metric_name: str | NotGiven = NOT_GIVEN,
|
|
60
60
|
offset: int | NotGiven = NOT_GIVEN,
|
|
61
|
+
order_by: Literal[
|
|
62
|
+
"active_from.asc",
|
|
63
|
+
"active_from.desc",
|
|
64
|
+
"active_to.asc",
|
|
65
|
+
"active_to.desc",
|
|
66
|
+
"created_at.asc",
|
|
67
|
+
"created_at.desc",
|
|
68
|
+
]
|
|
69
|
+
| NotGiven = NOT_GIVEN,
|
|
61
70
|
region_id: int | NotGiven = NOT_GIVEN,
|
|
62
71
|
status: List[
|
|
63
72
|
Literal[
|
|
@@ -96,6 +105,8 @@ class BillingReservationsResource(SyncAPIResource):
|
|
|
96
105
|
|
|
97
106
|
offset: Offset in reservation list
|
|
98
107
|
|
|
108
|
+
order_by: Order by field and direction.
|
|
109
|
+
|
|
99
110
|
region_id: Region for reservation
|
|
100
111
|
|
|
101
112
|
status: Field for fixed a status by reservation workflow
|
|
@@ -127,6 +138,7 @@ class BillingReservationsResource(SyncAPIResource):
|
|
|
127
138
|
"limit": limit,
|
|
128
139
|
"metric_name": metric_name,
|
|
129
140
|
"offset": offset,
|
|
141
|
+
"order_by": order_by,
|
|
130
142
|
"region_id": region_id,
|
|
131
143
|
"status": status,
|
|
132
144
|
},
|
|
@@ -202,6 +214,15 @@ class AsyncBillingReservationsResource(AsyncAPIResource):
|
|
|
202
214
|
limit: int | NotGiven = NOT_GIVEN,
|
|
203
215
|
metric_name: str | NotGiven = NOT_GIVEN,
|
|
204
216
|
offset: int | NotGiven = NOT_GIVEN,
|
|
217
|
+
order_by: Literal[
|
|
218
|
+
"active_from.asc",
|
|
219
|
+
"active_from.desc",
|
|
220
|
+
"active_to.asc",
|
|
221
|
+
"active_to.desc",
|
|
222
|
+
"created_at.asc",
|
|
223
|
+
"created_at.desc",
|
|
224
|
+
]
|
|
225
|
+
| NotGiven = NOT_GIVEN,
|
|
205
226
|
region_id: int | NotGiven = NOT_GIVEN,
|
|
206
227
|
status: List[
|
|
207
228
|
Literal[
|
|
@@ -240,6 +261,8 @@ class AsyncBillingReservationsResource(AsyncAPIResource):
|
|
|
240
261
|
|
|
241
262
|
offset: Offset in reservation list
|
|
242
263
|
|
|
264
|
+
order_by: Order by field and direction.
|
|
265
|
+
|
|
243
266
|
region_id: Region for reservation
|
|
244
267
|
|
|
245
268
|
status: Field for fixed a status by reservation workflow
|
|
@@ -271,6 +294,7 @@ class AsyncBillingReservationsResource(AsyncAPIResource):
|
|
|
271
294
|
"limit": limit,
|
|
272
295
|
"metric_name": metric_name,
|
|
273
296
|
"offset": offset,
|
|
297
|
+
"order_by": order_by,
|
|
274
298
|
"region_id": region_id,
|
|
275
299
|
"status": status,
|
|
276
300
|
},
|
|
@@ -269,7 +269,9 @@ class FileSharesResource(SyncAPIResource):
|
|
|
269
269
|
project_id: int | None = None,
|
|
270
270
|
region_id: int | None = None,
|
|
271
271
|
limit: int | NotGiven = NOT_GIVEN,
|
|
272
|
+
name: str | NotGiven = NOT_GIVEN,
|
|
272
273
|
offset: int | NotGiven = NOT_GIVEN,
|
|
274
|
+
type_name: Literal["standard", "vast"] | NotGiven = NOT_GIVEN,
|
|
273
275
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
274
276
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
275
277
|
extra_headers: Headers | None = None,
|
|
@@ -287,9 +289,13 @@ class FileSharesResource(SyncAPIResource):
|
|
|
287
289
|
|
|
288
290
|
limit: Optional. Limit the number of returned items
|
|
289
291
|
|
|
292
|
+
name: File share name. Uses partial match.
|
|
293
|
+
|
|
290
294
|
offset: Optional. Offset value is used to exclude the first set of records from the
|
|
291
295
|
result
|
|
292
296
|
|
|
297
|
+
type_name: File share type name
|
|
298
|
+
|
|
293
299
|
extra_headers: Send extra headers
|
|
294
300
|
|
|
295
301
|
extra_query: Add additional query parameters to the request
|
|
@@ -313,7 +319,9 @@ class FileSharesResource(SyncAPIResource):
|
|
|
313
319
|
query=maybe_transform(
|
|
314
320
|
{
|
|
315
321
|
"limit": limit,
|
|
322
|
+
"name": name,
|
|
316
323
|
"offset": offset,
|
|
324
|
+
"type_name": type_name,
|
|
317
325
|
},
|
|
318
326
|
file_share_list_params.FileShareListParams,
|
|
319
327
|
),
|
|
@@ -690,7 +698,9 @@ class AsyncFileSharesResource(AsyncAPIResource):
|
|
|
690
698
|
project_id: int | None = None,
|
|
691
699
|
region_id: int | None = None,
|
|
692
700
|
limit: int | NotGiven = NOT_GIVEN,
|
|
701
|
+
name: str | NotGiven = NOT_GIVEN,
|
|
693
702
|
offset: int | NotGiven = NOT_GIVEN,
|
|
703
|
+
type_name: Literal["standard", "vast"] | NotGiven = NOT_GIVEN,
|
|
694
704
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
695
705
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
696
706
|
extra_headers: Headers | None = None,
|
|
@@ -708,9 +718,13 @@ class AsyncFileSharesResource(AsyncAPIResource):
|
|
|
708
718
|
|
|
709
719
|
limit: Optional. Limit the number of returned items
|
|
710
720
|
|
|
721
|
+
name: File share name. Uses partial match.
|
|
722
|
+
|
|
711
723
|
offset: Optional. Offset value is used to exclude the first set of records from the
|
|
712
724
|
result
|
|
713
725
|
|
|
726
|
+
type_name: File share type name
|
|
727
|
+
|
|
714
728
|
extra_headers: Send extra headers
|
|
715
729
|
|
|
716
730
|
extra_query: Add additional query parameters to the request
|
|
@@ -734,7 +748,9 @@ class AsyncFileSharesResource(AsyncAPIResource):
|
|
|
734
748
|
query=maybe_transform(
|
|
735
749
|
{
|
|
736
750
|
"limit": limit,
|
|
751
|
+
"name": name,
|
|
737
752
|
"offset": offset,
|
|
753
|
+
"type_name": type_name,
|
|
738
754
|
},
|
|
739
755
|
file_share_list_params.FileShareListParams,
|
|
740
756
|
),
|