diff --git a/scaleway-async/scaleway_async/baremetal/v1/api.py b/scaleway-async/scaleway_async/baremetal/v1/api.py index 24f8f9163..a40fbb24c 100644 --- a/scaleway-async/scaleway_async/baremetal/v1/api.py +++ b/scaleway-async/scaleway_async/baremetal/v1/api.py @@ -281,6 +281,7 @@ async def create_server( offer_id: str, name: str, description: str, + protected: bool, zone: Optional[ScwZone] = None, organization_id: Optional[str] = None, project_id: Optional[str] = None, @@ -294,6 +295,7 @@ async def create_server( :param offer_id: Offer ID of the new server. :param name: Name of the server (≠hostname). :param description: Description associated with the server, max 255 characters. + :param protected: If enabled, the server can not be deleted. :param zone: Zone to target. If none is passed will use default zone from the config. :param organization_id: Organization ID with which the server will be created. One-Of ('project_identifier'): at most one of 'project_id', 'organization_id' could be set. @@ -311,6 +313,7 @@ async def create_server( offer_id="example", name="example", description="example", + protected=False, ) """ @@ -324,6 +327,7 @@ async def create_server( offer_id=offer_id, name=name, description=description, + protected=protected, zone=zone, tags=tags, install=install, @@ -346,15 +350,17 @@ async def update_server( name: Optional[str] = None, description: Optional[str] = None, tags: Optional[List[str]] = None, + protected: Optional[bool] = None, ) -> Server: """ Update an Elastic Metal server. - Update the server associated with the ID. You can update parameters such as the server's name, tags and description. Any parameters left null in the request body are not updated. + Update the server associated with the ID. You can update parameters such as the server's name, tags, description and protection flag. Any parameters left null in the request body are not updated. :param server_id: ID of the server to update. :param zone: Zone to target. If none is passed will use default zone from the config. :param name: Name of the server (≠hostname), not updated if null. :param description: Description associated with the server, max 255 characters, not updated if null. :param tags: Tags associated with the server, not updated if null. + :param protected: If enabled, the server can not be deleted. :return: :class:`Server ` Usage: @@ -378,6 +384,7 @@ async def update_server( name=name, description=description, tags=tags, + protected=protected, ), self.client, ), diff --git a/scaleway-async/scaleway_async/baremetal/v1/marshalling.py b/scaleway-async/scaleway_async/baremetal/v1/marshalling.py index 594312c7d..acbda2f4a 100644 --- a/scaleway-async/scaleway_async/baremetal/v1/marshalling.py +++ b/scaleway-async/scaleway_async/baremetal/v1/marshalling.py @@ -1055,6 +1055,14 @@ def unmarshal_Server(data: Any) -> Server: if field is not None: args["status"] = field + field = data.get("offer_id", None) + if field is not None: + args["offer_id"] = field + + field = data.get("offer_name", None) + if field is not None: + args["offer_name"] = field + field = data.get("updated_at", None) if field is not None: args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field @@ -1067,14 +1075,6 @@ def unmarshal_Server(data: Any) -> Server: else: args["created_at"] = None - field = data.get("offer_id", None) - if field is not None: - args["offer_id"] = field - - field = data.get("offer_name", None) - if field is not None: - args["offer_name"] = field - field = data.get("tags", None) if field is not None: args["tags"] = field @@ -1105,6 +1105,10 @@ def unmarshal_Server(data: Any) -> Server: [unmarshal_ServerOption(v) for v in field] if field is not None else None ) + field = data.get("protected", None) + if field is not None: + args["protected"] = field + field = data.get("install", None) if field is not None: args["install"] = unmarshal_ServerInstall(field) @@ -1603,6 +1607,9 @@ def marshal_CreateServerRequest( if request.description is not None: output["description"] = request.description + if request.protected is not None: + output["protected"] = request.protected + if request.tags is not None: output["tags"] = request.tags @@ -1739,6 +1746,9 @@ def marshal_UpdateServerRequest( if request.tags is not None: output["tags"] = request.tags + if request.protected is not None: + output["protected"] = request.protected + return output diff --git a/scaleway-async/scaleway_async/baremetal/v1/types.py b/scaleway-async/scaleway_async/baremetal/v1/types.py index fac2f380a..25d4e308a 100644 --- a/scaleway-async/scaleway_async/baremetal/v1/types.py +++ b/scaleway-async/scaleway_async/baremetal/v1/types.py @@ -959,24 +959,24 @@ class Server: Status of the server. """ - updated_at: Optional[datetime] + offer_id: str """ - Last modification date of the server. + Offer ID of the server. """ - created_at: Optional[datetime] + offer_name: str """ - Creation date of the server. + Offer name of the server. """ - offer_id: str + updated_at: Optional[datetime] """ - Offer ID of the server. + Last modification date of the server. """ - offer_name: str + created_at: Optional[datetime] """ - Offer name of the server. + Creation date of the server. """ tags: List[str] @@ -1014,6 +1014,11 @@ class Server: Options enabled on the server. """ + protected: bool + """ + If enabled, the server can not be deleted. + """ + install: Optional[ServerInstall] """ Configuration of the installation. @@ -1111,6 +1116,11 @@ class CreateServerRequest: Description associated with the server, max 255 characters. """ + protected: bool + """ + If enabled, the server can not be deleted. + """ + zone: Optional[ScwZone] """ Zone to target. If none is passed will use default zone from the config. @@ -1842,6 +1852,11 @@ class UpdateServerRequest: Tags associated with the server, not updated if null. """ + protected: Optional[bool] + """ + If enabled, the server can not be deleted. + """ + @dataclass class UpdateSettingRequest: diff --git a/scaleway/scaleway/baremetal/v1/api.py b/scaleway/scaleway/baremetal/v1/api.py index d9b73a500..4088fa42f 100644 --- a/scaleway/scaleway/baremetal/v1/api.py +++ b/scaleway/scaleway/baremetal/v1/api.py @@ -281,6 +281,7 @@ def create_server( offer_id: str, name: str, description: str, + protected: bool, zone: Optional[ScwZone] = None, organization_id: Optional[str] = None, project_id: Optional[str] = None, @@ -294,6 +295,7 @@ def create_server( :param offer_id: Offer ID of the new server. :param name: Name of the server (≠hostname). :param description: Description associated with the server, max 255 characters. + :param protected: If enabled, the server can not be deleted. :param zone: Zone to target. If none is passed will use default zone from the config. :param organization_id: Organization ID with which the server will be created. One-Of ('project_identifier'): at most one of 'project_id', 'organization_id' could be set. @@ -311,6 +313,7 @@ def create_server( offer_id="example", name="example", description="example", + protected=False, ) """ @@ -324,6 +327,7 @@ def create_server( offer_id=offer_id, name=name, description=description, + protected=protected, zone=zone, tags=tags, install=install, @@ -346,15 +350,17 @@ def update_server( name: Optional[str] = None, description: Optional[str] = None, tags: Optional[List[str]] = None, + protected: Optional[bool] = None, ) -> Server: """ Update an Elastic Metal server. - Update the server associated with the ID. You can update parameters such as the server's name, tags and description. Any parameters left null in the request body are not updated. + Update the server associated with the ID. You can update parameters such as the server's name, tags, description and protection flag. Any parameters left null in the request body are not updated. :param server_id: ID of the server to update. :param zone: Zone to target. If none is passed will use default zone from the config. :param name: Name of the server (≠hostname), not updated if null. :param description: Description associated with the server, max 255 characters, not updated if null. :param tags: Tags associated with the server, not updated if null. + :param protected: If enabled, the server can not be deleted. :return: :class:`Server ` Usage: @@ -378,6 +384,7 @@ def update_server( name=name, description=description, tags=tags, + protected=protected, ), self.client, ), diff --git a/scaleway/scaleway/baremetal/v1/marshalling.py b/scaleway/scaleway/baremetal/v1/marshalling.py index 594312c7d..acbda2f4a 100644 --- a/scaleway/scaleway/baremetal/v1/marshalling.py +++ b/scaleway/scaleway/baremetal/v1/marshalling.py @@ -1055,6 +1055,14 @@ def unmarshal_Server(data: Any) -> Server: if field is not None: args["status"] = field + field = data.get("offer_id", None) + if field is not None: + args["offer_id"] = field + + field = data.get("offer_name", None) + if field is not None: + args["offer_name"] = field + field = data.get("updated_at", None) if field is not None: args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field @@ -1067,14 +1075,6 @@ def unmarshal_Server(data: Any) -> Server: else: args["created_at"] = None - field = data.get("offer_id", None) - if field is not None: - args["offer_id"] = field - - field = data.get("offer_name", None) - if field is not None: - args["offer_name"] = field - field = data.get("tags", None) if field is not None: args["tags"] = field @@ -1105,6 +1105,10 @@ def unmarshal_Server(data: Any) -> Server: [unmarshal_ServerOption(v) for v in field] if field is not None else None ) + field = data.get("protected", None) + if field is not None: + args["protected"] = field + field = data.get("install", None) if field is not None: args["install"] = unmarshal_ServerInstall(field) @@ -1603,6 +1607,9 @@ def marshal_CreateServerRequest( if request.description is not None: output["description"] = request.description + if request.protected is not None: + output["protected"] = request.protected + if request.tags is not None: output["tags"] = request.tags @@ -1739,6 +1746,9 @@ def marshal_UpdateServerRequest( if request.tags is not None: output["tags"] = request.tags + if request.protected is not None: + output["protected"] = request.protected + return output diff --git a/scaleway/scaleway/baremetal/v1/types.py b/scaleway/scaleway/baremetal/v1/types.py index fac2f380a..25d4e308a 100644 --- a/scaleway/scaleway/baremetal/v1/types.py +++ b/scaleway/scaleway/baremetal/v1/types.py @@ -959,24 +959,24 @@ class Server: Status of the server. """ - updated_at: Optional[datetime] + offer_id: str """ - Last modification date of the server. + Offer ID of the server. """ - created_at: Optional[datetime] + offer_name: str """ - Creation date of the server. + Offer name of the server. """ - offer_id: str + updated_at: Optional[datetime] """ - Offer ID of the server. + Last modification date of the server. """ - offer_name: str + created_at: Optional[datetime] """ - Offer name of the server. + Creation date of the server. """ tags: List[str] @@ -1014,6 +1014,11 @@ class Server: Options enabled on the server. """ + protected: bool + """ + If enabled, the server can not be deleted. + """ + install: Optional[ServerInstall] """ Configuration of the installation. @@ -1111,6 +1116,11 @@ class CreateServerRequest: Description associated with the server, max 255 characters. """ + protected: bool + """ + If enabled, the server can not be deleted. + """ + zone: Optional[ScwZone] """ Zone to target. If none is passed will use default zone from the config. @@ -1842,6 +1852,11 @@ class UpdateServerRequest: Tags associated with the server, not updated if null. """ + protected: Optional[bool] + """ + If enabled, the server can not be deleted. + """ + @dataclass class UpdateSettingRequest: