From 85ee9a5750e71da9d20482dbd58b89f2c3d5fc0c Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Fri, 11 Oct 2024 14:35:16 +0000 Subject: [PATCH] feat: update generated APIs --- .../scaleway_async/instance/v1/__init__.py | 8 - .../scaleway_async/instance/v1/api.py | 152 +----------------- .../scaleway_async/instance/v1/marshalling.py | 126 ++++----------- .../scaleway_async/instance/v1/types.py | 106 +----------- .../instance/v1/types_private.py | 5 - scaleway/scaleway/instance/v1/__init__.py | 8 - scaleway/scaleway/instance/v1/api.py | 152 +----------------- scaleway/scaleway/instance/v1/marshalling.py | 126 ++++----------- scaleway/scaleway/instance/v1/types.py | 106 +----------- .../scaleway/instance/v1/types_private.py | 5 - 10 files changed, 88 insertions(+), 706 deletions(-) diff --git a/scaleway-async/scaleway_async/instance/v1/__init__.py b/scaleway-async/scaleway_async/instance/v1/__init__.py index 8f2320f26..a5563e97a 100644 --- a/scaleway-async/scaleway_async/instance/v1/__init__.py +++ b/scaleway-async/scaleway_async/instance/v1/__init__.py @@ -111,8 +111,6 @@ from .types import DetachServerVolumeResponse from .types import ExportSnapshotRequest from .types import ExportSnapshotResponse -from .types import GetBootscriptRequest -from .types import GetBootscriptResponse from .types import GetDashboardRequest from .types import GetDashboardResponse from .types import GetImageRequest @@ -137,8 +135,6 @@ from .types import GetSnapshotResponse from .types import GetVolumeRequest from .types import GetVolumeResponse -from .types import ListBootscriptsRequest -from .types import ListBootscriptsResponse from .types import ListDefaultSecurityGroupRulesRequest from .types import ListImagesRequest from .types import ListImagesResponse @@ -310,8 +306,6 @@ "DetachServerVolumeResponse", "ExportSnapshotRequest", "ExportSnapshotResponse", - "GetBootscriptRequest", - "GetBootscriptResponse", "GetDashboardRequest", "GetDashboardResponse", "GetImageRequest", @@ -336,8 +330,6 @@ "GetSnapshotResponse", "GetVolumeRequest", "GetVolumeResponse", - "ListBootscriptsRequest", - "ListBootscriptsResponse", "ListDefaultSecurityGroupRulesRequest", "ListImagesRequest", "ListImagesResponse", diff --git a/scaleway-async/scaleway_async/instance/v1/api.py b/scaleway-async/scaleway_async/instance/v1/api.py index 6f9816084..8aa5e54e2 100644 --- a/scaleway-async/scaleway_async/instance/v1/api.py +++ b/scaleway-async/scaleway_async/instance/v1/api.py @@ -68,7 +68,6 @@ DetachServerVolumeResponse, ExportSnapshotRequest, ExportSnapshotResponse, - GetBootscriptResponse, GetDashboardResponse, GetImageResponse, GetIpResponse, @@ -83,7 +82,6 @@ GetVolumeResponse, Image, Ip, - ListBootscriptsResponse, ListImagesResponse, ListIpsResponse, ListPlacementGroupsResponse, @@ -163,7 +161,6 @@ unmarshal_CreateVolumeResponse, unmarshal_DetachServerVolumeResponse, unmarshal_ExportSnapshotResponse, - unmarshal_GetBootscriptResponse, unmarshal_GetDashboardResponse, unmarshal_GetImageResponse, unmarshal_GetIpResponse, @@ -176,7 +173,6 @@ unmarshal_GetServerTypesAvailabilityResponse, unmarshal_GetSnapshotResponse, unmarshal_GetVolumeResponse, - unmarshal_ListBootscriptsResponse, unmarshal_ListImagesResponse, unmarshal_ListIpsResponse, unmarshal_ListPlacementGroupsResponse, @@ -522,7 +518,6 @@ async def _create_server( public_ip: Optional[str] = None, public_ips: Optional[List[str]] = None, boot_type: Optional[BootType] = None, - bootscript: Optional[str] = None, organization: Optional[str] = None, project: Optional[str] = None, tags: Optional[List[str]] = None, @@ -545,7 +540,6 @@ async def _create_server( :param public_ip: ID of the reserved IP to attach to the Instance. :param public_ips: A list of reserved IP IDs to attach to the Instance. :param boot_type: Boot type to use. - :param bootscript: Bootscript ID to use when `boot_type` is set to `bootscript`. :param organization: Instance Organization ID. One-Of ('project_identifier'): at most one of 'project', 'organization' could be set. :param project: Instance Project ID. @@ -583,7 +577,6 @@ async def _create_server( public_ip=public_ip, public_ips=public_ips, boot_type=boot_type, - bootscript=bootscript, tags=tags, security_group=security_group, placement_group=placement_group, @@ -667,11 +660,9 @@ async def _set_server( id: str, name: str, commercial_type: str, - organization: Optional[str] = None, dynamic_ip_required: bool, hostname: str, - protected: bool, - state_detail: str, + organization: Optional[str] = None, project: Optional[str] = None, allowed_actions: Optional[List[ServerAction]] = None, tags: Optional[List[str]] = None, @@ -679,6 +670,7 @@ async def _set_server( routed_ip_enabled: Optional[bool] = None, enable_ipv6: Optional[bool] = None, image: Optional[Image] = None, + protected: bool, private_ip: Optional[str] = None, public_ip: Optional[ServerIp] = None, public_ips: Optional[List[ServerIp]] = None, @@ -686,8 +678,8 @@ async def _set_server( state: Optional[ServerState] = None, location: Optional[ServerLocation] = None, ipv6: Optional[ServerIpv6] = None, - bootscript: Optional[Bootscript] = None, boot_type: Optional[BootType] = None, + state_detail: str, volumes: Optional[Dict[str, Volume]] = None, security_group: Optional[SecurityGroupSummary] = None, maintenances: Optional[List[ServerMaintenance]] = None, @@ -701,11 +693,9 @@ async def _set_server( :param id: Instance unique ID. :param name: Instance name. :param commercial_type: Instance commercial type (eg. GP1-M). - :param organization: Instance Organization ID. :param dynamic_ip_required: True if a dynamic IPv4 is required. :param hostname: Instance host name. - :param protected: Instance protection option is activated. - :param state_detail: Instance state_detail. + :param organization: Instance Organization ID. :param project: Instance Project ID. :param allowed_actions: Provide a list of allowed actions on the server. :param tags: Tags associated with the Instance. @@ -713,6 +703,7 @@ async def _set_server( :param routed_ip_enabled: True to configure the instance so it uses the new routed IP mode (once this is set to True you cannot set it back to False). :param enable_ipv6: True if IPv6 is enabled (deprecated and always `False` when `routed_ip_enabled` is `True`). :param image: Provide information on the Instance image. + :param protected: Instance protection option is activated. :param private_ip: Instance private IP address (deprecated and always `null` when `routed_ip_enabled` is `True`). :param public_ip: Information about the public IP (deprecated in favor of `public_ips`). :param public_ips: Information about all the public IPs attached to the server. @@ -720,8 +711,8 @@ async def _set_server( :param state: Instance state. :param location: Instance location. :param ipv6: Instance IPv6 address (deprecated when `routed_ip_enabled` is `True`). - :param bootscript: Instance bootscript. :param boot_type: Instance boot type. + :param state_detail: Instance state_detail. :param volumes: Instance volumes. :param security_group: Instance security group. :param maintenances: Instance planned maintenances. @@ -776,7 +767,6 @@ async def _set_server( state=state, location=location, ipv6=ipv6, - bootscript=bootscript, boot_type=boot_type, volumes=volumes, security_group=security_group, @@ -802,7 +792,6 @@ async def _update_server( boot_type: Optional[BootType] = None, tags: Optional[List[str]] = None, volumes: Optional[Dict[str, VolumeServerTemplate]] = None, - bootscript: Optional[str] = None, dynamic_ip_required: Optional[bool] = None, routed_ip_enabled: Optional[bool] = None, public_ips: Optional[List[str]] = None, @@ -823,7 +812,6 @@ async def _update_server( :param boot_type: :param tags: Tags of the Instance. :param volumes: - :param bootscript: :param dynamic_ip_required: :param routed_ip_enabled: True to configure the instance so it uses the new routed IP mode (once this is set to True you cannot set it back to False). :param public_ips: A list of reserved IP IDs to attach to the Instance. @@ -862,7 +850,6 @@ async def _update_server( boot_type=boot_type, tags=tags, volumes=volumes, - bootscript=bootscript, dynamic_ip_required=dynamic_ip_required, routed_ip_enabled=routed_ip_enabled, public_ips=public_ips, @@ -1270,7 +1257,6 @@ async def create_image( arch: Arch, zone: Optional[Zone] = None, name: Optional[str] = None, - default_bootscript: Optional[str] = None, extra_volumes: Optional[Dict[str, VolumeTemplate]] = None, organization: Optional[str] = None, project: Optional[str] = None, @@ -1284,7 +1270,6 @@ async def create_image( :param arch: Architecture of the image. :param zone: Zone to target. If none is passed will use default zone from the config. :param name: Name of the image. - :param default_bootscript: Default bootscript of the image. :param extra_volumes: Additional volumes of the image. :param organization: Organization ID of the image. One-Of ('project_identifier'): at most one of 'project', 'organization' could be set. @@ -1314,7 +1299,6 @@ async def create_image( arch=arch, zone=zone, name=name or random_name(prefix="img"), - default_bootscript=default_bootscript, extra_volumes=extra_volumes, tags=tags, public=public, @@ -3940,130 +3924,6 @@ async def delete_private_nic( self._throw_on_error(res) - async def list_bootscripts( - self, - *, - zone: Optional[Zone] = None, - arch: Optional[str] = None, - title: Optional[str] = None, - default: Optional[bool] = None, - public: Optional[bool] = None, - per_page: Optional[int] = None, - page: Optional[int] = None, - ) -> ListBootscriptsResponse: - """ - List bootscripts. - :param zone: Zone to target. If none is passed will use default zone from the config. - :param arch: - :param title: - :param default: - :param public: - :param per_page: - :param page: - :return: :class:`ListBootscriptsResponse ` - :deprecated - - Usage: - :: - - result = await api.list_bootscripts() - """ - - param_zone = validate_path_param("zone", zone or self.client.default_zone) - - res = self._request( - "GET", - f"/instance/v1/zones/{param_zone}/bootscripts", - params={ - "arch": arch, - "default": default, - "page": page, - "per_page": per_page or self.client.default_page_size, - "public": public, - "title": title, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListBootscriptsResponse(res.json()) - - async def list_bootscripts_all( - self, - *, - zone: Optional[Zone] = None, - arch: Optional[str] = None, - title: Optional[str] = None, - default: Optional[bool] = None, - public: Optional[bool] = None, - per_page: Optional[int] = None, - page: Optional[int] = None, - ) -> List[Bootscript]: - """ - List bootscripts. - :param zone: Zone to target. If none is passed will use default zone from the config. - :param arch: - :param title: - :param default: - :param public: - :param per_page: - :param page: - :return: :class:`List[Bootscript] ` - :deprecated - - Usage: - :: - - result = await api.list_bootscripts_all() - """ - - return await fetch_all_pages_async( - type=ListBootscriptsResponse, - key="bootscripts", - fetcher=self.list_bootscripts, - args={ - "zone": zone, - "arch": arch, - "title": title, - "default": default, - "public": public, - "per_page": per_page, - "page": page, - }, - ) - - async def get_bootscript( - self, - *, - bootscript_id: str, - zone: Optional[Zone] = None, - ) -> GetBootscriptResponse: - """ - Get bootscripts. - Get details of a bootscript with the specified ID. - :param bootscript_id: - :param zone: Zone to target. If none is passed will use default zone from the config. - :return: :class:`GetBootscriptResponse ` - :deprecated - - Usage: - :: - - result = await api.get_bootscript( - bootscript_id="example", - ) - """ - - param_zone = validate_path_param("zone", zone or self.client.default_zone) - param_bootscript_id = validate_path_param("bootscript_id", bootscript_id) - - res = self._request( - "GET", - f"/instance/v1/zones/{param_zone}/bootscripts/{param_bootscript_id}", - ) - - self._throw_on_error(res) - return unmarshal_GetBootscriptResponse(res.json()) - async def get_dashboard( self, *, diff --git a/scaleway-async/scaleway_async/instance/v1/marshalling.py b/scaleway-async/scaleway_async/instance/v1/marshalling.py index 128b20744..2fb081f97 100644 --- a/scaleway-async/scaleway_async/instance/v1/marshalling.py +++ b/scaleway-async/scaleway_async/instance/v1/marshalling.py @@ -55,7 +55,6 @@ CreateVolumeResponse, DetachServerVolumeResponse, ExportSnapshotResponse, - GetBootscriptResponse, Dashboard, GetDashboardResponse, GetImageResponse, @@ -71,7 +70,6 @@ GetServerTypesAvailabilityResponse, GetSnapshotResponse, GetVolumeResponse, - ListBootscriptsResponse, ListImagesResponse, ListIpsResponse, ListPlacementGroupsResponse, @@ -208,6 +206,10 @@ def unmarshal_Bootscript(data: Any) -> Bootscript: args: Dict[str, Any] = {} + field = data.get("architecture", None) + if field is not None: + args["architecture"] = field + field = data.get("bootcmdargs", None) if field is not None: args["bootcmdargs"] = field @@ -236,10 +238,6 @@ def unmarshal_Bootscript(data: Any) -> Bootscript: if field is not None: args["organization"] = field - field = data.get("project", None) - if field is not None: - args["project"] = field - field = data.get("public", None) if field is not None: args["public"] = field @@ -248,9 +246,9 @@ def unmarshal_Bootscript(data: Any) -> Bootscript: if field is not None: args["title"] = field - field = data.get("architecture", None) + field = data.get("project", None) if field is not None: - args["architecture"] = field + args["project"] = field field = data.get("zone", None) if field is not None: @@ -829,6 +827,22 @@ def unmarshal_Server(data: Any) -> Server: else None ) + field = data.get("maintenances", None) + if field is not None: + args["maintenances"] = ( + [unmarshal_ServerMaintenance(v) for v in field] + if field is not None + else None + ) + + field = data.get("state_detail", None) + if field is not None: + args["state_detail"] = field + + field = data.get("arch", None) + if field is not None: + args["arch"] = field + field = data.get("modification_date", None) if field is not None: args["modification_date"] = ( @@ -849,27 +863,17 @@ def unmarshal_Server(data: Any) -> Server: else: args["ipv6"] = None - field = data.get("bootscript", None) + field = data.get("security_group", None) if field is not None: - args["bootscript"] = unmarshal_Bootscript(field) + args["security_group"] = unmarshal_SecurityGroupSummary(field) else: - args["bootscript"] = None - - field = data.get("maintenances", None) - if field is not None: - args["maintenances"] = ( - [unmarshal_ServerMaintenance(v) for v in field] - if field is not None - else None - ) - - field = data.get("state_detail", None) - if field is not None: - args["state_detail"] = field + args["security_group"] = None - field = data.get("arch", None) + field = data.get("placement_group", None) if field is not None: - args["arch"] = field + args["placement_group"] = unmarshal_PlacementGroup(field) + else: + args["placement_group"] = None field = data.get("private_nics", None) if field is not None: @@ -881,18 +885,6 @@ def unmarshal_Server(data: Any) -> Server: if field is not None: args["zone"] = field - field = data.get("security_group", None) - if field is not None: - args["security_group"] = unmarshal_SecurityGroupSummary(field) - else: - args["security_group"] = None - - field = data.get("placement_group", None) - if field is not None: - args["placement_group"] = unmarshal_PlacementGroup(field) - else: - args["placement_group"] = None - field = data.get("admin_password_encryption_ssh_key_id", None) if field is not None: args["admin_password_encryption_ssh_key_id"] = field @@ -1476,23 +1468,6 @@ def unmarshal_ExportSnapshotResponse(data: Any) -> ExportSnapshotResponse: return ExportSnapshotResponse(**args) -def unmarshal_GetBootscriptResponse(data: Any) -> GetBootscriptResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'GetBootscriptResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("bootscript", None) - if field is not None: - args["bootscript"] = unmarshal_Bootscript(field) - else: - args["bootscript"] = None - - return GetBootscriptResponse(**args) - - def unmarshal_Dashboard(data: Any) -> Dashboard: if not isinstance(data, dict): raise TypeError( @@ -1823,27 +1798,6 @@ def unmarshal_GetVolumeResponse(data: Any) -> GetVolumeResponse: return GetVolumeResponse(**args) -def unmarshal_ListBootscriptsResponse(data: Any) -> ListBootscriptsResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListBootscriptsResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - - field = data.get("bootscripts", None) - if field is not None: - args["bootscripts"] = ( - [unmarshal_Bootscript(v) for v in field] if field is not None else None - ) - - return ListBootscriptsResponse(**args) - - def unmarshal_ListImagesResponse(data: Any) -> ListImagesResponse: if not isinstance(data, dict): raise TypeError( @@ -2825,9 +2779,6 @@ def marshal_CreateImageRequest( if request.name is not None: output["name"] = request.name - if request.default_bootscript is not None: - output["default_bootscript"] = request.default_bootscript - if request.extra_volumes is not None: output["extra_volumes"] = { key: marshal_VolumeTemplate(value, defaults) @@ -3102,9 +3053,6 @@ def marshal_CreateServerRequest( if request.boot_type is not None: output["boot_type"] = str(request.boot_type) - if request.bootscript is not None: - output["bootscript"] = request.bootscript - if request.tags is not None: output["tags"] = request.tags @@ -3304,6 +3252,9 @@ def marshal_Bootscript( ) -> Dict[str, Any]: output: Dict[str, Any] = {} + if request.architecture is not None: + output["architecture"] = str(request.architecture) + if request.bootcmdargs is not None: output["bootcmdargs"] = request.bootcmdargs @@ -3327,17 +3278,14 @@ def marshal_Bootscript( request.organization or defaults.default_organization_id ) - if request.project is not None: - output["project"] = request.project or defaults.default_project_id - if request.public is not None: output["public"] = request.public if request.title is not None: output["title"] = request.title - if request.architecture is not None: - output["architecture"] = str(request.architecture) + if request.project is not None: + output["project"] = request.project or defaults.default_project_id if request.zone is not None: output["zone"] = request.zone or defaults.default_zone @@ -3773,9 +3721,6 @@ def marshal_UpdateServerRequest( for key, value in request.volumes.items() } - if request.bootscript is not None: - output["bootscript"] = request.bootscript - if request.dynamic_ip_required is not None: output["dynamic_ip_required"] = request.dynamic_ip_required @@ -4247,9 +4192,6 @@ def marshal__SetServerRequest( if request.ipv6 is not None: output["ipv6"] = marshal_ServerIpv6(request.ipv6, defaults) - if request.bootscript is not None: - output["bootscript"] = marshal_Bootscript(request.bootscript, defaults) - if request.boot_type is not None: output["boot_type"] = str(request.boot_type) diff --git a/scaleway-async/scaleway_async/instance/v1/types.py b/scaleway-async/scaleway_async/instance/v1/types.py index 185efdfda..a31a50b14 100644 --- a/scaleway-async/scaleway_async/instance/v1/types.py +++ b/scaleway-async/scaleway_async/instance/v1/types.py @@ -308,64 +308,31 @@ class ServerSummary: @dataclass class Bootscript: + architecture: Arch + bootcmdargs: str - """ - Bootscript arguments. - """ default: bool - """ - Display if the bootscript is the default bootscript (if no other boot option is configured). - """ dtb: str - """ - Provide information regarding a Device Tree Binary (DTB) for use with C1 servers. - """ id: str - """ - Bootscript ID. - """ initrd: str - """ - Initrd (initial ramdisk) configuration. - """ kernel: str - """ - Instance kernel version. - """ organization: str - """ - Bootscript Organization ID. - """ - - project: str - """ - Bootscript Project ID. - """ public: bool - """ - Provide information if the bootscript is public. - """ title: str - """ - Bootscript title. - """ - architecture: Arch - """ - Bootscript architecture. - """ + project: str zone: Zone """ - Zone in which the bootscript is located. + Zone to target. If none is passed will use default zone from the config. """ @@ -912,11 +879,6 @@ class Server: Instance IPv6 address (deprecated when `routed_ip_enabled` is `True`). """ - bootscript: Optional[Bootscript] - """ - Instance bootscript. - """ - maintenances: List[ServerMaintenance] """ Instance planned maintenance. @@ -1562,11 +1524,6 @@ class CreateImageRequest: Name of the image. """ - default_bootscript: Optional[str] - """ - Default bootscript of the image. - """ - extra_volumes: Optional[Dict[str, VolumeTemplate]] """ Additional volumes of the image. @@ -1858,11 +1815,6 @@ class CreateServerRequest: Boot type to use. """ - bootscript: Optional[str] - """ - Bootscript ID to use when `boot_type` is set to `bootscript`. - """ - tags: Optional[List[str]] """ Instance tags. @@ -2165,21 +2117,6 @@ class ExportSnapshotResponse: task: Optional[Task] -@dataclass -class GetBootscriptRequest: - bootscript_id: str - - zone: Optional[Zone] - """ - Zone to target. If none is passed will use default zone from the config. - """ - - -@dataclass -class GetBootscriptResponse: - bootscript: Optional[Bootscript] - - @dataclass class GetDashboardRequest: zone: Optional[Zone] @@ -2412,39 +2349,6 @@ class GetVolumeResponse: volume: Optional[Volume] -@dataclass -class ListBootscriptsRequest: - zone: Optional[Zone] - """ - Zone to target. If none is passed will use default zone from the config. - """ - - arch: Optional[str] - - title: Optional[str] - - default: Optional[bool] - - public: Optional[bool] - - per_page: Optional[int] - - page: Optional[int] - - -@dataclass -class ListBootscriptsResponse: - total_count: int - """ - Total number of bootscripts. - """ - - bootscripts: List[Bootscript] - """ - List of bootscripts. - """ - - @dataclass class ListDefaultSecurityGroupRulesRequest: zone: Optional[Zone] @@ -3509,8 +3413,6 @@ class UpdateServerRequest: volumes: Optional[Dict[str, VolumeServerTemplate]] - bootscript: Optional[str] - dynamic_ip_required: Optional[bool] routed_ip_enabled: Optional[bool] diff --git a/scaleway-async/scaleway_async/instance/v1/types_private.py b/scaleway-async/scaleway_async/instance/v1/types_private.py index 26165b3d2..517b22f86 100644 --- a/scaleway-async/scaleway_async/instance/v1/types_private.py +++ b/scaleway-async/scaleway_async/instance/v1/types_private.py @@ -22,7 +22,6 @@ SnapshotState, VolumeVolumeType, ServerSummary, - Bootscript, Volume, Image, PlacementGroup, @@ -236,10 +235,6 @@ class _SetServerRequest: """ Instance IPv6 address (deprecated when `routed_ip_enabled` is `True`). """ - bootscript: Optional[Bootscript] - """ - Instance bootscript. - """ boot_type: Optional[BootType] """ Instance boot type. diff --git a/scaleway/scaleway/instance/v1/__init__.py b/scaleway/scaleway/instance/v1/__init__.py index 8f2320f26..a5563e97a 100644 --- a/scaleway/scaleway/instance/v1/__init__.py +++ b/scaleway/scaleway/instance/v1/__init__.py @@ -111,8 +111,6 @@ from .types import DetachServerVolumeResponse from .types import ExportSnapshotRequest from .types import ExportSnapshotResponse -from .types import GetBootscriptRequest -from .types import GetBootscriptResponse from .types import GetDashboardRequest from .types import GetDashboardResponse from .types import GetImageRequest @@ -137,8 +135,6 @@ from .types import GetSnapshotResponse from .types import GetVolumeRequest from .types import GetVolumeResponse -from .types import ListBootscriptsRequest -from .types import ListBootscriptsResponse from .types import ListDefaultSecurityGroupRulesRequest from .types import ListImagesRequest from .types import ListImagesResponse @@ -310,8 +306,6 @@ "DetachServerVolumeResponse", "ExportSnapshotRequest", "ExportSnapshotResponse", - "GetBootscriptRequest", - "GetBootscriptResponse", "GetDashboardRequest", "GetDashboardResponse", "GetImageRequest", @@ -336,8 +330,6 @@ "GetSnapshotResponse", "GetVolumeRequest", "GetVolumeResponse", - "ListBootscriptsRequest", - "ListBootscriptsResponse", "ListDefaultSecurityGroupRulesRequest", "ListImagesRequest", "ListImagesResponse", diff --git a/scaleway/scaleway/instance/v1/api.py b/scaleway/scaleway/instance/v1/api.py index c59291c20..47b0545b4 100644 --- a/scaleway/scaleway/instance/v1/api.py +++ b/scaleway/scaleway/instance/v1/api.py @@ -68,7 +68,6 @@ DetachServerVolumeResponse, ExportSnapshotRequest, ExportSnapshotResponse, - GetBootscriptResponse, GetDashboardResponse, GetImageResponse, GetIpResponse, @@ -83,7 +82,6 @@ GetVolumeResponse, Image, Ip, - ListBootscriptsResponse, ListImagesResponse, ListIpsResponse, ListPlacementGroupsResponse, @@ -163,7 +161,6 @@ unmarshal_CreateVolumeResponse, unmarshal_DetachServerVolumeResponse, unmarshal_ExportSnapshotResponse, - unmarshal_GetBootscriptResponse, unmarshal_GetDashboardResponse, unmarshal_GetImageResponse, unmarshal_GetIpResponse, @@ -176,7 +173,6 @@ unmarshal_GetServerTypesAvailabilityResponse, unmarshal_GetSnapshotResponse, unmarshal_GetVolumeResponse, - unmarshal_ListBootscriptsResponse, unmarshal_ListImagesResponse, unmarshal_ListIpsResponse, unmarshal_ListPlacementGroupsResponse, @@ -522,7 +518,6 @@ def _create_server( public_ip: Optional[str] = None, public_ips: Optional[List[str]] = None, boot_type: Optional[BootType] = None, - bootscript: Optional[str] = None, organization: Optional[str] = None, project: Optional[str] = None, tags: Optional[List[str]] = None, @@ -545,7 +540,6 @@ def _create_server( :param public_ip: ID of the reserved IP to attach to the Instance. :param public_ips: A list of reserved IP IDs to attach to the Instance. :param boot_type: Boot type to use. - :param bootscript: Bootscript ID to use when `boot_type` is set to `bootscript`. :param organization: Instance Organization ID. One-Of ('project_identifier'): at most one of 'project', 'organization' could be set. :param project: Instance Project ID. @@ -583,7 +577,6 @@ def _create_server( public_ip=public_ip, public_ips=public_ips, boot_type=boot_type, - bootscript=bootscript, tags=tags, security_group=security_group, placement_group=placement_group, @@ -667,11 +660,9 @@ def _set_server( id: str, name: str, commercial_type: str, - organization: Optional[str] = None, dynamic_ip_required: bool, hostname: str, - protected: bool, - state_detail: str, + organization: Optional[str] = None, project: Optional[str] = None, allowed_actions: Optional[List[ServerAction]] = None, tags: Optional[List[str]] = None, @@ -679,6 +670,7 @@ def _set_server( routed_ip_enabled: Optional[bool] = None, enable_ipv6: Optional[bool] = None, image: Optional[Image] = None, + protected: bool, private_ip: Optional[str] = None, public_ip: Optional[ServerIp] = None, public_ips: Optional[List[ServerIp]] = None, @@ -686,8 +678,8 @@ def _set_server( state: Optional[ServerState] = None, location: Optional[ServerLocation] = None, ipv6: Optional[ServerIpv6] = None, - bootscript: Optional[Bootscript] = None, boot_type: Optional[BootType] = None, + state_detail: str, volumes: Optional[Dict[str, Volume]] = None, security_group: Optional[SecurityGroupSummary] = None, maintenances: Optional[List[ServerMaintenance]] = None, @@ -701,11 +693,9 @@ def _set_server( :param id: Instance unique ID. :param name: Instance name. :param commercial_type: Instance commercial type (eg. GP1-M). - :param organization: Instance Organization ID. :param dynamic_ip_required: True if a dynamic IPv4 is required. :param hostname: Instance host name. - :param protected: Instance protection option is activated. - :param state_detail: Instance state_detail. + :param organization: Instance Organization ID. :param project: Instance Project ID. :param allowed_actions: Provide a list of allowed actions on the server. :param tags: Tags associated with the Instance. @@ -713,6 +703,7 @@ def _set_server( :param routed_ip_enabled: True to configure the instance so it uses the new routed IP mode (once this is set to True you cannot set it back to False). :param enable_ipv6: True if IPv6 is enabled (deprecated and always `False` when `routed_ip_enabled` is `True`). :param image: Provide information on the Instance image. + :param protected: Instance protection option is activated. :param private_ip: Instance private IP address (deprecated and always `null` when `routed_ip_enabled` is `True`). :param public_ip: Information about the public IP (deprecated in favor of `public_ips`). :param public_ips: Information about all the public IPs attached to the server. @@ -720,8 +711,8 @@ def _set_server( :param state: Instance state. :param location: Instance location. :param ipv6: Instance IPv6 address (deprecated when `routed_ip_enabled` is `True`). - :param bootscript: Instance bootscript. :param boot_type: Instance boot type. + :param state_detail: Instance state_detail. :param volumes: Instance volumes. :param security_group: Instance security group. :param maintenances: Instance planned maintenances. @@ -776,7 +767,6 @@ def _set_server( state=state, location=location, ipv6=ipv6, - bootscript=bootscript, boot_type=boot_type, volumes=volumes, security_group=security_group, @@ -802,7 +792,6 @@ def _update_server( boot_type: Optional[BootType] = None, tags: Optional[List[str]] = None, volumes: Optional[Dict[str, VolumeServerTemplate]] = None, - bootscript: Optional[str] = None, dynamic_ip_required: Optional[bool] = None, routed_ip_enabled: Optional[bool] = None, public_ips: Optional[List[str]] = None, @@ -823,7 +812,6 @@ def _update_server( :param boot_type: :param tags: Tags of the Instance. :param volumes: - :param bootscript: :param dynamic_ip_required: :param routed_ip_enabled: True to configure the instance so it uses the new routed IP mode (once this is set to True you cannot set it back to False). :param public_ips: A list of reserved IP IDs to attach to the Instance. @@ -862,7 +850,6 @@ def _update_server( boot_type=boot_type, tags=tags, volumes=volumes, - bootscript=bootscript, dynamic_ip_required=dynamic_ip_required, routed_ip_enabled=routed_ip_enabled, public_ips=public_ips, @@ -1270,7 +1257,6 @@ def create_image( arch: Arch, zone: Optional[Zone] = None, name: Optional[str] = None, - default_bootscript: Optional[str] = None, extra_volumes: Optional[Dict[str, VolumeTemplate]] = None, organization: Optional[str] = None, project: Optional[str] = None, @@ -1284,7 +1270,6 @@ def create_image( :param arch: Architecture of the image. :param zone: Zone to target. If none is passed will use default zone from the config. :param name: Name of the image. - :param default_bootscript: Default bootscript of the image. :param extra_volumes: Additional volumes of the image. :param organization: Organization ID of the image. One-Of ('project_identifier'): at most one of 'project', 'organization' could be set. @@ -1314,7 +1299,6 @@ def create_image( arch=arch, zone=zone, name=name or random_name(prefix="img"), - default_bootscript=default_bootscript, extra_volumes=extra_volumes, tags=tags, public=public, @@ -3940,130 +3924,6 @@ def delete_private_nic( self._throw_on_error(res) - def list_bootscripts( - self, - *, - zone: Optional[Zone] = None, - arch: Optional[str] = None, - title: Optional[str] = None, - default: Optional[bool] = None, - public: Optional[bool] = None, - per_page: Optional[int] = None, - page: Optional[int] = None, - ) -> ListBootscriptsResponse: - """ - List bootscripts. - :param zone: Zone to target. If none is passed will use default zone from the config. - :param arch: - :param title: - :param default: - :param public: - :param per_page: - :param page: - :return: :class:`ListBootscriptsResponse ` - :deprecated - - Usage: - :: - - result = api.list_bootscripts() - """ - - param_zone = validate_path_param("zone", zone or self.client.default_zone) - - res = self._request( - "GET", - f"/instance/v1/zones/{param_zone}/bootscripts", - params={ - "arch": arch, - "default": default, - "page": page, - "per_page": per_page or self.client.default_page_size, - "public": public, - "title": title, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListBootscriptsResponse(res.json()) - - def list_bootscripts_all( - self, - *, - zone: Optional[Zone] = None, - arch: Optional[str] = None, - title: Optional[str] = None, - default: Optional[bool] = None, - public: Optional[bool] = None, - per_page: Optional[int] = None, - page: Optional[int] = None, - ) -> List[Bootscript]: - """ - List bootscripts. - :param zone: Zone to target. If none is passed will use default zone from the config. - :param arch: - :param title: - :param default: - :param public: - :param per_page: - :param page: - :return: :class:`List[Bootscript] ` - :deprecated - - Usage: - :: - - result = api.list_bootscripts_all() - """ - - return fetch_all_pages( - type=ListBootscriptsResponse, - key="bootscripts", - fetcher=self.list_bootscripts, - args={ - "zone": zone, - "arch": arch, - "title": title, - "default": default, - "public": public, - "per_page": per_page, - "page": page, - }, - ) - - def get_bootscript( - self, - *, - bootscript_id: str, - zone: Optional[Zone] = None, - ) -> GetBootscriptResponse: - """ - Get bootscripts. - Get details of a bootscript with the specified ID. - :param bootscript_id: - :param zone: Zone to target. If none is passed will use default zone from the config. - :return: :class:`GetBootscriptResponse ` - :deprecated - - Usage: - :: - - result = api.get_bootscript( - bootscript_id="example", - ) - """ - - param_zone = validate_path_param("zone", zone or self.client.default_zone) - param_bootscript_id = validate_path_param("bootscript_id", bootscript_id) - - res = self._request( - "GET", - f"/instance/v1/zones/{param_zone}/bootscripts/{param_bootscript_id}", - ) - - self._throw_on_error(res) - return unmarshal_GetBootscriptResponse(res.json()) - def get_dashboard( self, *, diff --git a/scaleway/scaleway/instance/v1/marshalling.py b/scaleway/scaleway/instance/v1/marshalling.py index 128b20744..2fb081f97 100644 --- a/scaleway/scaleway/instance/v1/marshalling.py +++ b/scaleway/scaleway/instance/v1/marshalling.py @@ -55,7 +55,6 @@ CreateVolumeResponse, DetachServerVolumeResponse, ExportSnapshotResponse, - GetBootscriptResponse, Dashboard, GetDashboardResponse, GetImageResponse, @@ -71,7 +70,6 @@ GetServerTypesAvailabilityResponse, GetSnapshotResponse, GetVolumeResponse, - ListBootscriptsResponse, ListImagesResponse, ListIpsResponse, ListPlacementGroupsResponse, @@ -208,6 +206,10 @@ def unmarshal_Bootscript(data: Any) -> Bootscript: args: Dict[str, Any] = {} + field = data.get("architecture", None) + if field is not None: + args["architecture"] = field + field = data.get("bootcmdargs", None) if field is not None: args["bootcmdargs"] = field @@ -236,10 +238,6 @@ def unmarshal_Bootscript(data: Any) -> Bootscript: if field is not None: args["organization"] = field - field = data.get("project", None) - if field is not None: - args["project"] = field - field = data.get("public", None) if field is not None: args["public"] = field @@ -248,9 +246,9 @@ def unmarshal_Bootscript(data: Any) -> Bootscript: if field is not None: args["title"] = field - field = data.get("architecture", None) + field = data.get("project", None) if field is not None: - args["architecture"] = field + args["project"] = field field = data.get("zone", None) if field is not None: @@ -829,6 +827,22 @@ def unmarshal_Server(data: Any) -> Server: else None ) + field = data.get("maintenances", None) + if field is not None: + args["maintenances"] = ( + [unmarshal_ServerMaintenance(v) for v in field] + if field is not None + else None + ) + + field = data.get("state_detail", None) + if field is not None: + args["state_detail"] = field + + field = data.get("arch", None) + if field is not None: + args["arch"] = field + field = data.get("modification_date", None) if field is not None: args["modification_date"] = ( @@ -849,27 +863,17 @@ def unmarshal_Server(data: Any) -> Server: else: args["ipv6"] = None - field = data.get("bootscript", None) + field = data.get("security_group", None) if field is not None: - args["bootscript"] = unmarshal_Bootscript(field) + args["security_group"] = unmarshal_SecurityGroupSummary(field) else: - args["bootscript"] = None - - field = data.get("maintenances", None) - if field is not None: - args["maintenances"] = ( - [unmarshal_ServerMaintenance(v) for v in field] - if field is not None - else None - ) - - field = data.get("state_detail", None) - if field is not None: - args["state_detail"] = field + args["security_group"] = None - field = data.get("arch", None) + field = data.get("placement_group", None) if field is not None: - args["arch"] = field + args["placement_group"] = unmarshal_PlacementGroup(field) + else: + args["placement_group"] = None field = data.get("private_nics", None) if field is not None: @@ -881,18 +885,6 @@ def unmarshal_Server(data: Any) -> Server: if field is not None: args["zone"] = field - field = data.get("security_group", None) - if field is not None: - args["security_group"] = unmarshal_SecurityGroupSummary(field) - else: - args["security_group"] = None - - field = data.get("placement_group", None) - if field is not None: - args["placement_group"] = unmarshal_PlacementGroup(field) - else: - args["placement_group"] = None - field = data.get("admin_password_encryption_ssh_key_id", None) if field is not None: args["admin_password_encryption_ssh_key_id"] = field @@ -1476,23 +1468,6 @@ def unmarshal_ExportSnapshotResponse(data: Any) -> ExportSnapshotResponse: return ExportSnapshotResponse(**args) -def unmarshal_GetBootscriptResponse(data: Any) -> GetBootscriptResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'GetBootscriptResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("bootscript", None) - if field is not None: - args["bootscript"] = unmarshal_Bootscript(field) - else: - args["bootscript"] = None - - return GetBootscriptResponse(**args) - - def unmarshal_Dashboard(data: Any) -> Dashboard: if not isinstance(data, dict): raise TypeError( @@ -1823,27 +1798,6 @@ def unmarshal_GetVolumeResponse(data: Any) -> GetVolumeResponse: return GetVolumeResponse(**args) -def unmarshal_ListBootscriptsResponse(data: Any) -> ListBootscriptsResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListBootscriptsResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - - field = data.get("bootscripts", None) - if field is not None: - args["bootscripts"] = ( - [unmarshal_Bootscript(v) for v in field] if field is not None else None - ) - - return ListBootscriptsResponse(**args) - - def unmarshal_ListImagesResponse(data: Any) -> ListImagesResponse: if not isinstance(data, dict): raise TypeError( @@ -2825,9 +2779,6 @@ def marshal_CreateImageRequest( if request.name is not None: output["name"] = request.name - if request.default_bootscript is not None: - output["default_bootscript"] = request.default_bootscript - if request.extra_volumes is not None: output["extra_volumes"] = { key: marshal_VolumeTemplate(value, defaults) @@ -3102,9 +3053,6 @@ def marshal_CreateServerRequest( if request.boot_type is not None: output["boot_type"] = str(request.boot_type) - if request.bootscript is not None: - output["bootscript"] = request.bootscript - if request.tags is not None: output["tags"] = request.tags @@ -3304,6 +3252,9 @@ def marshal_Bootscript( ) -> Dict[str, Any]: output: Dict[str, Any] = {} + if request.architecture is not None: + output["architecture"] = str(request.architecture) + if request.bootcmdargs is not None: output["bootcmdargs"] = request.bootcmdargs @@ -3327,17 +3278,14 @@ def marshal_Bootscript( request.organization or defaults.default_organization_id ) - if request.project is not None: - output["project"] = request.project or defaults.default_project_id - if request.public is not None: output["public"] = request.public if request.title is not None: output["title"] = request.title - if request.architecture is not None: - output["architecture"] = str(request.architecture) + if request.project is not None: + output["project"] = request.project or defaults.default_project_id if request.zone is not None: output["zone"] = request.zone or defaults.default_zone @@ -3773,9 +3721,6 @@ def marshal_UpdateServerRequest( for key, value in request.volumes.items() } - if request.bootscript is not None: - output["bootscript"] = request.bootscript - if request.dynamic_ip_required is not None: output["dynamic_ip_required"] = request.dynamic_ip_required @@ -4247,9 +4192,6 @@ def marshal__SetServerRequest( if request.ipv6 is not None: output["ipv6"] = marshal_ServerIpv6(request.ipv6, defaults) - if request.bootscript is not None: - output["bootscript"] = marshal_Bootscript(request.bootscript, defaults) - if request.boot_type is not None: output["boot_type"] = str(request.boot_type) diff --git a/scaleway/scaleway/instance/v1/types.py b/scaleway/scaleway/instance/v1/types.py index 185efdfda..a31a50b14 100644 --- a/scaleway/scaleway/instance/v1/types.py +++ b/scaleway/scaleway/instance/v1/types.py @@ -308,64 +308,31 @@ class ServerSummary: @dataclass class Bootscript: + architecture: Arch + bootcmdargs: str - """ - Bootscript arguments. - """ default: bool - """ - Display if the bootscript is the default bootscript (if no other boot option is configured). - """ dtb: str - """ - Provide information regarding a Device Tree Binary (DTB) for use with C1 servers. - """ id: str - """ - Bootscript ID. - """ initrd: str - """ - Initrd (initial ramdisk) configuration. - """ kernel: str - """ - Instance kernel version. - """ organization: str - """ - Bootscript Organization ID. - """ - - project: str - """ - Bootscript Project ID. - """ public: bool - """ - Provide information if the bootscript is public. - """ title: str - """ - Bootscript title. - """ - architecture: Arch - """ - Bootscript architecture. - """ + project: str zone: Zone """ - Zone in which the bootscript is located. + Zone to target. If none is passed will use default zone from the config. """ @@ -912,11 +879,6 @@ class Server: Instance IPv6 address (deprecated when `routed_ip_enabled` is `True`). """ - bootscript: Optional[Bootscript] - """ - Instance bootscript. - """ - maintenances: List[ServerMaintenance] """ Instance planned maintenance. @@ -1562,11 +1524,6 @@ class CreateImageRequest: Name of the image. """ - default_bootscript: Optional[str] - """ - Default bootscript of the image. - """ - extra_volumes: Optional[Dict[str, VolumeTemplate]] """ Additional volumes of the image. @@ -1858,11 +1815,6 @@ class CreateServerRequest: Boot type to use. """ - bootscript: Optional[str] - """ - Bootscript ID to use when `boot_type` is set to `bootscript`. - """ - tags: Optional[List[str]] """ Instance tags. @@ -2165,21 +2117,6 @@ class ExportSnapshotResponse: task: Optional[Task] -@dataclass -class GetBootscriptRequest: - bootscript_id: str - - zone: Optional[Zone] - """ - Zone to target. If none is passed will use default zone from the config. - """ - - -@dataclass -class GetBootscriptResponse: - bootscript: Optional[Bootscript] - - @dataclass class GetDashboardRequest: zone: Optional[Zone] @@ -2412,39 +2349,6 @@ class GetVolumeResponse: volume: Optional[Volume] -@dataclass -class ListBootscriptsRequest: - zone: Optional[Zone] - """ - Zone to target. If none is passed will use default zone from the config. - """ - - arch: Optional[str] - - title: Optional[str] - - default: Optional[bool] - - public: Optional[bool] - - per_page: Optional[int] - - page: Optional[int] - - -@dataclass -class ListBootscriptsResponse: - total_count: int - """ - Total number of bootscripts. - """ - - bootscripts: List[Bootscript] - """ - List of bootscripts. - """ - - @dataclass class ListDefaultSecurityGroupRulesRequest: zone: Optional[Zone] @@ -3509,8 +3413,6 @@ class UpdateServerRequest: volumes: Optional[Dict[str, VolumeServerTemplate]] - bootscript: Optional[str] - dynamic_ip_required: Optional[bool] routed_ip_enabled: Optional[bool] diff --git a/scaleway/scaleway/instance/v1/types_private.py b/scaleway/scaleway/instance/v1/types_private.py index 26165b3d2..517b22f86 100644 --- a/scaleway/scaleway/instance/v1/types_private.py +++ b/scaleway/scaleway/instance/v1/types_private.py @@ -22,7 +22,6 @@ SnapshotState, VolumeVolumeType, ServerSummary, - Bootscript, Volume, Image, PlacementGroup, @@ -236,10 +235,6 @@ class _SetServerRequest: """ Instance IPv6 address (deprecated when `routed_ip_enabled` is `True`). """ - bootscript: Optional[Bootscript] - """ - Instance bootscript. - """ boot_type: Optional[BootType] """ Instance boot type.