Skip to content

Commit 88f9475

Browse files
authored
feat(instance): create CheckQuotasOrganizationBlockMigration endpoint (#768)
1 parent e51b291 commit 88f9475

File tree

8 files changed

+122
-0
lines changed

8 files changed

+122
-0
lines changed

scaleway-async/scaleway_async/instance/v1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
from .types import ApplyBlockMigrationRequest
8080
from .types import AttachServerVolumeRequest
8181
from .types import AttachServerVolumeResponse
82+
from .types import CheckBlockMigrationOrganizationQuotasRequest
8283
from .types import CreateImageRequest
8384
from .types import CreateImageResponse
8485
from .types import CreateIpRequest
@@ -274,6 +275,7 @@
274275
"ApplyBlockMigrationRequest",
275276
"AttachServerVolumeRequest",
276277
"AttachServerVolumeResponse",
278+
"CheckBlockMigrationOrganizationQuotasRequest",
277279
"CreateImageRequest",
278280
"CreateImageResponse",
279281
"CreateIpRequest",

scaleway-async/scaleway_async/instance/v1/api.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
AttachServerVolumeRequest,
4747
AttachServerVolumeResponse,
4848
Bootscript,
49+
CheckBlockMigrationOrganizationQuotasRequest,
4950
CreateImageRequest,
5051
CreateImageResponse,
5152
CreateIpRequest,
@@ -207,6 +208,7 @@
207208
unmarshal__SetSnapshotResponse,
208209
marshal_ApplyBlockMigrationRequest,
209210
marshal_AttachServerVolumeRequest,
211+
marshal_CheckBlockMigrationOrganizationQuotasRequest,
210212
marshal_CreateImageRequest,
211213
marshal_CreateIpRequest,
212214
marshal_CreatePlacementGroupRequest,
@@ -4052,3 +4054,35 @@ async def apply_block_migration(
40524054
)
40534055

40544056
self._throw_on_error(res)
4057+
4058+
async def check_block_migration_organization_quotas(
4059+
self,
4060+
*,
4061+
zone: Optional[Zone] = None,
4062+
organization: Optional[str] = None,
4063+
) -> None:
4064+
"""
4065+
:param zone: Zone to target. If none is passed will use default zone from the config.
4066+
:param organization:
4067+
4068+
Usage:
4069+
::
4070+
4071+
result = await api.check_block_migration_organization_quotas()
4072+
"""
4073+
4074+
param_zone = validate_path_param("zone", zone or self.client.default_zone)
4075+
4076+
res = self._request(
4077+
"POST",
4078+
f"/instance/v1/zones/{param_zone}/block-migration/check-organization-quotas",
4079+
body=marshal_CheckBlockMigrationOrganizationQuotasRequest(
4080+
CheckBlockMigrationOrganizationQuotasRequest(
4081+
zone=zone,
4082+
organization=organization,
4083+
),
4084+
self.client,
4085+
),
4086+
)
4087+
4088+
self._throw_on_error(res)

scaleway-async/scaleway_async/instance/v1/marshalling.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
UpdateVolumeResponse,
109109
ApplyBlockMigrationRequest,
110110
AttachServerVolumeRequest,
111+
CheckBlockMigrationOrganizationQuotasRequest,
111112
VolumeTemplate,
112113
CreateImageRequest,
113114
CreateIpRequest,
@@ -2729,6 +2730,20 @@ def marshal_AttachServerVolumeRequest(
27292730
return output
27302731

27312732

2733+
def marshal_CheckBlockMigrationOrganizationQuotasRequest(
2734+
request: CheckBlockMigrationOrganizationQuotasRequest,
2735+
defaults: ProfileDefaults,
2736+
) -> Dict[str, Any]:
2737+
output: Dict[str, Any] = {}
2738+
2739+
if request.organization is not None:
2740+
output["organization"] = (
2741+
request.organization or defaults.default_organization_id
2742+
)
2743+
2744+
return output
2745+
2746+
27322747
def marshal_VolumeTemplate(
27332748
request: VolumeTemplate,
27342749
defaults: ProfileDefaults,

scaleway-async/scaleway_async/instance/v1/types.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,6 +1502,16 @@ class AttachServerVolumeResponse:
15021502
server: Optional[Server]
15031503

15041504

1505+
@dataclass
1506+
class CheckBlockMigrationOrganizationQuotasRequest:
1507+
zone: Optional[Zone]
1508+
"""
1509+
Zone to target. If none is passed will use default zone from the config.
1510+
"""
1511+
1512+
organization: Optional[str]
1513+
1514+
15051515
@dataclass
15061516
class CreateImageRequest:
15071517
root_volume: str

scaleway/scaleway/instance/v1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
from .types import ApplyBlockMigrationRequest
8080
from .types import AttachServerVolumeRequest
8181
from .types import AttachServerVolumeResponse
82+
from .types import CheckBlockMigrationOrganizationQuotasRequest
8283
from .types import CreateImageRequest
8384
from .types import CreateImageResponse
8485
from .types import CreateIpRequest
@@ -274,6 +275,7 @@
274275
"ApplyBlockMigrationRequest",
275276
"AttachServerVolumeRequest",
276277
"AttachServerVolumeResponse",
278+
"CheckBlockMigrationOrganizationQuotasRequest",
277279
"CreateImageRequest",
278280
"CreateImageResponse",
279281
"CreateIpRequest",

scaleway/scaleway/instance/v1/api.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
AttachServerVolumeRequest,
4747
AttachServerVolumeResponse,
4848
Bootscript,
49+
CheckBlockMigrationOrganizationQuotasRequest,
4950
CreateImageRequest,
5051
CreateImageResponse,
5152
CreateIpRequest,
@@ -207,6 +208,7 @@
207208
unmarshal__SetSnapshotResponse,
208209
marshal_ApplyBlockMigrationRequest,
209210
marshal_AttachServerVolumeRequest,
211+
marshal_CheckBlockMigrationOrganizationQuotasRequest,
210212
marshal_CreateImageRequest,
211213
marshal_CreateIpRequest,
212214
marshal_CreatePlacementGroupRequest,
@@ -4052,3 +4054,35 @@ def apply_block_migration(
40524054
)
40534055

40544056
self._throw_on_error(res)
4057+
4058+
def check_block_migration_organization_quotas(
4059+
self,
4060+
*,
4061+
zone: Optional[Zone] = None,
4062+
organization: Optional[str] = None,
4063+
) -> None:
4064+
"""
4065+
:param zone: Zone to target. If none is passed will use default zone from the config.
4066+
:param organization:
4067+
4068+
Usage:
4069+
::
4070+
4071+
result = api.check_block_migration_organization_quotas()
4072+
"""
4073+
4074+
param_zone = validate_path_param("zone", zone or self.client.default_zone)
4075+
4076+
res = self._request(
4077+
"POST",
4078+
f"/instance/v1/zones/{param_zone}/block-migration/check-organization-quotas",
4079+
body=marshal_CheckBlockMigrationOrganizationQuotasRequest(
4080+
CheckBlockMigrationOrganizationQuotasRequest(
4081+
zone=zone,
4082+
organization=organization,
4083+
),
4084+
self.client,
4085+
),
4086+
)
4087+
4088+
self._throw_on_error(res)

scaleway/scaleway/instance/v1/marshalling.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
UpdateVolumeResponse,
109109
ApplyBlockMigrationRequest,
110110
AttachServerVolumeRequest,
111+
CheckBlockMigrationOrganizationQuotasRequest,
111112
VolumeTemplate,
112113
CreateImageRequest,
113114
CreateIpRequest,
@@ -2729,6 +2730,20 @@ def marshal_AttachServerVolumeRequest(
27292730
return output
27302731

27312732

2733+
def marshal_CheckBlockMigrationOrganizationQuotasRequest(
2734+
request: CheckBlockMigrationOrganizationQuotasRequest,
2735+
defaults: ProfileDefaults,
2736+
) -> Dict[str, Any]:
2737+
output: Dict[str, Any] = {}
2738+
2739+
if request.organization is not None:
2740+
output["organization"] = (
2741+
request.organization or defaults.default_organization_id
2742+
)
2743+
2744+
return output
2745+
2746+
27322747
def marshal_VolumeTemplate(
27332748
request: VolumeTemplate,
27342749
defaults: ProfileDefaults,

scaleway/scaleway/instance/v1/types.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,6 +1502,16 @@ class AttachServerVolumeResponse:
15021502
server: Optional[Server]
15031503

15041504

1505+
@dataclass
1506+
class CheckBlockMigrationOrganizationQuotasRequest:
1507+
zone: Optional[Zone]
1508+
"""
1509+
Zone to target. If none is passed will use default zone from the config.
1510+
"""
1511+
1512+
organization: Optional[str]
1513+
1514+
15051515
@dataclass
15061516
class CreateImageRequest:
15071517
root_volume: str

0 commit comments

Comments
 (0)