From a7ce06a0291ee3b8e631592303b18d36ff57ed0e Mon Sep 17 00:00:00 2001 From: A Vertex SDK engineer Date: Thu, 27 Aug 2026 22:39:23 -0700 Subject: [PATCH] feat: Allow setting `ingress_control_config` when creating a `SandboxEnvironmentTemplate` via the SDK (Python, Java, JS). FUTURE_COPYBARA_INTEGRATE_REVIEW=https://github.com/googleapis/python-aiplatform/pull/7113 from googleapis:release-please--branches--main 42f56c79ca3712c6e0b7e7e592e74724ab983c9b PiperOrigin-RevId: 972355621 --- agentplatform/_genai/sandbox_templates.py | 7 + agentplatform/_genai/types/__init__.py | 6 +- agentplatform/_genai/types/common.py | 191 +++++++++++----------- 3 files changed, 109 insertions(+), 95 deletions(-) diff --git a/agentplatform/_genai/sandbox_templates.py b/agentplatform/_genai/sandbox_templates.py index d173081f80..66d5767824 100644 --- a/agentplatform/_genai/sandbox_templates.py +++ b/agentplatform/_genai/sandbox_templates.py @@ -62,6 +62,13 @@ def _CreateSandboxEnvironmentTemplateConfig_to_vertex( getv(from_object, ["egress_control_config"]), ) + if getv(from_object, ["ingress_control_config"]) is not None: + setv( + parent_object, + ["ingressControlConfig"], + getv(from_object, ["ingress_control_config"]), + ) + return to_object diff --git a/agentplatform/_genai/types/__init__.py b/agentplatform/_genai/types/__init__.py index fc3e0056b5..667ce0b282 100644 --- a/agentplatform/_genai/types/__init__.py +++ b/agentplatform/_genai/types/__init__.py @@ -3457,15 +3457,15 @@ "SandboxEnvironmentTemplateEgressControlConfig", "SandboxEnvironmentTemplateEgressControlConfigDict", "SandboxEnvironmentTemplateEgressControlConfigOrDict", - "CreateSandboxEnvironmentTemplateConfig", - "CreateSandboxEnvironmentTemplateConfigDict", - "CreateSandboxEnvironmentTemplateConfigOrDict", "PSCAutomationConfig", "PSCAutomationConfigDict", "PSCAutomationConfigOrDict", "PrivateServiceConnectConfig", "PrivateServiceConnectConfigDict", "PrivateServiceConnectConfigOrDict", + "CreateSandboxEnvironmentTemplateConfig", + "CreateSandboxEnvironmentTemplateConfigDict", + "CreateSandboxEnvironmentTemplateConfigOrDict", "SandboxEnvironmentTemplate", "SandboxEnvironmentTemplateDict", "SandboxEnvironmentTemplateOrDict", diff --git a/agentplatform/_genai/types/common.py b/agentplatform/_genai/types/common.py index ee0f0130c0..0eb2e58739 100644 --- a/agentplatform/_genai/types/common.py +++ b/agentplatform/_genai/types/common.py @@ -17603,98 +17603,6 @@ class SandboxEnvironmentTemplateEgressControlConfigDict(TypedDict, total=False): ] -class CreateSandboxEnvironmentTemplateConfig(_common.BaseModel): - """Config for creating a Sandbox Template.""" - - http_options: Optional[genai_types.HttpOptions] = Field( - default=None, description="""Used to override HTTP request options.""" - ) - wait_for_completion: Optional[bool] = Field( - default=True, - description="""Waits for the operation to complete before returning.""", - ) - custom_container_environment: Optional[ - SandboxEnvironmentTemplateCustomContainerEnvironment - ] = Field( - default=None, - description="""The custom container environment for the sandbox template.""", - ) - default_container_environment: Optional[ - SandboxEnvironmentTemplateDefaultContainerEnvironment - ] = Field( - default=None, - description="""The default container environment for the sandbox template.""", - ) - egress_control_config: Optional[SandboxEnvironmentTemplateEgressControlConfig] = ( - Field( - default=None, - description="""The egress control config for the sandbox template.""", - ) - ) - - -class CreateSandboxEnvironmentTemplateConfigDict(TypedDict, total=False): - """Config for creating a Sandbox Template.""" - - http_options: Optional[genai_types.HttpOptions] - """Used to override HTTP request options.""" - - wait_for_completion: Optional[bool] - """Waits for the operation to complete before returning.""" - - custom_container_environment: Optional[ - SandboxEnvironmentTemplateCustomContainerEnvironmentDict - ] - """The custom container environment for the sandbox template.""" - - default_container_environment: Optional[ - SandboxEnvironmentTemplateDefaultContainerEnvironmentDict - ] - """The default container environment for the sandbox template.""" - - egress_control_config: Optional[SandboxEnvironmentTemplateEgressControlConfigDict] - """The egress control config for the sandbox template.""" - - -CreateSandboxEnvironmentTemplateConfigOrDict = Union[ - CreateSandboxEnvironmentTemplateConfig, CreateSandboxEnvironmentTemplateConfigDict -] - - -class _CreateSandboxEnvironmentTemplateRequestParameters(_common.BaseModel): - """Parameters for creating Sandbox Environment Templates.""" - - name: Optional[str] = Field( - default=None, - description="""Name of the agent runtime to create the template under.""", - ) - display_name: Optional[str] = Field( - default=None, description="""The display name of the sandbox template.""" - ) - config: Optional[CreateSandboxEnvironmentTemplateConfig] = Field( - default=None, description="""""" - ) - - -class _CreateSandboxEnvironmentTemplateRequestParametersDict(TypedDict, total=False): - """Parameters for creating Sandbox Environment Templates.""" - - name: Optional[str] - """Name of the agent runtime to create the template under.""" - - display_name: Optional[str] - """The display name of the sandbox template.""" - - config: Optional[CreateSandboxEnvironmentTemplateConfigDict] - """""" - - -_CreateSandboxEnvironmentTemplateRequestParametersOrDict = Union[ - _CreateSandboxEnvironmentTemplateRequestParameters, - _CreateSandboxEnvironmentTemplateRequestParametersDict, -] - - class PSCAutomationConfig(_common.BaseModel): """PSC config that is used to automatically create PSC endpoints in the user projects.""" @@ -17798,6 +17706,105 @@ class PrivateServiceConnectConfigDict(TypedDict, total=False): ] +class CreateSandboxEnvironmentTemplateConfig(_common.BaseModel): + """Config for creating a Sandbox Template.""" + + http_options: Optional[genai_types.HttpOptions] = Field( + default=None, description="""Used to override HTTP request options.""" + ) + wait_for_completion: Optional[bool] = Field( + default=True, + description="""Waits for the operation to complete before returning.""", + ) + custom_container_environment: Optional[ + SandboxEnvironmentTemplateCustomContainerEnvironment + ] = Field( + default=None, + description="""The custom container environment for the sandbox template.""", + ) + default_container_environment: Optional[ + SandboxEnvironmentTemplateDefaultContainerEnvironment + ] = Field( + default=None, + description="""The default container environment for the sandbox template.""", + ) + egress_control_config: Optional[SandboxEnvironmentTemplateEgressControlConfig] = ( + Field( + default=None, + description="""The egress control config for the sandbox template.""", + ) + ) + ingress_control_config: Optional[PrivateServiceConnectConfig] = Field( + default=None, + description="""The ingress control config for the sandbox template.""", + ) + + +class CreateSandboxEnvironmentTemplateConfigDict(TypedDict, total=False): + """Config for creating a Sandbox Template.""" + + http_options: Optional[genai_types.HttpOptions] + """Used to override HTTP request options.""" + + wait_for_completion: Optional[bool] + """Waits for the operation to complete before returning.""" + + custom_container_environment: Optional[ + SandboxEnvironmentTemplateCustomContainerEnvironmentDict + ] + """The custom container environment for the sandbox template.""" + + default_container_environment: Optional[ + SandboxEnvironmentTemplateDefaultContainerEnvironmentDict + ] + """The default container environment for the sandbox template.""" + + egress_control_config: Optional[SandboxEnvironmentTemplateEgressControlConfigDict] + """The egress control config for the sandbox template.""" + + ingress_control_config: Optional[PrivateServiceConnectConfigDict] + """The ingress control config for the sandbox template.""" + + +CreateSandboxEnvironmentTemplateConfigOrDict = Union[ + CreateSandboxEnvironmentTemplateConfig, CreateSandboxEnvironmentTemplateConfigDict +] + + +class _CreateSandboxEnvironmentTemplateRequestParameters(_common.BaseModel): + """Parameters for creating Sandbox Environment Templates.""" + + name: Optional[str] = Field( + default=None, + description="""Name of the agent runtime to create the template under.""", + ) + display_name: Optional[str] = Field( + default=None, description="""The display name of the sandbox template.""" + ) + config: Optional[CreateSandboxEnvironmentTemplateConfig] = Field( + default=None, description="""""" + ) + + +class _CreateSandboxEnvironmentTemplateRequestParametersDict(TypedDict, total=False): + """Parameters for creating Sandbox Environment Templates.""" + + name: Optional[str] + """Name of the agent runtime to create the template under.""" + + display_name: Optional[str] + """The display name of the sandbox template.""" + + config: Optional[CreateSandboxEnvironmentTemplateConfigDict] + """""" + + +_CreateSandboxEnvironmentTemplateRequestParametersOrDict = Union[ + _CreateSandboxEnvironmentTemplateRequestParameters, + _CreateSandboxEnvironmentTemplateRequestParametersDict, +] + + class SandboxEnvironmentTemplate(_common.BaseModel): """A sandbox environment template."""