Skip to main content

Module clients.sandbox.port.client

Classes

PortClient

class PortClient(connection_config: h2o_engine_manager.clients.connection_config.ConnectionConfig, verify_ssl: bool = True, ssl_ca_cert: Optional[str] = None)

PortClient manages port operations within a SandboxEngine.

Args
connection_config
AIEM connection configuration object.
verify_ssl
Set to False to disable SSL certificate verification.
ssl_ca_cert
Path to a CA cert bundle with certificates of trusted CAs.

Methods

create_port

def create_port(self, parent: str, port: h2o_engine_manager.clients.sandbox.port.port.Port, port_id: str) ‑> h2o_engine_manager.clients.sandbox.port.port.Port

Create a new port in the sandbox engine.

Args
parent : str
The parent SandboxEngine resource name. Format: "workspaces//sandboxEngines/"
port : Port
The Port to create.
port_id : str
The port number to expose (1024-65535). This will become the port ID in the resource name.
Returns
Port
The created port.

delete_port

def delete_port(self, name: str) ‑> None

Delete a port.

Args
name : str
Port resource name. Format: "workspaces//sandboxEngines//ports/*"

get_port

def get_port(self, name: str) ‑> h2o_engine_manager.clients.sandbox.port.port.Port

Get a port by its resource name.

Args
name : str
Port resource name. Format: "workspaces//sandboxEngines//ports/*"
Returns
Port
The port.

list_ports

def list_ports(self, parent: str, page_size: int = 0, page_token: str = '') ‑> tuple[typing.List[h2o_engine_manager.clients.sandbox.port.port.Port], str]

List ports in a sandbox engine.

Args
parent : str
The parent SandboxEngine resource name. Format: "workspaces//sandboxEngines/"
page_size : int
Maximum number of ports to return. If unspecified (or set to 0), at most 50 ports will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.
page_token : str
Token for pagination. Leave unset to receive the initial page.
Returns
tuple[List[Port], str]
A tuple of (ports, next_page_token).

update_port

def update_port(self, port: h2o_engine_manager.clients.sandbox.port.port.Port, update_mask: List[str]) ‑> h2o_engine_manager.clients.sandbox.port.port.Port

Update a port.

Args
port : Port
The Port resource to update. The name field must be set to identify which port to update.
update_mask : List[str]
Field mask specifying which fields to update. Updatable fields: display_name, public Example: ["display_name", "public"]
Returns
Port
The updated port.

wait

def wait(self, name: str, timeout_seconds: Optional[float] = None) ‑> Optional[h2o_engine_manager.clients.sandbox.port.port.Port]

Blocks execution until the port reaches a stable state or is no longer found.

A port is considered stable when it reaches STATE_READY or STATE_FAILED.

Args
name : str
Port resource name. Format: "workspaces//sandboxEngines//ports/*"
timeout_seconds : float, optional
Time limit in seconds for how long to wait. If not specified, waits indefinitely.
Returns
Port
The port that has reached a stable state, or None if port was deleted.
Raises
TimeoutException
If timeout_seconds is specified and the port doesn't reach a stable state within the timeout.

Feedback