AS AgentScopeAPI 手册 / API Reference

PortForwardStrategy

public class PortForwardStrategy implements ConnectionStrategy
源码Source io/agentscope/extensions/sandbox/kubernetes/client/internal/strategy/PortForwardStrategy.java:34–117

Port Forward Strategy,在隔离环境中安全执行代码和工具。位于 io.agentscope.extensions.sandbox.kubernetes.client.internal.strategy 包,实现 ConnectionStrategy。核心成员包括 connect、close、PortForwardStrategy。

Port-forward connection strategy — establishes a fabric8 port-forward tunnel to the sandbox-router service for development / out-of-cluster mode.

构造器摘要Constructor Summary

构造器Constructor说明Description
public PortForwardStrategy(KubernetesClient client, LocalTunnelConnectionConfig config)
初始化 `PortForwardStrategy` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public String connect() throws Exception
建立连接并完成初始化。
Returns the connect.
public void close()
关闭连接并释放相关资源。
Releases resources and connections.

构造器详情Constructor Detail

PortForwardStrategy

public PortForwardStrategy(KubernetesClient client, LocalTunnelConnectionConfig config)

初始化 PortForwardStrategy 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
clientKubernetesClient客户端(类型 `KubernetesClient`)。The client.
configLocalTunnelConnectionConfig配置对象(类型 `LocalTunnelConnectionConfig`)。The config.
源码Source io/agentscope/extensions/sandbox/kubernetes/client/internal/strategy/PortForwardStrategy.java:43–46

方法详情Method Detail

connect

public String connect() throws Exception

建立连接并完成初始化。

Returns the connect.

返回Returns String
返回字符串结果。Returns a string.
抛出Throws
  • Exception 可能抛出 `Exception`。Thrown when the operation cannot be completed.
源码Source io/agentscope/extensions/sandbox/kubernetes/client/internal/strategy/PortForwardStrategy.java:48–80

close

public void close()

关闭连接并释放相关资源。

Releases resources and connections.

源码Source io/agentscope/extensions/sandbox/kubernetes/client/internal/strategy/PortForwardStrategy.java:82–93

继承成员Inherited Members

继承自Methods inherited from ConnectionStrategy
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.