From be34b1ce21cc84079f03078a9197d12a784208ca Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Mon, 9 Sep 2024 14:31:01 +0000 Subject: [PATCH] feat: update generated APIs --- scaleway-async/scaleway_async/ipam/v1/api.py | 46 +++++++++++++------ .../scaleway_async/ipam/v1/marshalling.py | 22 ++++++++- .../scaleway_async/ipam/v1/types.py | 22 ++++++--- scaleway/scaleway/ipam/v1/api.py | 46 +++++++++++++------ scaleway/scaleway/ipam/v1/marshalling.py | 22 ++++++++- scaleway/scaleway/ipam/v1/types.py | 22 ++++++--- 6 files changed, 134 insertions(+), 46 deletions(-) diff --git a/scaleway-async/scaleway_async/ipam/v1/api.py b/scaleway-async/scaleway_async/ipam/v1/api.py index d5202ce63..2cb835bf7 100644 --- a/scaleway-async/scaleway_async/ipam/v1/api.py +++ b/scaleway-async/scaleway_async/ipam/v1/api.py @@ -19,6 +19,7 @@ AttachIPRequest, BookIPRequest, CustomResource, + DetachIPRequest, IP, ListIPsResponse, MoveIPRequest, @@ -32,6 +33,7 @@ unmarshal_ListIPsResponse, marshal_AttachIPRequest, marshal_BookIPRequest, + marshal_DetachIPRequest, marshal_MoveIPRequest, marshal_ReleaseIPSetRequest, marshal_UpdateIPRequest, @@ -55,15 +57,15 @@ async def book_ip( resource: Optional[CustomResource] = None, ) -> IP: """ - Book a new IP. - Book a new IP from the specified source. Currently IPs can only be booked from a Private Network. - :param source: Source in which to book the IP. Not all sources are available for booking. + Reserve a new IP. + Reserve a new IP from the specified source. Currently IPs can only be reserved from a Private Network. + :param source: Source in which to reserve the IP. Not all sources are available for reservation. :param is_ipv6: Request an IPv6 instead of an IPv4. :param region: Region to target. If none is passed will use default region from the config. :param project_id: When creating an IP in a Private Network, the Project must match the Private Network's Project. - :param address: The requested address should not include the subnet mask (/suffix). Note that only the Private Network source allows you to pick a specific IP. If the requested IP is already booked, then the call will fail. + :param address: The requested address should not include the subnet mask (/suffix). Note that only the Private Network source allows you to pick a specific IP. If the requested IP is already reserved, then the call will fail. :param tags: Tags for the IP. - :param resource: Custom resource to attach to the IP being booked. An example of a custom resource is a virtual machine hosted on an Elastic Metal server, or an additional user network interface on an Instance. Do not use this for attaching IP addresses to standard Scaleway resources, as it will fail - instead, see the relevant product API for an equivalent method. + :param resource: Custom resource to attach to the IP being reserved. An example of a custom resource is a virtual machine hosted on an Elastic Metal server. Do not use this for attaching IP addresses to standard Scaleway resources, as it will fail - instead, see the relevant product API for an equivalent method. :return: :class:`IP ` Usage: @@ -425,8 +427,8 @@ async def attach_ip( region: Optional[Region] = None, ) -> IP: """ - Attach existing IP to custom resource. - Attach an existing IP from a Private Network subnet to a custom, named resource via its MAC address. An example of a custom resource is a virtual machine hosted on an Elastic Metal server, or an additional user network interface on an Instance. Do not use this method for attaching IP addresses to standard Scaleway resources as it will fail - see the relevant product API for an equivalent method. + Attach IP to custom resource. + Attach an existing reserved IP from a Private Network subnet to a custom, named resource via its MAC address. An example of a custom resource is a virtual machine hosted on an Elastic Metal server. Do not use this method for attaching IP addresses to standard Scaleway resources as it will fail - see the relevant product API for an equivalent method. :param ip_id: IP ID. :param resource: Custom resource to be attached to the IP. :param region: Region to target. If none is passed will use default region from the config. @@ -466,12 +468,14 @@ async def detach_ip( self, *, ip_id: str, + resource: CustomResource, region: Optional[Region] = None, ) -> IP: """ - Detach existing IP from a custom resource. - Detach a private IP from a custom resource. An example of a custom resource is a virtual machine hosted on an Elastic Metal server. Do not use this method for attaching IP addresses to standard Scaleway resources (e.g. Instances, Load Balancers) as it will fail - see the relevant product API for an equivalent method. + Detach IP from a custom resource. + Detach a private IP from a custom resource. An example of a custom resource is a virtual machine hosted on an Elastic Metal server. Do not use this method for detaching IP addresses from standard Scaleway resources (e.g. Instances, Load Balancers) as it will fail - see the relevant product API for an equivalent method. :param ip_id: IP ID. + :param resource: Custom resource currently attached to the IP. :param region: Region to target. If none is passed will use default region from the config. :return: :class:`IP ` @@ -480,6 +484,7 @@ async def detach_ip( result = await api.detach_ip( ip_id="example", + resource=CustomResource(), ) """ @@ -491,7 +496,14 @@ async def detach_ip( res = self._request( "POST", f"/ipam/v1/regions/{param_region}/ips/{param_ip_id}/detach", - body={}, + body=marshal_DetachIPRequest( + DetachIPRequest( + ip_id=ip_id, + resource=resource, + region=region, + ), + self.client, + ), ) self._throw_on_error(res) @@ -501,15 +513,17 @@ async def move_ip( self, *, ip_id: str, + from_resource: CustomResource, region: Optional[Region] = None, - resource: Optional[CustomResource] = None, + to_resource: Optional[CustomResource] = None, ) -> IP: """ - Move existing IP to a custom resource. - Move an existing private IP from one custom resource (e.g. a virtual machine hosted on an Elastic Metal server) to another custom resource. This will detach it from the first resource, and attach it to the second. Do not use this method for moving IP addresses between standard Scaleway resources (e.g. Instances, Load Balancers) as it will fail - see the relevant product API for an equivalent method. + Move IP to a custom resource. + Move an existing reserved private IP from one custom resource (e.g. a virtual machine hosted on an Elastic Metal server) to another custom resource. This will detach it from the first resource, and attach it to the second. Do not use this method for moving IP addresses between standard Scaleway resources (e.g. Instances, Load Balancers) as it will fail - see the relevant product API for an equivalent method. :param ip_id: IP ID. + :param from_resource: Custom resource currently attached to the IP. :param region: Region to target. If none is passed will use default region from the config. - :param resource: Custom resource to be attached to the IP. + :param to_resource: Custom resource to be attached to the IP. :return: :class:`IP ` Usage: @@ -517,6 +531,7 @@ async def move_ip( result = await api.move_ip( ip_id="example", + from_resource=CustomResource(), ) """ @@ -531,8 +546,9 @@ async def move_ip( body=marshal_MoveIPRequest( MoveIPRequest( ip_id=ip_id, + from_resource=from_resource, region=region, - resource=resource, + to_resource=to_resource, ), self.client, ), diff --git a/scaleway-async/scaleway_async/ipam/v1/marshalling.py b/scaleway-async/scaleway_async/ipam/v1/marshalling.py index a146c6951..dc61dff97 100644 --- a/scaleway-async/scaleway_async/ipam/v1/marshalling.py +++ b/scaleway-async/scaleway_async/ipam/v1/marshalling.py @@ -18,6 +18,7 @@ CustomResource, AttachIPRequest, BookIPRequest, + DetachIPRequest, MoveIPRequest, ReleaseIPSetRequest, UpdateIPRequest, @@ -267,8 +268,8 @@ def marshal_BookIPRequest( return output -def marshal_MoveIPRequest( - request: MoveIPRequest, +def marshal_DetachIPRequest( + request: DetachIPRequest, defaults: ProfileDefaults, ) -> Dict[str, Any]: output: Dict[str, Any] = {} @@ -279,6 +280,23 @@ def marshal_MoveIPRequest( return output +def marshal_MoveIPRequest( + request: MoveIPRequest, + defaults: ProfileDefaults, +) -> Dict[str, Any]: + output: Dict[str, Any] = {} + + if request.from_resource is not None: + output["from_resource"] = marshal_CustomResource( + request.from_resource, defaults + ) + + if request.to_resource is not None: + output["to_resource"] = marshal_CustomResource(request.to_resource, defaults) + + return output + + def marshal_ReleaseIPSetRequest( request: ReleaseIPSetRequest, defaults: ProfileDefaults, diff --git a/scaleway-async/scaleway_async/ipam/v1/types.py b/scaleway-async/scaleway_async/ipam/v1/types.py index 5be77b2e2..b524974f8 100644 --- a/scaleway-async/scaleway_async/ipam/v1/types.py +++ b/scaleway-async/scaleway_async/ipam/v1/types.py @@ -147,7 +147,7 @@ class IP: created_at: Optional[datetime] """ - Date the IP was booked. + Date the IP was reserved. """ updated_at: Optional[datetime] @@ -157,7 +157,7 @@ class IP: source: Optional[Source] """ - Source pool where the IP was booked in. + Source pool where the IP was reserved in. """ resource: Optional[Resource] @@ -193,7 +193,7 @@ class AttachIPRequest: class BookIPRequest: source: Source """ - Source in which to book the IP. Not all sources are available for booking. + Source in which to reserve the IP. Not all sources are available for reservation. """ is_ipv6: bool @@ -213,7 +213,7 @@ class BookIPRequest: address: Optional[str] """ - The requested address should not include the subnet mask (/suffix). Note that only the Private Network source allows you to pick a specific IP. If the requested IP is already booked, then the call will fail. + The requested address should not include the subnet mask (/suffix). Note that only the Private Network source allows you to pick a specific IP. If the requested IP is already reserved, then the call will fail. """ tags: Optional[List[str]] @@ -223,7 +223,7 @@ class BookIPRequest: resource: Optional[CustomResource] """ - Custom resource to attach to the IP being booked. An example of a custom resource is a virtual machine hosted on an Elastic Metal server, or an additional user network interface on an Instance. Do not use this for attaching IP addresses to standard Scaleway resources, as it will fail - instead, see the relevant product API for an equivalent method. + Custom resource to attach to the IP being reserved. An example of a custom resource is a virtual machine hosted on an Elastic Metal server. Do not use this for attaching IP addresses to standard Scaleway resources, as it will fail - instead, see the relevant product API for an equivalent method. """ @@ -234,6 +234,11 @@ class DetachIPRequest: IP ID. """ + resource: CustomResource + """ + Custom resource currently attached to the IP. + """ + region: Optional[Region] """ Region to target. If none is passed will use default region from the config. @@ -351,12 +356,17 @@ class MoveIPRequest: IP ID. """ + from_resource: CustomResource + """ + Custom resource currently attached to the IP. + """ + region: Optional[Region] """ Region to target. If none is passed will use default region from the config. """ - resource: Optional[CustomResource] + to_resource: Optional[CustomResource] """ Custom resource to be attached to the IP. """ diff --git a/scaleway/scaleway/ipam/v1/api.py b/scaleway/scaleway/ipam/v1/api.py index e53300cef..ca4b21a91 100644 --- a/scaleway/scaleway/ipam/v1/api.py +++ b/scaleway/scaleway/ipam/v1/api.py @@ -19,6 +19,7 @@ AttachIPRequest, BookIPRequest, CustomResource, + DetachIPRequest, IP, ListIPsResponse, MoveIPRequest, @@ -32,6 +33,7 @@ unmarshal_ListIPsResponse, marshal_AttachIPRequest, marshal_BookIPRequest, + marshal_DetachIPRequest, marshal_MoveIPRequest, marshal_ReleaseIPSetRequest, marshal_UpdateIPRequest, @@ -55,15 +57,15 @@ def book_ip( resource: Optional[CustomResource] = None, ) -> IP: """ - Book a new IP. - Book a new IP from the specified source. Currently IPs can only be booked from a Private Network. - :param source: Source in which to book the IP. Not all sources are available for booking. + Reserve a new IP. + Reserve a new IP from the specified source. Currently IPs can only be reserved from a Private Network. + :param source: Source in which to reserve the IP. Not all sources are available for reservation. :param is_ipv6: Request an IPv6 instead of an IPv4. :param region: Region to target. If none is passed will use default region from the config. :param project_id: When creating an IP in a Private Network, the Project must match the Private Network's Project. - :param address: The requested address should not include the subnet mask (/suffix). Note that only the Private Network source allows you to pick a specific IP. If the requested IP is already booked, then the call will fail. + :param address: The requested address should not include the subnet mask (/suffix). Note that only the Private Network source allows you to pick a specific IP. If the requested IP is already reserved, then the call will fail. :param tags: Tags for the IP. - :param resource: Custom resource to attach to the IP being booked. An example of a custom resource is a virtual machine hosted on an Elastic Metal server, or an additional user network interface on an Instance. Do not use this for attaching IP addresses to standard Scaleway resources, as it will fail - instead, see the relevant product API for an equivalent method. + :param resource: Custom resource to attach to the IP being reserved. An example of a custom resource is a virtual machine hosted on an Elastic Metal server. Do not use this for attaching IP addresses to standard Scaleway resources, as it will fail - instead, see the relevant product API for an equivalent method. :return: :class:`IP ` Usage: @@ -425,8 +427,8 @@ def attach_ip( region: Optional[Region] = None, ) -> IP: """ - Attach existing IP to custom resource. - Attach an existing IP from a Private Network subnet to a custom, named resource via its MAC address. An example of a custom resource is a virtual machine hosted on an Elastic Metal server, or an additional user network interface on an Instance. Do not use this method for attaching IP addresses to standard Scaleway resources as it will fail - see the relevant product API for an equivalent method. + Attach IP to custom resource. + Attach an existing reserved IP from a Private Network subnet to a custom, named resource via its MAC address. An example of a custom resource is a virtual machine hosted on an Elastic Metal server. Do not use this method for attaching IP addresses to standard Scaleway resources as it will fail - see the relevant product API for an equivalent method. :param ip_id: IP ID. :param resource: Custom resource to be attached to the IP. :param region: Region to target. If none is passed will use default region from the config. @@ -466,12 +468,14 @@ def detach_ip( self, *, ip_id: str, + resource: CustomResource, region: Optional[Region] = None, ) -> IP: """ - Detach existing IP from a custom resource. - Detach a private IP from a custom resource. An example of a custom resource is a virtual machine hosted on an Elastic Metal server. Do not use this method for attaching IP addresses to standard Scaleway resources (e.g. Instances, Load Balancers) as it will fail - see the relevant product API for an equivalent method. + Detach IP from a custom resource. + Detach a private IP from a custom resource. An example of a custom resource is a virtual machine hosted on an Elastic Metal server. Do not use this method for detaching IP addresses from standard Scaleway resources (e.g. Instances, Load Balancers) as it will fail - see the relevant product API for an equivalent method. :param ip_id: IP ID. + :param resource: Custom resource currently attached to the IP. :param region: Region to target. If none is passed will use default region from the config. :return: :class:`IP ` @@ -480,6 +484,7 @@ def detach_ip( result = api.detach_ip( ip_id="example", + resource=CustomResource(), ) """ @@ -491,7 +496,14 @@ def detach_ip( res = self._request( "POST", f"/ipam/v1/regions/{param_region}/ips/{param_ip_id}/detach", - body={}, + body=marshal_DetachIPRequest( + DetachIPRequest( + ip_id=ip_id, + resource=resource, + region=region, + ), + self.client, + ), ) self._throw_on_error(res) @@ -501,15 +513,17 @@ def move_ip( self, *, ip_id: str, + from_resource: CustomResource, region: Optional[Region] = None, - resource: Optional[CustomResource] = None, + to_resource: Optional[CustomResource] = None, ) -> IP: """ - Move existing IP to a custom resource. - Move an existing private IP from one custom resource (e.g. a virtual machine hosted on an Elastic Metal server) to another custom resource. This will detach it from the first resource, and attach it to the second. Do not use this method for moving IP addresses between standard Scaleway resources (e.g. Instances, Load Balancers) as it will fail - see the relevant product API for an equivalent method. + Move IP to a custom resource. + Move an existing reserved private IP from one custom resource (e.g. a virtual machine hosted on an Elastic Metal server) to another custom resource. This will detach it from the first resource, and attach it to the second. Do not use this method for moving IP addresses between standard Scaleway resources (e.g. Instances, Load Balancers) as it will fail - see the relevant product API for an equivalent method. :param ip_id: IP ID. + :param from_resource: Custom resource currently attached to the IP. :param region: Region to target. If none is passed will use default region from the config. - :param resource: Custom resource to be attached to the IP. + :param to_resource: Custom resource to be attached to the IP. :return: :class:`IP ` Usage: @@ -517,6 +531,7 @@ def move_ip( result = api.move_ip( ip_id="example", + from_resource=CustomResource(), ) """ @@ -531,8 +546,9 @@ def move_ip( body=marshal_MoveIPRequest( MoveIPRequest( ip_id=ip_id, + from_resource=from_resource, region=region, - resource=resource, + to_resource=to_resource, ), self.client, ), diff --git a/scaleway/scaleway/ipam/v1/marshalling.py b/scaleway/scaleway/ipam/v1/marshalling.py index a146c6951..dc61dff97 100644 --- a/scaleway/scaleway/ipam/v1/marshalling.py +++ b/scaleway/scaleway/ipam/v1/marshalling.py @@ -18,6 +18,7 @@ CustomResource, AttachIPRequest, BookIPRequest, + DetachIPRequest, MoveIPRequest, ReleaseIPSetRequest, UpdateIPRequest, @@ -267,8 +268,8 @@ def marshal_BookIPRequest( return output -def marshal_MoveIPRequest( - request: MoveIPRequest, +def marshal_DetachIPRequest( + request: DetachIPRequest, defaults: ProfileDefaults, ) -> Dict[str, Any]: output: Dict[str, Any] = {} @@ -279,6 +280,23 @@ def marshal_MoveIPRequest( return output +def marshal_MoveIPRequest( + request: MoveIPRequest, + defaults: ProfileDefaults, +) -> Dict[str, Any]: + output: Dict[str, Any] = {} + + if request.from_resource is not None: + output["from_resource"] = marshal_CustomResource( + request.from_resource, defaults + ) + + if request.to_resource is not None: + output["to_resource"] = marshal_CustomResource(request.to_resource, defaults) + + return output + + def marshal_ReleaseIPSetRequest( request: ReleaseIPSetRequest, defaults: ProfileDefaults, diff --git a/scaleway/scaleway/ipam/v1/types.py b/scaleway/scaleway/ipam/v1/types.py index 5be77b2e2..b524974f8 100644 --- a/scaleway/scaleway/ipam/v1/types.py +++ b/scaleway/scaleway/ipam/v1/types.py @@ -147,7 +147,7 @@ class IP: created_at: Optional[datetime] """ - Date the IP was booked. + Date the IP was reserved. """ updated_at: Optional[datetime] @@ -157,7 +157,7 @@ class IP: source: Optional[Source] """ - Source pool where the IP was booked in. + Source pool where the IP was reserved in. """ resource: Optional[Resource] @@ -193,7 +193,7 @@ class AttachIPRequest: class BookIPRequest: source: Source """ - Source in which to book the IP. Not all sources are available for booking. + Source in which to reserve the IP. Not all sources are available for reservation. """ is_ipv6: bool @@ -213,7 +213,7 @@ class BookIPRequest: address: Optional[str] """ - The requested address should not include the subnet mask (/suffix). Note that only the Private Network source allows you to pick a specific IP. If the requested IP is already booked, then the call will fail. + The requested address should not include the subnet mask (/suffix). Note that only the Private Network source allows you to pick a specific IP. If the requested IP is already reserved, then the call will fail. """ tags: Optional[List[str]] @@ -223,7 +223,7 @@ class BookIPRequest: resource: Optional[CustomResource] """ - Custom resource to attach to the IP being booked. An example of a custom resource is a virtual machine hosted on an Elastic Metal server, or an additional user network interface on an Instance. Do not use this for attaching IP addresses to standard Scaleway resources, as it will fail - instead, see the relevant product API for an equivalent method. + Custom resource to attach to the IP being reserved. An example of a custom resource is a virtual machine hosted on an Elastic Metal server. Do not use this for attaching IP addresses to standard Scaleway resources, as it will fail - instead, see the relevant product API for an equivalent method. """ @@ -234,6 +234,11 @@ class DetachIPRequest: IP ID. """ + resource: CustomResource + """ + Custom resource currently attached to the IP. + """ + region: Optional[Region] """ Region to target. If none is passed will use default region from the config. @@ -351,12 +356,17 @@ class MoveIPRequest: IP ID. """ + from_resource: CustomResource + """ + Custom resource currently attached to the IP. + """ + region: Optional[Region] """ Region to target. If none is passed will use default region from the config. """ - resource: Optional[CustomResource] + to_resource: Optional[CustomResource] """ Custom resource to be attached to the IP. """