diff --git a/scaleway-async/scaleway_async/function/v1beta1/api.py b/scaleway-async/scaleway_async/function/v1beta1/api.py index 0b28ea66c..04bf3cf7b 100644 --- a/scaleway-async/scaleway_async/function/v1beta1/api.py +++ b/scaleway-async/scaleway_async/function/v1beta1/api.py @@ -271,6 +271,7 @@ async def wait_for_namespace( async def create_namespace( self, *, + activate_vpc_integration: bool, region: Optional[ScwRegion] = None, name: Optional[str] = None, environment_variables: Optional[Dict[str, str]] = None, @@ -282,6 +283,7 @@ async def create_namespace( """ Create a new namespace. Create a new namespace in a specified Organization or Project. + :param activate_vpc_integration: When activated, functions in the namespace can be connected to a Private Network. :param region: Region to target. If none is passed will use default region from the config. :param name: :param environment_variables: Environment variables of the namespace. @@ -294,7 +296,9 @@ async def create_namespace( Usage: :: - result = await api.create_namespace() + result = await api.create_namespace( + activate_vpc_integration=False, + ) """ param_region = validate_path_param( @@ -306,6 +310,7 @@ async def create_namespace( f"/functions/v1beta1/regions/{param_region}/namespaces", body=marshal_CreateNamespaceRequest( CreateNamespaceRequest( + activate_vpc_integration=activate_vpc_integration, region=region, name=name or random_name(prefix="ns"), environment_variables=environment_variables, @@ -602,6 +607,7 @@ async def create_function( http_option: Optional[FunctionHttpOption] = None, sandbox: Optional[FunctionSandbox] = None, tags: Optional[List[str]] = None, + private_network_id: Optional[str] = None, ) -> Function: """ Create a new function. @@ -624,6 +630,9 @@ async def create_function( - enabled: Serve both HTTP and HTTPS traffic. :param sandbox: Execution environment of the function. :param tags: Tags of the Serverless Function. + :param private_network_id: When connected to a Private Network, the function can access other Scaleway resources in this Private Network. + + Note: this feature is currently in beta and requires a namespace with VPC integration activated, using the `activate_vpc_integration` flag. :return: :class:`Function ` Usage: @@ -659,6 +668,7 @@ async def create_function( http_option=http_option, sandbox=sandbox, tags=tags, + private_network_id=private_network_id, ), self.client, ), @@ -686,6 +696,7 @@ async def update_function( http_option: Optional[FunctionHttpOption] = None, sandbox: Optional[FunctionSandbox] = None, tags: Optional[List[str]] = None, + private_network_id: Optional[str] = None, ) -> Function: """ Update an existing function. @@ -708,6 +719,9 @@ async def update_function( - enabled: Serve both HTTP and HTTPS traffic. :param sandbox: Execution environment of the function. :param tags: Tags of the Serverless Function. + :param private_network_id: When connected to a Private Network, the function can access other Scaleway resources in this Private Network. + + Note: this feature is currently in beta and requires a namespace with VPC integration activated, using the `activate_vpc_integration` flag. :return: :class:`Function ` Usage: @@ -744,6 +758,7 @@ async def update_function( http_option=http_option, sandbox=sandbox, tags=tags, + private_network_id=private_network_id, ), self.client, ), diff --git a/scaleway-async/scaleway_async/function/v1beta1/marshalling.py b/scaleway-async/scaleway_async/function/v1beta1/marshalling.py index d3cb71cde..2f34c0b02 100644 --- a/scaleway-async/scaleway_async/function/v1beta1/marshalling.py +++ b/scaleway-async/scaleway_async/function/v1beta1/marshalling.py @@ -271,6 +271,12 @@ def unmarshal_Function(data: Any) -> Function: else: args["ready_at"] = None + field = data.get("private_network_id", None) + if field is not None: + args["private_network_id"] = field + else: + args["private_network_id"] = None + return Function(**args) @@ -310,6 +316,12 @@ def unmarshal_Namespace(data: Any) -> Namespace: if field is not None: args["registry_namespace_id"] = field + field = data.get("error_message", None) + if field is not None: + args["error_message"] = field + else: + args["error_message"] = None + field = data.get("registry_endpoint", None) if field is not None: args["registry_endpoint"] = field @@ -330,12 +342,6 @@ def unmarshal_Namespace(data: Any) -> Namespace: if field is not None: args["tags"] = field - field = data.get("error_message", None) - if field is not None: - args["error_message"] = field - else: - args["error_message"] = None - field = data.get("description", None) if field is not None: args["description"] = field @@ -354,6 +360,12 @@ def unmarshal_Namespace(data: Any) -> Namespace: else: args["updated_at"] = None + field = data.get("vpc_integration_activated", None) + if field is not None: + args["vpc_integration_activated"] = field + else: + args["vpc_integration_activated"] = None + return Namespace(**args) @@ -899,6 +911,9 @@ def marshal_CreateFunctionRequest( if request.tags is not None: output["tags"] = request.tags + if request.private_network_id is not None: + output["private_network_id"] = request.private_network_id + return output @@ -908,6 +923,9 @@ def marshal_CreateNamespaceRequest( ) -> Dict[str, Any]: output: Dict[str, Any] = {} + if request.activate_vpc_integration is not None: + output["activate_vpc_integration"] = request.activate_vpc_integration + if request.name is not None: output["name"] = request.name @@ -1114,6 +1132,9 @@ def marshal_UpdateFunctionRequest( if request.tags is not None: output["tags"] = request.tags + if request.private_network_id is not None: + output["private_network_id"] = request.private_network_id + return output diff --git a/scaleway-async/scaleway_async/function/v1beta1/types.py b/scaleway-async/scaleway_async/function/v1beta1/types.py index 1e3b82200..7d97d0aad 100644 --- a/scaleway-async/scaleway_async/function/v1beta1/types.py +++ b/scaleway-async/scaleway_async/function/v1beta1/types.py @@ -583,6 +583,11 @@ class Function: Last date when the function was successfully deployed and set to ready. """ + private_network_id: Optional[str] + """ + When connected to a Private Network, the function can access other Scaleway resources in this Private Network. + """ + @dataclass class Namespace: @@ -621,6 +626,11 @@ class Namespace: UUID of the registry namespace. """ + error_message: Optional[str] + """ + Error message if the namespace is in "error" state. + """ + registry_endpoint: str """ Registry endpoint of the namespace. @@ -641,11 +651,6 @@ class Namespace: List of tags applied to the Serverless Function Namespace. """ - error_message: Optional[str] - """ - Error message if the namespace is in "error" state. - """ - description: Optional[str] """ Description of the namespace. @@ -661,6 +666,12 @@ class Namespace: Last update date of the namespace. """ + vpc_integration_activated: Optional[bool] + """ + When activated, functions in the namespace can be connected to a Private Network. +Note that activating the VPC integration can only be done when creating a new namespace. + """ + @dataclass class Token: @@ -877,9 +888,21 @@ class CreateFunctionRequest: Tags of the Serverless Function. """ + private_network_id: Optional[str] + """ + When connected to a Private Network, the function can access other Scaleway resources in this Private Network. + +Note: this feature is currently in beta and requires a namespace with VPC integration activated, using the `activate_vpc_integration` flag. + """ + @dataclass class CreateNamespaceRequest: + activate_vpc_integration: bool + """ + When activated, functions in the namespace can be connected to a Private Network. + """ + region: Optional[ScwRegion] """ Region to target. If none is passed will use default region from the config. @@ -1577,6 +1600,13 @@ class UpdateFunctionRequest: Tags of the Serverless Function. """ + private_network_id: Optional[str] + """ + When connected to a Private Network, the function can access other Scaleway resources in this Private Network. + +Note: this feature is currently in beta and requires a namespace with VPC integration activated, using the `activate_vpc_integration` flag. + """ + @dataclass class UpdateNamespaceRequest: diff --git a/scaleway/scaleway/function/v1beta1/api.py b/scaleway/scaleway/function/v1beta1/api.py index 63826d8c5..771b4f92e 100644 --- a/scaleway/scaleway/function/v1beta1/api.py +++ b/scaleway/scaleway/function/v1beta1/api.py @@ -269,6 +269,7 @@ def wait_for_namespace( def create_namespace( self, *, + activate_vpc_integration: bool, region: Optional[ScwRegion] = None, name: Optional[str] = None, environment_variables: Optional[Dict[str, str]] = None, @@ -280,6 +281,7 @@ def create_namespace( """ Create a new namespace. Create a new namespace in a specified Organization or Project. + :param activate_vpc_integration: When activated, functions in the namespace can be connected to a Private Network. :param region: Region to target. If none is passed will use default region from the config. :param name: :param environment_variables: Environment variables of the namespace. @@ -292,7 +294,9 @@ def create_namespace( Usage: :: - result = api.create_namespace() + result = api.create_namespace( + activate_vpc_integration=False, + ) """ param_region = validate_path_param( @@ -304,6 +308,7 @@ def create_namespace( f"/functions/v1beta1/regions/{param_region}/namespaces", body=marshal_CreateNamespaceRequest( CreateNamespaceRequest( + activate_vpc_integration=activate_vpc_integration, region=region, name=name or random_name(prefix="ns"), environment_variables=environment_variables, @@ -598,6 +603,7 @@ def create_function( http_option: Optional[FunctionHttpOption] = None, sandbox: Optional[FunctionSandbox] = None, tags: Optional[List[str]] = None, + private_network_id: Optional[str] = None, ) -> Function: """ Create a new function. @@ -620,6 +626,9 @@ def create_function( - enabled: Serve both HTTP and HTTPS traffic. :param sandbox: Execution environment of the function. :param tags: Tags of the Serverless Function. + :param private_network_id: When connected to a Private Network, the function can access other Scaleway resources in this Private Network. + + Note: this feature is currently in beta and requires a namespace with VPC integration activated, using the `activate_vpc_integration` flag. :return: :class:`Function ` Usage: @@ -655,6 +664,7 @@ def create_function( http_option=http_option, sandbox=sandbox, tags=tags, + private_network_id=private_network_id, ), self.client, ), @@ -682,6 +692,7 @@ def update_function( http_option: Optional[FunctionHttpOption] = None, sandbox: Optional[FunctionSandbox] = None, tags: Optional[List[str]] = None, + private_network_id: Optional[str] = None, ) -> Function: """ Update an existing function. @@ -704,6 +715,9 @@ def update_function( - enabled: Serve both HTTP and HTTPS traffic. :param sandbox: Execution environment of the function. :param tags: Tags of the Serverless Function. + :param private_network_id: When connected to a Private Network, the function can access other Scaleway resources in this Private Network. + + Note: this feature is currently in beta and requires a namespace with VPC integration activated, using the `activate_vpc_integration` flag. :return: :class:`Function ` Usage: @@ -740,6 +754,7 @@ def update_function( http_option=http_option, sandbox=sandbox, tags=tags, + private_network_id=private_network_id, ), self.client, ), diff --git a/scaleway/scaleway/function/v1beta1/marshalling.py b/scaleway/scaleway/function/v1beta1/marshalling.py index d3cb71cde..2f34c0b02 100644 --- a/scaleway/scaleway/function/v1beta1/marshalling.py +++ b/scaleway/scaleway/function/v1beta1/marshalling.py @@ -271,6 +271,12 @@ def unmarshal_Function(data: Any) -> Function: else: args["ready_at"] = None + field = data.get("private_network_id", None) + if field is not None: + args["private_network_id"] = field + else: + args["private_network_id"] = None + return Function(**args) @@ -310,6 +316,12 @@ def unmarshal_Namespace(data: Any) -> Namespace: if field is not None: args["registry_namespace_id"] = field + field = data.get("error_message", None) + if field is not None: + args["error_message"] = field + else: + args["error_message"] = None + field = data.get("registry_endpoint", None) if field is not None: args["registry_endpoint"] = field @@ -330,12 +342,6 @@ def unmarshal_Namespace(data: Any) -> Namespace: if field is not None: args["tags"] = field - field = data.get("error_message", None) - if field is not None: - args["error_message"] = field - else: - args["error_message"] = None - field = data.get("description", None) if field is not None: args["description"] = field @@ -354,6 +360,12 @@ def unmarshal_Namespace(data: Any) -> Namespace: else: args["updated_at"] = None + field = data.get("vpc_integration_activated", None) + if field is not None: + args["vpc_integration_activated"] = field + else: + args["vpc_integration_activated"] = None + return Namespace(**args) @@ -899,6 +911,9 @@ def marshal_CreateFunctionRequest( if request.tags is not None: output["tags"] = request.tags + if request.private_network_id is not None: + output["private_network_id"] = request.private_network_id + return output @@ -908,6 +923,9 @@ def marshal_CreateNamespaceRequest( ) -> Dict[str, Any]: output: Dict[str, Any] = {} + if request.activate_vpc_integration is not None: + output["activate_vpc_integration"] = request.activate_vpc_integration + if request.name is not None: output["name"] = request.name @@ -1114,6 +1132,9 @@ def marshal_UpdateFunctionRequest( if request.tags is not None: output["tags"] = request.tags + if request.private_network_id is not None: + output["private_network_id"] = request.private_network_id + return output diff --git a/scaleway/scaleway/function/v1beta1/types.py b/scaleway/scaleway/function/v1beta1/types.py index 1e3b82200..7d97d0aad 100644 --- a/scaleway/scaleway/function/v1beta1/types.py +++ b/scaleway/scaleway/function/v1beta1/types.py @@ -583,6 +583,11 @@ class Function: Last date when the function was successfully deployed and set to ready. """ + private_network_id: Optional[str] + """ + When connected to a Private Network, the function can access other Scaleway resources in this Private Network. + """ + @dataclass class Namespace: @@ -621,6 +626,11 @@ class Namespace: UUID of the registry namespace. """ + error_message: Optional[str] + """ + Error message if the namespace is in "error" state. + """ + registry_endpoint: str """ Registry endpoint of the namespace. @@ -641,11 +651,6 @@ class Namespace: List of tags applied to the Serverless Function Namespace. """ - error_message: Optional[str] - """ - Error message if the namespace is in "error" state. - """ - description: Optional[str] """ Description of the namespace. @@ -661,6 +666,12 @@ class Namespace: Last update date of the namespace. """ + vpc_integration_activated: Optional[bool] + """ + When activated, functions in the namespace can be connected to a Private Network. +Note that activating the VPC integration can only be done when creating a new namespace. + """ + @dataclass class Token: @@ -877,9 +888,21 @@ class CreateFunctionRequest: Tags of the Serverless Function. """ + private_network_id: Optional[str] + """ + When connected to a Private Network, the function can access other Scaleway resources in this Private Network. + +Note: this feature is currently in beta and requires a namespace with VPC integration activated, using the `activate_vpc_integration` flag. + """ + @dataclass class CreateNamespaceRequest: + activate_vpc_integration: bool + """ + When activated, functions in the namespace can be connected to a Private Network. + """ + region: Optional[ScwRegion] """ Region to target. If none is passed will use default region from the config. @@ -1577,6 +1600,13 @@ class UpdateFunctionRequest: Tags of the Serverless Function. """ + private_network_id: Optional[str] + """ + When connected to a Private Network, the function can access other Scaleway resources in this Private Network. + +Note: this feature is currently in beta and requires a namespace with VPC integration activated, using the `activate_vpc_integration` flag. + """ + @dataclass class UpdateNamespaceRequest: