From ee14515aa6ecd2ffe67b7d9de495caf8c345af78 Mon Sep 17 00:00:00 2001 From: Prototool Bot Date: Wed, 20 May 2026 11:10:47 +0000 Subject: [PATCH] feat: update generated APIs --- .../scaleway_async/dedibox/v1/marshalling.py | 6 + .../scaleway_async/dedibox/v1/types.py | 7 +- .../scaleway_async/messageq/v1alpha1/api.py | 6 - .../scaleway_async/messageq/v1alpha1/types.py | 5 - .../product_catalog/v2alpha1/__init__.py | 2 + .../product_catalog/v2alpha1/marshalling.py | 22 ++ .../product_catalog/v2alpha1/types.py | 10 + .../scaleway_async/searchdb/v1alpha1/api.py | 6 - .../scaleway_async/searchdb/v1alpha1/types.py | 5 - .../scaleway_async/vpc/v2/__init__.py | 16 + scaleway-async/scaleway_async/vpc/v2/api.py | 282 ++++++++++++++++++ .../scaleway_async/vpc/v2/marshalling.py | 151 ++++++++++ scaleway-async/scaleway_async/vpc/v2/types.py | 97 ++++++ scaleway/scaleway/dedibox/v1/marshalling.py | 6 + scaleway/scaleway/dedibox/v1/types.py | 7 +- scaleway/scaleway/messageq/v1alpha1/api.py | 6 - scaleway/scaleway/messageq/v1alpha1/types.py | 5 - .../product_catalog/v2alpha1/__init__.py | 2 + .../product_catalog/v2alpha1/marshalling.py | 22 ++ .../product_catalog/v2alpha1/types.py | 10 + scaleway/scaleway/searchdb/v1alpha1/api.py | 6 - scaleway/scaleway/searchdb/v1alpha1/types.py | 5 - scaleway/scaleway/vpc/v2/__init__.py | 16 + scaleway/scaleway/vpc/v2/api.py | 282 ++++++++++++++++++ scaleway/scaleway/vpc/v2/marshalling.py | 151 ++++++++++ scaleway/scaleway/vpc/v2/types.py | 97 ++++++ 26 files changed, 1184 insertions(+), 46 deletions(-) diff --git a/scaleway-async/scaleway_async/dedibox/v1/marshalling.py b/scaleway-async/scaleway_async/dedibox/v1/marshalling.py index 6c1ad69c8..0301fa871 100644 --- a/scaleway-async/scaleway_async/dedibox/v1/marshalling.py +++ b/scaleway-async/scaleway_async/dedibox/v1/marshalling.py @@ -775,6 +775,12 @@ def unmarshal_Offer(data: Any) -> Offer: else: args["pricing"] = None + field = data.get("offer_id", None) + if field is not None: + args["offer_id"] = field + else: + args["offer_id"] = 0 + field = data.get("server_info", None) if field is not None: args["server_info"] = unmarshal_OfferServerInfo(field) diff --git a/scaleway-async/scaleway_async/dedibox/v1/types.py b/scaleway-async/scaleway_async/dedibox/v1/types.py index 1240d0f21..5e33a9ca5 100644 --- a/scaleway-async/scaleway_async/dedibox/v1/types.py +++ b/scaleway-async/scaleway_async/dedibox/v1/types.py @@ -762,7 +762,7 @@ class IP: class Offer: id: int """ - ID of the offer. + ID of the offer (aka product.id). """ name: str @@ -785,6 +785,11 @@ class Offer: Price of the offer. """ + offer_id: Optional[int] = 0 + """ + Original Dedibox ID of the offer. + """ + server_info: Optional[OfferServerInfo] = None service_level_info: Optional[OfferServiceLevelInfo] = None diff --git a/scaleway-async/scaleway_async/messageq/v1alpha1/api.py b/scaleway-async/scaleway_async/messageq/v1alpha1/api.py index 5f7ce9fbd..c21821e83 100644 --- a/scaleway-async/scaleway_async/messageq/v1alpha1/api.py +++ b/scaleway-async/scaleway_async/messageq/v1alpha1/api.py @@ -339,7 +339,6 @@ async def list_deployments( page_size: Optional[int] = None, tags: Optional[list[str]] = None, name: Optional[str] = None, - version: Optional[str] = None, ) -> ListDeploymentsResponse: """ Retrieve a list of MessageQ deployments. @@ -351,7 +350,6 @@ async def list_deployments( :param page_size: Number of deployments to return per page. :param tags: Tags to filter for, only deployments with one or more matching tags will be returned. :param name: Deployment name to filter for, only deployments with this string within their name will be returned. - :param version: Engine version to filter for, only deployments with this version will be returned. :return: :class:`ListDeploymentsResponse ` Usage: @@ -376,7 +374,6 @@ async def list_deployments( "page_size": page_size or self.client.default_page_size, "project_id": project_id or self.client.default_project_id, "tags": tags, - "version": version, }, ) @@ -394,7 +391,6 @@ async def list_deployments_all( page_size: Optional[int] = None, tags: Optional[list[str]] = None, name: Optional[str] = None, - version: Optional[str] = None, ) -> list[Deployment]: """ Retrieve a list of MessageQ deployments. @@ -406,7 +402,6 @@ async def list_deployments_all( :param page_size: Number of deployments to return per page. :param tags: Tags to filter for, only deployments with one or more matching tags will be returned. :param name: Deployment name to filter for, only deployments with this string within their name will be returned. - :param version: Engine version to filter for, only deployments with this version will be returned. :return: :class:`list[Deployment] ` Usage: @@ -428,7 +423,6 @@ async def list_deployments_all( "page_size": page_size, "tags": tags, "name": name, - "version": version, }, ) diff --git a/scaleway-async/scaleway_async/messageq/v1alpha1/types.py b/scaleway-async/scaleway_async/messageq/v1alpha1/types.py index 643b33cd7..67912e6bf 100644 --- a/scaleway-async/scaleway_async/messageq/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/messageq/v1alpha1/types.py @@ -549,11 +549,6 @@ class ListDeploymentsRequest: Deployment name to filter for, only deployments with this string within their name will be returned. """ - version: Optional[str] = None - """ - Engine version to filter for, only deployments with this version will be returned. - """ - @dataclass class ListDeploymentsResponse: diff --git a/scaleway-async/scaleway_async/product_catalog/v2alpha1/__init__.py b/scaleway-async/scaleway_async/product_catalog/v2alpha1/__init__.py index 387e7f80e..011387fbe 100644 --- a/scaleway-async/scaleway_async/product_catalog/v2alpha1/__init__.py +++ b/scaleway-async/scaleway_async/product_catalog/v2alpha1/__init__.py @@ -55,6 +55,7 @@ from .types import PublicCatalogProductPropertiesManagedRelationalDatabase from .types import PublicCatalogProductPropertiesObjectStorage from .types import PublicCatalogProductPropertiesSecretManager +from .types import PublicCatalogProductPropertiesServerlessFunctions from .types import PublicCatalogProductEnvironmentalImpactEstimation from .types import PublicCatalogProductLocality from .types import PublicCatalogProductPrice @@ -117,6 +118,7 @@ "PublicCatalogProductPropertiesManagedRelationalDatabase", "PublicCatalogProductPropertiesObjectStorage", "PublicCatalogProductPropertiesSecretManager", + "PublicCatalogProductPropertiesServerlessFunctions", "PublicCatalogProductEnvironmentalImpactEstimation", "PublicCatalogProductLocality", "PublicCatalogProductPrice", diff --git a/scaleway-async/scaleway_async/product_catalog/v2alpha1/marshalling.py b/scaleway-async/scaleway_async/product_catalog/v2alpha1/marshalling.py index 0f104d1d2..9e59aa767 100644 --- a/scaleway-async/scaleway_async/product_catalog/v2alpha1/marshalling.py +++ b/scaleway-async/scaleway_async/product_catalog/v2alpha1/marshalling.py @@ -55,6 +55,7 @@ PublicCatalogProductPropertiesManagedRelationalDatabase, PublicCatalogProductPropertiesObjectStorage, PublicCatalogProductPropertiesSecretManager, + PublicCatalogProductPropertiesServerlessFunctions, PublicCatalogProductEnvironmentalImpactEstimation, PublicCatalogProductLocality, PublicCatalogProductPrice, @@ -1048,6 +1049,19 @@ def unmarshal_PublicCatalogProductPropertiesSecretManager( return PublicCatalogProductPropertiesSecretManager(**args) +def unmarshal_PublicCatalogProductPropertiesServerlessFunctions( + data: Any, +) -> PublicCatalogProductPropertiesServerlessFunctions: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesServerlessFunctions' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + return PublicCatalogProductPropertiesServerlessFunctions(**args) + + def unmarshal_PublicCatalogProductEnvironmentalImpactEstimation( data: Any, ) -> PublicCatalogProductEnvironmentalImpactEstimation: @@ -1245,6 +1259,14 @@ def unmarshal_PublicCatalogProductProperties( else: args["managed_relational_database"] = None + field = data.get("serverless_functions", None) + if field is not None: + args["serverless_functions"] = ( + unmarshal_PublicCatalogProductPropertiesServerlessFunctions(field) + ) + else: + args["serverless_functions"] = None + field = data.get("managed_mongodb", None) if field is not None: args["managed_mongodb"] = ( diff --git a/scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py b/scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py index 534702bfa..6cfd50d6a 100644 --- a/scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py +++ b/scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py @@ -34,6 +34,7 @@ class ListPublicCatalogProductsRequestProductType(str, Enum, metaclass=StrEnumMe KUBERNETES = "kubernetes" MANAGED_RELATIONAL_DATABASE = "managed_relational_database" MANAGED_MONGODB = "managed_mongodb" + SERVERLESS_FUNCTIONS = "serverless_functions" def __str__(self) -> str: return str(self.value) @@ -648,6 +649,11 @@ class PublicCatalogProductPropertiesSecretManager: pass +@dataclass +class PublicCatalogProductPropertiesServerlessFunctions: + pass + + @dataclass class PublicCatalogProductEnvironmentalImpactEstimation: kg_co2_equivalent: Optional[float] = None @@ -712,6 +718,10 @@ class PublicCatalogProductProperties: PublicCatalogProductPropertiesManagedRelationalDatabase ] = None + serverless_functions: Optional[ + PublicCatalogProductPropertiesServerlessFunctions + ] = None + managed_mongodb: Optional[PublicCatalogProductPropertiesManagedMongoDB] = None diff --git a/scaleway-async/scaleway_async/searchdb/v1alpha1/api.py b/scaleway-async/scaleway_async/searchdb/v1alpha1/api.py index a19f240a7..ea45e24f8 100644 --- a/scaleway-async/scaleway_async/searchdb/v1alpha1/api.py +++ b/scaleway-async/scaleway_async/searchdb/v1alpha1/api.py @@ -341,7 +341,6 @@ async def list_deployments( page_size: Optional[int] = None, tags: Optional[list[str]] = None, name: Optional[str] = None, - version: Optional[str] = None, ) -> ListDeploymentsResponse: """ Retrieve a list of Cloud Essentials for OpenSearch deployments. @@ -353,7 +352,6 @@ async def list_deployments( :param page_size: Number of deployments to return. :param tags: Filter by tag, only deployments with one or more matching tags will be returned. :param name: Deployment name to filter for. - :param version: Engine version to filter for. :return: :class:`ListDeploymentsResponse ` Usage: @@ -378,7 +376,6 @@ async def list_deployments( "page_size": page_size or self.client.default_page_size, "project_id": project_id or self.client.default_project_id, "tags": tags, - "version": version, }, ) @@ -396,7 +393,6 @@ async def list_deployments_all( page_size: Optional[int] = None, tags: Optional[list[str]] = None, name: Optional[str] = None, - version: Optional[str] = None, ) -> list[Deployment]: """ Retrieve a list of Cloud Essentials for OpenSearch deployments. @@ -408,7 +404,6 @@ async def list_deployments_all( :param page_size: Number of deployments to return. :param tags: Filter by tag, only deployments with one or more matching tags will be returned. :param name: Deployment name to filter for. - :param version: Engine version to filter for. :return: :class:`list[Deployment] ` Usage: @@ -430,7 +425,6 @@ async def list_deployments_all( "page_size": page_size, "tags": tags, "name": name, - "version": version, }, ) diff --git a/scaleway-async/scaleway_async/searchdb/v1alpha1/types.py b/scaleway-async/scaleway_async/searchdb/v1alpha1/types.py index 6cb8184c2..e0c5efbea 100644 --- a/scaleway-async/scaleway_async/searchdb/v1alpha1/types.py +++ b/scaleway-async/scaleway_async/searchdb/v1alpha1/types.py @@ -578,11 +578,6 @@ class ListDeploymentsRequest: Deployment name to filter for. """ - version: Optional[str] = None - """ - Engine version to filter for. - """ - @dataclass class ListDeploymentsResponse: diff --git a/scaleway-async/scaleway_async/vpc/v2/__init__.py b/scaleway-async/scaleway_async/vpc/v2/__init__.py index 48b7880c6..7efd3eea0 100644 --- a/scaleway-async/scaleway_async/vpc/v2/__init__.py +++ b/scaleway-async/scaleway_async/vpc/v2/__init__.py @@ -2,6 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from .types import AclRuleProtocol from .types import Action +from .types import ListIngressRulesRequestOrderBy from .types import ListPrivateNetworksRequestOrderBy from .types import ListSubnetOverlapsRequestOrderBy from .types import ListSubnetsRequestOrderBy @@ -14,15 +15,18 @@ from .types import Route from .types import VPCConnectorPeerInfo from .types import AclRule +from .types import IngressRule from .types import ListSubnetOverlapsResponseSubnetOverlap from .types import VPCConnector from .types import VPC from .types import AddSubnetsRequest from .types import AddSubnetsResponse +from .types import CreateIngressRuleRequest from .types import CreatePrivateNetworkRequest from .types import CreateRouteRequest from .types import CreateVPCConnectorRequest from .types import CreateVPCRequest +from .types import DeleteIngressRuleRequest from .types import DeletePrivateNetworkRequest from .types import DeleteRouteRequest from .types import DeleteSubnetsRequest @@ -34,10 +38,13 @@ from .types import EnableRoutingRequest from .types import GetAclRequest from .types import GetAclResponse +from .types import GetIngressRuleRequest from .types import GetPrivateNetworkRequest from .types import GetRouteRequest from .types import GetVPCConnectorRequest from .types import GetVPCRequest +from .types import ListIngressRulesRequest +from .types import ListIngressRulesResponse from .types import ListPrivateNetworksRequest from .types import ListPrivateNetworksResponse from .types import ListSubnetOverlapsRequest @@ -50,6 +57,7 @@ from .types import ListVPCsResponse from .types import SetAclRequest from .types import SetAclResponse +from .types import UpdateIngressRuleRequest from .types import UpdatePrivateNetworkRequest from .types import UpdateRouteRequest from .types import UpdateVPCConnectorRequest @@ -59,6 +67,7 @@ __all__ = [ "AclRuleProtocol", "Action", + "ListIngressRulesRequestOrderBy", "ListPrivateNetworksRequestOrderBy", "ListSubnetOverlapsRequestOrderBy", "ListSubnetsRequestOrderBy", @@ -71,15 +80,18 @@ "Route", "VPCConnectorPeerInfo", "AclRule", + "IngressRule", "ListSubnetOverlapsResponseSubnetOverlap", "VPCConnector", "VPC", "AddSubnetsRequest", "AddSubnetsResponse", + "CreateIngressRuleRequest", "CreatePrivateNetworkRequest", "CreateRouteRequest", "CreateVPCConnectorRequest", "CreateVPCRequest", + "DeleteIngressRuleRequest", "DeletePrivateNetworkRequest", "DeleteRouteRequest", "DeleteSubnetsRequest", @@ -91,10 +103,13 @@ "EnableRoutingRequest", "GetAclRequest", "GetAclResponse", + "GetIngressRuleRequest", "GetPrivateNetworkRequest", "GetRouteRequest", "GetVPCConnectorRequest", "GetVPCRequest", + "ListIngressRulesRequest", + "ListIngressRulesResponse", "ListPrivateNetworksRequest", "ListPrivateNetworksResponse", "ListSubnetOverlapsRequest", @@ -107,6 +122,7 @@ "ListVPCsResponse", "SetAclRequest", "SetAclResponse", + "UpdateIngressRuleRequest", "UpdatePrivateNetworkRequest", "UpdateRouteRequest", "UpdateVPCConnectorRequest", diff --git a/scaleway-async/scaleway_async/vpc/v2/api.py b/scaleway-async/scaleway_async/vpc/v2/api.py index 164a92079..b9e7936d6 100644 --- a/scaleway-async/scaleway_async/vpc/v2/api.py +++ b/scaleway-async/scaleway_async/vpc/v2/api.py @@ -14,6 +14,7 @@ ) from .types import ( Action, + ListIngressRulesRequestOrderBy, ListPrivateNetworksRequestOrderBy, ListSubnetOverlapsRequestOrderBy, ListSubnetsRequestOrderBy, @@ -23,6 +24,7 @@ AclRule, AddSubnetsRequest, AddSubnetsResponse, + CreateIngressRuleRequest, CreatePrivateNetworkRequest, CreateRouteRequest, CreateVPCConnectorRequest, @@ -30,6 +32,8 @@ DeleteSubnetsRequest, DeleteSubnetsResponse, GetAclResponse, + IngressRule, + ListIngressRulesResponse, ListPrivateNetworksResponse, ListSubnetOverlapsResponse, ListSubnetOverlapsResponseSubnetOverlap, @@ -41,6 +45,7 @@ SetAclRequest, SetAclResponse, Subnet, + UpdateIngressRuleRequest, UpdatePrivateNetworkRequest, UpdateRouteRequest, UpdateVPCConnectorRequest, @@ -51,11 +56,13 @@ from .marshalling import ( unmarshal_PrivateNetwork, unmarshal_Route, + unmarshal_IngressRule, unmarshal_VPCConnector, unmarshal_VPC, unmarshal_AddSubnetsResponse, unmarshal_DeleteSubnetsResponse, unmarshal_GetAclResponse, + unmarshal_ListIngressRulesResponse, unmarshal_ListPrivateNetworksResponse, unmarshal_ListSubnetOverlapsResponse, unmarshal_ListSubnetsResponse, @@ -63,12 +70,14 @@ unmarshal_ListVPCsResponse, unmarshal_SetAclResponse, marshal_AddSubnetsRequest, + marshal_CreateIngressRuleRequest, marshal_CreatePrivateNetworkRequest, marshal_CreateRouteRequest, marshal_CreateVPCConnectorRequest, marshal_CreateVPCRequest, marshal_DeleteSubnetsRequest, marshal_SetAclRequest, + marshal_UpdateIngressRuleRequest, marshal_UpdatePrivateNetworkRequest, marshal_UpdateRouteRequest, marshal_UpdateVPCConnectorRequest, @@ -1600,3 +1609,276 @@ async def list_subnet_overlaps_all( "page_size": page_size, }, ) + + async def list_ingress_rules( + self, + *, + region: Optional[ScwRegion] = None, + order_by: Optional[ListIngressRulesRequestOrderBy] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + vpc_id: Optional[str] = None, + nexthop_resource_ip: Optional[str] = None, + nexthop_private_network_id: Optional[str] = None, + is_ipv6: Optional[bool] = None, + tags: Optional[list[str]] = None, + ) -> ListIngressRulesResponse: + """ + :param region: Region to target. If none is passed will use default region from the config. + :param order_by: + :param page: + :param page_size: + :param vpc_id: + :param nexthop_resource_ip: + :param nexthop_private_network_id: + :param is_ipv6: + :param tags: + :return: :class:`ListIngressRulesResponse ` + + Usage: + :: + + result = await api.list_ingress_rules() + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + + res = self._request( + "GET", + f"/vpc/v2/regions/{param_region}/ingress-rules", + params={ + "is_ipv6": is_ipv6, + "nexthop_private_network_id": nexthop_private_network_id, + "nexthop_resource_ip": nexthop_resource_ip, + "order_by": order_by, + "page": page, + "page_size": page_size or self.client.default_page_size, + "tags": tags, + "vpc_id": vpc_id, + }, + ) + + self._throw_on_error(res) + return unmarshal_ListIngressRulesResponse(res.json()) + + async def list_ingress_rules_all( + self, + *, + region: Optional[ScwRegion] = None, + order_by: Optional[ListIngressRulesRequestOrderBy] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + vpc_id: Optional[str] = None, + nexthop_resource_ip: Optional[str] = None, + nexthop_private_network_id: Optional[str] = None, + is_ipv6: Optional[bool] = None, + tags: Optional[list[str]] = None, + ) -> list[IngressRule]: + """ + :param region: Region to target. If none is passed will use default region from the config. + :param order_by: + :param page: + :param page_size: + :param vpc_id: + :param nexthop_resource_ip: + :param nexthop_private_network_id: + :param is_ipv6: + :param tags: + :return: :class:`list[IngressRule] ` + + Usage: + :: + + result = await api.list_ingress_rules_all() + """ + + return await fetch_all_pages_async( + type=ListIngressRulesResponse, + key="rules", + fetcher=self.list_ingress_rules, + args={ + "region": region, + "order_by": order_by, + "page": page, + "page_size": page_size, + "vpc_id": vpc_id, + "nexthop_resource_ip": nexthop_resource_ip, + "nexthop_private_network_id": nexthop_private_network_id, + "is_ipv6": is_ipv6, + "tags": tags, + }, + ) + + async def create_ingress_rule( + self, + *, + vpc_id: str, + source: str, + nexthop_resource_ip: str, + nexthop_private_network_id: str, + region: Optional[ScwRegion] = None, + description: Optional[str] = None, + tags: Optional[list[str]] = None, + ) -> IngressRule: + """ + :param vpc_id: + :param source: + :param nexthop_resource_ip: + :param nexthop_private_network_id: + :param region: Region to target. If none is passed will use default region from the config. + :param description: + :param tags: + :return: :class:`IngressRule ` + + Usage: + :: + + result = await api.create_ingress_rule( + vpc_id="example", + source="example", + nexthop_resource_ip="example", + nexthop_private_network_id="example", + ) + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + + res = self._request( + "POST", + f"/vpc/v2/regions/{param_region}/ingress-rules", + body=marshal_CreateIngressRuleRequest( + CreateIngressRuleRequest( + vpc_id=vpc_id, + source=source, + nexthop_resource_ip=nexthop_resource_ip, + nexthop_private_network_id=nexthop_private_network_id, + region=region, + description=description, + tags=tags, + ), + self.client, + ), + ) + + self._throw_on_error(res) + return unmarshal_IngressRule(res.json()) + + async def get_ingress_rule( + self, + *, + rule_id: str, + region: Optional[ScwRegion] = None, + ) -> IngressRule: + """ + :param rule_id: + :param region: Region to target. If none is passed will use default region from the config. + :return: :class:`IngressRule ` + + Usage: + :: + + result = await api.get_ingress_rule( + rule_id="example", + ) + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + param_rule_id = validate_path_param("rule_id", rule_id) + + res = self._request( + "GET", + f"/vpc/v2/regions/{param_region}/ingress-rules/{param_rule_id}", + ) + + self._throw_on_error(res) + return unmarshal_IngressRule(res.json()) + + async def update_ingress_rule( + self, + *, + rule_id: str, + region: Optional[ScwRegion] = None, + source: Optional[str] = None, + nexthop_resource_ip: Optional[str] = None, + nexthop_private_network_id: Optional[str] = None, + description: Optional[str] = None, + tags: Optional[list[str]] = None, + ) -> IngressRule: + """ + :param rule_id: + :param region: Region to target. If none is passed will use default region from the config. + :param source: + :param nexthop_resource_ip: + :param nexthop_private_network_id: + :param description: + :param tags: + :return: :class:`IngressRule ` + + Usage: + :: + + result = await api.update_ingress_rule( + rule_id="example", + ) + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + param_rule_id = validate_path_param("rule_id", rule_id) + + res = self._request( + "PATCH", + f"/vpc/v2/regions/{param_region}/ingress-rules/{param_rule_id}", + body=marshal_UpdateIngressRuleRequest( + UpdateIngressRuleRequest( + rule_id=rule_id, + region=region, + source=source, + nexthop_resource_ip=nexthop_resource_ip, + nexthop_private_network_id=nexthop_private_network_id, + description=description, + tags=tags, + ), + self.client, + ), + ) + + self._throw_on_error(res) + return unmarshal_IngressRule(res.json()) + + async def delete_ingress_rule( + self, + *, + rule_id: str, + region: Optional[ScwRegion] = None, + ) -> None: + """ + :param rule_id: + :param region: Region to target. If none is passed will use default region from the config. + + Usage: + :: + + result = await api.delete_ingress_rule( + rule_id="example", + ) + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + param_rule_id = validate_path_param("rule_id", rule_id) + + res = self._request( + "DELETE", + f"/vpc/v2/regions/{param_region}/ingress-rules/{param_rule_id}", + ) + + self._throw_on_error(res) diff --git a/scaleway-async/scaleway_async/vpc/v2/marshalling.py b/scaleway-async/scaleway_async/vpc/v2/marshalling.py index 684f1c43c..c98e9be3c 100644 --- a/scaleway-async/scaleway_async/vpc/v2/marshalling.py +++ b/scaleway-async/scaleway_async/vpc/v2/marshalling.py @@ -11,6 +11,7 @@ Subnet, PrivateNetwork, Route, + IngressRule, VPCConnectorPeerInfo, VPCConnector, VPC, @@ -18,6 +19,7 @@ DeleteSubnetsResponse, AclRule, GetAclResponse, + ListIngressRulesResponse, ListPrivateNetworksResponse, ListSubnetOverlapsResponseSubnetOverlap, ListSubnetOverlapsResponse, @@ -26,12 +28,14 @@ ListVPCsResponse, SetAclResponse, AddSubnetsRequest, + CreateIngressRuleRequest, CreatePrivateNetworkRequest, CreateRouteRequest, CreateVPCConnectorRequest, CreateVPCRequest, DeleteSubnetsRequest, SetAclRequest, + UpdateIngressRuleRequest, UpdatePrivateNetworkRequest, UpdateRouteRequest, UpdateVPCConnectorRequest, @@ -266,6 +270,77 @@ def unmarshal_Route(data: Any) -> Route: return Route(**args) +def unmarshal_IngressRule(data: Any) -> IngressRule: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'IngressRule' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("id", None) + if field is not None: + args["id"] = field + else: + args["id"] = None + + field = data.get("vpc_id", None) + if field is not None: + args["vpc_id"] = field + else: + args["vpc_id"] = None + + field = data.get("is_ipv6", None) + if field is not None: + args["is_ipv6"] = field + else: + args["is_ipv6"] = None + + field = data.get("source", None) + if field is not None: + args["source"] = field + else: + args["source"] = None + + field = data.get("nexthop_resource_ip", None) + if field is not None: + args["nexthop_resource_ip"] = field + else: + args["nexthop_resource_ip"] = None + + field = data.get("nexthop_private_network_id", None) + if field is not None: + args["nexthop_private_network_id"] = field + else: + args["nexthop_private_network_id"] = None + + field = data.get("tags", None) + if field is not None: + args["tags"] = field + else: + args["tags"] = None + + field = data.get("created_at", None) + if field is not None: + args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["created_at"] = None + + field = data.get("updated_at", None) + if field is not None: + args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["updated_at"] = None + + field = data.get("description", None) + if field is not None: + args["description"] = field + else: + args["description"] = None + + return IngressRule(**args) + + def unmarshal_VPCConnectorPeerInfo(data: Any) -> VPCConnectorPeerInfo: if not isinstance(data, dict): raise TypeError( @@ -585,6 +660,31 @@ def unmarshal_GetAclResponse(data: Any) -> GetAclResponse: return GetAclResponse(**args) +def unmarshal_ListIngressRulesResponse(data: Any) -> ListIngressRulesResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListIngressRulesResponse' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("rules", None) + if field is not None: + args["rules"] = ( + [unmarshal_IngressRule(v) for v in field] if field is not None else None + ) + else: + args["rules"] = None + + field = data.get("total_count", None) + if field is not None: + args["total_count"] = field + else: + args["total_count"] = None + + return ListIngressRulesResponse(**args) + + def unmarshal_ListPrivateNetworksResponse(data: Any) -> ListPrivateNetworksResponse: if not isinstance(data, dict): raise TypeError( @@ -784,6 +884,33 @@ def marshal_AddSubnetsRequest( return output +def marshal_CreateIngressRuleRequest( + request: CreateIngressRuleRequest, + defaults: ProfileDefaults, +) -> dict[str, Any]: + output: dict[str, Any] = {} + + if request.vpc_id is not None: + output["vpc_id"] = request.vpc_id + + if request.source is not None: + output["source"] = request.source + + if request.nexthop_resource_ip is not None: + output["nexthop_resource_ip"] = request.nexthop_resource_ip + + if request.nexthop_private_network_id is not None: + output["nexthop_private_network_id"] = request.nexthop_private_network_id + + if request.description is not None: + output["description"] = request.description + + if request.tags is not None: + output["tags"] = request.tags + + return output + + def marshal_CreatePrivateNetworkRequest( request: CreatePrivateNetworkRequest, defaults: ProfileDefaults, @@ -955,6 +1082,30 @@ def marshal_SetAclRequest( return output +def marshal_UpdateIngressRuleRequest( + request: UpdateIngressRuleRequest, + defaults: ProfileDefaults, +) -> dict[str, Any]: + output: dict[str, Any] = {} + + if request.source is not None: + output["source"] = request.source + + if request.nexthop_resource_ip is not None: + output["nexthop_resource_ip"] = request.nexthop_resource_ip + + if request.nexthop_private_network_id is not None: + output["nexthop_private_network_id"] = request.nexthop_private_network_id + + if request.description is not None: + output["description"] = request.description + + if request.tags is not None: + output["tags"] = request.tags + + return output + + def marshal_UpdatePrivateNetworkRequest( request: UpdatePrivateNetworkRequest, defaults: ProfileDefaults, diff --git a/scaleway-async/scaleway_async/vpc/v2/types.py b/scaleway-async/scaleway_async/vpc/v2/types.py index 9e98a1970..aa302214f 100644 --- a/scaleway-async/scaleway_async/vpc/v2/types.py +++ b/scaleway-async/scaleway_async/vpc/v2/types.py @@ -34,6 +34,18 @@ def __str__(self) -> str: return str(self.value) +class ListIngressRulesRequestOrderBy(str, Enum, metaclass=StrEnumMeta): + CREATED_AT_ASC = "created_at_asc" + CREATED_AT_DESC = "created_at_desc" + SOURCE_ASC = "source_asc" + SOURCE_DESC = "source_desc" + PREFIX_LEN_ASC = "prefix_len_asc" + PREFIX_LEN_DESC = "prefix_len_desc" + + def __str__(self) -> str: + return str(self.value) + + class ListPrivateNetworksRequestOrderBy(str, Enum, metaclass=StrEnumMeta): CREATED_AT_ASC = "created_at_asc" CREATED_AT_DESC = "created_at_desc" @@ -328,6 +340,20 @@ class AclRule: """ +@dataclass +class IngressRule: + id: str + vpc_id: str + is_ipv6: bool + source: str + nexthop_resource_ip: str + nexthop_private_network_id: str + tags: list[str] + created_at: Optional[datetime] = None + updated_at: Optional[datetime] = None + description: Optional[str] = None + + @dataclass class ListSubnetOverlapsResponseSubnetOverlap: subnet_id: str @@ -485,6 +511,21 @@ class AddSubnetsResponse: subnets: list[str] +@dataclass +class CreateIngressRuleRequest: + vpc_id: str + source: str + nexthop_resource_ip: str + nexthop_private_network_id: str + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + description: Optional[str] = None + tags: Optional[list[str]] = field(default_factory=list) + + @dataclass class CreatePrivateNetworkRequest: default_route_propagation_enabled: bool @@ -622,6 +663,15 @@ class CreateVPCRequest: """ +@dataclass +class DeleteIngressRuleRequest: + rule_id: str + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + @dataclass class DeletePrivateNetworkRequest: private_network_id: str @@ -760,6 +810,15 @@ class GetAclResponse: default_policy: Action +@dataclass +class GetIngressRuleRequest: + rule_id: str + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + @dataclass class GetPrivateNetworkRequest: private_network_id: str @@ -812,6 +871,29 @@ class GetVPCRequest: """ +@dataclass +class ListIngressRulesRequest: + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + order_by: Optional[ListIngressRulesRequestOrderBy] = None + page: Optional[int] = None + page_size: Optional[int] = None + vpc_id: Optional[str] = None + nexthop_resource_ip: Optional[str] = None + nexthop_private_network_id: Optional[str] = None + is_ipv6: Optional[bool] = None + tags: Optional[list[str]] = field(default_factory=list) + + +@dataclass +class ListIngressRulesResponse: + rules: list[IngressRule] + total_count: int + + @dataclass class ListPrivateNetworksRequest: region: Optional[ScwRegion] = None @@ -1126,6 +1208,21 @@ class SetAclResponse: default_policy: Action +@dataclass +class UpdateIngressRuleRequest: + rule_id: str + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + source: Optional[str] = None + nexthop_resource_ip: Optional[str] = None + nexthop_private_network_id: Optional[str] = None + description: Optional[str] = None + tags: Optional[list[str]] = field(default_factory=list) + + @dataclass class UpdatePrivateNetworkRequest: private_network_id: str diff --git a/scaleway/scaleway/dedibox/v1/marshalling.py b/scaleway/scaleway/dedibox/v1/marshalling.py index 6c1ad69c8..0301fa871 100644 --- a/scaleway/scaleway/dedibox/v1/marshalling.py +++ b/scaleway/scaleway/dedibox/v1/marshalling.py @@ -775,6 +775,12 @@ def unmarshal_Offer(data: Any) -> Offer: else: args["pricing"] = None + field = data.get("offer_id", None) + if field is not None: + args["offer_id"] = field + else: + args["offer_id"] = 0 + field = data.get("server_info", None) if field is not None: args["server_info"] = unmarshal_OfferServerInfo(field) diff --git a/scaleway/scaleway/dedibox/v1/types.py b/scaleway/scaleway/dedibox/v1/types.py index 1240d0f21..5e33a9ca5 100644 --- a/scaleway/scaleway/dedibox/v1/types.py +++ b/scaleway/scaleway/dedibox/v1/types.py @@ -762,7 +762,7 @@ class IP: class Offer: id: int """ - ID of the offer. + ID of the offer (aka product.id). """ name: str @@ -785,6 +785,11 @@ class Offer: Price of the offer. """ + offer_id: Optional[int] = 0 + """ + Original Dedibox ID of the offer. + """ + server_info: Optional[OfferServerInfo] = None service_level_info: Optional[OfferServiceLevelInfo] = None diff --git a/scaleway/scaleway/messageq/v1alpha1/api.py b/scaleway/scaleway/messageq/v1alpha1/api.py index b3af1e6f7..b975d9e8a 100644 --- a/scaleway/scaleway/messageq/v1alpha1/api.py +++ b/scaleway/scaleway/messageq/v1alpha1/api.py @@ -337,7 +337,6 @@ def list_deployments( page_size: Optional[int] = None, tags: Optional[list[str]] = None, name: Optional[str] = None, - version: Optional[str] = None, ) -> ListDeploymentsResponse: """ Retrieve a list of MessageQ deployments. @@ -349,7 +348,6 @@ def list_deployments( :param page_size: Number of deployments to return per page. :param tags: Tags to filter for, only deployments with one or more matching tags will be returned. :param name: Deployment name to filter for, only deployments with this string within their name will be returned. - :param version: Engine version to filter for, only deployments with this version will be returned. :return: :class:`ListDeploymentsResponse ` Usage: @@ -374,7 +372,6 @@ def list_deployments( "page_size": page_size or self.client.default_page_size, "project_id": project_id or self.client.default_project_id, "tags": tags, - "version": version, }, ) @@ -392,7 +389,6 @@ def list_deployments_all( page_size: Optional[int] = None, tags: Optional[list[str]] = None, name: Optional[str] = None, - version: Optional[str] = None, ) -> list[Deployment]: """ Retrieve a list of MessageQ deployments. @@ -404,7 +400,6 @@ def list_deployments_all( :param page_size: Number of deployments to return per page. :param tags: Tags to filter for, only deployments with one or more matching tags will be returned. :param name: Deployment name to filter for, only deployments with this string within their name will be returned. - :param version: Engine version to filter for, only deployments with this version will be returned. :return: :class:`list[Deployment] ` Usage: @@ -426,7 +421,6 @@ def list_deployments_all( "page_size": page_size, "tags": tags, "name": name, - "version": version, }, ) diff --git a/scaleway/scaleway/messageq/v1alpha1/types.py b/scaleway/scaleway/messageq/v1alpha1/types.py index 643b33cd7..67912e6bf 100644 --- a/scaleway/scaleway/messageq/v1alpha1/types.py +++ b/scaleway/scaleway/messageq/v1alpha1/types.py @@ -549,11 +549,6 @@ class ListDeploymentsRequest: Deployment name to filter for, only deployments with this string within their name will be returned. """ - version: Optional[str] = None - """ - Engine version to filter for, only deployments with this version will be returned. - """ - @dataclass class ListDeploymentsResponse: diff --git a/scaleway/scaleway/product_catalog/v2alpha1/__init__.py b/scaleway/scaleway/product_catalog/v2alpha1/__init__.py index 387e7f80e..011387fbe 100644 --- a/scaleway/scaleway/product_catalog/v2alpha1/__init__.py +++ b/scaleway/scaleway/product_catalog/v2alpha1/__init__.py @@ -55,6 +55,7 @@ from .types import PublicCatalogProductPropertiesManagedRelationalDatabase from .types import PublicCatalogProductPropertiesObjectStorage from .types import PublicCatalogProductPropertiesSecretManager +from .types import PublicCatalogProductPropertiesServerlessFunctions from .types import PublicCatalogProductEnvironmentalImpactEstimation from .types import PublicCatalogProductLocality from .types import PublicCatalogProductPrice @@ -117,6 +118,7 @@ "PublicCatalogProductPropertiesManagedRelationalDatabase", "PublicCatalogProductPropertiesObjectStorage", "PublicCatalogProductPropertiesSecretManager", + "PublicCatalogProductPropertiesServerlessFunctions", "PublicCatalogProductEnvironmentalImpactEstimation", "PublicCatalogProductLocality", "PublicCatalogProductPrice", diff --git a/scaleway/scaleway/product_catalog/v2alpha1/marshalling.py b/scaleway/scaleway/product_catalog/v2alpha1/marshalling.py index 0f104d1d2..9e59aa767 100644 --- a/scaleway/scaleway/product_catalog/v2alpha1/marshalling.py +++ b/scaleway/scaleway/product_catalog/v2alpha1/marshalling.py @@ -55,6 +55,7 @@ PublicCatalogProductPropertiesManagedRelationalDatabase, PublicCatalogProductPropertiesObjectStorage, PublicCatalogProductPropertiesSecretManager, + PublicCatalogProductPropertiesServerlessFunctions, PublicCatalogProductEnvironmentalImpactEstimation, PublicCatalogProductLocality, PublicCatalogProductPrice, @@ -1048,6 +1049,19 @@ def unmarshal_PublicCatalogProductPropertiesSecretManager( return PublicCatalogProductPropertiesSecretManager(**args) +def unmarshal_PublicCatalogProductPropertiesServerlessFunctions( + data: Any, +) -> PublicCatalogProductPropertiesServerlessFunctions: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'PublicCatalogProductPropertiesServerlessFunctions' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + return PublicCatalogProductPropertiesServerlessFunctions(**args) + + def unmarshal_PublicCatalogProductEnvironmentalImpactEstimation( data: Any, ) -> PublicCatalogProductEnvironmentalImpactEstimation: @@ -1245,6 +1259,14 @@ def unmarshal_PublicCatalogProductProperties( else: args["managed_relational_database"] = None + field = data.get("serverless_functions", None) + if field is not None: + args["serverless_functions"] = ( + unmarshal_PublicCatalogProductPropertiesServerlessFunctions(field) + ) + else: + args["serverless_functions"] = None + field = data.get("managed_mongodb", None) if field is not None: args["managed_mongodb"] = ( diff --git a/scaleway/scaleway/product_catalog/v2alpha1/types.py b/scaleway/scaleway/product_catalog/v2alpha1/types.py index 534702bfa..6cfd50d6a 100644 --- a/scaleway/scaleway/product_catalog/v2alpha1/types.py +++ b/scaleway/scaleway/product_catalog/v2alpha1/types.py @@ -34,6 +34,7 @@ class ListPublicCatalogProductsRequestProductType(str, Enum, metaclass=StrEnumMe KUBERNETES = "kubernetes" MANAGED_RELATIONAL_DATABASE = "managed_relational_database" MANAGED_MONGODB = "managed_mongodb" + SERVERLESS_FUNCTIONS = "serverless_functions" def __str__(self) -> str: return str(self.value) @@ -648,6 +649,11 @@ class PublicCatalogProductPropertiesSecretManager: pass +@dataclass +class PublicCatalogProductPropertiesServerlessFunctions: + pass + + @dataclass class PublicCatalogProductEnvironmentalImpactEstimation: kg_co2_equivalent: Optional[float] = None @@ -712,6 +718,10 @@ class PublicCatalogProductProperties: PublicCatalogProductPropertiesManagedRelationalDatabase ] = None + serverless_functions: Optional[ + PublicCatalogProductPropertiesServerlessFunctions + ] = None + managed_mongodb: Optional[PublicCatalogProductPropertiesManagedMongoDB] = None diff --git a/scaleway/scaleway/searchdb/v1alpha1/api.py b/scaleway/scaleway/searchdb/v1alpha1/api.py index 4d08ec15f..ebea62e5f 100644 --- a/scaleway/scaleway/searchdb/v1alpha1/api.py +++ b/scaleway/scaleway/searchdb/v1alpha1/api.py @@ -339,7 +339,6 @@ def list_deployments( page_size: Optional[int] = None, tags: Optional[list[str]] = None, name: Optional[str] = None, - version: Optional[str] = None, ) -> ListDeploymentsResponse: """ Retrieve a list of Cloud Essentials for OpenSearch deployments. @@ -351,7 +350,6 @@ def list_deployments( :param page_size: Number of deployments to return. :param tags: Filter by tag, only deployments with one or more matching tags will be returned. :param name: Deployment name to filter for. - :param version: Engine version to filter for. :return: :class:`ListDeploymentsResponse ` Usage: @@ -376,7 +374,6 @@ def list_deployments( "page_size": page_size or self.client.default_page_size, "project_id": project_id or self.client.default_project_id, "tags": tags, - "version": version, }, ) @@ -394,7 +391,6 @@ def list_deployments_all( page_size: Optional[int] = None, tags: Optional[list[str]] = None, name: Optional[str] = None, - version: Optional[str] = None, ) -> list[Deployment]: """ Retrieve a list of Cloud Essentials for OpenSearch deployments. @@ -406,7 +402,6 @@ def list_deployments_all( :param page_size: Number of deployments to return. :param tags: Filter by tag, only deployments with one or more matching tags will be returned. :param name: Deployment name to filter for. - :param version: Engine version to filter for. :return: :class:`list[Deployment] ` Usage: @@ -428,7 +423,6 @@ def list_deployments_all( "page_size": page_size, "tags": tags, "name": name, - "version": version, }, ) diff --git a/scaleway/scaleway/searchdb/v1alpha1/types.py b/scaleway/scaleway/searchdb/v1alpha1/types.py index 6cb8184c2..e0c5efbea 100644 --- a/scaleway/scaleway/searchdb/v1alpha1/types.py +++ b/scaleway/scaleway/searchdb/v1alpha1/types.py @@ -578,11 +578,6 @@ class ListDeploymentsRequest: Deployment name to filter for. """ - version: Optional[str] = None - """ - Engine version to filter for. - """ - @dataclass class ListDeploymentsResponse: diff --git a/scaleway/scaleway/vpc/v2/__init__.py b/scaleway/scaleway/vpc/v2/__init__.py index 48b7880c6..7efd3eea0 100644 --- a/scaleway/scaleway/vpc/v2/__init__.py +++ b/scaleway/scaleway/vpc/v2/__init__.py @@ -2,6 +2,7 @@ # If you have any remark or suggestion do not hesitate to open an issue. from .types import AclRuleProtocol from .types import Action +from .types import ListIngressRulesRequestOrderBy from .types import ListPrivateNetworksRequestOrderBy from .types import ListSubnetOverlapsRequestOrderBy from .types import ListSubnetsRequestOrderBy @@ -14,15 +15,18 @@ from .types import Route from .types import VPCConnectorPeerInfo from .types import AclRule +from .types import IngressRule from .types import ListSubnetOverlapsResponseSubnetOverlap from .types import VPCConnector from .types import VPC from .types import AddSubnetsRequest from .types import AddSubnetsResponse +from .types import CreateIngressRuleRequest from .types import CreatePrivateNetworkRequest from .types import CreateRouteRequest from .types import CreateVPCConnectorRequest from .types import CreateVPCRequest +from .types import DeleteIngressRuleRequest from .types import DeletePrivateNetworkRequest from .types import DeleteRouteRequest from .types import DeleteSubnetsRequest @@ -34,10 +38,13 @@ from .types import EnableRoutingRequest from .types import GetAclRequest from .types import GetAclResponse +from .types import GetIngressRuleRequest from .types import GetPrivateNetworkRequest from .types import GetRouteRequest from .types import GetVPCConnectorRequest from .types import GetVPCRequest +from .types import ListIngressRulesRequest +from .types import ListIngressRulesResponse from .types import ListPrivateNetworksRequest from .types import ListPrivateNetworksResponse from .types import ListSubnetOverlapsRequest @@ -50,6 +57,7 @@ from .types import ListVPCsResponse from .types import SetAclRequest from .types import SetAclResponse +from .types import UpdateIngressRuleRequest from .types import UpdatePrivateNetworkRequest from .types import UpdateRouteRequest from .types import UpdateVPCConnectorRequest @@ -59,6 +67,7 @@ __all__ = [ "AclRuleProtocol", "Action", + "ListIngressRulesRequestOrderBy", "ListPrivateNetworksRequestOrderBy", "ListSubnetOverlapsRequestOrderBy", "ListSubnetsRequestOrderBy", @@ -71,15 +80,18 @@ "Route", "VPCConnectorPeerInfo", "AclRule", + "IngressRule", "ListSubnetOverlapsResponseSubnetOverlap", "VPCConnector", "VPC", "AddSubnetsRequest", "AddSubnetsResponse", + "CreateIngressRuleRequest", "CreatePrivateNetworkRequest", "CreateRouteRequest", "CreateVPCConnectorRequest", "CreateVPCRequest", + "DeleteIngressRuleRequest", "DeletePrivateNetworkRequest", "DeleteRouteRequest", "DeleteSubnetsRequest", @@ -91,10 +103,13 @@ "EnableRoutingRequest", "GetAclRequest", "GetAclResponse", + "GetIngressRuleRequest", "GetPrivateNetworkRequest", "GetRouteRequest", "GetVPCConnectorRequest", "GetVPCRequest", + "ListIngressRulesRequest", + "ListIngressRulesResponse", "ListPrivateNetworksRequest", "ListPrivateNetworksResponse", "ListSubnetOverlapsRequest", @@ -107,6 +122,7 @@ "ListVPCsResponse", "SetAclRequest", "SetAclResponse", + "UpdateIngressRuleRequest", "UpdatePrivateNetworkRequest", "UpdateRouteRequest", "UpdateVPCConnectorRequest", diff --git a/scaleway/scaleway/vpc/v2/api.py b/scaleway/scaleway/vpc/v2/api.py index a85385ed5..9ceccf315 100644 --- a/scaleway/scaleway/vpc/v2/api.py +++ b/scaleway/scaleway/vpc/v2/api.py @@ -14,6 +14,7 @@ ) from .types import ( Action, + ListIngressRulesRequestOrderBy, ListPrivateNetworksRequestOrderBy, ListSubnetOverlapsRequestOrderBy, ListSubnetsRequestOrderBy, @@ -23,6 +24,7 @@ AclRule, AddSubnetsRequest, AddSubnetsResponse, + CreateIngressRuleRequest, CreatePrivateNetworkRequest, CreateRouteRequest, CreateVPCConnectorRequest, @@ -30,6 +32,8 @@ DeleteSubnetsRequest, DeleteSubnetsResponse, GetAclResponse, + IngressRule, + ListIngressRulesResponse, ListPrivateNetworksResponse, ListSubnetOverlapsResponse, ListSubnetOverlapsResponseSubnetOverlap, @@ -41,6 +45,7 @@ SetAclRequest, SetAclResponse, Subnet, + UpdateIngressRuleRequest, UpdatePrivateNetworkRequest, UpdateRouteRequest, UpdateVPCConnectorRequest, @@ -51,11 +56,13 @@ from .marshalling import ( unmarshal_PrivateNetwork, unmarshal_Route, + unmarshal_IngressRule, unmarshal_VPCConnector, unmarshal_VPC, unmarshal_AddSubnetsResponse, unmarshal_DeleteSubnetsResponse, unmarshal_GetAclResponse, + unmarshal_ListIngressRulesResponse, unmarshal_ListPrivateNetworksResponse, unmarshal_ListSubnetOverlapsResponse, unmarshal_ListSubnetsResponse, @@ -63,12 +70,14 @@ unmarshal_ListVPCsResponse, unmarshal_SetAclResponse, marshal_AddSubnetsRequest, + marshal_CreateIngressRuleRequest, marshal_CreatePrivateNetworkRequest, marshal_CreateRouteRequest, marshal_CreateVPCConnectorRequest, marshal_CreateVPCRequest, marshal_DeleteSubnetsRequest, marshal_SetAclRequest, + marshal_UpdateIngressRuleRequest, marshal_UpdatePrivateNetworkRequest, marshal_UpdateRouteRequest, marshal_UpdateVPCConnectorRequest, @@ -1600,3 +1609,276 @@ def list_subnet_overlaps_all( "page_size": page_size, }, ) + + def list_ingress_rules( + self, + *, + region: Optional[ScwRegion] = None, + order_by: Optional[ListIngressRulesRequestOrderBy] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + vpc_id: Optional[str] = None, + nexthop_resource_ip: Optional[str] = None, + nexthop_private_network_id: Optional[str] = None, + is_ipv6: Optional[bool] = None, + tags: Optional[list[str]] = None, + ) -> ListIngressRulesResponse: + """ + :param region: Region to target. If none is passed will use default region from the config. + :param order_by: + :param page: + :param page_size: + :param vpc_id: + :param nexthop_resource_ip: + :param nexthop_private_network_id: + :param is_ipv6: + :param tags: + :return: :class:`ListIngressRulesResponse ` + + Usage: + :: + + result = api.list_ingress_rules() + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + + res = self._request( + "GET", + f"/vpc/v2/regions/{param_region}/ingress-rules", + params={ + "is_ipv6": is_ipv6, + "nexthop_private_network_id": nexthop_private_network_id, + "nexthop_resource_ip": nexthop_resource_ip, + "order_by": order_by, + "page": page, + "page_size": page_size or self.client.default_page_size, + "tags": tags, + "vpc_id": vpc_id, + }, + ) + + self._throw_on_error(res) + return unmarshal_ListIngressRulesResponse(res.json()) + + def list_ingress_rules_all( + self, + *, + region: Optional[ScwRegion] = None, + order_by: Optional[ListIngressRulesRequestOrderBy] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + vpc_id: Optional[str] = None, + nexthop_resource_ip: Optional[str] = None, + nexthop_private_network_id: Optional[str] = None, + is_ipv6: Optional[bool] = None, + tags: Optional[list[str]] = None, + ) -> list[IngressRule]: + """ + :param region: Region to target. If none is passed will use default region from the config. + :param order_by: + :param page: + :param page_size: + :param vpc_id: + :param nexthop_resource_ip: + :param nexthop_private_network_id: + :param is_ipv6: + :param tags: + :return: :class:`list[IngressRule] ` + + Usage: + :: + + result = api.list_ingress_rules_all() + """ + + return fetch_all_pages( + type=ListIngressRulesResponse, + key="rules", + fetcher=self.list_ingress_rules, + args={ + "region": region, + "order_by": order_by, + "page": page, + "page_size": page_size, + "vpc_id": vpc_id, + "nexthop_resource_ip": nexthop_resource_ip, + "nexthop_private_network_id": nexthop_private_network_id, + "is_ipv6": is_ipv6, + "tags": tags, + }, + ) + + def create_ingress_rule( + self, + *, + vpc_id: str, + source: str, + nexthop_resource_ip: str, + nexthop_private_network_id: str, + region: Optional[ScwRegion] = None, + description: Optional[str] = None, + tags: Optional[list[str]] = None, + ) -> IngressRule: + """ + :param vpc_id: + :param source: + :param nexthop_resource_ip: + :param nexthop_private_network_id: + :param region: Region to target. If none is passed will use default region from the config. + :param description: + :param tags: + :return: :class:`IngressRule ` + + Usage: + :: + + result = api.create_ingress_rule( + vpc_id="example", + source="example", + nexthop_resource_ip="example", + nexthop_private_network_id="example", + ) + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + + res = self._request( + "POST", + f"/vpc/v2/regions/{param_region}/ingress-rules", + body=marshal_CreateIngressRuleRequest( + CreateIngressRuleRequest( + vpc_id=vpc_id, + source=source, + nexthop_resource_ip=nexthop_resource_ip, + nexthop_private_network_id=nexthop_private_network_id, + region=region, + description=description, + tags=tags, + ), + self.client, + ), + ) + + self._throw_on_error(res) + return unmarshal_IngressRule(res.json()) + + def get_ingress_rule( + self, + *, + rule_id: str, + region: Optional[ScwRegion] = None, + ) -> IngressRule: + """ + :param rule_id: + :param region: Region to target. If none is passed will use default region from the config. + :return: :class:`IngressRule ` + + Usage: + :: + + result = api.get_ingress_rule( + rule_id="example", + ) + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + param_rule_id = validate_path_param("rule_id", rule_id) + + res = self._request( + "GET", + f"/vpc/v2/regions/{param_region}/ingress-rules/{param_rule_id}", + ) + + self._throw_on_error(res) + return unmarshal_IngressRule(res.json()) + + def update_ingress_rule( + self, + *, + rule_id: str, + region: Optional[ScwRegion] = None, + source: Optional[str] = None, + nexthop_resource_ip: Optional[str] = None, + nexthop_private_network_id: Optional[str] = None, + description: Optional[str] = None, + tags: Optional[list[str]] = None, + ) -> IngressRule: + """ + :param rule_id: + :param region: Region to target. If none is passed will use default region from the config. + :param source: + :param nexthop_resource_ip: + :param nexthop_private_network_id: + :param description: + :param tags: + :return: :class:`IngressRule ` + + Usage: + :: + + result = api.update_ingress_rule( + rule_id="example", + ) + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + param_rule_id = validate_path_param("rule_id", rule_id) + + res = self._request( + "PATCH", + f"/vpc/v2/regions/{param_region}/ingress-rules/{param_rule_id}", + body=marshal_UpdateIngressRuleRequest( + UpdateIngressRuleRequest( + rule_id=rule_id, + region=region, + source=source, + nexthop_resource_ip=nexthop_resource_ip, + nexthop_private_network_id=nexthop_private_network_id, + description=description, + tags=tags, + ), + self.client, + ), + ) + + self._throw_on_error(res) + return unmarshal_IngressRule(res.json()) + + def delete_ingress_rule( + self, + *, + rule_id: str, + region: Optional[ScwRegion] = None, + ) -> None: + """ + :param rule_id: + :param region: Region to target. If none is passed will use default region from the config. + + Usage: + :: + + result = api.delete_ingress_rule( + rule_id="example", + ) + """ + + param_region = validate_path_param( + "region", region or self.client.default_region + ) + param_rule_id = validate_path_param("rule_id", rule_id) + + res = self._request( + "DELETE", + f"/vpc/v2/regions/{param_region}/ingress-rules/{param_rule_id}", + ) + + self._throw_on_error(res) diff --git a/scaleway/scaleway/vpc/v2/marshalling.py b/scaleway/scaleway/vpc/v2/marshalling.py index 684f1c43c..c98e9be3c 100644 --- a/scaleway/scaleway/vpc/v2/marshalling.py +++ b/scaleway/scaleway/vpc/v2/marshalling.py @@ -11,6 +11,7 @@ Subnet, PrivateNetwork, Route, + IngressRule, VPCConnectorPeerInfo, VPCConnector, VPC, @@ -18,6 +19,7 @@ DeleteSubnetsResponse, AclRule, GetAclResponse, + ListIngressRulesResponse, ListPrivateNetworksResponse, ListSubnetOverlapsResponseSubnetOverlap, ListSubnetOverlapsResponse, @@ -26,12 +28,14 @@ ListVPCsResponse, SetAclResponse, AddSubnetsRequest, + CreateIngressRuleRequest, CreatePrivateNetworkRequest, CreateRouteRequest, CreateVPCConnectorRequest, CreateVPCRequest, DeleteSubnetsRequest, SetAclRequest, + UpdateIngressRuleRequest, UpdatePrivateNetworkRequest, UpdateRouteRequest, UpdateVPCConnectorRequest, @@ -266,6 +270,77 @@ def unmarshal_Route(data: Any) -> Route: return Route(**args) +def unmarshal_IngressRule(data: Any) -> IngressRule: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'IngressRule' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("id", None) + if field is not None: + args["id"] = field + else: + args["id"] = None + + field = data.get("vpc_id", None) + if field is not None: + args["vpc_id"] = field + else: + args["vpc_id"] = None + + field = data.get("is_ipv6", None) + if field is not None: + args["is_ipv6"] = field + else: + args["is_ipv6"] = None + + field = data.get("source", None) + if field is not None: + args["source"] = field + else: + args["source"] = None + + field = data.get("nexthop_resource_ip", None) + if field is not None: + args["nexthop_resource_ip"] = field + else: + args["nexthop_resource_ip"] = None + + field = data.get("nexthop_private_network_id", None) + if field is not None: + args["nexthop_private_network_id"] = field + else: + args["nexthop_private_network_id"] = None + + field = data.get("tags", None) + if field is not None: + args["tags"] = field + else: + args["tags"] = None + + field = data.get("created_at", None) + if field is not None: + args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["created_at"] = None + + field = data.get("updated_at", None) + if field is not None: + args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field + else: + args["updated_at"] = None + + field = data.get("description", None) + if field is not None: + args["description"] = field + else: + args["description"] = None + + return IngressRule(**args) + + def unmarshal_VPCConnectorPeerInfo(data: Any) -> VPCConnectorPeerInfo: if not isinstance(data, dict): raise TypeError( @@ -585,6 +660,31 @@ def unmarshal_GetAclResponse(data: Any) -> GetAclResponse: return GetAclResponse(**args) +def unmarshal_ListIngressRulesResponse(data: Any) -> ListIngressRulesResponse: + if not isinstance(data, dict): + raise TypeError( + "Unmarshalling the type 'ListIngressRulesResponse' failed as data isn't a dictionary." + ) + + args: dict[str, Any] = {} + + field = data.get("rules", None) + if field is not None: + args["rules"] = ( + [unmarshal_IngressRule(v) for v in field] if field is not None else None + ) + else: + args["rules"] = None + + field = data.get("total_count", None) + if field is not None: + args["total_count"] = field + else: + args["total_count"] = None + + return ListIngressRulesResponse(**args) + + def unmarshal_ListPrivateNetworksResponse(data: Any) -> ListPrivateNetworksResponse: if not isinstance(data, dict): raise TypeError( @@ -784,6 +884,33 @@ def marshal_AddSubnetsRequest( return output +def marshal_CreateIngressRuleRequest( + request: CreateIngressRuleRequest, + defaults: ProfileDefaults, +) -> dict[str, Any]: + output: dict[str, Any] = {} + + if request.vpc_id is not None: + output["vpc_id"] = request.vpc_id + + if request.source is not None: + output["source"] = request.source + + if request.nexthop_resource_ip is not None: + output["nexthop_resource_ip"] = request.nexthop_resource_ip + + if request.nexthop_private_network_id is not None: + output["nexthop_private_network_id"] = request.nexthop_private_network_id + + if request.description is not None: + output["description"] = request.description + + if request.tags is not None: + output["tags"] = request.tags + + return output + + def marshal_CreatePrivateNetworkRequest( request: CreatePrivateNetworkRequest, defaults: ProfileDefaults, @@ -955,6 +1082,30 @@ def marshal_SetAclRequest( return output +def marshal_UpdateIngressRuleRequest( + request: UpdateIngressRuleRequest, + defaults: ProfileDefaults, +) -> dict[str, Any]: + output: dict[str, Any] = {} + + if request.source is not None: + output["source"] = request.source + + if request.nexthop_resource_ip is not None: + output["nexthop_resource_ip"] = request.nexthop_resource_ip + + if request.nexthop_private_network_id is not None: + output["nexthop_private_network_id"] = request.nexthop_private_network_id + + if request.description is not None: + output["description"] = request.description + + if request.tags is not None: + output["tags"] = request.tags + + return output + + def marshal_UpdatePrivateNetworkRequest( request: UpdatePrivateNetworkRequest, defaults: ProfileDefaults, diff --git a/scaleway/scaleway/vpc/v2/types.py b/scaleway/scaleway/vpc/v2/types.py index 9e98a1970..aa302214f 100644 --- a/scaleway/scaleway/vpc/v2/types.py +++ b/scaleway/scaleway/vpc/v2/types.py @@ -34,6 +34,18 @@ def __str__(self) -> str: return str(self.value) +class ListIngressRulesRequestOrderBy(str, Enum, metaclass=StrEnumMeta): + CREATED_AT_ASC = "created_at_asc" + CREATED_AT_DESC = "created_at_desc" + SOURCE_ASC = "source_asc" + SOURCE_DESC = "source_desc" + PREFIX_LEN_ASC = "prefix_len_asc" + PREFIX_LEN_DESC = "prefix_len_desc" + + def __str__(self) -> str: + return str(self.value) + + class ListPrivateNetworksRequestOrderBy(str, Enum, metaclass=StrEnumMeta): CREATED_AT_ASC = "created_at_asc" CREATED_AT_DESC = "created_at_desc" @@ -328,6 +340,20 @@ class AclRule: """ +@dataclass +class IngressRule: + id: str + vpc_id: str + is_ipv6: bool + source: str + nexthop_resource_ip: str + nexthop_private_network_id: str + tags: list[str] + created_at: Optional[datetime] = None + updated_at: Optional[datetime] = None + description: Optional[str] = None + + @dataclass class ListSubnetOverlapsResponseSubnetOverlap: subnet_id: str @@ -485,6 +511,21 @@ class AddSubnetsResponse: subnets: list[str] +@dataclass +class CreateIngressRuleRequest: + vpc_id: str + source: str + nexthop_resource_ip: str + nexthop_private_network_id: str + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + description: Optional[str] = None + tags: Optional[list[str]] = field(default_factory=list) + + @dataclass class CreatePrivateNetworkRequest: default_route_propagation_enabled: bool @@ -622,6 +663,15 @@ class CreateVPCRequest: """ +@dataclass +class DeleteIngressRuleRequest: + rule_id: str + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + @dataclass class DeletePrivateNetworkRequest: private_network_id: str @@ -760,6 +810,15 @@ class GetAclResponse: default_policy: Action +@dataclass +class GetIngressRuleRequest: + rule_id: str + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + @dataclass class GetPrivateNetworkRequest: private_network_id: str @@ -812,6 +871,29 @@ class GetVPCRequest: """ +@dataclass +class ListIngressRulesRequest: + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + order_by: Optional[ListIngressRulesRequestOrderBy] = None + page: Optional[int] = None + page_size: Optional[int] = None + vpc_id: Optional[str] = None + nexthop_resource_ip: Optional[str] = None + nexthop_private_network_id: Optional[str] = None + is_ipv6: Optional[bool] = None + tags: Optional[list[str]] = field(default_factory=list) + + +@dataclass +class ListIngressRulesResponse: + rules: list[IngressRule] + total_count: int + + @dataclass class ListPrivateNetworksRequest: region: Optional[ScwRegion] = None @@ -1126,6 +1208,21 @@ class SetAclResponse: default_policy: Action +@dataclass +class UpdateIngressRuleRequest: + rule_id: str + region: Optional[ScwRegion] = None + """ + Region to target. If none is passed will use default region from the config. + """ + + source: Optional[str] = None + nexthop_resource_ip: Optional[str] = None + nexthop_private_network_id: Optional[str] = None + description: Optional[str] = None + tags: Optional[list[str]] = field(default_factory=list) + + @dataclass class UpdatePrivateNetworkRequest: private_network_id: str