gcore 0.3.0__py3-none-any.whl → 0.4.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 +2 -1
- gcore/_base_client.py +22 -0
- gcore/_client.py +9 -0
- gcore/_version.py +1 -1
- gcore/pagination.py +61 -1
- gcore/resources/__init__.py +14 -0
- gcore/resources/cloud/baremetal/flavors.py +11 -137
- gcore/resources/cloud/baremetal/images.py +10 -12
- gcore/resources/cloud/baremetal/servers.py +31 -28
- gcore/resources/cloud/billing_reservations.py +2 -2
- gcore/resources/cloud/file_shares/file_shares.py +7 -8
- gcore/resources/cloud/floating_ips.py +7 -12
- gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +31 -20
- gcore/resources/cloud/gpu_baremetal_clusters/images.py +9 -10
- gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py +2 -2
- gcore/resources/cloud/gpu_baremetal_clusters/servers.py +8 -4
- gcore/resources/cloud/inference/deployments/deployments.py +10 -2
- gcore/resources/cloud/inference/registry_credentials.py +2 -2
- gcore/resources/cloud/inference/secrets.py +8 -8
- gcore/resources/cloud/instances/flavors.py +9 -233
- gcore/resources/cloud/instances/images.py +47 -37
- gcore/resources/cloud/instances/instances.py +47 -32
- gcore/resources/cloud/instances/interfaces.py +2 -2
- gcore/resources/cloud/ip_ranges.py +34 -2
- gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py +10 -2
- gcore/resources/cloud/load_balancers/listeners.py +17 -8
- gcore/resources/cloud/load_balancers/load_balancers.py +73 -21
- gcore/resources/cloud/load_balancers/metrics.py +2 -2
- gcore/resources/cloud/load_balancers/pools/health_monitors.py +2 -2
- gcore/resources/cloud/load_balancers/pools/members.py +6 -2
- gcore/resources/cloud/networks/networks.py +81 -17
- gcore/resources/cloud/networks/routers.py +18 -18
- gcore/resources/cloud/networks/subnets.py +51 -11
- gcore/resources/cloud/projects.py +38 -24
- gcore/resources/cloud/quotas/quotas.py +6 -6
- gcore/resources/cloud/quotas/requests.py +8 -8
- gcore/resources/cloud/registries/artifacts.py +4 -4
- gcore/resources/cloud/registries/registries.py +14 -16
- gcore/resources/cloud/registries/repositories.py +4 -4
- gcore/resources/cloud/registries/tags.py +2 -2
- gcore/resources/cloud/registries/users.py +21 -22
- gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +20 -20
- gcore/resources/cloud/reserved_fixed_ips/vip.py +10 -10
- gcore/resources/cloud/security_groups/rules.py +6 -6
- gcore/resources/cloud/security_groups/security_groups.py +70 -31
- gcore/resources/cloud/tasks.py +4 -4
- gcore/resources/cloud/users/role_assignments.py +12 -14
- gcore/resources/cloud/volumes.py +139 -49
- gcore/resources/iam/__init__.py +47 -0
- gcore/resources/iam/api_tokens.py +521 -0
- gcore/resources/iam/iam.py +199 -0
- gcore/resources/iam/users.py +642 -0
- gcore/resources/waap/__init__.py +0 -14
- gcore/resources/waap/waap.py +0 -32
- gcore/types/cloud/baremetal/__init__.py +0 -1
- gcore/types/cloud/baremetal/image_list_params.py +1 -5
- gcore/types/cloud/baremetal/server_create_params.py +4 -8
- gcore/types/cloud/baremetal/server_list_params.py +1 -5
- gcore/types/cloud/ddos_profile.py +9 -3
- gcore/types/cloud/file_share_create_params.py +3 -5
- gcore/types/cloud/floating_ip_create_params.py +2 -4
- gcore/types/cloud/floating_ip_list_params.py +1 -5
- gcore/types/cloud/gpu_baremetal_cluster_create_params.py +2 -3
- gcore/types/cloud/gpu_baremetal_clusters/image_upload_params.py +2 -4
- gcore/types/cloud/health_monitor.py +6 -1
- gcore/types/cloud/instance_create_params.py +7 -8
- gcore/types/cloud/instance_list_params.py +1 -5
- gcore/types/cloud/instances/__init__.py +0 -2
- gcore/types/cloud/instances/image_create_from_volume_params.py +2 -4
- gcore/types/cloud/instances/image_list_params.py +1 -5
- gcore/types/cloud/instances/image_upload_params.py +2 -4
- gcore/types/cloud/load_balancer_create_params.py +8 -4
- gcore/types/cloud/load_balancer_list_params.py +1 -5
- gcore/types/cloud/load_balancer_update_params.py +24 -0
- gcore/types/cloud/load_balancers/pool_create_params.py +6 -1
- gcore/types/cloud/load_balancers/pool_update_params.py +6 -1
- gcore/types/cloud/load_balancers/pools/member_add_params.py +6 -1
- gcore/types/cloud/member.py +6 -1
- gcore/types/cloud/network_create_params.py +2 -3
- gcore/types/cloud/network_list_params.py +4 -5
- gcore/types/cloud/network_update_params.py +28 -2
- gcore/types/cloud/networks/router_list_params.py +2 -2
- gcore/types/cloud/networks/subnet_create_params.py +2 -3
- gcore/types/cloud/networks/subnet_list_params.py +1 -5
- gcore/types/cloud/networks/subnet_update_params.py +25 -0
- gcore/types/cloud/registries/__init__.py +1 -0
- gcore/types/cloud/registries/user_refresh_secret_response.py +31 -0
- gcore/types/cloud/reserved_fixed_ip_list_params.py +2 -2
- gcore/types/cloud/security_group_list_params.py +3 -7
- gcore/types/cloud/security_group_update_params.py +25 -0
- gcore/types/cloud/tag_update_map_param.py +2 -2
- gcore/types/cloud/volume_list_params.py +1 -5
- gcore/types/cloud/volume_update_params.py +29 -3
- gcore/types/iam/__init__.py +17 -0
- gcore/types/iam/account_overview.py +488 -0
- gcore/types/iam/api_token.py +78 -0
- gcore/types/iam/api_token_create.py +15 -0
- gcore/types/iam/api_token_create_params.py +42 -0
- gcore/types/iam/api_token_list.py +81 -0
- gcore/types/iam/api_token_list_params.py +41 -0
- gcore/types/iam/user.py +86 -0
- gcore/types/iam/user_detailed.py +104 -0
- gcore/types/iam/user_invite.py +15 -0
- gcore/types/iam/user_invite_params.py +37 -0
- gcore/types/iam/user_list_params.py +15 -0
- gcore/types/iam/user_update.py +104 -0
- gcore/types/iam/user_update_params.py +52 -0
- gcore/types/waap/__init__.py +0 -1
- gcore/types/waap/domains/custom_rule_create_params.py +7 -3
- gcore/types/waap/domains/custom_rule_update_params.py +7 -3
- gcore/types/waap/waap_custom_rule.py +7 -3
- {gcore-0.3.0.dist-info → gcore-0.4.0.dist-info}/METADATA +40 -3
- {gcore-0.3.0.dist-info → gcore-0.4.0.dist-info}/RECORD +115 -101
- gcore/resources/waap/clients.py +0 -135
- gcore/types/cloud/baremetal/flavor_list_suitable_params.py +0 -22
- gcore/types/cloud/instances/flavor_list_for_resize_params.py +0 -16
- gcore/types/cloud/instances/flavor_list_suitable_params.py +0 -59
- gcore/types/waap/client_me_response.py +0 -34
- {gcore-0.3.0.dist-info → gcore-0.4.0.dist-info}/WHEEL +0 -0
- {gcore-0.3.0.dist-info → gcore-0.4.0.dist-info}/licenses/LICENSE +0 -0
gcore/__init__.py
CHANGED
|
@@ -26,7 +26,7 @@ from ._exceptions import (
|
|
|
26
26
|
UnprocessableEntityError,
|
|
27
27
|
APIResponseValidationError,
|
|
28
28
|
)
|
|
29
|
-
from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient
|
|
29
|
+
from ._base_client import DefaultHttpxClient, DefaultAioHttpClient, DefaultAsyncHttpxClient
|
|
30
30
|
from ._utils._logs import setup_logging as _setup_logging
|
|
31
31
|
|
|
32
32
|
__all__ = [
|
|
@@ -68,6 +68,7 @@ __all__ = [
|
|
|
68
68
|
"DEFAULT_CONNECTION_LIMITS",
|
|
69
69
|
"DefaultHttpxClient",
|
|
70
70
|
"DefaultAsyncHttpxClient",
|
|
71
|
+
"DefaultAioHttpClient",
|
|
71
72
|
]
|
|
72
73
|
|
|
73
74
|
if not _t.TYPE_CHECKING:
|
gcore/_base_client.py
CHANGED
|
@@ -1289,6 +1289,24 @@ class _DefaultAsyncHttpxClient(httpx.AsyncClient):
|
|
|
1289
1289
|
super().__init__(**kwargs)
|
|
1290
1290
|
|
|
1291
1291
|
|
|
1292
|
+
try:
|
|
1293
|
+
import httpx_aiohttp
|
|
1294
|
+
except ImportError:
|
|
1295
|
+
|
|
1296
|
+
class _DefaultAioHttpClient(httpx.AsyncClient):
|
|
1297
|
+
def __init__(self, **_kwargs: Any) -> None:
|
|
1298
|
+
raise RuntimeError("To use the aiohttp client you must have installed the package with the `aiohttp` extra")
|
|
1299
|
+
else:
|
|
1300
|
+
|
|
1301
|
+
class _DefaultAioHttpClient(httpx_aiohttp.HttpxAiohttpClient): # type: ignore
|
|
1302
|
+
def __init__(self, **kwargs: Any) -> None:
|
|
1303
|
+
kwargs.setdefault("timeout", DEFAULT_TIMEOUT)
|
|
1304
|
+
kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS)
|
|
1305
|
+
kwargs.setdefault("follow_redirects", True)
|
|
1306
|
+
|
|
1307
|
+
super().__init__(**kwargs)
|
|
1308
|
+
|
|
1309
|
+
|
|
1292
1310
|
if TYPE_CHECKING:
|
|
1293
1311
|
DefaultAsyncHttpxClient = httpx.AsyncClient
|
|
1294
1312
|
"""An alias to `httpx.AsyncClient` that provides the same defaults that this SDK
|
|
@@ -1297,8 +1315,12 @@ if TYPE_CHECKING:
|
|
|
1297
1315
|
This is useful because overriding the `http_client` with your own instance of
|
|
1298
1316
|
`httpx.AsyncClient` will result in httpx's defaults being used, not ours.
|
|
1299
1317
|
"""
|
|
1318
|
+
|
|
1319
|
+
DefaultAioHttpClient = httpx.AsyncClient
|
|
1320
|
+
"""An alias to `httpx.AsyncClient` that changes the default HTTP transport to `aiohttp`."""
|
|
1300
1321
|
else:
|
|
1301
1322
|
DefaultAsyncHttpxClient = _DefaultAsyncHttpxClient
|
|
1323
|
+
DefaultAioHttpClient = _DefaultAioHttpClient
|
|
1302
1324
|
|
|
1303
1325
|
|
|
1304
1326
|
class AsyncHttpxClientWrapper(DefaultAsyncHttpxClient):
|
gcore/_client.py
CHANGED
|
@@ -28,6 +28,7 @@ from ._base_client import (
|
|
|
28
28
|
SyncAPIClient,
|
|
29
29
|
AsyncAPIClient,
|
|
30
30
|
)
|
|
31
|
+
from .resources.iam import iam
|
|
31
32
|
from .resources.waap import waap
|
|
32
33
|
from .resources.cloud import cloud
|
|
33
34
|
|
|
@@ -37,6 +38,7 @@ __all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Gcore", "A
|
|
|
37
38
|
class Gcore(SyncAPIClient):
|
|
38
39
|
cloud: cloud.CloudResource
|
|
39
40
|
waap: waap.WaapResource
|
|
41
|
+
iam: iam.IamResource
|
|
40
42
|
with_raw_response: GcoreWithRawResponse
|
|
41
43
|
with_streaming_response: GcoreWithStreamedResponse
|
|
42
44
|
|
|
@@ -117,6 +119,7 @@ class Gcore(SyncAPIClient):
|
|
|
117
119
|
|
|
118
120
|
self.cloud = cloud.CloudResource(self)
|
|
119
121
|
self.waap = waap.WaapResource(self)
|
|
122
|
+
self.iam = iam.IamResource(self)
|
|
120
123
|
self.with_raw_response = GcoreWithRawResponse(self)
|
|
121
124
|
self.with_streaming_response = GcoreWithStreamedResponse(self)
|
|
122
125
|
|
|
@@ -252,6 +255,7 @@ class Gcore(SyncAPIClient):
|
|
|
252
255
|
class AsyncGcore(AsyncAPIClient):
|
|
253
256
|
cloud: cloud.AsyncCloudResource
|
|
254
257
|
waap: waap.AsyncWaapResource
|
|
258
|
+
iam: iam.AsyncIamResource
|
|
255
259
|
with_raw_response: AsyncGcoreWithRawResponse
|
|
256
260
|
with_streaming_response: AsyncGcoreWithStreamedResponse
|
|
257
261
|
|
|
@@ -332,6 +336,7 @@ class AsyncGcore(AsyncAPIClient):
|
|
|
332
336
|
|
|
333
337
|
self.cloud = cloud.AsyncCloudResource(self)
|
|
334
338
|
self.waap = waap.AsyncWaapResource(self)
|
|
339
|
+
self.iam = iam.AsyncIamResource(self)
|
|
335
340
|
self.with_raw_response = AsyncGcoreWithRawResponse(self)
|
|
336
341
|
self.with_streaming_response = AsyncGcoreWithStreamedResponse(self)
|
|
337
342
|
|
|
@@ -468,24 +473,28 @@ class GcoreWithRawResponse:
|
|
|
468
473
|
def __init__(self, client: Gcore) -> None:
|
|
469
474
|
self.cloud = cloud.CloudResourceWithRawResponse(client.cloud)
|
|
470
475
|
self.waap = waap.WaapResourceWithRawResponse(client.waap)
|
|
476
|
+
self.iam = iam.IamResourceWithRawResponse(client.iam)
|
|
471
477
|
|
|
472
478
|
|
|
473
479
|
class AsyncGcoreWithRawResponse:
|
|
474
480
|
def __init__(self, client: AsyncGcore) -> None:
|
|
475
481
|
self.cloud = cloud.AsyncCloudResourceWithRawResponse(client.cloud)
|
|
476
482
|
self.waap = waap.AsyncWaapResourceWithRawResponse(client.waap)
|
|
483
|
+
self.iam = iam.AsyncIamResourceWithRawResponse(client.iam)
|
|
477
484
|
|
|
478
485
|
|
|
479
486
|
class GcoreWithStreamedResponse:
|
|
480
487
|
def __init__(self, client: Gcore) -> None:
|
|
481
488
|
self.cloud = cloud.CloudResourceWithStreamingResponse(client.cloud)
|
|
482
489
|
self.waap = waap.WaapResourceWithStreamingResponse(client.waap)
|
|
490
|
+
self.iam = iam.IamResourceWithStreamingResponse(client.iam)
|
|
483
491
|
|
|
484
492
|
|
|
485
493
|
class AsyncGcoreWithStreamedResponse:
|
|
486
494
|
def __init__(self, client: AsyncGcore) -> None:
|
|
487
495
|
self.cloud = cloud.AsyncCloudResourceWithStreamingResponse(client.cloud)
|
|
488
496
|
self.waap = waap.AsyncWaapResourceWithStreamingResponse(client.waap)
|
|
497
|
+
self.iam = iam.AsyncIamResourceWithStreamingResponse(client.iam)
|
|
489
498
|
|
|
490
499
|
|
|
491
500
|
Client = Gcore
|
gcore/_version.py
CHANGED
gcore/pagination.py
CHANGED
|
@@ -5,7 +5,7 @@ from typing_extensions import override
|
|
|
5
5
|
|
|
6
6
|
from ._base_client import BasePage, PageInfo, BaseSyncPage, BaseAsyncPage
|
|
7
7
|
|
|
8
|
-
__all__ = ["SyncOffsetPage", "AsyncOffsetPage"]
|
|
8
|
+
__all__ = ["SyncOffsetPage", "AsyncOffsetPage", "SyncOffsetPageIam", "AsyncOffsetPageIam"]
|
|
9
9
|
|
|
10
10
|
_T = TypeVar("_T")
|
|
11
11
|
|
|
@@ -68,3 +68,63 @@ class AsyncOffsetPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
|
|
|
68
68
|
return PageInfo(params={"offset": current_count})
|
|
69
69
|
|
|
70
70
|
return None
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class SyncOffsetPageIam(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
|
|
74
|
+
result: List[_T]
|
|
75
|
+
count: Optional[int] = None
|
|
76
|
+
|
|
77
|
+
@override
|
|
78
|
+
def _get_page_items(self) -> List[_T]:
|
|
79
|
+
result = self.result
|
|
80
|
+
if not result:
|
|
81
|
+
return []
|
|
82
|
+
return result
|
|
83
|
+
|
|
84
|
+
@override
|
|
85
|
+
def next_page_info(self) -> Optional[PageInfo]:
|
|
86
|
+
offset = self._options.params.get("offset") or 0
|
|
87
|
+
if not isinstance(offset, int):
|
|
88
|
+
raise ValueError(f'Expected "offset" param to be an integer but got {offset}')
|
|
89
|
+
|
|
90
|
+
length = len(self._get_page_items())
|
|
91
|
+
current_count = offset + length
|
|
92
|
+
|
|
93
|
+
count = self.count
|
|
94
|
+
if count is None:
|
|
95
|
+
return None
|
|
96
|
+
|
|
97
|
+
if current_count < count:
|
|
98
|
+
return PageInfo(params={"offset": current_count})
|
|
99
|
+
|
|
100
|
+
return None
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class AsyncOffsetPageIam(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
|
|
104
|
+
result: List[_T]
|
|
105
|
+
count: Optional[int] = None
|
|
106
|
+
|
|
107
|
+
@override
|
|
108
|
+
def _get_page_items(self) -> List[_T]:
|
|
109
|
+
result = self.result
|
|
110
|
+
if not result:
|
|
111
|
+
return []
|
|
112
|
+
return result
|
|
113
|
+
|
|
114
|
+
@override
|
|
115
|
+
def next_page_info(self) -> Optional[PageInfo]:
|
|
116
|
+
offset = self._options.params.get("offset") or 0
|
|
117
|
+
if not isinstance(offset, int):
|
|
118
|
+
raise ValueError(f'Expected "offset" param to be an integer but got {offset}')
|
|
119
|
+
|
|
120
|
+
length = len(self._get_page_items())
|
|
121
|
+
current_count = offset + length
|
|
122
|
+
|
|
123
|
+
count = self.count
|
|
124
|
+
if count is None:
|
|
125
|
+
return None
|
|
126
|
+
|
|
127
|
+
if current_count < count:
|
|
128
|
+
return PageInfo(params={"offset": current_count})
|
|
129
|
+
|
|
130
|
+
return None
|
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 .iam import (
|
|
4
|
+
IamResource,
|
|
5
|
+
AsyncIamResource,
|
|
6
|
+
IamResourceWithRawResponse,
|
|
7
|
+
AsyncIamResourceWithRawResponse,
|
|
8
|
+
IamResourceWithStreamingResponse,
|
|
9
|
+
AsyncIamResourceWithStreamingResponse,
|
|
10
|
+
)
|
|
3
11
|
from .waap import (
|
|
4
12
|
WaapResource,
|
|
5
13
|
AsyncWaapResource,
|
|
@@ -30,4 +38,10 @@ __all__ = [
|
|
|
30
38
|
"AsyncWaapResourceWithRawResponse",
|
|
31
39
|
"WaapResourceWithStreamingResponse",
|
|
32
40
|
"AsyncWaapResourceWithStreamingResponse",
|
|
41
|
+
"IamResource",
|
|
42
|
+
"AsyncIamResource",
|
|
43
|
+
"IamResourceWithRawResponse",
|
|
44
|
+
"AsyncIamResourceWithRawResponse",
|
|
45
|
+
"IamResourceWithStreamingResponse",
|
|
46
|
+
"AsyncIamResourceWithStreamingResponse",
|
|
33
47
|
]
|
|
@@ -15,7 +15,7 @@ from ...._response import (
|
|
|
15
15
|
async_to_streamed_response_wrapper,
|
|
16
16
|
)
|
|
17
17
|
from ...._base_client import make_request_options
|
|
18
|
-
from ....types.cloud.baremetal import flavor_list_params
|
|
18
|
+
from ....types.cloud.baremetal import flavor_list_params
|
|
19
19
|
from ....types.cloud.baremetal_flavor_list import BaremetalFlavorList
|
|
20
20
|
|
|
21
21
|
__all__ = ["FlavorsResource", "AsyncFlavorsResource"]
|
|
@@ -59,11 +59,12 @@ class FlavorsResource(SyncAPIResource):
|
|
|
59
59
|
extra_body: Body | None = None,
|
|
60
60
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
61
61
|
) -> BaremetalFlavorList:
|
|
62
|
-
"""
|
|
62
|
+
"""List all available bare metal flavors in the specified project and region.
|
|
63
63
|
|
|
64
|
-
When
|
|
65
|
-
specified, the list
|
|
66
|
-
as 0. If you get Pricing Error contact the
|
|
64
|
+
When
|
|
65
|
+
`include_prices` is specified, the list includes pricing information. A client
|
|
66
|
+
in trial mode gets all price values as 0. If you get Pricing Error contact the
|
|
67
|
+
support.
|
|
67
68
|
|
|
68
69
|
Args:
|
|
69
70
|
disabled: Flag for filtering disabled flavors in the region. Defaults to true
|
|
@@ -113,64 +114,6 @@ class FlavorsResource(SyncAPIResource):
|
|
|
113
114
|
cast_to=BaremetalFlavorList,
|
|
114
115
|
)
|
|
115
116
|
|
|
116
|
-
def list_suitable(
|
|
117
|
-
self,
|
|
118
|
-
*,
|
|
119
|
-
project_id: int | None = None,
|
|
120
|
-
region_id: int | None = None,
|
|
121
|
-
include_prices: bool | NotGiven = NOT_GIVEN,
|
|
122
|
-
apptemplate_id: str | NotGiven = NOT_GIVEN,
|
|
123
|
-
image_id: str | NotGiven = NOT_GIVEN,
|
|
124
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
125
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
126
|
-
extra_headers: Headers | None = None,
|
|
127
|
-
extra_query: Query | None = None,
|
|
128
|
-
extra_body: Body | None = None,
|
|
129
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
130
|
-
) -> BaremetalFlavorList:
|
|
131
|
-
"""
|
|
132
|
-
List suitalbe flavors for bare metal server creation
|
|
133
|
-
|
|
134
|
-
Args:
|
|
135
|
-
include_prices: Set to true if flavor listing should include flavor prices
|
|
136
|
-
|
|
137
|
-
apptemplate_id: Apptemplate ID
|
|
138
|
-
|
|
139
|
-
image_id: Image ID
|
|
140
|
-
|
|
141
|
-
extra_headers: Send extra headers
|
|
142
|
-
|
|
143
|
-
extra_query: Add additional query parameters to the request
|
|
144
|
-
|
|
145
|
-
extra_body: Add additional JSON properties to the request
|
|
146
|
-
|
|
147
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
148
|
-
"""
|
|
149
|
-
if project_id is None:
|
|
150
|
-
project_id = self._client._get_cloud_project_id_path_param()
|
|
151
|
-
if region_id is None:
|
|
152
|
-
region_id = self._client._get_cloud_region_id_path_param()
|
|
153
|
-
return self._post(
|
|
154
|
-
f"/cloud/v1/bminstances/{project_id}/{region_id}/available_flavors",
|
|
155
|
-
body=maybe_transform(
|
|
156
|
-
{
|
|
157
|
-
"apptemplate_id": apptemplate_id,
|
|
158
|
-
"image_id": image_id,
|
|
159
|
-
},
|
|
160
|
-
flavor_list_suitable_params.FlavorListSuitableParams,
|
|
161
|
-
),
|
|
162
|
-
options=make_request_options(
|
|
163
|
-
extra_headers=extra_headers,
|
|
164
|
-
extra_query=extra_query,
|
|
165
|
-
extra_body=extra_body,
|
|
166
|
-
timeout=timeout,
|
|
167
|
-
query=maybe_transform(
|
|
168
|
-
{"include_prices": include_prices}, flavor_list_suitable_params.FlavorListSuitableParams
|
|
169
|
-
),
|
|
170
|
-
),
|
|
171
|
-
cast_to=BaremetalFlavorList,
|
|
172
|
-
)
|
|
173
|
-
|
|
174
117
|
|
|
175
118
|
class AsyncFlavorsResource(AsyncAPIResource):
|
|
176
119
|
@cached_property
|
|
@@ -210,11 +153,12 @@ class AsyncFlavorsResource(AsyncAPIResource):
|
|
|
210
153
|
extra_body: Body | None = None,
|
|
211
154
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
212
155
|
) -> BaremetalFlavorList:
|
|
213
|
-
"""
|
|
156
|
+
"""List all available bare metal flavors in the specified project and region.
|
|
214
157
|
|
|
215
|
-
When
|
|
216
|
-
specified, the list
|
|
217
|
-
as 0. If you get Pricing Error contact the
|
|
158
|
+
When
|
|
159
|
+
`include_prices` is specified, the list includes pricing information. A client
|
|
160
|
+
in trial mode gets all price values as 0. If you get Pricing Error contact the
|
|
161
|
+
support.
|
|
218
162
|
|
|
219
163
|
Args:
|
|
220
164
|
disabled: Flag for filtering disabled flavors in the region. Defaults to true
|
|
@@ -264,64 +208,6 @@ class AsyncFlavorsResource(AsyncAPIResource):
|
|
|
264
208
|
cast_to=BaremetalFlavorList,
|
|
265
209
|
)
|
|
266
210
|
|
|
267
|
-
async def list_suitable(
|
|
268
|
-
self,
|
|
269
|
-
*,
|
|
270
|
-
project_id: int | None = None,
|
|
271
|
-
region_id: int | None = None,
|
|
272
|
-
include_prices: bool | NotGiven = NOT_GIVEN,
|
|
273
|
-
apptemplate_id: str | NotGiven = NOT_GIVEN,
|
|
274
|
-
image_id: str | NotGiven = NOT_GIVEN,
|
|
275
|
-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
276
|
-
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
277
|
-
extra_headers: Headers | None = None,
|
|
278
|
-
extra_query: Query | None = None,
|
|
279
|
-
extra_body: Body | None = None,
|
|
280
|
-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
281
|
-
) -> BaremetalFlavorList:
|
|
282
|
-
"""
|
|
283
|
-
List suitalbe flavors for bare metal server creation
|
|
284
|
-
|
|
285
|
-
Args:
|
|
286
|
-
include_prices: Set to true if flavor listing should include flavor prices
|
|
287
|
-
|
|
288
|
-
apptemplate_id: Apptemplate ID
|
|
289
|
-
|
|
290
|
-
image_id: Image ID
|
|
291
|
-
|
|
292
|
-
extra_headers: Send extra headers
|
|
293
|
-
|
|
294
|
-
extra_query: Add additional query parameters to the request
|
|
295
|
-
|
|
296
|
-
extra_body: Add additional JSON properties to the request
|
|
297
|
-
|
|
298
|
-
timeout: Override the client-level default timeout for this request, in seconds
|
|
299
|
-
"""
|
|
300
|
-
if project_id is None:
|
|
301
|
-
project_id = self._client._get_cloud_project_id_path_param()
|
|
302
|
-
if region_id is None:
|
|
303
|
-
region_id = self._client._get_cloud_region_id_path_param()
|
|
304
|
-
return await self._post(
|
|
305
|
-
f"/cloud/v1/bminstances/{project_id}/{region_id}/available_flavors",
|
|
306
|
-
body=await async_maybe_transform(
|
|
307
|
-
{
|
|
308
|
-
"apptemplate_id": apptemplate_id,
|
|
309
|
-
"image_id": image_id,
|
|
310
|
-
},
|
|
311
|
-
flavor_list_suitable_params.FlavorListSuitableParams,
|
|
312
|
-
),
|
|
313
|
-
options=make_request_options(
|
|
314
|
-
extra_headers=extra_headers,
|
|
315
|
-
extra_query=extra_query,
|
|
316
|
-
extra_body=extra_body,
|
|
317
|
-
timeout=timeout,
|
|
318
|
-
query=await async_maybe_transform(
|
|
319
|
-
{"include_prices": include_prices}, flavor_list_suitable_params.FlavorListSuitableParams
|
|
320
|
-
),
|
|
321
|
-
),
|
|
322
|
-
cast_to=BaremetalFlavorList,
|
|
323
|
-
)
|
|
324
|
-
|
|
325
211
|
|
|
326
212
|
class FlavorsResourceWithRawResponse:
|
|
327
213
|
def __init__(self, flavors: FlavorsResource) -> None:
|
|
@@ -330,9 +216,6 @@ class FlavorsResourceWithRawResponse:
|
|
|
330
216
|
self.list = to_raw_response_wrapper(
|
|
331
217
|
flavors.list,
|
|
332
218
|
)
|
|
333
|
-
self.list_suitable = to_raw_response_wrapper(
|
|
334
|
-
flavors.list_suitable,
|
|
335
|
-
)
|
|
336
219
|
|
|
337
220
|
|
|
338
221
|
class AsyncFlavorsResourceWithRawResponse:
|
|
@@ -342,9 +225,6 @@ class AsyncFlavorsResourceWithRawResponse:
|
|
|
342
225
|
self.list = async_to_raw_response_wrapper(
|
|
343
226
|
flavors.list,
|
|
344
227
|
)
|
|
345
|
-
self.list_suitable = async_to_raw_response_wrapper(
|
|
346
|
-
flavors.list_suitable,
|
|
347
|
-
)
|
|
348
228
|
|
|
349
229
|
|
|
350
230
|
class FlavorsResourceWithStreamingResponse:
|
|
@@ -354,9 +234,6 @@ class FlavorsResourceWithStreamingResponse:
|
|
|
354
234
|
self.list = to_streamed_response_wrapper(
|
|
355
235
|
flavors.list,
|
|
356
236
|
)
|
|
357
|
-
self.list_suitable = to_streamed_response_wrapper(
|
|
358
|
-
flavors.list_suitable,
|
|
359
|
-
)
|
|
360
237
|
|
|
361
238
|
|
|
362
239
|
class AsyncFlavorsResourceWithStreamingResponse:
|
|
@@ -366,6 +243,3 @@ class AsyncFlavorsResourceWithStreamingResponse:
|
|
|
366
243
|
self.list = async_to_streamed_response_wrapper(
|
|
367
244
|
flavors.list,
|
|
368
245
|
)
|
|
369
|
-
self.list_suitable = async_to_streamed_response_wrapper(
|
|
370
|
-
flavors.list_suitable,
|
|
371
|
-
)
|
|
@@ -61,10 +61,11 @@ class ImagesResource(SyncAPIResource):
|
|
|
61
61
|
extra_body: Body | None = None,
|
|
62
62
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
63
63
|
) -> ImageList:
|
|
64
|
-
"""Retrieve
|
|
64
|
+
"""Retrieve a list of available images for bare metal servers.
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
The list can be
|
|
67
|
+
filtered by visibility, tags, and other parameters. Returned entities may or may
|
|
68
|
+
not be owned by the project.
|
|
68
69
|
|
|
69
70
|
Args:
|
|
70
71
|
include_prices: Show price
|
|
@@ -73,9 +74,7 @@ class ImagesResource(SyncAPIResource):
|
|
|
73
74
|
|
|
74
75
|
tag_key: Filter by tag keys.
|
|
75
76
|
|
|
76
|
-
tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string.
|
|
77
|
-
--data-urlencode '`tag_key_value`={"key": "value"}' --url
|
|
78
|
-
'http://localhost:1111/v1/images/1/1'"
|
|
77
|
+
tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string.
|
|
79
78
|
|
|
80
79
|
visibility: Image visibility. Globally visible images are public
|
|
81
80
|
|
|
@@ -150,10 +149,11 @@ class AsyncImagesResource(AsyncAPIResource):
|
|
|
150
149
|
extra_body: Body | None = None,
|
|
151
150
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
152
151
|
) -> ImageList:
|
|
153
|
-
"""Retrieve
|
|
152
|
+
"""Retrieve a list of available images for bare metal servers.
|
|
154
153
|
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
The list can be
|
|
155
|
+
filtered by visibility, tags, and other parameters. Returned entities may or may
|
|
156
|
+
not be owned by the project.
|
|
157
157
|
|
|
158
158
|
Args:
|
|
159
159
|
include_prices: Show price
|
|
@@ -162,9 +162,7 @@ class AsyncImagesResource(AsyncAPIResource):
|
|
|
162
162
|
|
|
163
163
|
tag_key: Filter by tag keys.
|
|
164
164
|
|
|
165
|
-
tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string.
|
|
166
|
-
--data-urlencode '`tag_key_value`={"key": "value"}' --url
|
|
167
|
-
'http://localhost:1111/v1/images/1/1'"
|
|
165
|
+
tag_key_value: Filter by tag key-value pairs. Must be a valid JSON string.
|
|
168
166
|
|
|
169
167
|
visibility: Image visibility. Globally visible images are public
|
|
170
168
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import List, Union, Iterable, Optional
|
|
5
|
+
from typing import Dict, List, Union, Iterable, Optional
|
|
6
6
|
from datetime import datetime
|
|
7
7
|
from typing_extensions import Literal
|
|
8
8
|
|
|
@@ -22,7 +22,6 @@ from ....pagination import SyncOffsetPage, AsyncOffsetPage
|
|
|
22
22
|
from ...._base_client import AsyncPaginator, make_request_options
|
|
23
23
|
from ....types.cloud.baremetal import server_list_params, server_create_params, server_rebuild_params
|
|
24
24
|
from ....types.cloud.task_id_list import TaskIDList
|
|
25
|
-
from ....types.cloud.tag_update_map_param import TagUpdateMapParam
|
|
26
25
|
from ....types.cloud.baremetal.baremetal_server import BaremetalServer
|
|
27
26
|
|
|
28
27
|
__all__ = ["ServersResource", "AsyncServersResource"]
|
|
@@ -63,7 +62,7 @@ class ServersResource(SyncAPIResource):
|
|
|
63
62
|
name_template: str | NotGiven = NOT_GIVEN,
|
|
64
63
|
password: str | NotGiven = NOT_GIVEN,
|
|
65
64
|
ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
66
|
-
tags:
|
|
65
|
+
tags: Dict[str, str] | NotGiven = NOT_GIVEN,
|
|
67
66
|
user_data: str | NotGiven = NOT_GIVEN,
|
|
68
67
|
username: str | NotGiven = NOT_GIVEN,
|
|
69
68
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -73,8 +72,10 @@ class ServersResource(SyncAPIResource):
|
|
|
73
72
|
extra_body: Body | None = None,
|
|
74
73
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
75
74
|
) -> TaskIDList:
|
|
76
|
-
"""
|
|
77
|
-
|
|
75
|
+
"""Create a new bare metal server with the specified configuration.
|
|
76
|
+
|
|
77
|
+
How to get
|
|
78
|
+
access: For Linux,
|
|
78
79
|
|
|
79
80
|
- Use the `user_data` field to provide a
|
|
80
81
|
[cloud-init script](https://cloudinit.readthedocs.io/en/latest/reference/examples.html)
|
|
@@ -217,8 +218,10 @@ class ServersResource(SyncAPIResource):
|
|
|
217
218
|
extra_body: Body | None = None,
|
|
218
219
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
219
220
|
) -> SyncOffsetPage[BaremetalServer]:
|
|
220
|
-
"""
|
|
221
|
-
|
|
221
|
+
"""List all bare metal servers in the specified project and region.
|
|
222
|
+
|
|
223
|
+
Results can be
|
|
224
|
+
filtered by various parameters like name, status, and IP address.
|
|
222
225
|
|
|
223
226
|
Args:
|
|
224
227
|
project_id: Project ID
|
|
@@ -263,9 +266,7 @@ class ServersResource(SyncAPIResource):
|
|
|
263
266
|
|
|
264
267
|
status: Filters instances by a server status, as a string.
|
|
265
268
|
|
|
266
|
-
tag_key_value: Optional. Filter by tag key-value pairs.
|
|
267
|
-
"`tag_key_value`={"key": "value"}" --url
|
|
268
|
-
"https://example.com/cloud/v1/resource/1/1"
|
|
269
|
+
tag_key_value: Optional. Filter by tag key-value pairs.
|
|
269
270
|
|
|
270
271
|
tag_value: Optional. Filter by tag values. ?`tag_value`=value1&`tag_value`=value2
|
|
271
272
|
|
|
@@ -346,7 +347,7 @@ class ServersResource(SyncAPIResource):
|
|
|
346
347
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
347
348
|
) -> TaskIDList:
|
|
348
349
|
"""
|
|
349
|
-
Rebuild bare metal server
|
|
350
|
+
Rebuild a bare metal server with a new image while preserving its configuration.
|
|
350
351
|
|
|
351
352
|
Args:
|
|
352
353
|
image_id: Image ID
|
|
@@ -399,7 +400,7 @@ class ServersResource(SyncAPIResource):
|
|
|
399
400
|
name_template: str | NotGiven = NOT_GIVEN,
|
|
400
401
|
password: str | NotGiven = NOT_GIVEN,
|
|
401
402
|
ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
402
|
-
tags:
|
|
403
|
+
tags: Dict[str, str] | NotGiven = NOT_GIVEN,
|
|
403
404
|
user_data: str | NotGiven = NOT_GIVEN,
|
|
404
405
|
username: str | NotGiven = NOT_GIVEN,
|
|
405
406
|
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
@@ -483,7 +484,7 @@ class ServersResource(SyncAPIResource):
|
|
|
483
484
|
extra_body=extra_body,
|
|
484
485
|
)
|
|
485
486
|
if not response.tasks:
|
|
486
|
-
raise ValueError("Expected at least one task to be created")
|
|
487
|
+
raise ValueError("Expected at least one task to be created")
|
|
487
488
|
self._client.cloud.tasks.poll(
|
|
488
489
|
response.tasks[0],
|
|
489
490
|
extra_headers=extra_headers,
|
|
@@ -501,7 +502,7 @@ class ServersResource(SyncAPIResource):
|
|
|
501
502
|
raise ValueError(f"Server {server_id} not found")
|
|
502
503
|
return servers.results[0]
|
|
503
504
|
|
|
504
|
-
|
|
505
|
+
|
|
505
506
|
class AsyncServersResource(AsyncAPIResource):
|
|
506
507
|
@cached_property
|
|
507
508
|
def with_raw_response(self) -> AsyncServersResourceWithRawResponse:
|
|
@@ -537,7 +538,7 @@ class AsyncServersResource(AsyncAPIResource):
|
|
|
537
538
|
name_template: str | NotGiven = NOT_GIVEN,
|
|
538
539
|
password: str | NotGiven = NOT_GIVEN,
|
|
539
540
|
ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
540
|
-
tags:
|
|
541
|
+
tags: Dict[str, str] | NotGiven = NOT_GIVEN,
|
|
541
542
|
user_data: str | NotGiven = NOT_GIVEN,
|
|
542
543
|
username: str | NotGiven = NOT_GIVEN,
|
|
543
544
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -547,8 +548,10 @@ class AsyncServersResource(AsyncAPIResource):
|
|
|
547
548
|
extra_body: Body | None = None,
|
|
548
549
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
549
550
|
) -> TaskIDList:
|
|
550
|
-
"""
|
|
551
|
-
|
|
551
|
+
"""Create a new bare metal server with the specified configuration.
|
|
552
|
+
|
|
553
|
+
How to get
|
|
554
|
+
access: For Linux,
|
|
552
555
|
|
|
553
556
|
- Use the `user_data` field to provide a
|
|
554
557
|
[cloud-init script](https://cloudinit.readthedocs.io/en/latest/reference/examples.html)
|
|
@@ -691,8 +694,10 @@ class AsyncServersResource(AsyncAPIResource):
|
|
|
691
694
|
extra_body: Body | None = None,
|
|
692
695
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
693
696
|
) -> AsyncPaginator[BaremetalServer, AsyncOffsetPage[BaremetalServer]]:
|
|
694
|
-
"""
|
|
695
|
-
|
|
697
|
+
"""List all bare metal servers in the specified project and region.
|
|
698
|
+
|
|
699
|
+
Results can be
|
|
700
|
+
filtered by various parameters like name, status, and IP address.
|
|
696
701
|
|
|
697
702
|
Args:
|
|
698
703
|
project_id: Project ID
|
|
@@ -737,9 +742,7 @@ class AsyncServersResource(AsyncAPIResource):
|
|
|
737
742
|
|
|
738
743
|
status: Filters instances by a server status, as a string.
|
|
739
744
|
|
|
740
|
-
tag_key_value: Optional. Filter by tag key-value pairs.
|
|
741
|
-
"`tag_key_value`={"key": "value"}" --url
|
|
742
|
-
"https://example.com/cloud/v1/resource/1/1"
|
|
745
|
+
tag_key_value: Optional. Filter by tag key-value pairs.
|
|
743
746
|
|
|
744
747
|
tag_value: Optional. Filter by tag values. ?`tag_value`=value1&`tag_value`=value2
|
|
745
748
|
|
|
@@ -820,7 +823,7 @@ class AsyncServersResource(AsyncAPIResource):
|
|
|
820
823
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
821
824
|
) -> TaskIDList:
|
|
822
825
|
"""
|
|
823
|
-
Rebuild bare metal server
|
|
826
|
+
Rebuild a bare metal server with a new image while preserving its configuration.
|
|
824
827
|
|
|
825
828
|
Args:
|
|
826
829
|
image_id: Image ID
|
|
@@ -873,7 +876,7 @@ class AsyncServersResource(AsyncAPIResource):
|
|
|
873
876
|
name_template: str | NotGiven = NOT_GIVEN,
|
|
874
877
|
password: str | NotGiven = NOT_GIVEN,
|
|
875
878
|
ssh_key_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
876
|
-
tags:
|
|
879
|
+
tags: Dict[str, str] | NotGiven = NOT_GIVEN,
|
|
877
880
|
user_data: str | NotGiven = NOT_GIVEN,
|
|
878
881
|
username: str | NotGiven = NOT_GIVEN,
|
|
879
882
|
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
@@ -907,8 +910,8 @@ class AsyncServersResource(AsyncAPIResource):
|
|
|
907
910
|
extra_body=extra_body,
|
|
908
911
|
)
|
|
909
912
|
if not response.tasks or len(response.tasks) != 1:
|
|
910
|
-
raise ValueError(f"Expected exactly one task to be created")
|
|
911
|
-
task =await self._client.cloud.tasks.poll(
|
|
913
|
+
raise ValueError(f"Expected exactly one task to be created")
|
|
914
|
+
task = await self._client.cloud.tasks.poll(
|
|
912
915
|
response.tasks[0],
|
|
913
916
|
extra_headers=extra_headers,
|
|
914
917
|
polling_interval_seconds=polling_interval_seconds,
|
|
@@ -957,7 +960,7 @@ class AsyncServersResource(AsyncAPIResource):
|
|
|
957
960
|
extra_body=extra_body,
|
|
958
961
|
)
|
|
959
962
|
if not response.tasks:
|
|
960
|
-
raise ValueError("Expected at least one task to be created")
|
|
963
|
+
raise ValueError("Expected at least one task to be created")
|
|
961
964
|
await self._client.cloud.tasks.poll(
|
|
962
965
|
response.tasks[0],
|
|
963
966
|
extra_headers=extra_headers,
|
|
@@ -973,7 +976,7 @@ class AsyncServersResource(AsyncAPIResource):
|
|
|
973
976
|
)
|
|
974
977
|
if len(servers.results) != 1:
|
|
975
978
|
raise ValueError(f"Server {server_id} not found")
|
|
976
|
-
return servers.results[0]
|
|
979
|
+
return servers.results[0]
|
|
977
980
|
|
|
978
981
|
|
|
979
982
|
class ServersResourceWithRawResponse:
|