Skip to content

feat(instance): create CheckQuotasOrganizationBlockMigration endpoint #768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions scaleway-async/scaleway_async/instance/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
from .types import ApplyBlockMigrationRequest
from .types import AttachServerVolumeRequest
from .types import AttachServerVolumeResponse
from .types import CheckBlockMigrationOrganizationQuotasRequest
from .types import CreateImageRequest
from .types import CreateImageResponse
from .types import CreateIpRequest
Expand Down Expand Up @@ -274,6 +275,7 @@
"ApplyBlockMigrationRequest",
"AttachServerVolumeRequest",
"AttachServerVolumeResponse",
"CheckBlockMigrationOrganizationQuotasRequest",
"CreateImageRequest",
"CreateImageResponse",
"CreateIpRequest",
Expand Down
34 changes: 34 additions & 0 deletions scaleway-async/scaleway_async/instance/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
AttachServerVolumeRequest,
AttachServerVolumeResponse,
Bootscript,
CheckBlockMigrationOrganizationQuotasRequest,
CreateImageRequest,
CreateImageResponse,
CreateIpRequest,
Expand Down Expand Up @@ -207,6 +208,7 @@
unmarshal__SetSnapshotResponse,
marshal_ApplyBlockMigrationRequest,
marshal_AttachServerVolumeRequest,
marshal_CheckBlockMigrationOrganizationQuotasRequest,
marshal_CreateImageRequest,
marshal_CreateIpRequest,
marshal_CreatePlacementGroupRequest,
Expand Down Expand Up @@ -4052,3 +4054,35 @@ async def apply_block_migration(
)

self._throw_on_error(res)

async def check_block_migration_organization_quotas(
self,
*,
zone: Optional[Zone] = None,
organization: Optional[str] = None,
) -> None:
"""
:param zone: Zone to target. If none is passed will use default zone from the config.
:param organization:
Usage:
::
result = await api.check_block_migration_organization_quotas()
"""

param_zone = validate_path_param("zone", zone or self.client.default_zone)

res = self._request(
"POST",
f"/instance/v1/zones/{param_zone}/block-migration/check-organization-quotas",
body=marshal_CheckBlockMigrationOrganizationQuotasRequest(
CheckBlockMigrationOrganizationQuotasRequest(
zone=zone,
organization=organization,
),
self.client,
),
)

self._throw_on_error(res)
15 changes: 15 additions & 0 deletions scaleway-async/scaleway_async/instance/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
UpdateVolumeResponse,
ApplyBlockMigrationRequest,
AttachServerVolumeRequest,
CheckBlockMigrationOrganizationQuotasRequest,
VolumeTemplate,
CreateImageRequest,
CreateIpRequest,
Expand Down Expand Up @@ -2729,6 +2730,20 @@ def marshal_AttachServerVolumeRequest(
return output


def marshal_CheckBlockMigrationOrganizationQuotasRequest(
request: CheckBlockMigrationOrganizationQuotasRequest,
defaults: ProfileDefaults,
) -> Dict[str, Any]:
output: Dict[str, Any] = {}

if request.organization is not None:
output["organization"] = (
request.organization or defaults.default_organization_id
)

return output


def marshal_VolumeTemplate(
request: VolumeTemplate,
defaults: ProfileDefaults,
Expand Down
10 changes: 10 additions & 0 deletions scaleway-async/scaleway_async/instance/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1502,6 +1502,16 @@ class AttachServerVolumeResponse:
server: Optional[Server]


@dataclass
class CheckBlockMigrationOrganizationQuotasRequest:
zone: Optional[Zone]
"""
Zone to target. If none is passed will use default zone from the config.
"""

organization: Optional[str]


@dataclass
class CreateImageRequest:
root_volume: str
Expand Down
2 changes: 2 additions & 0 deletions scaleway/scaleway/instance/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
from .types import ApplyBlockMigrationRequest
from .types import AttachServerVolumeRequest
from .types import AttachServerVolumeResponse
from .types import CheckBlockMigrationOrganizationQuotasRequest
from .types import CreateImageRequest
from .types import CreateImageResponse
from .types import CreateIpRequest
Expand Down Expand Up @@ -274,6 +275,7 @@
"ApplyBlockMigrationRequest",
"AttachServerVolumeRequest",
"AttachServerVolumeResponse",
"CheckBlockMigrationOrganizationQuotasRequest",
"CreateImageRequest",
"CreateImageResponse",
"CreateIpRequest",
Expand Down
34 changes: 34 additions & 0 deletions scaleway/scaleway/instance/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
AttachServerVolumeRequest,
AttachServerVolumeResponse,
Bootscript,
CheckBlockMigrationOrganizationQuotasRequest,
CreateImageRequest,
CreateImageResponse,
CreateIpRequest,
Expand Down Expand Up @@ -207,6 +208,7 @@
unmarshal__SetSnapshotResponse,
marshal_ApplyBlockMigrationRequest,
marshal_AttachServerVolumeRequest,
marshal_CheckBlockMigrationOrganizationQuotasRequest,
marshal_CreateImageRequest,
marshal_CreateIpRequest,
marshal_CreatePlacementGroupRequest,
Expand Down Expand Up @@ -4052,3 +4054,35 @@ def apply_block_migration(
)

self._throw_on_error(res)

def check_block_migration_organization_quotas(
self,
*,
zone: Optional[Zone] = None,
organization: Optional[str] = None,
) -> None:
"""
:param zone: Zone to target. If none is passed will use default zone from the config.
:param organization:

Usage:
::

result = api.check_block_migration_organization_quotas()
"""

param_zone = validate_path_param("zone", zone or self.client.default_zone)

res = self._request(
"POST",
f"/instance/v1/zones/{param_zone}/block-migration/check-organization-quotas",
body=marshal_CheckBlockMigrationOrganizationQuotasRequest(
CheckBlockMigrationOrganizationQuotasRequest(
zone=zone,
organization=organization,
),
self.client,
),
)

self._throw_on_error(res)
15 changes: 15 additions & 0 deletions scaleway/scaleway/instance/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
UpdateVolumeResponse,
ApplyBlockMigrationRequest,
AttachServerVolumeRequest,
CheckBlockMigrationOrganizationQuotasRequest,
VolumeTemplate,
CreateImageRequest,
CreateIpRequest,
Expand Down Expand Up @@ -2729,6 +2730,20 @@ def marshal_AttachServerVolumeRequest(
return output


def marshal_CheckBlockMigrationOrganizationQuotasRequest(
request: CheckBlockMigrationOrganizationQuotasRequest,
defaults: ProfileDefaults,
) -> Dict[str, Any]:
output: Dict[str, Any] = {}

if request.organization is not None:
output["organization"] = (
request.organization or defaults.default_organization_id
)

return output


def marshal_VolumeTemplate(
request: VolumeTemplate,
defaults: ProfileDefaults,
Expand Down
10 changes: 10 additions & 0 deletions scaleway/scaleway/instance/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1502,6 +1502,16 @@ class AttachServerVolumeResponse:
server: Optional[Server]


@dataclass
class CheckBlockMigrationOrganizationQuotasRequest:
zone: Optional[Zone]
"""
Zone to target. If none is passed will use default zone from the config.
"""

organization: Optional[str]


@dataclass
class CreateImageRequest:
root_volume: str
Expand Down