From ce552dc6ec56d4d853d45d1f28c55beccd5fb84d Mon Sep 17 00:00:00 2001 From: zhaoqing Date: Thu, 11 Jun 2026 10:52:40 +0800 Subject: [PATCH 1/5] update java sdk --- .../agents/client/e2b/ConnectionConfig.java | 244 ++ .../agents/client/e2b/E2bRuntimeConfig.java | 146 ++ .../agents/client/e2b/README_zh-CH.md | 264 ++ .../openkruise/agents/client/e2b/Sandbox.java | 72 + .../agents/client/e2b/SandboxApi.java | 164 ++ .../agents/client/e2b/SandboxInfo.java | 186 ++ .../client/e2b/SandboxNotFoundException.java | 27 + .../client/e2b/api/AccessTokensApi.java | 340 +++ .../agents/client/e2b/api/AdminApi.java | 1060 ++++++++ .../agents/client/e2b/api/ApiKeysApi.java | 604 +++++ .../agents/client/e2b/api/AuthApi.java | 523 ++++ .../agents/client/e2b/api/DefaultApi.java | 189 ++ .../agents/client/e2b/api/SandboxesApi.java | 261 +- .../agents/client/e2b/api/SnapshotsApi.java | 222 ++ .../agents/client/e2b/api/TagsApi.java | 493 ++++ .../agents/client/e2b/api/TemplatesApi.java | 2303 +++++++++++++++++ .../agents/client/e2b/api/VolumesApi.java | 601 +++++ .../client/e2b/api/invoker/ApiClient.java | 70 +- .../client/e2b/api/invoker/ApiException.java | 20 +- .../client/e2b/api/invoker/ApiResponse.java | 2 +- .../client/e2b/api/invoker/Configuration.java | 2 +- .../agents/client/e2b/api/invoker/JSON.java | 9 +- .../agents/client/e2b/api/invoker/Pair.java | 2 +- .../client/e2b/api/invoker/StringUtil.java | 2 +- .../e2b/api/invoker/auth/ApiKeyAuth.java | 2 +- .../e2b/api/invoker/auth/HttpBearerAuth.java | 2 +- .../client/e2b/api/models/AWSRegistry.java | 6 +- .../e2b/api/models/AbstractOpenApiSchema.java | 2 +- .../api/models/AdminBuildCancelResult.java | 317 +++ .../api/models/AdminSandboxKillResult.java | 6 +- .../api/models/AssignTemplateTagsRequest.java | 6 +- .../e2b/api/models/AssignedTemplateTags.java | 6 +- .../client/e2b/api/models/BuildLogEntry.java | 6 +- .../e2b/api/models/BuildStatusReason.java | 6 +- .../client/e2b/api/models/ConnectSandbox.java | 6 +- .../e2b/api/models/CreatedAccessToken.java | 6 +- .../e2b/api/models/CreatedTeamAPIKey.java | 6 +- .../api/models/DeleteTemplateTagsRequest.java | 6 +- .../client/e2b/api/models/DiskMetrics.java | 6 +- .../agents/client/e2b/api/models/Error.java | 6 +- .../e2b/api/models/FromImageRegistry.java | 2 +- .../client/e2b/api/models/GCPRegistry.java | 6 +- .../e2b/api/models/GeneralRegistry.java | 6 +- .../api/models/IdentifierMaskingDetails.java | 6 +- .../client/e2b/api/models/ListedSandbox.java | 6 +- .../client/e2b/api/models/MachineInfo.java | 6 +- .../client/e2b/api/models/MaxTeamMetric.java | 6 +- .../client/e2b/api/models/NewAccessToken.java | 6 +- .../client/e2b/api/models/NewSandbox.java | 6 +- .../client/e2b/api/models/NewTeamAPIKey.java | 6 +- .../client/e2b/api/models/NewVolume.java | 6 +- .../agents/client/e2b/api/models/Node.java | 45 +- .../client/e2b/api/models/NodeDetail.java | 94 +- .../client/e2b/api/models/NodeMetrics.java | 6 +- .../client/e2b/api/models/NodeStatus.java | 6 +- .../e2b/api/models/NodeStatusChange.java | 6 +- .../api/models/NodesGet200ResponseInner.java | 45 +- .../client/e2b/api/models/ResumedSandbox.java | 6 +- .../api/models/SandboxAutoResumeConfig.java | 6 +- .../client/e2b/api/models/SandboxDetail.java | 102 +- .../e2b/api/models/SandboxLifecycle.java | 318 +++ .../client/e2b/api/models/SandboxLog.java | 6 +- .../e2b/api/models/SandboxLogEntry.java | 6 +- .../client/e2b/api/models/SandboxLogs.java | 6 +- .../e2b/api/models/SandboxLogsV2Response.java | 6 +- .../client/e2b/api/models/SandboxMetric.java | 37 +- .../e2b/api/models/SandboxNetworkConfig.java | 53 +- .../e2b/api/models/SandboxNetworkRule.java | 285 ++ .../api/models/SandboxNetworkTransform.java | 290 +++ .../models/SandboxNetworkUpdateConfig.java | 401 +++ .../e2b/api/models/SandboxOnTimeout.java | 73 + .../{Sandbox.java => SandboxResponse.java} | 90 +- .../e2b/api/models/SandboxVolumeMount.java | 6 +- .../models/SandboxesGet200ResponseInner.java | 6 +- ...andboxesSandboxIDRefreshesPostRequest.java | 6 +- ...andboxesSandboxIDSnapshotsPostRequest.java | 6 +- .../SandboxesSandboxIDTimeoutPostRequest.java | 6 +- .../e2b/api/models/SandboxesWithMetrics.java | 6 +- .../client/e2b/api/models/SnapshotInfo.java | 8 +- .../agents/client/e2b/api/models/Team.java | 6 +- .../client/e2b/api/models/TeamAPIKey.java | 6 +- .../client/e2b/api/models/TeamMetric.java | 6 +- .../client/e2b/api/models/TeamUser.java | 13 +- .../api/models/TeamsGet200ResponseInner.java | 6 +- .../client/e2b/api/models/Template.java | 6 +- .../e2b/api/models/TemplateAliasResponse.java | 6 +- .../client/e2b/api/models/TemplateBuild.java | 6 +- .../api/models/TemplateBuildFileUpload.java | 6 +- .../e2b/api/models/TemplateBuildInfo.java | 6 +- .../api/models/TemplateBuildLogsResponse.java | 6 +- .../e2b/api/models/TemplateBuildRequest.java | 6 +- .../api/models/TemplateBuildRequestV2.java | 6 +- .../api/models/TemplateBuildRequestV3.java | 6 +- .../e2b/api/models/TemplateBuildStartV2.java | 6 +- .../client/e2b/api/models/TemplateLegacy.java | 6 +- .../api/models/TemplateRequestResponseV3.java | 6 +- .../client/e2b/api/models/TemplateStep.java | 6 +- .../client/e2b/api/models/TemplateTag.java | 6 +- .../e2b/api/models/TemplateUpdateRequest.java | 6 +- .../api/models/TemplateUpdateResponse.java | 6 +- .../e2b/api/models/TemplateWithBuilds.java | 6 +- .../models/TemplatesGet200ResponseInner.java | 6 +- .../e2b/api/models/UpdateTeamAPIKey.java | 6 +- .../agents/client/e2b/api/models/Volume.java | 6 +- .../client/e2b/api/models/VolumeAndToken.java | 355 +++ .../client/e2b/api/models/VolumeToken.java | 291 +++ .../client/e2b/config/ConnectionConfig.java | 292 --- .../e2b/example/SandboxClientExample.java | 255 -- .../exceptions/AuthenticationException.java | 7 - .../exceptions/InvalidArgumentException.java | 7 - .../e2b/exceptions/NotFoundException.java | 7 - .../e2b/exceptions/TimeoutException.java | 7 - .../client/e2b/sandbox/SandboxClient.java | 205 -- .../e2b/sandbox/commands/CommandHandle.java | 186 -- .../e2b/sandbox/filesystem/Filesystem.java | 352 --- .../e2b/utils/PathModifyingInterceptor.java | 32 - .../agents/client/e2b/utils/RpcUtils.java | 127 - .../e2b/SandboxApiManagerExample.java | 78 + .../examples/e2b/SandboxCommandsExample.java | 170 ++ .../examples/e2b/SandboxFilesExample.java | 199 ++ .../runtime/K8sDirectConnectExample.java | 60 + .../agents/client/runtime/EnvdMethods.java | 55 + .../agents/client/runtime/K8sHelper.java | 50 + .../agents/client/runtime/README_zh-CH.md | 214 ++ .../agents/client/runtime/RuntimeClient.java | 82 + .../agents/client/runtime/RuntimeConfig.java | 282 ++ .../runtime/commands/CommandHandle.java | 153 ++ .../commands/CommandResult.java | 2 +- .../commands/Commands.java | 173 +- .../envd/filesystem/CreateWatcherRequest.java | 2 +- .../CreateWatcherRequestOrBuilder.java | 2 +- .../filesystem/CreateWatcherResponse.java | 2 +- .../CreateWatcherResponseOrBuilder.java | 2 +- .../envd/filesystem/EntryInfo.java | 2 +- .../envd/filesystem/EntryInfoOrBuilder.java | 2 +- .../envd/filesystem/EventType.java | 2 +- .../envd/filesystem/FileType.java | 2 +- .../envd/filesystem/FilesystemEvent.java | 2 +- .../filesystem/FilesystemEventOrBuilder.java | 2 +- .../envd/filesystem/FilesystemGrpc.java | 2 +- .../envd/filesystem/FilesystemProto.java | 2 +- .../filesystem/GetWatcherEventsRequest.java | 2 +- .../GetWatcherEventsRequestOrBuilder.java | 2 +- .../filesystem/GetWatcherEventsResponse.java | 2 +- .../GetWatcherEventsResponseOrBuilder.java | 2 +- .../envd/filesystem/ListDirRequest.java | 2 +- .../filesystem/ListDirRequestOrBuilder.java | 2 +- .../envd/filesystem/ListDirResponse.java | 2 +- .../filesystem/ListDirResponseOrBuilder.java | 2 +- .../envd/filesystem/MakeDirRequest.java | 2 +- .../filesystem/MakeDirRequestOrBuilder.java | 2 +- .../envd/filesystem/MakeDirResponse.java | 2 +- .../filesystem/MakeDirResponseOrBuilder.java | 2 +- .../envd/filesystem/MoveRequest.java | 2 +- .../envd/filesystem/MoveRequestOrBuilder.java | 2 +- .../envd/filesystem/MoveResponse.java | 2 +- .../filesystem/MoveResponseOrBuilder.java | 2 +- .../envd/filesystem/RemoveRequest.java | 2 +- .../filesystem/RemoveRequestOrBuilder.java | 2 +- .../envd/filesystem/RemoveResponse.java | 2 +- .../filesystem/RemoveResponseOrBuilder.java | 2 +- .../envd/filesystem/RemoveWatcherRequest.java | 2 +- .../RemoveWatcherRequestOrBuilder.java | 2 +- .../filesystem/RemoveWatcherResponse.java | 2 +- .../RemoveWatcherResponseOrBuilder.java | 2 +- .../envd/filesystem/StatRequest.java | 2 +- .../envd/filesystem/StatRequestOrBuilder.java | 2 +- .../envd/filesystem/StatResponse.java | 2 +- .../filesystem/StatResponseOrBuilder.java | 2 +- .../envd/filesystem/WatchDirRequest.java | 2 +- .../filesystem/WatchDirRequestOrBuilder.java | 2 +- .../envd/filesystem/WatchDirResponse.java | 2 +- .../filesystem/WatchDirResponseOrBuilder.java | 2 +- .../envd/process/CloseStdinRequest.java | 2 +- .../process/CloseStdinRequestOrBuilder.java | 2 +- .../envd/process/CloseStdinResponse.java | 2 +- .../process/CloseStdinResponseOrBuilder.java | 2 +- .../envd/process/ConnectRequest.java | 2 +- .../envd/process/ConnectRequestOrBuilder.java | 2 +- .../envd/process/ConnectResponse.java | 2 +- .../process/ConnectResponseOrBuilder.java | 2 +- .../envd/process/ListRequest.java | 2 +- .../envd/process/ListRequestOrBuilder.java | 2 +- .../envd/process/ListResponse.java | 2 +- .../envd/process/ListResponseOrBuilder.java | 2 +- .../{e2b => runtime}/envd/process/PTY.java | 2 +- .../envd/process/PTYOrBuilder.java | 2 +- .../envd/process/ProcessConfig.java | 2 +- .../envd/process/ProcessConfigOrBuilder.java | 2 +- .../envd/process/ProcessEvent.java | 2 +- .../envd/process/ProcessEventOrBuilder.java | 2 +- .../envd/process/ProcessGrpc.java | 2 +- .../envd/process/ProcessInfo.java | 2 +- .../envd/process/ProcessInfoOrBuilder.java | 2 +- .../envd/process/ProcessInput.java | 2 +- .../envd/process/ProcessInputOrBuilder.java | 2 +- .../envd/process/ProcessProto.java | 2 +- .../envd/process/ProcessSelector.java | 2 +- .../process/ProcessSelectorOrBuilder.java | 2 +- .../envd/process/SendInputRequest.java | 2 +- .../process/SendInputRequestOrBuilder.java | 2 +- .../envd/process/SendInputResponse.java | 2 +- .../process/SendInputResponseOrBuilder.java | 2 +- .../envd/process/SendSignalRequest.java | 2 +- .../process/SendSignalRequestOrBuilder.java | 2 +- .../envd/process/SendSignalResponse.java | 2 +- .../process/SendSignalResponseOrBuilder.java | 2 +- .../{e2b => runtime}/envd/process/Signal.java | 2 +- .../envd/process/StartRequest.java | 2 +- .../envd/process/StartRequestOrBuilder.java | 2 +- .../envd/process/StartResponse.java | 2 +- .../envd/process/StartResponseOrBuilder.java | 2 +- .../envd/process/StreamInputRequest.java | 2 +- .../process/StreamInputRequestOrBuilder.java | 2 +- .../envd/process/StreamInputResponse.java | 2 +- .../process/StreamInputResponseOrBuilder.java | 2 +- .../envd/process/UpdateRequest.java | 2 +- .../envd/process/UpdateRequestOrBuilder.java | 2 +- .../envd/process/UpdateResponse.java | 2 +- .../envd/process/UpdateResponseOrBuilder.java | 2 +- .../exceptions/SandboxException.java | 7 +- .../client/runtime/filesystem/Filesystem.java | 613 +++++ .../filesystem/WatchDirResponseObserver.java | 24 +- .../filesystem/WatchHandle.java | 26 +- .../runtime/utils/ConnectStreamReader.java | 149 ++ 225 files changed, 12841 insertions(+), 2152 deletions(-) create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/ConnectionConfig.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/E2bRuntimeConfig.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/README_zh-CH.md create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/Sandbox.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/SandboxApi.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/SandboxInfo.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/SandboxNotFoundException.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/AccessTokensApi.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/AdminApi.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/ApiKeysApi.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/AuthApi.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/DefaultApi.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/SnapshotsApi.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/TagsApi.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/TemplatesApi.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/VolumesApi.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/AdminBuildCancelResult.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxLifecycle.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxNetworkRule.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxNetworkTransform.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxNetworkUpdateConfig.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxOnTimeout.java rename k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/{Sandbox.java => SandboxResponse.java} (84%) create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/VolumeAndToken.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/VolumeToken.java delete mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/config/ConnectionConfig.java delete mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/example/SandboxClientExample.java delete mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/exceptions/AuthenticationException.java delete mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/exceptions/InvalidArgumentException.java delete mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/exceptions/NotFoundException.java delete mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/exceptions/TimeoutException.java delete mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/sandbox/SandboxClient.java delete mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/sandbox/commands/CommandHandle.java delete mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/sandbox/filesystem/Filesystem.java delete mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/utils/PathModifyingInterceptor.java delete mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/utils/RpcUtils.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/examples/e2b/SandboxApiManagerExample.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/examples/e2b/SandboxCommandsExample.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/examples/e2b/SandboxFilesExample.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/examples/runtime/K8sDirectConnectExample.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/runtime/EnvdMethods.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/runtime/K8sHelper.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/runtime/README_zh-CH.md create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/runtime/RuntimeClient.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/runtime/RuntimeConfig.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/runtime/commands/CommandHandle.java rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b/sandbox => runtime}/commands/CommandResult.java (96%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b/sandbox => runtime}/commands/Commands.java (64%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/CreateWatcherRequest.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/CreateWatcherRequestOrBuilder.java (92%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/CreateWatcherResponse.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/CreateWatcherResponseOrBuilder.java (91%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/EntryInfo.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/EntryInfoOrBuilder.java (98%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/EventType.java (98%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/FileType.java (98%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/FilesystemEvent.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/FilesystemEventOrBuilder.java (93%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/FilesystemGrpc.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/FilesystemProto.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/GetWatcherEventsRequest.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/GetWatcherEventsRequestOrBuilder.java (91%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/GetWatcherEventsResponse.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/GetWatcherEventsResponseOrBuilder.java (95%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/ListDirRequest.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/ListDirRequestOrBuilder.java (92%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/ListDirResponse.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/ListDirResponseOrBuilder.java (94%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/MakeDirRequest.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/MakeDirRequestOrBuilder.java (91%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/MakeDirResponse.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/MakeDirResponseOrBuilder.java (92%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/MoveRequest.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/MoveRequestOrBuilder.java (94%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/MoveResponse.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/MoveResponseOrBuilder.java (92%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/RemoveRequest.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/RemoveRequestOrBuilder.java (91%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/RemoveResponse.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/RemoveResponseOrBuilder.java (85%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/RemoveWatcherRequest.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/RemoveWatcherRequestOrBuilder.java (91%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/RemoveWatcherResponse.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/RemoveWatcherResponseOrBuilder.java (86%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/StatRequest.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/StatRequestOrBuilder.java (91%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/StatResponse.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/StatResponseOrBuilder.java (92%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/WatchDirRequest.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/WatchDirRequestOrBuilder.java (92%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/WatchDirResponse.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/filesystem/WatchDirResponseOrBuilder.java (96%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/CloseStdinRequest.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/CloseStdinRequestOrBuilder.java (93%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/CloseStdinResponse.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/CloseStdinResponseOrBuilder.java (86%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/ConnectRequest.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/ConnectRequestOrBuilder.java (93%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/ConnectResponse.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/ConnectResponseOrBuilder.java (93%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/ListRequest.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/ListRequestOrBuilder.java (85%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/ListResponse.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/ListResponseOrBuilder.java (95%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/PTY.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/PTYOrBuilder.java (92%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/ProcessConfig.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/ProcessConfigOrBuilder.java (97%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/ProcessEvent.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/ProcessEventOrBuilder.java (97%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/ProcessGrpc.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/ProcessInfo.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/ProcessInfoOrBuilder.java (95%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/ProcessInput.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/ProcessInputOrBuilder.java (94%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/ProcessProto.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/ProcessSelector.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/ProcessSelectorOrBuilder.java (94%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/SendInputRequest.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/SendInputRequestOrBuilder.java (95%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/SendInputResponse.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/SendInputResponseOrBuilder.java (86%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/SendSignalRequest.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/SendSignalRequestOrBuilder.java (95%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/SendSignalResponse.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/SendSignalResponseOrBuilder.java (86%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/Signal.java (98%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/StartRequest.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/StartRequestOrBuilder.java (97%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/StartResponse.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/StartResponseOrBuilder.java (93%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/StreamInputRequest.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/StreamInputRequestOrBuilder.java (97%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/StreamInputResponse.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/StreamInputResponseOrBuilder.java (86%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/UpdateRequest.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/UpdateRequestOrBuilder.java (95%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/UpdateResponse.java (99%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/envd/process/UpdateResponseOrBuilder.java (86%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b => runtime}/exceptions/SandboxException.java (69%) create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/runtime/filesystem/Filesystem.java rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b/sandbox => runtime}/filesystem/WatchDirResponseObserver.java (63%) rename k8s/java/src/main/java/io/openkruise/agents/client/{e2b/sandbox => runtime}/filesystem/WatchHandle.java (59%) create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/runtime/utils/ConnectStreamReader.java diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/ConnectionConfig.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/ConnectionConfig.java new file mode 100644 index 0000000..a1a3e2e --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/ConnectionConfig.java @@ -0,0 +1,244 @@ +package io.openkruise.agents.client.e2b; + +import io.openkruise.agents.client.e2b.api.SandboxesApi; +import io.openkruise.agents.client.e2b.api.invoker.ApiClient; + +import java.util.HashMap; +import java.util.Map; + +/** + * E2B control plane connection configuration with Builder pattern support. + */ +public class ConnectionConfig { + + public enum Protocol { + NATIVE("native"), + PRIVATE("private"); + + private final String value; + + Protocol(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + } + + private static final String DEFAULT_DOMAIN = "your.domain.com"; + private static final String DEFAULT_SCHEME = "https"; + private static final long DEFAULT_REQUEST_TIMEOUT_MS = 60_000L; + static final int DEFAULT_SANDBOX_TIMEOUT = 300; + static final int DEFAULT_RUNTIME_PORT = 49983; + + private String apiKey; + private String accessToken; + private String domain; + private String scheme; + private Protocol protocol; + private String apiURL; + private String sandboxBaseURL; + private boolean debug; + private long requestTimeoutMs; + private int port; + private Map headers; + + private volatile ApiClient apiClient; + private volatile SandboxesApi sandboxesApi; + private final Object lock = new Object(); + + private ConnectionConfig() { + this.domain = DEFAULT_DOMAIN; + this.scheme = DEFAULT_SCHEME; + this.protocol = Protocol.NATIVE; + this.requestTimeoutMs = DEFAULT_REQUEST_TIMEOUT_MS; + this.port = DEFAULT_RUNTIME_PORT; + this.headers = new HashMap<>(); + } + + private ConnectionConfig(ConnectionConfig config) { + this.apiKey = config.apiKey; + this.accessToken = config.accessToken; + this.domain = config.domain; + this.scheme = config.scheme; + this.protocol = config.protocol; + this.apiURL = config.apiURL; + this.sandboxBaseURL = config.sandboxBaseURL; + this.debug = config.debug; + this.requestTimeoutMs = config.requestTimeoutMs; + this.port = config.port; + this.headers = new HashMap<>(config.headers); + } + + public static ConnectionConfig create() { + return new Builder().build(); + } + + /** API base URL, automatically selects NATIVE/PRIVATE format based on protocol. */ + public String getAPIURL() { + if (apiURL != null && !apiURL.isEmpty()) { + return apiURL; + } + String s = getSchemeOrDefault(); + if (protocol == Protocol.PRIVATE) { + return String.format("%s://%s/kruise/api", s, domain); + } + return String.format("%s://api.%s", s, domain); + } + + /** Envd URL for a specific sandbox, automatically selects NATIVE/PRIVATE format based on protocol. */ + public String getSandboxURL(String sandboxID) { + if (sandboxBaseURL != null && !sandboxBaseURL.isEmpty()) { + return String.format("%s/%s", sandboxBaseURL, sandboxID); + } + String s = getSchemeOrDefault(); + if (protocol == Protocol.PRIVATE) { + return String.format("%s://%s/kruise/%s/%d", s, domain, sandboxID, port); + } + return String.format("%s://%d-%s.%s", s, port, sandboxID, domain); + } + + /** Shared ApiClient with double-checked locking lazy initialization. */ + public ApiClient getOrCreateApiClient() { + if (apiClient == null) { + synchronized (lock) { + if (apiClient == null) { + ApiClient client = new ApiClient(); + client.setBasePath(getAPIURL()); + client.setConnectTimeout((int)requestTimeoutMs); + client.setReadTimeout((int)requestTimeoutMs); + if (apiKey != null && !apiKey.isEmpty()) { + client.addDefaultHeader("X-API-Key", apiKey); + } + for (Map.Entry entry : headers.entrySet()) { + client.addDefaultHeader(entry.getKey(), entry.getValue()); + } + this.apiClient = client; + } + } + } + return apiClient; + } + + SandboxesApi getOrCreateSandboxesApi() { + if (sandboxesApi == null) { + synchronized (lock) { + if (sandboxesApi == null) { + sandboxesApi = new SandboxesApi(getOrCreateApiClient()); + } + } + } + return sandboxesApi; + } + + private String getSchemeOrDefault() { + return (scheme != null && !scheme.isEmpty()) ? scheme : DEFAULT_SCHEME; + } + + public String getApiKey() {return apiKey;} + + public String getAccessToken() {return accessToken;} + + public String getDomain() {return domain;} + + public String getScheme() {return scheme;} + + public Protocol getProtocol() {return protocol;} + + public String getApiURL() {return apiURL;} + + public String getSandboxBaseURL() {return sandboxBaseURL;} + + public boolean isDebug() {return debug;} + + public long getRequestTimeoutMs() {return requestTimeoutMs;} + + public int getPort() {return port;} + + public Map getHeaders() {return headers;} + + public static class Builder { + private final ConnectionConfig config = new ConnectionConfig(); + + public Builder() { + // Environment variables as defaults + String envApiKey = System.getenv("X_API_KEY"); + if (envApiKey != null && !envApiKey.isEmpty()) { + config.apiKey = envApiKey; + } + String envScheme = System.getenv("SCHEME"); + if (envScheme != null && !envScheme.isEmpty()) { + config.scheme = envScheme; + } + String envProtocol = System.getenv("PROTOCOL"); + if (envProtocol != null && !envProtocol.isEmpty()) { + config.protocol = Protocol.valueOf(envProtocol.toUpperCase()); + } + } + + public Builder apiKey(String apiKey) { + config.apiKey = apiKey; + return this; + } + + public Builder accessToken(String accessToken) { + config.accessToken = accessToken; + return this; + } + + public Builder domain(String domain) { + config.domain = domain; + return this; + } + + public Builder scheme(String scheme) { + config.scheme = scheme; + return this; + } + + public Builder protocol(Protocol protocol) { + config.protocol = protocol; + return this; + } + + public Builder apiURL(String apiURL) { + config.apiURL = apiURL; + return this; + } + + public Builder sandboxBaseURL(String sandboxBaseURL) { + config.sandboxBaseURL = sandboxBaseURL; + return this; + } + + public Builder debug(boolean debug) { + config.debug = debug; + return this; + } + + public Builder requestTimeoutMs(long timeoutMs) { + config.requestTimeoutMs = timeoutMs; + return this; + } + + public Builder port(int port) { + config.port = port; + return this; + } + + public Builder headers(Map headers) { + config.headers.putAll(headers); + return this; + } + + public Builder addHeader(String key, String value) { + config.headers.put(key, value); + return this; + } + + public ConnectionConfig build() { + return new ConnectionConfig(config); + } + } +} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/E2bRuntimeConfig.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/E2bRuntimeConfig.java new file mode 100644 index 0000000..ebf3f4d --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/E2bRuntimeConfig.java @@ -0,0 +1,146 @@ +package io.openkruise.agents.client.e2b; + +import io.openkruise.agents.client.runtime.RuntimeConfig; + +import java.util.Map; + +/** + * RuntimeConfig subclass that carries E2B-specific URL construction and request header logic. + */ +public class E2bRuntimeConfig extends RuntimeConfig { + + private final String sandboxBaseURL; + private final int e2bRuntimePort; + + private E2bRuntimeConfig(Builder builder) { + super(builder); + this.sandboxBaseURL = builder.sandboxBaseURL; + this.e2bRuntimePort = builder.e2bRuntimePort; + } + + /** + * PRIVATE mode uses sandboxBaseURL, NATIVE mode uses {@code ://-.}. + */ + @Override + public String getSandboxURL(String sandboxID) { + if (sandboxBaseURL != null && !sandboxBaseURL.isEmpty()) { + // PRIVATE mode: sandboxBaseURL already contains full path prefix + return sandboxBaseURL; + } + return String.format("%s://%d-%s.%s", getScheme(), e2bRuntimePort, sandboxID, getDomain()); + } + + /** Adds e2b-sandbox-port to the base request headers. */ + @Override + public Map getSandboxHeaders(String sandboxID) { + Map result = super.getSandboxHeaders(sandboxID); + result.put("e2b-sandbox-port", String.valueOf(e2bRuntimePort)); + return result; + } + + public static E2bRuntimeConfig fromConnectionConfig(ConnectionConfig connectionConfig, String envdAccessToken) { + Builder builder = new Builder(); + builder.domain(connectionConfig.getDomain()); + builder.scheme(connectionConfig.getScheme()); + builder.requestTimeoutMs(connectionConfig.getRequestTimeoutMs()); + + if (connectionConfig.getApiKey() != null) { + builder.apiKey(connectionConfig.getApiKey()); + } + if (connectionConfig.getHeaders() != null) { + builder.headers(connectionConfig.getHeaders()); + } + if (envdAccessToken != null && !envdAccessToken.isEmpty()) { + builder.runtimeToken(envdAccessToken); + } + + builder.e2bRuntimePort(connectionConfig.getPort()); + + if (connectionConfig.getProtocol() == ConnectionConfig.Protocol.PRIVATE) { + String scheme = connectionConfig.getScheme() != null ? connectionConfig.getScheme() : "https"; + builder.e2bSandboxBaseURL(String.format("%s://%s", scheme, connectionConfig.getDomain())); + } + + return builder.buildE2b(); + } + + public static class Builder extends RuntimeConfig.Builder { + private String sandboxBaseURL; + private int e2bRuntimePort = ConnectionConfig.DEFAULT_RUNTIME_PORT; + + public Builder() { + super(); + } + + /** + * Sets sandboxBaseURL for PRIVATE mode. + */ + public Builder e2bSandboxBaseURL(String sandboxBaseURL) { + this.sandboxBaseURL = sandboxBaseURL; + return this; + } + + public Builder e2bRuntimePort(int port) { + this.e2bRuntimePort = port; + return this; + } + + public E2bRuntimeConfig buildE2b() { + return new E2bRuntimeConfig(this); + } + + @Override + public Builder domain(String domain) { + super.domain(domain); + return this; + } + + @Override + public Builder scheme(String scheme) { + super.scheme(scheme); + return this; + } + + @Override + public Builder runtimeToken(String runtimeToken) { + super.runtimeToken(runtimeToken); + return this; + } + + @Override + public Builder authHeader(String authHeader) { + super.authHeader(authHeader); + return this; + } + + @Override + public Builder apiKey(String apiKey) { + super.apiKey(apiKey); + return this; + } + + @Override + public Builder headers(Map headers) { + super.headers(headers); + return this; + } + + @Override + public Builder addHeader(String key, String value) { + super.addHeader(key, value); + return this; + } + + @Override + public Builder requestTimeoutMs(long requestTimeoutMs) { + super.requestTimeoutMs(requestTimeoutMs); + return this; + } + + @Override + public Builder runtimeUrl(String runtimeUrl) { + super.runtimeUrl(runtimeUrl); + return this; + } + } +} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/README_zh-CH.md b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/README_zh-CH.md new file mode 100644 index 0000000..2e98513 --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/README_zh-CH.md @@ -0,0 +1,264 @@ +# E2B Java SDK(e2b 管理客户端) + +## 依赖导入 +Maven 仓库:该包未发布到官方 Maven 仓库,你需要手动下载项目并打包成 JAR 文件使用。 + +--- + +## 快速开始 + +```java +import io.openkruise.agents.client.e2b.*; + +ConnectionConfig config = new ConnectionConfig.Builder() + .apiKey("your-api-key") + .domain("your.domain.com") + .build(); + +SandboxApi api = new SandboxApi(config); + +// 创建 → 使用 → 自动销毁 +try (Sandbox sandbox = api.create("code-interpreter")) { + sandbox.Commands.run("echo hello"); + sandbox.Files.writeText("/tmp/demo.txt", "Hello!"); +} +``` + +完整演示:[生命周期管理完整示例](../examples/e2b/SandboxApiManagerExample.java) | [命令操作完整示例](../examples/e2b/SandboxCommandsExample.java) | [文件操作完整示例](../examples/e2b/SandboxFilesExample.java) + +--- + +## 一、Sandbox 生命周期管理(SandboxApi) + +`SandboxApi` 提供 Sandbox 的完整生命周期管理能力,包括创建、连接、查询、暂停、恢复和终止。 + +### 初始化 + +```java +ConnectionConfig config = new ConnectionConfig.Builder() + .apiKey("your-api-key") + .domain("your.domain.com") + .build(); + +SandboxApi api = new SandboxApi(config); +``` + +### API 方法一览 + +| 方法 | 说明 | +|------------------------------------------------------------------------------------|-------------------------------------------------| +| `create(String template)` | 从模板创建 sandbox | +| `create(NewSandbox body)` | 创建 sandbox(全部参数) | +| `connect(String sandboxID)` | 连接已有 sandbox | +| `connect(String sandboxID, int timeout)` | 连接已有 sandbox(指定超时) | +| `list()` | 列出所有运行中的 sandbox | +| `list(String metadata)` | 按 metadata 过滤列出 | +| `list(String metadata, List state, String nextToken, Integer limit)` | 列出 sandbox(支持分页和状态过滤) | +| `getInfo(String sandboxID)` | 获取 sandbox 详情,404 抛出 `SandboxNotFoundException` | +| `kill(String sandboxID)` | 终止 sandbox;返回 `true` 成功,`false` 未找到 | +| `pause(String sandboxID)` | 暂停 sandbox | +| `setTimeout(String sandboxID, int timeout)` | 修改超时时间(秒) | + +### 生命周期示例 + +```java +SandboxApi api = new SandboxApi(config); + +// ---- 创建 ---- +Sandbox sandbox = api.create("code-interpreter"); +String id = sandbox.getSandboxID(); + +// 也可传入完整参数 +Sandbox sandbox2 = api.create(new NewSandbox() + .templateID("code-interpreter") + .timeout(600) + .envVars(Map.of("FOO", "1"))); + +// ---- 查询 ---- +SandboxInfo info = api.getInfo(id); +List all = api.list(); + +// ---- 连接已有 sandbox ---- +Sandbox reconnected = api.connect(id); + +// ---- 暂停 / 修改超时 ---- +api.pause(id); +api.setTimeout(id, 600); + +// ---- 终止 ---- +api.kill(id); +``` + +### Sandbox 实例 + +`SandboxApi.create()` / `connect()` 返回 `Sandbox` 实例,它是数据面操作的入口: + +| 方法 | 说明 | +|----------------------|----------------------------------------| +| `getSandboxID()` | 返回 sandbox ID | +| `getSandboxURL()` | 返回 sandbox envd URL | +| `getConfig()` | 返回连接配置 | +| `getRuntimeClient()` | 返回底层 `RuntimeClient` | +| `close()` | 关闭连接并终止 sandbox(支持 try-with-resources) | + +`Sandbox` 暴露两个操作模块: + +- **`sandbox.Commands`** — 命令执行 +- **`sandbox.Files`** — 文件系统 + +--- + +## 二、命令执行(Commands) + +通过 `sandbox.Commands` 操作容器内进程。底层走 envd 的 `Process` gRPC 服务,命令统一通过 `/bin/bash -l -c ` 执行。 + +### 方法 + +| 方法 | 说明 | +|-----------------------------------------|---------------------------------------| +| `run(String cmd)` | **前台执行**:启动命令并等待完成,返回 `CommandResult` | +| `run(String cmd, RunOptions options)` | 前台执行(带选项) | +| `start(String cmd, RunOptions options)` | **后台启动**:返回 `CommandHandle`,调用方决定何时等待 | +| `list()` | 列出所有运行中的进程,返回 `List` | +| `kill(int pid)` | 向指定 PID 发送 SIGKILL | +| `sendStdin(int pid, String data)` | 向指定进程的 stdin 写入数据 | +| `connectToProcess(int pid)` | 重新连接到已运行的进程,订阅其后续输出 | + +### RunOptions + +```java +RunOptions opts = new RunOptions() + .envs(Map.of("LANG", "C")) // 环境变量 + .cwd("/tmp") // 工作目录 + .onStdout(line -> System.out.print(line)) // 流式 stdout 回调 + .onStderr(line -> System.err.print(line)); // 流式 stderr 回调 +``` + +### CommandResult + +| 字段 | 类型 | 说明 | +|------------|----------|------| +| `stdout` | `String` | 标准输出 | +| `stderr` | `String` | 标准错误 | +| `exitCode` | `int` | 退出码 | + +### CommandHandle + +由 `start` / `connectToProcess` 返回: + +| 方法 | 说明 | +|-----------------------|---------------------------| +| `getPid()` | 返回进程 PID | +| `isCompleted()` | 是否已完成 | +| `waitForCompletion()` | 阻塞等待结束,返回 `CommandResult` | +| `kill()` | 终止进程 | +| `close()` | 关闭(实现 `AutoCloseable`) | + +### 示例 + +```java +// 前台执行 +CommandResult res = sandbox.Commands.run("pwd"); +System.out.println(res.getStdout()); + +// 带选项执行 + 流式输出 +CommandResult res2 = sandbox.Commands.run("ls -la /tmp", + new RunOptions().cwd("/tmp").onStdout(System.out::print)); + +// 后台启动 + 主动 Kill +CommandHandle handle = sandbox.Commands.start("sleep 60", new RunOptions()); +System.out.println("pid = " + handle.getPid()); +handle.kill(); +handle.close(); + +// 列出进程 +List procs = sandbox.Commands.list(); +for (ProcessInfo p : procs) { + System.out.printf("PID: %d, Cmd: %s%n", p.getPid(), p.getCmd()); +} +``` + +--- + +## 三、文件系统(Filesystem) + +通过 `sandbox.Files` 操作容器内文件。元数据操作走 envd Filesystem gRPC,文件内容读写走 HTTP `/files` 端点。 + +### 方法 + +| 方法 | 说明 | +|-------------------------------------------------------------------------------|--------------------------| +| `listDir(String path)` | 列出目录条目(depth=1) | +| `listDir(String path, int depth)` | 列出目录条目(指定深度) | +| `exists(String path)` | 路径是否存在 | +| `getInfo(String path)` | 获取文件/目录信息,返回 `EntryInfo` | +| `makeDir(String path)` | 递归创建目录;已存在返回 `false` | +| `remove(String path)` | 删除文件或目录 | +| `read(String path)` | 读取文件内容(`byte[]`) | +| `read(String path, String user)` | 读取文件内容(指定用户) | +| `readText(String path)` | 读取文件内容(`String`,UTF-8) | +| `writeText(String path, String content)` | 写入文件(文本,UTF-8) | +| `write(String path, byte[] data)` | 写入文件(二进制),自动创建父目录 | +| `watchDir(String path, Consumer onEvent)` | 监听目录变更事件 | +| `watchDir(String path, boolean recursive, Consumer onEvent)` | 监听目录变更事件(支持递归) | + +### 示例 + +```java +// 目录操作 +sandbox.Files.makeDir("/tmp/work"); +List entries = sandbox.Files.listDir("/tmp"); +sandbox.Files.remove("/tmp/work"); + +// 文件读写 +sandbox.Files.writeText("/tmp/hello.txt", "Hello, World!"); +String content = sandbox.Files.readText("/tmp/hello.txt"); + +// 二进制读写 +sandbox.Files.write("/tmp/data.bin", new byte[]{0x01, 0x02}); +byte[] data = sandbox.Files.read("/tmp/data.bin"); + +// 目录监听 +WatchHandle wh = sandbox.Files.watchDir("/tmp", true, event -> + System.out.printf("Event: %s %s%n", event.getType(), event.getPath())); +wh.close(); +``` + +--- + +## 四、连接配置(ConnectionConfig) + +### Scheme 与 Protocol + +连接行为由 **Scheme** 和 **Protocol** 两个正交维度决定 URL 形态。 + +#### Protocol(路由协议) + +| 值 | 枚举值 | API URL | Sandbox URL | +|----------------|--------------------|----------------------------------|-------------------------------------------------| +| **Native(默认)** | `Protocol.NATIVE` | `https://api.` | `https://-.` | +| **Private** | `Protocol.PRIVATE` | `:///kruise/api` | `:///kruise//` | + +- **Native**:基于子域名路由,对应原生公网部署 +- **Private**:基于路径前缀通过统一网关路由,适用于私有化或端口转发场景 + +#### Builder 方法 + +| 方法 | 说明 | +|----------------------------------------|--------------------------------------| +| `.apiKey(String)` | API Key,写入请求头 `X-API-Key` | +| `.accessToken(String)` | Access Token,写入请求头 `X-Access-Token` | +| `.domain(String)` | 域名,默认 `your.domain.com` | +| `.scheme(String)` | URL scheme,默认 `https` | +| `.protocol(Protocol)` | 路由协议,默认 `Protocol.NATIVE` | +| `.apiURL(String)` | **最高优先级**:直接覆盖 API base URL | +| `.sandboxBaseURL(String)` | **最高优先级**:直接覆盖 sandbox envd base URL | +| `.requestTimeoutMs(long)` | HTTP 请求超时(毫秒),默认 60000 | +| `.port(int)` | envd 端口,默认 49983 | +| `.debug(boolean)` | 调试模式,kill/setTimeout 跳过实际调用 | +| `.headers(Map)` | 自定义请求头(同时应用于管理面和 runtime) | +| `.addHeader(String key, String value)` | 添加单个自定义请求头 | + +#### 优先级 + +`apiURL` / `sandboxBaseURL`(显式覆盖) > `protocol` + `domain` 拼装 > 环境变量(`X_API_KEY`、`SCHEME`、`PROTOCOL`) > 默认值 diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/Sandbox.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/Sandbox.java new file mode 100644 index 0000000..288e7ac --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/Sandbox.java @@ -0,0 +1,72 @@ +package io.openkruise.agents.client.e2b; + +import io.openkruise.agents.client.e2b.api.invoker.ApiException; +import io.openkruise.agents.client.runtime.RuntimeClient; +import io.openkruise.agents.client.runtime.commands.Commands; +import io.openkruise.agents.client.runtime.filesystem.Filesystem; + +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * Represents a created/connected E2B sandbox instance (data plane) with try-with-resources support for automatic termination. + */ +public class Sandbox implements AutoCloseable { + + private static final Logger LOG = Logger.getLogger(Sandbox.class.getName()); + + /** Command execution within the sandbox */ + public final Commands Commands; + /** File operations within the sandbox */ + public final Filesystem Files; + + private final String sandboxID; + private final ConnectionConfig config; + private final SandboxApi sandboxApi; + private final RuntimeClient runtimeClient; + + Sandbox(String sandboxID, String envdAccessToken, ConnectionConfig config, SandboxApi sandboxApi) { + this.sandboxID = sandboxID; + this.config = config; + this.sandboxApi = sandboxApi; + + E2bRuntimeConfig runtimeConfig = E2bRuntimeConfig.fromConnectionConfig(config, envdAccessToken); + this.runtimeClient = RuntimeClient.create(sandboxID, runtimeConfig); + this.Commands = runtimeClient.Commands; + this.Files = runtimeClient.Files; + } + + public String getSandboxID() { + return sandboxID; + } + + public ConnectionConfig getConfig() { + return config; + } + + public String getSandboxURL() { + return config.getSandboxURL(sandboxID); + } + + public RuntimeClient getRuntimeClient() { + return runtimeClient; + } + + /** Closes and terminates the sandbox. Termination failures are logged but not thrown. */ + @Override + public void close() { + if (runtimeClient != null) { + runtimeClient.close(); + } + try { + sandboxApi.kill(sandboxID); + } catch (ApiException e) { + LOG.log(Level.WARNING, "Failed to kill sandbox " + sandboxID + " on close()", e); + } + } + + @Override + public String toString() { + return "Sandbox{sandboxID='" + sandboxID + "'}"; + } +} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/SandboxApi.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/SandboxApi.java new file mode 100644 index 0000000..4bb65cc --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/SandboxApi.java @@ -0,0 +1,164 @@ +package io.openkruise.agents.client.e2b; + +import io.openkruise.agents.client.e2b.api.SandboxesApi; +import io.openkruise.agents.client.e2b.api.invoker.ApiException; +import io.openkruise.agents.client.e2b.api.models.*; + +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * Manages sandbox lifecycle (control plane): create, connect, list, kill, pause, etc. + */ +public class SandboxApi { + + private static final Logger LOG = Logger.getLogger(SandboxApi.class.getName()); + + private final ConnectionConfig config; + private final SandboxesApi lowLevelApi; + + public SandboxApi(ConnectionConfig config) { + this.config = config; + this.lowLevelApi = config.getOrCreateSandboxesApi(); + } + + public Sandbox create(NewSandbox body) throws ApiException { + if (body.getTemplateID() == null || body.getTemplateID().isEmpty()) { + body.setTemplateID("code-interpreter"); + } + if (body.getTimeout() == null || body.getTimeout() <= 0) { + body.setTimeout(ConnectionConfig.DEFAULT_SANDBOX_TIMEOUT); + } + + SandboxResponse resp = lowLevelApi.sandboxesPost(body); + + return new Sandbox(resp.getSandboxID(), resp.getEnvdAccessToken(), config, this); + } + + public Sandbox create(String template) throws ApiException { + return create(new NewSandbox().templateID(template).timeout(ConnectionConfig.DEFAULT_SANDBOX_TIMEOUT)); + } + + public Sandbox connect(String sandboxID, int timeout) throws ApiException { + if (timeout <= 0) { + timeout = ConnectionConfig.DEFAULT_SANDBOX_TIMEOUT; + } + try { + ConnectSandbox body = new ConnectSandbox(); + body.setTimeout(timeout); + SandboxResponse resp = lowLevelApi.sandboxesSandboxIDConnectPost(sandboxID, body); + + return new Sandbox(resp.getSandboxID(), resp.getEnvdAccessToken(), config, this); + } catch (ApiException e) { + if (e.getCode() == 404) { + throw new SandboxNotFoundException(sandboxID, e); + } + throw e; + } + } + + public Sandbox connect(String sandboxID) throws ApiException { + return connect(sandboxID, 0); + } + + public List list() throws ApiException { + return list(null); + } + + /** + * Lists sandboxes filtered by metadata. + */ + public List list(String metadata) throws ApiException { + return list(metadata, null, null, null); + } + + /** + * Lists sandboxes (v2) with support for metadata, state filtering, and pagination. + */ + public List list(String metadata, List state, + String nextToken, Integer limit) throws ApiException { + List resp = lowLevelApi.v2SandboxesGet(metadata, state, nextToken, limit); + List result = new ArrayList<>(); + if (resp == null) { + return result; + } + for (SandboxesGet200ResponseInner sb : resp) { + result.add(toSandboxInfo(sb)); + } + return result; + } + + public SandboxInfo getInfo(String sandboxID) throws ApiException { + try { + SandboxDetail resp = lowLevelApi.sandboxesSandboxIDGet(sandboxID); + return SandboxInfo.fromDetail(resp); + } catch (ApiException e) { + if (e.getCode() == 404) { + throw new SandboxNotFoundException(sandboxID, e); + } + throw e; + } + } + + /** + * Terminates a sandbox. Returns true if successful, false if not found. + */ + public boolean kill(String sandboxID) throws ApiException { + if (config.isDebug()) { + LOG.log(Level.WARNING, "Debug mode: skipping kill for sandbox {0}", sandboxID); + return true; + } + try { + lowLevelApi.sandboxesSandboxIDDelete(sandboxID); + return true; + } catch (ApiException e) { + if (e.getCode() == 404) { + return false; + } + throw e; + } + } + + /** + * Pauses a sandbox. 409 Conflict is treated as already paused. + */ + public String pause(String sandboxID) throws ApiException { + try { + lowLevelApi.sandboxesSandboxIDPausePost(sandboxID); + return sandboxID; + } catch (ApiException e) { + if (e.getCode() == 404) { + throw new SandboxNotFoundException(sandboxID, e); + } + // 409 Conflict indicates already paused, treat as success + if (e.getCode() == 409) { + return sandboxID; + } + throw e; + } + } + + public void setTimeout(String sandboxID, int timeout) throws ApiException { + if (config.isDebug()) { + LOG.log(Level.WARNING, "Debug mode: skipping setTimeout({0}s) for sandbox {1}", + new Object[] {timeout, sandboxID}); + return; + } + try { + SandboxesSandboxIDTimeoutPostRequest body = new SandboxesSandboxIDTimeoutPostRequest(); + body.setTimeout(timeout); + lowLevelApi.sandboxesSandboxIDTimeoutPost(sandboxID, body); + } catch (ApiException e) { + if (e.getCode() == 404) { + throw new SandboxNotFoundException(sandboxID, e); + } + throw e; + } + } + + private SandboxInfo toSandboxInfo(SandboxesGet200ResponseInner sb) { + return SandboxInfo.fromListResponse(sb); + } +} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/SandboxInfo.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/SandboxInfo.java new file mode 100644 index 0000000..454581e --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/SandboxInfo.java @@ -0,0 +1,186 @@ +package io.openkruise.agents.client.e2b; + +import io.openkruise.agents.client.e2b.api.models.SandboxDetail; +import io.openkruise.agents.client.e2b.api.models.SandboxLifecycle; +import io.openkruise.agents.client.e2b.api.models.SandboxNetworkConfig; +import io.openkruise.agents.client.e2b.api.models.SandboxVolumeMount; +import io.openkruise.agents.client.e2b.api.models.SandboxesGet200ResponseInner; + +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * Sandbox information, used uniformly for list() and getInfo() return values. + * Fields unique to detail are null when returned by list(). + */ +public class SandboxInfo { + + private String sandboxID; + private String templateID; + private String alias; + private String clientID; + private OffsetDateTime startedAt; + private OffsetDateTime endAt; + private Integer cpuCount; + private Integer memoryMB; + private Integer diskSizeMB; + private String envdVersion; + private Map metadata; + private String state; + private List volumeMounts; + + private String envdAccessToken; + private String domain; + private Boolean allowInternetAccess; + private SandboxNetworkConfig network; + private SandboxLifecycle lifecycle; + + public SandboxInfo() { + } + + static SandboxInfo fromListResponse(SandboxesGet200ResponseInner sb) { + return fillCommon(new SandboxInfo(), + sb.getSandboxID(), sb.getTemplateID(), sb.getAlias(), sb.getClientID(), + sb.getStartedAt(), sb.getEndAt(), sb.getCpuCount(), sb.getMemoryMB(), + sb.getDiskSizeMB(), sb.getEnvdVersion(), + sb.getState() != null ? sb.getState().getValue() : null, + sb.getMetadata(), sb.getVolumeMounts()); + } + + static SandboxInfo fromDetail(SandboxDetail resp) { + SandboxInfo info = fillCommon(new SandboxInfo(), + resp.getSandboxID(), resp.getTemplateID(), resp.getAlias(), resp.getClientID(), + resp.getStartedAt(), resp.getEndAt(), resp.getCpuCount(), resp.getMemoryMB(), + resp.getDiskSizeMB(), resp.getEnvdVersion(), + resp.getState() != null ? resp.getState().getValue() : null, + resp.getMetadata(), resp.getVolumeMounts()); + info.envdAccessToken = resp.getEnvdAccessToken(); + info.domain = resp.getDomain(); + info.allowInternetAccess = resp.getAllowInternetAccess(); + info.network = resp.getNetwork(); + info.lifecycle = resp.getLifecycle(); + return info; + } + + private static SandboxInfo fillCommon(SandboxInfo info, + String sandboxID, String templateID, String alias, String clientID, + OffsetDateTime startedAt, OffsetDateTime endAt, + Integer cpuCount, Integer memoryMB, Integer diskSizeMB, + String envdVersion, String state, + Map metadata, List volumeMounts) { + info.sandboxID = sandboxID; + info.templateID = templateID; + info.alias = alias; + info.clientID = clientID; + info.startedAt = startedAt; + info.endAt = endAt; + info.cpuCount = cpuCount; + info.memoryMB = memoryMB; + info.diskSizeMB = diskSizeMB; + info.envdVersion = envdVersion; + info.state = state; + info.metadata = metadata; + info.volumeMounts = volumeMounts; + return info; + } + + public String getSandboxID() {return sandboxID;} + + public void setSandboxID(String sandboxID) {this.sandboxID = sandboxID;} + + public String getTemplateID() {return templateID;} + + public void setTemplateID(String templateID) {this.templateID = templateID;} + + public String getAlias() {return alias;} + + public void setAlias(String alias) {this.alias = alias;} + + public String getClientID() {return clientID;} + + public void setClientID(String clientID) {this.clientID = clientID;} + + public OffsetDateTime getStartedAt() {return startedAt;} + + public void setStartedAt(OffsetDateTime startedAt) {this.startedAt = startedAt;} + + public OffsetDateTime getEndAt() {return endAt;} + + public void setEndAt(OffsetDateTime endAt) {this.endAt = endAt;} + + public Integer getCpuCount() {return cpuCount;} + + public void setCpuCount(Integer cpuCount) {this.cpuCount = cpuCount;} + + public Integer getMemoryMB() {return memoryMB;} + + public void setMemoryMB(Integer memoryMB) {this.memoryMB = memoryMB;} + + public Integer getDiskSizeMB() {return diskSizeMB;} + + public void setDiskSizeMB(Integer diskSizeMB) {this.diskSizeMB = diskSizeMB;} + + public String getEnvdVersion() {return envdVersion;} + + public void setEnvdVersion(String envdVersion) {this.envdVersion = envdVersion;} + + public Map getMetadata() {return metadata;} + + public void setMetadata(Map metadata) {this.metadata = metadata;} + + public String getState() {return state;} + + public void setState(String state) {this.state = state;} + + public List getVolumeMounts() {return volumeMounts;} + + public void setVolumeMounts(List volumeMounts) {this.volumeMounts = volumeMounts;} + + public String getEnvdAccessToken() {return envdAccessToken;} + + public void setEnvdAccessToken(String envdAccessToken) {this.envdAccessToken = envdAccessToken;} + + public String getDomain() {return domain;} + + public void setDomain(String domain) {this.domain = domain;} + + public Boolean getAllowInternetAccess() {return allowInternetAccess;} + + public void setAllowInternetAccess(Boolean allowInternetAccess) {this.allowInternetAccess = allowInternetAccess;} + + public SandboxNetworkConfig getNetwork() {return network;} + + public void setNetwork(SandboxNetworkConfig network) {this.network = network;} + + public SandboxLifecycle getLifecycle() {return lifecycle;} + + public void setLifecycle(SandboxLifecycle lifecycle) {this.lifecycle = lifecycle;} + + @Override + public boolean equals(Object o) { + if (this == o) {return true;} + if (o == null || getClass() != o.getClass()) {return false;} + SandboxInfo that = (SandboxInfo)o; + return Objects.equals(sandboxID, that.sandboxID); + } + + @Override + public int hashCode() { + return Objects.hash(sandboxID); + } + + @Override + public String toString() { + return "SandboxInfo{" + + "sandboxID='" + sandboxID + '\'' + + ", templateID='" + templateID + '\'' + + ", alias='" + alias + '\'' + + ", state='" + state + '\'' + + ", cpuCount=" + cpuCount + + ", memoryMB=" + memoryMB + + ", diskSizeMB=" + diskSizeMB + + '}'; + } +} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/SandboxNotFoundException.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/SandboxNotFoundException.java new file mode 100644 index 0000000..cffba78 --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/SandboxNotFoundException.java @@ -0,0 +1,27 @@ +package io.openkruise.agents.client.e2b; + +import io.openkruise.agents.client.e2b.api.invoker.ApiException; + +import java.util.List; +import java.util.Map; + +/** + * Thrown when the specified sandbox does not exist (HTTP 404). + */ +public class SandboxNotFoundException extends ApiException { + + private final String sandboxID; + + public SandboxNotFoundException(String sandboxID, ApiException cause) { + super("sandbox " + sandboxID + " not found", cause, + 404, cause.getResponseHeaders(), cause.getResponseBody()); + this.sandboxID = sandboxID; + } + + /** + * Returns the ID of the sandbox that was not found. + */ + public String getSandboxID() { + return sandboxID; + } +} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/AccessTokensApi.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/AccessTokensApi.java new file mode 100644 index 0000000..aec9b64 --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/AccessTokensApi.java @@ -0,0 +1,340 @@ +/* + * E2B API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.openkruise.agents.client.e2b.api; + +import io.openkruise.agents.client.e2b.api.invoker.ApiCallback; +import io.openkruise.agents.client.e2b.api.invoker.ApiClient; +import io.openkruise.agents.client.e2b.api.invoker.ApiException; +import io.openkruise.agents.client.e2b.api.invoker.ApiResponse; +import io.openkruise.agents.client.e2b.api.invoker.Configuration; +import io.openkruise.agents.client.e2b.api.invoker.Pair; +import io.openkruise.agents.client.e2b.api.invoker.ProgressRequestBody; +import io.openkruise.agents.client.e2b.api.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import io.openkruise.agents.client.e2b.api.models.CreatedAccessToken; +import io.openkruise.agents.client.e2b.api.models.Error; +import io.openkruise.agents.client.e2b.api.models.NewAccessToken; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.GenericType; + +public class AccessTokensApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public AccessTokensApi() { + this(Configuration.getDefaultApiClient()); + } + + public AccessTokensApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for accessTokensAccessTokenIDDelete + * @param accessTokenID (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Access token deleted successfully -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call accessTokensAccessTokenIDDeleteCall(String accessTokenID, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/access-tokens/{accessTokenID}" + .replace("{" + "accessTokenID" + "}", localVarApiClient.escapeString(accessTokenID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call accessTokensAccessTokenIDDeleteValidateBeforeCall(String accessTokenID, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accessTokenID' is set + if (accessTokenID == null) { + throw new ApiException("Missing the required parameter 'accessTokenID' when calling accessTokensAccessTokenIDDelete(Async)"); + } + + return accessTokensAccessTokenIDDeleteCall(accessTokenID, _callback); + + } + + /** + * + * Delete an access token + * @param accessTokenID (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Access token deleted successfully -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public void accessTokensAccessTokenIDDelete(String accessTokenID) throws ApiException { + accessTokensAccessTokenIDDeleteWithHttpInfo(accessTokenID); + } + + /** + * + * Delete an access token + * @param accessTokenID (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Access token deleted successfully -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public ApiResponse accessTokensAccessTokenIDDeleteWithHttpInfo(String accessTokenID) throws ApiException { + okhttp3.Call localVarCall = accessTokensAccessTokenIDDeleteValidateBeforeCall(accessTokenID, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * Delete an access token + * @param accessTokenID (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Access token deleted successfully -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call accessTokensAccessTokenIDDeleteAsync(String accessTokenID, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = accessTokensAccessTokenIDDeleteValidateBeforeCall(accessTokenID, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for accessTokensPost + * @param newAccessToken (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
201 Access token created successfully -
401 Authentication error -
500 Server error -
+ */ + public okhttp3.Call accessTokensPostCall(NewAccessToken newAccessToken, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = newAccessToken; + + // create path and map variables + String localVarPath = "/access-tokens"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call accessTokensPostValidateBeforeCall(NewAccessToken newAccessToken, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'newAccessToken' is set + if (newAccessToken == null) { + throw new ApiException("Missing the required parameter 'newAccessToken' when calling accessTokensPost(Async)"); + } + + return accessTokensPostCall(newAccessToken, _callback); + + } + + /** + * + * Create a new access token + * @param newAccessToken (required) + * @return CreatedAccessToken + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
201 Access token created successfully -
401 Authentication error -
500 Server error -
+ */ + public CreatedAccessToken accessTokensPost(NewAccessToken newAccessToken) throws ApiException { + ApiResponse localVarResp = accessTokensPostWithHttpInfo(newAccessToken); + return localVarResp.getData(); + } + + /** + * + * Create a new access token + * @param newAccessToken (required) + * @return ApiResponse<CreatedAccessToken> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
201 Access token created successfully -
401 Authentication error -
500 Server error -
+ */ + public ApiResponse accessTokensPostWithHttpInfo(NewAccessToken newAccessToken) throws ApiException { + okhttp3.Call localVarCall = accessTokensPostValidateBeforeCall(newAccessToken, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Create a new access token + * @param newAccessToken (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
201 Access token created successfully -
401 Authentication error -
500 Server error -
+ */ + public okhttp3.Call accessTokensPostAsync(NewAccessToken newAccessToken, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = accessTokensPostValidateBeforeCall(newAccessToken, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/AdminApi.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/AdminApi.java new file mode 100644 index 0000000..26e6264 --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/AdminApi.java @@ -0,0 +1,1060 @@ +/* + * E2B API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.openkruise.agents.client.e2b.api; + +import io.openkruise.agents.client.e2b.api.invoker.ApiCallback; +import io.openkruise.agents.client.e2b.api.invoker.ApiClient; +import io.openkruise.agents.client.e2b.api.invoker.ApiException; +import io.openkruise.agents.client.e2b.api.invoker.ApiResponse; +import io.openkruise.agents.client.e2b.api.invoker.Configuration; +import io.openkruise.agents.client.e2b.api.invoker.Pair; +import io.openkruise.agents.client.e2b.api.invoker.ProgressRequestBody; +import io.openkruise.agents.client.e2b.api.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import io.openkruise.agents.client.e2b.api.models.AdminBuildCancelResult; +import io.openkruise.agents.client.e2b.api.models.AdminSandboxKillResult; +import io.openkruise.agents.client.e2b.api.models.CreatedTeamAPIKey; +import io.openkruise.agents.client.e2b.api.models.Error; +import io.openkruise.agents.client.e2b.api.models.NewTeamAPIKey; +import io.openkruise.agents.client.e2b.api.models.NodeDetail; +import io.openkruise.agents.client.e2b.api.models.NodeStatusChange; +import io.openkruise.agents.client.e2b.api.models.NodesGet200ResponseInner; +import java.util.UUID; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.GenericType; + +public class AdminApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public AdminApi() { + this(Configuration.getDefaultApiClient()); + } + + public AdminApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for adminTeamsTeamIDApiKeysApiKeyIDDelete + * @param teamID Team ID (required) + * @param apiKeyID (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
204 Team API key deleted successfully -
400 Bad request -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call adminTeamsTeamIDApiKeysApiKeyIDDeleteCall(UUID teamID, String apiKeyID, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/admin/teams/{teamID}/api-keys/{apiKeyID}" + .replace("{" + "teamID" + "}", localVarApiClient.escapeString(teamID.toString())) + .replace("{" + "apiKeyID" + "}", localVarApiClient.escapeString(apiKeyID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AdminTokenAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call adminTeamsTeamIDApiKeysApiKeyIDDeleteValidateBeforeCall(UUID teamID, String apiKeyID, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'teamID' is set + if (teamID == null) { + throw new ApiException("Missing the required parameter 'teamID' when calling adminTeamsTeamIDApiKeysApiKeyIDDelete(Async)"); + } + + // verify the required parameter 'apiKeyID' is set + if (apiKeyID == null) { + throw new ApiException("Missing the required parameter 'apiKeyID' when calling adminTeamsTeamIDApiKeysApiKeyIDDelete(Async)"); + } + + return adminTeamsTeamIDApiKeysApiKeyIDDeleteCall(teamID, apiKeyID, _callback); + + } + + /** + * Delete team API key as admin + * Deletes a team API key for internal service workflows. + * @param teamID Team ID (required) + * @param apiKeyID (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
204 Team API key deleted successfully -
400 Bad request -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public void adminTeamsTeamIDApiKeysApiKeyIDDelete(UUID teamID, String apiKeyID) throws ApiException { + adminTeamsTeamIDApiKeysApiKeyIDDeleteWithHttpInfo(teamID, apiKeyID); + } + + /** + * Delete team API key as admin + * Deletes a team API key for internal service workflows. + * @param teamID Team ID (required) + * @param apiKeyID (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
204 Team API key deleted successfully -
400 Bad request -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public ApiResponse adminTeamsTeamIDApiKeysApiKeyIDDeleteWithHttpInfo(UUID teamID, String apiKeyID) throws ApiException { + okhttp3.Call localVarCall = adminTeamsTeamIDApiKeysApiKeyIDDeleteValidateBeforeCall(teamID, apiKeyID, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete team API key as admin (asynchronously) + * Deletes a team API key for internal service workflows. + * @param teamID Team ID (required) + * @param apiKeyID (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
204 Team API key deleted successfully -
400 Bad request -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call adminTeamsTeamIDApiKeysApiKeyIDDeleteAsync(UUID teamID, String apiKeyID, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = adminTeamsTeamIDApiKeysApiKeyIDDeleteValidateBeforeCall(teamID, apiKeyID, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for adminTeamsTeamIDApiKeysPost + * @param teamID Team ID (required) + * @param newTeamAPIKey (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Status Code Description Response Headers
201 Team API key created successfully -
400 Bad request -
401 Authentication error -
403 Forbidden -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call adminTeamsTeamIDApiKeysPostCall(UUID teamID, NewTeamAPIKey newTeamAPIKey, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = newTeamAPIKey; + + // create path and map variables + String localVarPath = "/admin/teams/{teamID}/api-keys" + .replace("{" + "teamID" + "}", localVarApiClient.escapeString(teamID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AdminTokenAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call adminTeamsTeamIDApiKeysPostValidateBeforeCall(UUID teamID, NewTeamAPIKey newTeamAPIKey, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'teamID' is set + if (teamID == null) { + throw new ApiException("Missing the required parameter 'teamID' when calling adminTeamsTeamIDApiKeysPost(Async)"); + } + + // verify the required parameter 'newTeamAPIKey' is set + if (newTeamAPIKey == null) { + throw new ApiException("Missing the required parameter 'newTeamAPIKey' when calling adminTeamsTeamIDApiKeysPost(Async)"); + } + + return adminTeamsTeamIDApiKeysPostCall(teamID, newTeamAPIKey, _callback); + + } + + /** + * Create team API key as admin + * Creates a team API key for internal service workflows. + * @param teamID Team ID (required) + * @param newTeamAPIKey (required) + * @return CreatedTeamAPIKey + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Status Code Description Response Headers
201 Team API key created successfully -
400 Bad request -
401 Authentication error -
403 Forbidden -
404 Not found -
500 Server error -
+ */ + public CreatedTeamAPIKey adminTeamsTeamIDApiKeysPost(UUID teamID, NewTeamAPIKey newTeamAPIKey) throws ApiException { + ApiResponse localVarResp = adminTeamsTeamIDApiKeysPostWithHttpInfo(teamID, newTeamAPIKey); + return localVarResp.getData(); + } + + /** + * Create team API key as admin + * Creates a team API key for internal service workflows. + * @param teamID Team ID (required) + * @param newTeamAPIKey (required) + * @return ApiResponse<CreatedTeamAPIKey> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Status Code Description Response Headers
201 Team API key created successfully -
400 Bad request -
401 Authentication error -
403 Forbidden -
404 Not found -
500 Server error -
+ */ + public ApiResponse adminTeamsTeamIDApiKeysPostWithHttpInfo(UUID teamID, NewTeamAPIKey newTeamAPIKey) throws ApiException { + okhttp3.Call localVarCall = adminTeamsTeamIDApiKeysPostValidateBeforeCall(teamID, newTeamAPIKey, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create team API key as admin (asynchronously) + * Creates a team API key for internal service workflows. + * @param teamID Team ID (required) + * @param newTeamAPIKey (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + +
Status Code Description Response Headers
201 Team API key created successfully -
400 Bad request -
401 Authentication error -
403 Forbidden -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call adminTeamsTeamIDApiKeysPostAsync(UUID teamID, NewTeamAPIKey newTeamAPIKey, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = adminTeamsTeamIDApiKeysPostValidateBeforeCall(teamID, newTeamAPIKey, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for adminTeamsTeamIDBuildsCancelPost + * @param teamID Team ID (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Successfully cancelled builds -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call adminTeamsTeamIDBuildsCancelPostCall(UUID teamID, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/admin/teams/{teamID}/builds/cancel" + .replace("{" + "teamID" + "}", localVarApiClient.escapeString(teamID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AdminTokenAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call adminTeamsTeamIDBuildsCancelPostValidateBeforeCall(UUID teamID, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'teamID' is set + if (teamID == null) { + throw new ApiException("Missing the required parameter 'teamID' when calling adminTeamsTeamIDBuildsCancelPost(Async)"); + } + + return adminTeamsTeamIDBuildsCancelPostCall(teamID, _callback); + + } + + /** + * Cancel all builds for a team + * Cancels all in-progress and pending builds for the specified team + * @param teamID Team ID (required) + * @return AdminBuildCancelResult + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Successfully cancelled builds -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public AdminBuildCancelResult adminTeamsTeamIDBuildsCancelPost(UUID teamID) throws ApiException { + ApiResponse localVarResp = adminTeamsTeamIDBuildsCancelPostWithHttpInfo(teamID); + return localVarResp.getData(); + } + + /** + * Cancel all builds for a team + * Cancels all in-progress and pending builds for the specified team + * @param teamID Team ID (required) + * @return ApiResponse<AdminBuildCancelResult> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Successfully cancelled builds -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public ApiResponse adminTeamsTeamIDBuildsCancelPostWithHttpInfo(UUID teamID) throws ApiException { + okhttp3.Call localVarCall = adminTeamsTeamIDBuildsCancelPostValidateBeforeCall(teamID, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Cancel all builds for a team (asynchronously) + * Cancels all in-progress and pending builds for the specified team + * @param teamID Team ID (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Successfully cancelled builds -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call adminTeamsTeamIDBuildsCancelPostAsync(UUID teamID, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = adminTeamsTeamIDBuildsCancelPostValidateBeforeCall(teamID, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for adminTeamsTeamIDSandboxesKillPost + * @param teamID Team ID (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Successfully killed sandboxes -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call adminTeamsTeamIDSandboxesKillPostCall(UUID teamID, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/admin/teams/{teamID}/sandboxes/kill" + .replace("{" + "teamID" + "}", localVarApiClient.escapeString(teamID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AdminTokenAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call adminTeamsTeamIDSandboxesKillPostValidateBeforeCall(UUID teamID, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'teamID' is set + if (teamID == null) { + throw new ApiException("Missing the required parameter 'teamID' when calling adminTeamsTeamIDSandboxesKillPost(Async)"); + } + + return adminTeamsTeamIDSandboxesKillPostCall(teamID, _callback); + + } + + /** + * Kill all sandboxes for a team + * Kills all sandboxes for the specified team + * @param teamID Team ID (required) + * @return AdminSandboxKillResult + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Successfully killed sandboxes -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public AdminSandboxKillResult adminTeamsTeamIDSandboxesKillPost(UUID teamID) throws ApiException { + ApiResponse localVarResp = adminTeamsTeamIDSandboxesKillPostWithHttpInfo(teamID); + return localVarResp.getData(); + } + + /** + * Kill all sandboxes for a team + * Kills all sandboxes for the specified team + * @param teamID Team ID (required) + * @return ApiResponse<AdminSandboxKillResult> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Successfully killed sandboxes -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public ApiResponse adminTeamsTeamIDSandboxesKillPostWithHttpInfo(UUID teamID) throws ApiException { + okhttp3.Call localVarCall = adminTeamsTeamIDSandboxesKillPostValidateBeforeCall(teamID, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Kill all sandboxes for a team (asynchronously) + * Kills all sandboxes for the specified team + * @param teamID Team ID (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Successfully killed sandboxes -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call adminTeamsTeamIDSandboxesKillPostAsync(UUID teamID, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = adminTeamsTeamIDSandboxesKillPostValidateBeforeCall(teamID, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for nodesGet + * @param clusterID Identifier of the cluster (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully returned all nodes -
401 Authentication error -
500 Server error -
+ */ + public okhttp3.Call nodesGetCall(UUID clusterID, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/nodes"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (clusterID != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("clusterID", clusterID)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AdminTokenAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call nodesGetValidateBeforeCall(UUID clusterID, final ApiCallback _callback) throws ApiException { + return nodesGetCall(clusterID, _callback); + + } + + /** + * + * List all nodes + * @param clusterID Identifier of the cluster (optional) + * @return List<NodesGet200ResponseInner> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully returned all nodes -
401 Authentication error -
500 Server error -
+ */ + public List nodesGet(UUID clusterID) throws ApiException { + ApiResponse> localVarResp = nodesGetWithHttpInfo(clusterID); + return localVarResp.getData(); + } + + /** + * + * List all nodes + * @param clusterID Identifier of the cluster (optional) + * @return ApiResponse<List<NodesGet200ResponseInner>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully returned all nodes -
401 Authentication error -
500 Server error -
+ */ + public ApiResponse> nodesGetWithHttpInfo(UUID clusterID) throws ApiException { + okhttp3.Call localVarCall = nodesGetValidateBeforeCall(clusterID, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * List all nodes + * @param clusterID Identifier of the cluster (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully returned all nodes -
401 Authentication error -
500 Server error -
+ */ + public okhttp3.Call nodesGetAsync(UUID clusterID, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = nodesGetValidateBeforeCall(clusterID, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for nodesNodeIDGet + * @param nodeID (required) + * @param clusterID Identifier of the cluster (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Successfully returned the node -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call nodesNodeIDGetCall(String nodeID, UUID clusterID, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/nodes/{nodeID}" + .replace("{" + "nodeID" + "}", localVarApiClient.escapeString(nodeID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (clusterID != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("clusterID", clusterID)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AdminTokenAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call nodesNodeIDGetValidateBeforeCall(String nodeID, UUID clusterID, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'nodeID' is set + if (nodeID == null) { + throw new ApiException("Missing the required parameter 'nodeID' when calling nodesNodeIDGet(Async)"); + } + + return nodesNodeIDGetCall(nodeID, clusterID, _callback); + + } + + /** + * + * Get node info + * @param nodeID (required) + * @param clusterID Identifier of the cluster (optional) + * @return NodeDetail + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Successfully returned the node -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public NodeDetail nodesNodeIDGet(String nodeID, UUID clusterID) throws ApiException { + ApiResponse localVarResp = nodesNodeIDGetWithHttpInfo(nodeID, clusterID); + return localVarResp.getData(); + } + + /** + * + * Get node info + * @param nodeID (required) + * @param clusterID Identifier of the cluster (optional) + * @return ApiResponse<NodeDetail> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Successfully returned the node -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public ApiResponse nodesNodeIDGetWithHttpInfo(String nodeID, UUID clusterID) throws ApiException { + okhttp3.Call localVarCall = nodesNodeIDGetValidateBeforeCall(nodeID, clusterID, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Get node info + * @param nodeID (required) + * @param clusterID Identifier of the cluster (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Successfully returned the node -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call nodesNodeIDGetAsync(String nodeID, UUID clusterID, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = nodesNodeIDGetValidateBeforeCall(nodeID, clusterID, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for nodesNodeIDPost + * @param nodeID (required) + * @param nodeStatusChange (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 The node status was changed successfully -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call nodesNodeIDPostCall(String nodeID, NodeStatusChange nodeStatusChange, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = nodeStatusChange; + + // create path and map variables + String localVarPath = "/nodes/{nodeID}" + .replace("{" + "nodeID" + "}", localVarApiClient.escapeString(nodeID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AdminTokenAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call nodesNodeIDPostValidateBeforeCall(String nodeID, NodeStatusChange nodeStatusChange, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'nodeID' is set + if (nodeID == null) { + throw new ApiException("Missing the required parameter 'nodeID' when calling nodesNodeIDPost(Async)"); + } + + return nodesNodeIDPostCall(nodeID, nodeStatusChange, _callback); + + } + + /** + * + * Change status of a node + * @param nodeID (required) + * @param nodeStatusChange (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 The node status was changed successfully -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public void nodesNodeIDPost(String nodeID, NodeStatusChange nodeStatusChange) throws ApiException { + nodesNodeIDPostWithHttpInfo(nodeID, nodeStatusChange); + } + + /** + * + * Change status of a node + * @param nodeID (required) + * @param nodeStatusChange (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 The node status was changed successfully -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public ApiResponse nodesNodeIDPostWithHttpInfo(String nodeID, NodeStatusChange nodeStatusChange) throws ApiException { + okhttp3.Call localVarCall = nodesNodeIDPostValidateBeforeCall(nodeID, nodeStatusChange, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * Change status of a node + * @param nodeID (required) + * @param nodeStatusChange (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 The node status was changed successfully -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call nodesNodeIDPostAsync(String nodeID, NodeStatusChange nodeStatusChange, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = nodesNodeIDPostValidateBeforeCall(nodeID, nodeStatusChange, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/ApiKeysApi.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/ApiKeysApi.java new file mode 100644 index 0000000..0cdb335 --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/ApiKeysApi.java @@ -0,0 +1,604 @@ +/* + * E2B API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.openkruise.agents.client.e2b.api; + +import io.openkruise.agents.client.e2b.api.invoker.ApiCallback; +import io.openkruise.agents.client.e2b.api.invoker.ApiClient; +import io.openkruise.agents.client.e2b.api.invoker.ApiException; +import io.openkruise.agents.client.e2b.api.invoker.ApiResponse; +import io.openkruise.agents.client.e2b.api.invoker.Configuration; +import io.openkruise.agents.client.e2b.api.invoker.Pair; +import io.openkruise.agents.client.e2b.api.invoker.ProgressRequestBody; +import io.openkruise.agents.client.e2b.api.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import io.openkruise.agents.client.e2b.api.models.CreatedTeamAPIKey; +import io.openkruise.agents.client.e2b.api.models.Error; +import io.openkruise.agents.client.e2b.api.models.NewTeamAPIKey; +import io.openkruise.agents.client.e2b.api.models.TeamAPIKey; +import io.openkruise.agents.client.e2b.api.models.UpdateTeamAPIKey; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.GenericType; + +public class ApiKeysApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ApiKeysApi() { + this(Configuration.getDefaultApiClient()); + } + + public ApiKeysApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for apiKeysApiKeyIDDelete + * @param apiKeyID (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Team API key deleted successfully -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call apiKeysApiKeyIDDeleteCall(String apiKeyID, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/api-keys/{apiKeyID}" + .replace("{" + "apiKeyID" + "}", localVarApiClient.escapeString(apiKeyID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call apiKeysApiKeyIDDeleteValidateBeforeCall(String apiKeyID, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'apiKeyID' is set + if (apiKeyID == null) { + throw new ApiException("Missing the required parameter 'apiKeyID' when calling apiKeysApiKeyIDDelete(Async)"); + } + + return apiKeysApiKeyIDDeleteCall(apiKeyID, _callback); + + } + + /** + * + * Delete a team API key + * @param apiKeyID (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Team API key deleted successfully -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public void apiKeysApiKeyIDDelete(String apiKeyID) throws ApiException { + apiKeysApiKeyIDDeleteWithHttpInfo(apiKeyID); + } + + /** + * + * Delete a team API key + * @param apiKeyID (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Team API key deleted successfully -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public ApiResponse apiKeysApiKeyIDDeleteWithHttpInfo(String apiKeyID) throws ApiException { + okhttp3.Call localVarCall = apiKeysApiKeyIDDeleteValidateBeforeCall(apiKeyID, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * Delete a team API key + * @param apiKeyID (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Team API key deleted successfully -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call apiKeysApiKeyIDDeleteAsync(String apiKeyID, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = apiKeysApiKeyIDDeleteValidateBeforeCall(apiKeyID, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for apiKeysApiKeyIDPatch + * @param apiKeyID (required) + * @param updateTeamAPIKey (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Team API key updated successfully -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call apiKeysApiKeyIDPatchCall(String apiKeyID, UpdateTeamAPIKey updateTeamAPIKey, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = updateTeamAPIKey; + + // create path and map variables + String localVarPath = "/api-keys/{apiKeyID}" + .replace("{" + "apiKeyID" + "}", localVarApiClient.escapeString(apiKeyID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call apiKeysApiKeyIDPatchValidateBeforeCall(String apiKeyID, UpdateTeamAPIKey updateTeamAPIKey, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'apiKeyID' is set + if (apiKeyID == null) { + throw new ApiException("Missing the required parameter 'apiKeyID' when calling apiKeysApiKeyIDPatch(Async)"); + } + + // verify the required parameter 'updateTeamAPIKey' is set + if (updateTeamAPIKey == null) { + throw new ApiException("Missing the required parameter 'updateTeamAPIKey' when calling apiKeysApiKeyIDPatch(Async)"); + } + + return apiKeysApiKeyIDPatchCall(apiKeyID, updateTeamAPIKey, _callback); + + } + + /** + * + * Update a team API key + * @param apiKeyID (required) + * @param updateTeamAPIKey (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Team API key updated successfully -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public void apiKeysApiKeyIDPatch(String apiKeyID, UpdateTeamAPIKey updateTeamAPIKey) throws ApiException { + apiKeysApiKeyIDPatchWithHttpInfo(apiKeyID, updateTeamAPIKey); + } + + /** + * + * Update a team API key + * @param apiKeyID (required) + * @param updateTeamAPIKey (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Team API key updated successfully -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public ApiResponse apiKeysApiKeyIDPatchWithHttpInfo(String apiKeyID, UpdateTeamAPIKey updateTeamAPIKey) throws ApiException { + okhttp3.Call localVarCall = apiKeysApiKeyIDPatchValidateBeforeCall(apiKeyID, updateTeamAPIKey, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * Update a team API key + * @param apiKeyID (required) + * @param updateTeamAPIKey (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Team API key updated successfully -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call apiKeysApiKeyIDPatchAsync(String apiKeyID, UpdateTeamAPIKey updateTeamAPIKey, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = apiKeysApiKeyIDPatchValidateBeforeCall(apiKeyID, updateTeamAPIKey, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for apiKeysGet + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully returned all team API keys -
401 Authentication error -
500 Server error -
+ */ + public okhttp3.Call apiKeysGetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/api-keys"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call apiKeysGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return apiKeysGetCall(_callback); + + } + + /** + * + * List all team API keys + * @return List<TeamAPIKey> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully returned all team API keys -
401 Authentication error -
500 Server error -
+ */ + public List apiKeysGet() throws ApiException { + ApiResponse> localVarResp = apiKeysGetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * + * List all team API keys + * @return ApiResponse<List<TeamAPIKey>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully returned all team API keys -
401 Authentication error -
500 Server error -
+ */ + public ApiResponse> apiKeysGetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = apiKeysGetValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * List all team API keys + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully returned all team API keys -
401 Authentication error -
500 Server error -
+ */ + public okhttp3.Call apiKeysGetAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = apiKeysGetValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for apiKeysPost + * @param newTeamAPIKey (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
201 Team API key created successfully -
401 Authentication error -
500 Server error -
+ */ + public okhttp3.Call apiKeysPostCall(NewTeamAPIKey newTeamAPIKey, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = newTeamAPIKey; + + // create path and map variables + String localVarPath = "/api-keys"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call apiKeysPostValidateBeforeCall(NewTeamAPIKey newTeamAPIKey, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'newTeamAPIKey' is set + if (newTeamAPIKey == null) { + throw new ApiException("Missing the required parameter 'newTeamAPIKey' when calling apiKeysPost(Async)"); + } + + return apiKeysPostCall(newTeamAPIKey, _callback); + + } + + /** + * + * Create a new team API key + * @param newTeamAPIKey (required) + * @return CreatedTeamAPIKey + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
201 Team API key created successfully -
401 Authentication error -
500 Server error -
+ */ + public CreatedTeamAPIKey apiKeysPost(NewTeamAPIKey newTeamAPIKey) throws ApiException { + ApiResponse localVarResp = apiKeysPostWithHttpInfo(newTeamAPIKey); + return localVarResp.getData(); + } + + /** + * + * Create a new team API key + * @param newTeamAPIKey (required) + * @return ApiResponse<CreatedTeamAPIKey> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
201 Team API key created successfully -
401 Authentication error -
500 Server error -
+ */ + public ApiResponse apiKeysPostWithHttpInfo(NewTeamAPIKey newTeamAPIKey) throws ApiException { + okhttp3.Call localVarCall = apiKeysPostValidateBeforeCall(newTeamAPIKey, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Create a new team API key + * @param newTeamAPIKey (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
201 Team API key created successfully -
401 Authentication error -
500 Server error -
+ */ + public okhttp3.Call apiKeysPostAsync(NewTeamAPIKey newTeamAPIKey, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = apiKeysPostValidateBeforeCall(newTeamAPIKey, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/AuthApi.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/AuthApi.java new file mode 100644 index 0000000..84b5a41 --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/AuthApi.java @@ -0,0 +1,523 @@ +/* + * E2B API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.openkruise.agents.client.e2b.api; + +import io.openkruise.agents.client.e2b.api.invoker.ApiCallback; +import io.openkruise.agents.client.e2b.api.invoker.ApiClient; +import io.openkruise.agents.client.e2b.api.invoker.ApiException; +import io.openkruise.agents.client.e2b.api.invoker.ApiResponse; +import io.openkruise.agents.client.e2b.api.invoker.Configuration; +import io.openkruise.agents.client.e2b.api.invoker.Pair; +import io.openkruise.agents.client.e2b.api.invoker.ProgressRequestBody; +import io.openkruise.agents.client.e2b.api.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import io.openkruise.agents.client.e2b.api.models.Error; +import io.openkruise.agents.client.e2b.api.models.MaxTeamMetric; +import io.openkruise.agents.client.e2b.api.models.TeamMetric; +import io.openkruise.agents.client.e2b.api.models.TeamsGet200ResponseInner; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.GenericType; + +public class AuthApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public AuthApi() { + this(Configuration.getDefaultApiClient()); + } + + public AuthApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for teamsGet + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully returned all teams -
401 Authentication error -
500 Server error -
+ */ + public okhttp3.Call teamsGetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/teams"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AccessTokenAuth", "AuthProviderBearerAuth", "Supabase1TokenAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call teamsGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return teamsGetCall(_callback); + + } + + /** + * + * List all teams + * @return List<TeamsGet200ResponseInner> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully returned all teams -
401 Authentication error -
500 Server error -
+ */ + public List teamsGet() throws ApiException { + ApiResponse> localVarResp = teamsGetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * + * List all teams + * @return ApiResponse<List<TeamsGet200ResponseInner>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully returned all teams -
401 Authentication error -
500 Server error -
+ */ + public ApiResponse> teamsGetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = teamsGetValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * List all teams + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully returned all teams -
401 Authentication error -
500 Server error -
+ */ + public okhttp3.Call teamsGetAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = teamsGetValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for teamsTeamIDMetricsGet + * @param teamID (required) + * @param start Unix timestamp for the start of the interval, in seconds, for which the metrics (optional) + * @param end (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 Successfully returned the team metrics -
400 Bad request -
401 Authentication error -
403 Forbidden -
500 Server error -
+ */ + public okhttp3.Call teamsTeamIDMetricsGetCall(String teamID, Long start, Long end, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/teams/{teamID}/metrics" + .replace("{" + "teamID" + "}", localVarApiClient.escapeString(teamID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (start != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("start", start)); + } + + if (end != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("end", end)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call teamsTeamIDMetricsGetValidateBeforeCall(String teamID, Long start, Long end, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'teamID' is set + if (teamID == null) { + throw new ApiException("Missing the required parameter 'teamID' when calling teamsTeamIDMetricsGet(Async)"); + } + + return teamsTeamIDMetricsGetCall(teamID, start, end, _callback); + + } + + /** + * + * Get metrics for the team + * @param teamID (required) + * @param start Unix timestamp for the start of the interval, in seconds, for which the metrics (optional) + * @param end (optional) + * @return List<TeamMetric> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 Successfully returned the team metrics -
400 Bad request -
401 Authentication error -
403 Forbidden -
500 Server error -
+ */ + public List teamsTeamIDMetricsGet(String teamID, Long start, Long end) throws ApiException { + ApiResponse> localVarResp = teamsTeamIDMetricsGetWithHttpInfo(teamID, start, end); + return localVarResp.getData(); + } + + /** + * + * Get metrics for the team + * @param teamID (required) + * @param start Unix timestamp for the start of the interval, in seconds, for which the metrics (optional) + * @param end (optional) + * @return ApiResponse<List<TeamMetric>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 Successfully returned the team metrics -
400 Bad request -
401 Authentication error -
403 Forbidden -
500 Server error -
+ */ + public ApiResponse> teamsTeamIDMetricsGetWithHttpInfo(String teamID, Long start, Long end) throws ApiException { + okhttp3.Call localVarCall = teamsTeamIDMetricsGetValidateBeforeCall(teamID, start, end, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Get metrics for the team + * @param teamID (required) + * @param start Unix timestamp for the start of the interval, in seconds, for which the metrics (optional) + * @param end (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 Successfully returned the team metrics -
400 Bad request -
401 Authentication error -
403 Forbidden -
500 Server error -
+ */ + public okhttp3.Call teamsTeamIDMetricsGetAsync(String teamID, Long start, Long end, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = teamsTeamIDMetricsGetValidateBeforeCall(teamID, start, end, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for teamsTeamIDMetricsMaxGet + * @param teamID (required) + * @param metric Metric to retrieve the maximum value for (required) + * @param start Unix timestamp for the start of the interval, in seconds, for which the metrics (optional) + * @param end (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 Successfully returned the team metrics -
400 Bad request -
401 Authentication error -
403 Forbidden -
500 Server error -
+ */ + public okhttp3.Call teamsTeamIDMetricsMaxGetCall(String teamID, String metric, Long start, Long end, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/teams/{teamID}/metrics/max" + .replace("{" + "teamID" + "}", localVarApiClient.escapeString(teamID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (start != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("start", start)); + } + + if (end != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("end", end)); + } + + if (metric != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("metric", metric)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call teamsTeamIDMetricsMaxGetValidateBeforeCall(String teamID, String metric, Long start, Long end, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'teamID' is set + if (teamID == null) { + throw new ApiException("Missing the required parameter 'teamID' when calling teamsTeamIDMetricsMaxGet(Async)"); + } + + // verify the required parameter 'metric' is set + if (metric == null) { + throw new ApiException("Missing the required parameter 'metric' when calling teamsTeamIDMetricsMaxGet(Async)"); + } + + return teamsTeamIDMetricsMaxGetCall(teamID, metric, start, end, _callback); + + } + + /** + * + * Get the maximum metrics for the team in the given interval + * @param teamID (required) + * @param metric Metric to retrieve the maximum value for (required) + * @param start Unix timestamp for the start of the interval, in seconds, for which the metrics (optional) + * @param end (optional) + * @return MaxTeamMetric + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 Successfully returned the team metrics -
400 Bad request -
401 Authentication error -
403 Forbidden -
500 Server error -
+ */ + public MaxTeamMetric teamsTeamIDMetricsMaxGet(String teamID, String metric, Long start, Long end) throws ApiException { + ApiResponse localVarResp = teamsTeamIDMetricsMaxGetWithHttpInfo(teamID, metric, start, end); + return localVarResp.getData(); + } + + /** + * + * Get the maximum metrics for the team in the given interval + * @param teamID (required) + * @param metric Metric to retrieve the maximum value for (required) + * @param start Unix timestamp for the start of the interval, in seconds, for which the metrics (optional) + * @param end (optional) + * @return ApiResponse<MaxTeamMetric> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 Successfully returned the team metrics -
400 Bad request -
401 Authentication error -
403 Forbidden -
500 Server error -
+ */ + public ApiResponse teamsTeamIDMetricsMaxGetWithHttpInfo(String teamID, String metric, Long start, Long end) throws ApiException { + okhttp3.Call localVarCall = teamsTeamIDMetricsMaxGetValidateBeforeCall(teamID, metric, start, end, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Get the maximum metrics for the team in the given interval + * @param teamID (required) + * @param metric Metric to retrieve the maximum value for (required) + * @param start Unix timestamp for the start of the interval, in seconds, for which the metrics (optional) + * @param end (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 Successfully returned the team metrics -
400 Bad request -
401 Authentication error -
403 Forbidden -
500 Server error -
+ */ + public okhttp3.Call teamsTeamIDMetricsMaxGetAsync(String teamID, String metric, Long start, Long end, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = teamsTeamIDMetricsMaxGetValidateBeforeCall(teamID, metric, start, end, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/DefaultApi.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/DefaultApi.java new file mode 100644 index 0000000..e4573ed --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/DefaultApi.java @@ -0,0 +1,189 @@ +/* + * E2B API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.openkruise.agents.client.e2b.api; + +import io.openkruise.agents.client.e2b.api.invoker.ApiCallback; +import io.openkruise.agents.client.e2b.api.invoker.ApiClient; +import io.openkruise.agents.client.e2b.api.invoker.ApiException; +import io.openkruise.agents.client.e2b.api.invoker.ApiResponse; +import io.openkruise.agents.client.e2b.api.invoker.Configuration; +import io.openkruise.agents.client.e2b.api.invoker.Pair; +import io.openkruise.agents.client.e2b.api.invoker.ProgressRequestBody; +import io.openkruise.agents.client.e2b.api.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import io.openkruise.agents.client.e2b.api.models.Error; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.GenericType; + +public class DefaultApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public DefaultApi() { + this(Configuration.getDefaultApiClient()); + } + + public DefaultApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for healthGet + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
204 The service is healthy -
401 Authentication error -
+ */ + public okhttp3.Call healthGetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/health"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call healthGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return healthGetCall(_callback); + + } + + /** + * + * Health check + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
204 The service is healthy -
401 Authentication error -
+ */ + public void healthGet() throws ApiException { + healthGetWithHttpInfo(); + } + + /** + * + * Health check + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
204 The service is healthy -
401 Authentication error -
+ */ + public ApiResponse healthGetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = healthGetValidateBeforeCall(null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * Health check + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
204 The service is healthy -
401 Authentication error -
+ */ + public okhttp3.Call healthGetAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = healthGetValidateBeforeCall(_callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/SandboxesApi.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/SandboxesApi.java index 7d9b2b8..f716c2e 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/SandboxesApi.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/SandboxesApi.java @@ -29,14 +29,16 @@ import io.openkruise.agents.client.e2b.api.models.ConnectSandbox; import io.openkruise.agents.client.e2b.api.models.Error; +import io.openkruise.agents.client.e2b.api.models.LogLevel; import io.openkruise.agents.client.e2b.api.models.LogsDirection; import io.openkruise.agents.client.e2b.api.models.NewSandbox; import io.openkruise.agents.client.e2b.api.models.ResumedSandbox; -import io.openkruise.agents.client.e2b.api.models.Sandbox; import io.openkruise.agents.client.e2b.api.models.SandboxDetail; import io.openkruise.agents.client.e2b.api.models.SandboxLogs; import io.openkruise.agents.client.e2b.api.models.SandboxLogsV2Response; import io.openkruise.agents.client.e2b.api.models.SandboxMetric; +import io.openkruise.agents.client.e2b.api.models.SandboxNetworkUpdateConfig; +import io.openkruise.agents.client.e2b.api.models.SandboxResponse; import io.openkruise.agents.client.e2b.api.models.SandboxState; import io.openkruise.agents.client.e2b.api.models.SandboxesGet200ResponseInner; import io.openkruise.agents.client.e2b.api.models.SandboxesSandboxIDRefreshesPostRequest; @@ -149,7 +151,7 @@ public okhttp3.Call sandboxesGetCall(String metadata, final ApiCallback _callbac localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth" }; + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @@ -282,7 +284,7 @@ public okhttp3.Call sandboxesMetricsGetCall(Set sandboxIds, final ApiCal localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth" }; + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @@ -417,7 +419,7 @@ public okhttp3.Call sandboxesPostCall(NewSandbox newSandbox, final ApiCallback _ localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth" }; + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @@ -436,7 +438,7 @@ private okhttp3.Call sandboxesPostValidateBeforeCall(NewSandbox newSandbox, fina * * Create a sandbox from the template * @param newSandbox (required) - * @return Sandbox + * @return SandboxResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -447,8 +449,8 @@ private okhttp3.Call sandboxesPostValidateBeforeCall(NewSandbox newSandbox, fina
500 Server error -
*/ - public Sandbox sandboxesPost(NewSandbox newSandbox) throws ApiException { - ApiResponse localVarResp = sandboxesPostWithHttpInfo(newSandbox); + public SandboxResponse sandboxesPost(NewSandbox newSandbox) throws ApiException { + ApiResponse localVarResp = sandboxesPostWithHttpInfo(newSandbox); return localVarResp.getData(); } @@ -456,7 +458,7 @@ public Sandbox sandboxesPost(NewSandbox newSandbox) throws ApiException { * * Create a sandbox from the template * @param newSandbox (required) - * @return ApiResponse<Sandbox> + * @return ApiResponse<SandboxResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -467,9 +469,9 @@ public Sandbox sandboxesPost(NewSandbox newSandbox) throws ApiException {
500 Server error -
*/ - public ApiResponse sandboxesPostWithHttpInfo(NewSandbox newSandbox) throws ApiException { + public ApiResponse sandboxesPostWithHttpInfo(NewSandbox newSandbox) throws ApiException { okhttp3.Call localVarCall = sandboxesPostValidateBeforeCall(newSandbox, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } @@ -489,10 +491,10 @@ public ApiResponse sandboxesPostWithHttpInfo(NewSandbox newSandbox) thr 500 Server error - */ - public okhttp3.Call sandboxesPostAsync(NewSandbox newSandbox, final ApiCallback _callback) throws ApiException { + public okhttp3.Call sandboxesPostAsync(NewSandbox newSandbox, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = sandboxesPostValidateBeforeCall(newSandbox, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } @@ -556,7 +558,7 @@ public okhttp3.Call sandboxesSandboxIDConnectPostCall(String sandboxID, ConnectS localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth" }; + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @@ -581,7 +583,7 @@ private okhttp3.Call sandboxesSandboxIDConnectPostValidateBeforeCall(String sand * Returns sandbox details. If the sandbox is paused, it will be resumed. TTL is only extended. * @param sandboxID (required) * @param connectSandbox (required) - * @return Sandbox + * @return SandboxResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -594,8 +596,8 @@ private okhttp3.Call sandboxesSandboxIDConnectPostValidateBeforeCall(String sand
500 Server error -
*/ - public Sandbox sandboxesSandboxIDConnectPost(String sandboxID, ConnectSandbox connectSandbox) throws ApiException { - ApiResponse localVarResp = sandboxesSandboxIDConnectPostWithHttpInfo(sandboxID, connectSandbox); + public SandboxResponse sandboxesSandboxIDConnectPost(String sandboxID, ConnectSandbox connectSandbox) throws ApiException { + ApiResponse localVarResp = sandboxesSandboxIDConnectPostWithHttpInfo(sandboxID, connectSandbox); return localVarResp.getData(); } @@ -604,7 +606,7 @@ public Sandbox sandboxesSandboxIDConnectPost(String sandboxID, ConnectSandbox co * Returns sandbox details. If the sandbox is paused, it will be resumed. TTL is only extended. * @param sandboxID (required) * @param connectSandbox (required) - * @return ApiResponse<Sandbox> + * @return ApiResponse<SandboxResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -617,9 +619,9 @@ public Sandbox sandboxesSandboxIDConnectPost(String sandboxID, ConnectSandbox co
500 Server error -
*/ - public ApiResponse sandboxesSandboxIDConnectPostWithHttpInfo(String sandboxID, ConnectSandbox connectSandbox) throws ApiException { + public ApiResponse sandboxesSandboxIDConnectPostWithHttpInfo(String sandboxID, ConnectSandbox connectSandbox) throws ApiException { okhttp3.Call localVarCall = sandboxesSandboxIDConnectPostValidateBeforeCall(sandboxID, connectSandbox, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } @@ -642,10 +644,10 @@ public ApiResponse sandboxesSandboxIDConnectPostWithHttpInfo(String san 500 Server error - */ - public okhttp3.Call sandboxesSandboxIDConnectPostAsync(String sandboxID, ConnectSandbox connectSandbox, final ApiCallback _callback) throws ApiException { + public okhttp3.Call sandboxesSandboxIDConnectPostAsync(String sandboxID, ConnectSandbox connectSandbox, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = sandboxesSandboxIDConnectPostValidateBeforeCall(sandboxID, connectSandbox, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } @@ -705,7 +707,7 @@ public okhttp3.Call sandboxesSandboxIDDeleteCall(String sandboxID, final ApiCall localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth" }; + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @@ -836,7 +838,7 @@ public okhttp3.Call sandboxesSandboxIDGetCall(String sandboxID, final ApiCallbac localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth" }; + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @@ -983,7 +985,7 @@ public okhttp3.Call sandboxesSandboxIDLogsGetCall(String sandboxID, Long start, localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth" }; + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @@ -1142,7 +1144,7 @@ public okhttp3.Call sandboxesSandboxIDMetricsGetCall(String sandboxID, Long star localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth" }; + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @@ -1230,6 +1232,151 @@ public okhttp3.Call sandboxesSandboxIDMetricsGetAsync(String sandboxID, Long sta localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for sandboxesSandboxIDNetworkPut + * @param sandboxID (required) + * @param sandboxNetworkUpdateConfig (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
204 Successfully updated the sandbox network configuration -
401 Authentication error -
404 Not found -
409 Conflict -
500 Server error -
+ */ + public okhttp3.Call sandboxesSandboxIDNetworkPutCall(String sandboxID, SandboxNetworkUpdateConfig sandboxNetworkUpdateConfig, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = sandboxNetworkUpdateConfig; + + // create path and map variables + String localVarPath = "/sandboxes/{sandboxID}/network" + .replace("{" + "sandboxID" + "}", localVarApiClient.escapeString(sandboxID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call sandboxesSandboxIDNetworkPutValidateBeforeCall(String sandboxID, SandboxNetworkUpdateConfig sandboxNetworkUpdateConfig, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'sandboxID' is set + if (sandboxID == null) { + throw new ApiException("Missing the required parameter 'sandboxID' when calling sandboxesSandboxIDNetworkPut(Async)"); + } + + // verify the required parameter 'sandboxNetworkUpdateConfig' is set + if (sandboxNetworkUpdateConfig == null) { + throw new ApiException("Missing the required parameter 'sandboxNetworkUpdateConfig' when calling sandboxesSandboxIDNetworkPut(Async)"); + } + + return sandboxesSandboxIDNetworkPutCall(sandboxID, sandboxNetworkUpdateConfig, _callback); + + } + + /** + * + * Update the network configuration for a running sandbox. Replaces the current egress rules with the provided configuration. Omitting field clears it. + * @param sandboxID (required) + * @param sandboxNetworkUpdateConfig (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
204 Successfully updated the sandbox network configuration -
401 Authentication error -
404 Not found -
409 Conflict -
500 Server error -
+ */ + public void sandboxesSandboxIDNetworkPut(String sandboxID, SandboxNetworkUpdateConfig sandboxNetworkUpdateConfig) throws ApiException { + sandboxesSandboxIDNetworkPutWithHttpInfo(sandboxID, sandboxNetworkUpdateConfig); + } + + /** + * + * Update the network configuration for a running sandbox. Replaces the current egress rules with the provided configuration. Omitting field clears it. + * @param sandboxID (required) + * @param sandboxNetworkUpdateConfig (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
204 Successfully updated the sandbox network configuration -
401 Authentication error -
404 Not found -
409 Conflict -
500 Server error -
+ */ + public ApiResponse sandboxesSandboxIDNetworkPutWithHttpInfo(String sandboxID, SandboxNetworkUpdateConfig sandboxNetworkUpdateConfig) throws ApiException { + okhttp3.Call localVarCall = sandboxesSandboxIDNetworkPutValidateBeforeCall(sandboxID, sandboxNetworkUpdateConfig, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * Update the network configuration for a running sandbox. Replaces the current egress rules with the provided configuration. Omitting field clears it. + * @param sandboxID (required) + * @param sandboxNetworkUpdateConfig (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
204 Successfully updated the sandbox network configuration -
401 Authentication error -
404 Not found -
409 Conflict -
500 Server error -
+ */ + public okhttp3.Call sandboxesSandboxIDNetworkPutAsync(String sandboxID, SandboxNetworkUpdateConfig sandboxNetworkUpdateConfig, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = sandboxesSandboxIDNetworkPutValidateBeforeCall(sandboxID, sandboxNetworkUpdateConfig, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } /** * Build call for sandboxesSandboxIDPausePost * @param sandboxID (required) @@ -1287,7 +1434,7 @@ public okhttp3.Call sandboxesSandboxIDPausePostCall(String sandboxID, final ApiC localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth" }; + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @@ -1422,7 +1569,7 @@ public okhttp3.Call sandboxesSandboxIDRefreshesPostCall(String sandboxID, Sandbo localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth" }; + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @@ -1558,7 +1705,7 @@ public okhttp3.Call sandboxesSandboxIDResumePostCall(String sandboxID, ResumedSa localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth" }; + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @@ -1584,7 +1731,7 @@ private okhttp3.Call sandboxesSandboxIDResumePostValidateBeforeCall(String sandb * Resume the sandbox * @param sandboxID (required) * @param resumedSandbox (required) - * @return Sandbox + * @return SandboxResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -1598,8 +1745,8 @@ private okhttp3.Call sandboxesSandboxIDResumePostValidateBeforeCall(String sandb * @deprecated */ @Deprecated - public Sandbox sandboxesSandboxIDResumePost(String sandboxID, ResumedSandbox resumedSandbox) throws ApiException { - ApiResponse localVarResp = sandboxesSandboxIDResumePostWithHttpInfo(sandboxID, resumedSandbox); + public SandboxResponse sandboxesSandboxIDResumePost(String sandboxID, ResumedSandbox resumedSandbox) throws ApiException { + ApiResponse localVarResp = sandboxesSandboxIDResumePostWithHttpInfo(sandboxID, resumedSandbox); return localVarResp.getData(); } @@ -1608,7 +1755,7 @@ public Sandbox sandboxesSandboxIDResumePost(String sandboxID, ResumedSandbox res * Resume the sandbox * @param sandboxID (required) * @param resumedSandbox (required) - * @return ApiResponse<Sandbox> + * @return ApiResponse<SandboxResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
@@ -1622,9 +1769,9 @@ public Sandbox sandboxesSandboxIDResumePost(String sandboxID, ResumedSandbox res * @deprecated */ @Deprecated - public ApiResponse sandboxesSandboxIDResumePostWithHttpInfo(String sandboxID, ResumedSandbox resumedSandbox) throws ApiException { + public ApiResponse sandboxesSandboxIDResumePostWithHttpInfo(String sandboxID, ResumedSandbox resumedSandbox) throws ApiException { okhttp3.Call localVarCall = sandboxesSandboxIDResumePostValidateBeforeCall(sandboxID, resumedSandbox, null); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } @@ -1648,10 +1795,10 @@ public ApiResponse sandboxesSandboxIDResumePostWithHttpInfo(String sand * @deprecated */ @Deprecated - public okhttp3.Call sandboxesSandboxIDResumePostAsync(String sandboxID, ResumedSandbox resumedSandbox, final ApiCallback _callback) throws ApiException { + public okhttp3.Call sandboxesSandboxIDResumePostAsync(String sandboxID, ResumedSandbox resumedSandbox, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = sandboxesSandboxIDResumePostValidateBeforeCall(sandboxID, resumedSandbox, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } @@ -1714,7 +1861,7 @@ public okhttp3.Call sandboxesSandboxIDSnapshotsPostCall(String sandboxID, Sandbo localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth" }; + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @@ -1862,7 +2009,7 @@ public okhttp3.Call sandboxesSandboxIDTimeoutPostCall(String sandboxID, Sandboxe localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth" }; + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @@ -2014,7 +2161,7 @@ public okhttp3.Call v2SandboxesGetCall(String metadata, List state localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth" }; + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @@ -2103,6 +2250,8 @@ public okhttp3.Call v2SandboxesGetAsync(String metadata, List stat * @param cursor Starting timestamp of the logs that should be returned in milliseconds (optional) * @param limit Maximum number of logs that should be returned (optional, default to 1000) * @param direction Direction of the logs that should be returned (optional) + * @param level Minimum log level to return. Logs below this level are excluded (optional) + * @param search Case-sensitive substring match on log message content (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -2115,7 +2264,7 @@ public okhttp3.Call v2SandboxesGetAsync(String metadata, List stat
500 Server error -
*/ - public okhttp3.Call v2SandboxesSandboxIDLogsGetCall(String sandboxID, Long cursor, Integer limit, LogsDirection direction, final ApiCallback _callback) throws ApiException { + public okhttp3.Call v2SandboxesSandboxIDLogsGetCall(String sandboxID, Long cursor, Integer limit, LogsDirection direction, LogLevel level, String search, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; @@ -2153,6 +2302,14 @@ public okhttp3.Call v2SandboxesSandboxIDLogsGetCall(String sandboxID, Long curso localVarQueryParams.addAll(localVarApiClient.parameterToPair("direction", direction)); } + if (level != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("level", level)); + } + + if (search != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("search", search)); + } + final String[] localVarAccepts = { "application/json" }; @@ -2168,18 +2325,18 @@ public okhttp3.Call v2SandboxesSandboxIDLogsGetCall(String sandboxID, Long curso localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] { "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth" }; + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call v2SandboxesSandboxIDLogsGetValidateBeforeCall(String sandboxID, Long cursor, Integer limit, LogsDirection direction, final ApiCallback _callback) throws ApiException { + private okhttp3.Call v2SandboxesSandboxIDLogsGetValidateBeforeCall(String sandboxID, Long cursor, Integer limit, LogsDirection direction, LogLevel level, String search, final ApiCallback _callback) throws ApiException { // verify the required parameter 'sandboxID' is set if (sandboxID == null) { throw new ApiException("Missing the required parameter 'sandboxID' when calling v2SandboxesSandboxIDLogsGet(Async)"); } - return v2SandboxesSandboxIDLogsGetCall(sandboxID, cursor, limit, direction, _callback); + return v2SandboxesSandboxIDLogsGetCall(sandboxID, cursor, limit, direction, level, search, _callback); } @@ -2190,6 +2347,8 @@ private okhttp3.Call v2SandboxesSandboxIDLogsGetValidateBeforeCall(String sandbo * @param cursor Starting timestamp of the logs that should be returned in milliseconds (optional) * @param limit Maximum number of logs that should be returned (optional, default to 1000) * @param direction Direction of the logs that should be returned (optional) + * @param level Minimum log level to return. Logs below this level are excluded (optional) + * @param search Case-sensitive substring match on log message content (optional) * @return SandboxLogsV2Response * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -2201,8 +2360,8 @@ private okhttp3.Call v2SandboxesSandboxIDLogsGetValidateBeforeCall(String sandbo 500 Server error - */ - public SandboxLogsV2Response v2SandboxesSandboxIDLogsGet(String sandboxID, Long cursor, Integer limit, LogsDirection direction) throws ApiException { - ApiResponse localVarResp = v2SandboxesSandboxIDLogsGetWithHttpInfo(sandboxID, cursor, limit, direction); + public SandboxLogsV2Response v2SandboxesSandboxIDLogsGet(String sandboxID, Long cursor, Integer limit, LogsDirection direction, LogLevel level, String search) throws ApiException { + ApiResponse localVarResp = v2SandboxesSandboxIDLogsGetWithHttpInfo(sandboxID, cursor, limit, direction, level, search); return localVarResp.getData(); } @@ -2213,6 +2372,8 @@ public SandboxLogsV2Response v2SandboxesSandboxIDLogsGet(String sandboxID, Long * @param cursor Starting timestamp of the logs that should be returned in milliseconds (optional) * @param limit Maximum number of logs that should be returned (optional, default to 1000) * @param direction Direction of the logs that should be returned (optional) + * @param level Minimum log level to return. Logs below this level are excluded (optional) + * @param search Case-sensitive substring match on log message content (optional) * @return ApiResponse<SandboxLogsV2Response> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -2224,8 +2385,8 @@ public SandboxLogsV2Response v2SandboxesSandboxIDLogsGet(String sandboxID, Long 500 Server error - */ - public ApiResponse v2SandboxesSandboxIDLogsGetWithHttpInfo(String sandboxID, Long cursor, Integer limit, LogsDirection direction) throws ApiException { - okhttp3.Call localVarCall = v2SandboxesSandboxIDLogsGetValidateBeforeCall(sandboxID, cursor, limit, direction, null); + public ApiResponse v2SandboxesSandboxIDLogsGetWithHttpInfo(String sandboxID, Long cursor, Integer limit, LogsDirection direction, LogLevel level, String search) throws ApiException { + okhttp3.Call localVarCall = v2SandboxesSandboxIDLogsGetValidateBeforeCall(sandboxID, cursor, limit, direction, level, search, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } @@ -2237,6 +2398,8 @@ public ApiResponse v2SandboxesSandboxIDLogsGetWithHttpInf * @param cursor Starting timestamp of the logs that should be returned in milliseconds (optional) * @param limit Maximum number of logs that should be returned (optional, default to 1000) * @param direction Direction of the logs that should be returned (optional) + * @param level Minimum log level to return. Logs below this level are excluded (optional) + * @param search Case-sensitive substring match on log message content (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object @@ -2249,9 +2412,9 @@ public ApiResponse v2SandboxesSandboxIDLogsGetWithHttpInf 500 Server error - */ - public okhttp3.Call v2SandboxesSandboxIDLogsGetAsync(String sandboxID, Long cursor, Integer limit, LogsDirection direction, final ApiCallback _callback) throws ApiException { + public okhttp3.Call v2SandboxesSandboxIDLogsGetAsync(String sandboxID, Long cursor, Integer limit, LogsDirection direction, LogLevel level, String search, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = v2SandboxesSandboxIDLogsGetValidateBeforeCall(sandboxID, cursor, limit, direction, _callback); + okhttp3.Call localVarCall = v2SandboxesSandboxIDLogsGetValidateBeforeCall(sandboxID, cursor, limit, direction, level, search, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/SnapshotsApi.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/SnapshotsApi.java new file mode 100644 index 0000000..d96fb39 --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/SnapshotsApi.java @@ -0,0 +1,222 @@ +/* + * E2B API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.openkruise.agents.client.e2b.api; + +import io.openkruise.agents.client.e2b.api.invoker.ApiCallback; +import io.openkruise.agents.client.e2b.api.invoker.ApiClient; +import io.openkruise.agents.client.e2b.api.invoker.ApiException; +import io.openkruise.agents.client.e2b.api.invoker.ApiResponse; +import io.openkruise.agents.client.e2b.api.invoker.Configuration; +import io.openkruise.agents.client.e2b.api.invoker.Pair; +import io.openkruise.agents.client.e2b.api.invoker.ProgressRequestBody; +import io.openkruise.agents.client.e2b.api.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import io.openkruise.agents.client.e2b.api.models.Error; +import io.openkruise.agents.client.e2b.api.models.SnapshotInfo; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.GenericType; + +public class SnapshotsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public SnapshotsApi() { + this(Configuration.getDefaultApiClient()); + } + + public SnapshotsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for snapshotsGet + * @param sandboxID (optional) + * @param limit Maximum number of items to return per page (optional, default to 100) + * @param nextToken Cursor to start the list from (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully returned snapshots -
401 Authentication error -
500 Server error -
+ */ + public okhttp3.Call snapshotsGetCall(String sandboxID, Integer limit, String nextToken, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/snapshots"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (sandboxID != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sandboxID", sandboxID)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (nextToken != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("nextToken", nextToken)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call snapshotsGetValidateBeforeCall(String sandboxID, Integer limit, String nextToken, final ApiCallback _callback) throws ApiException { + return snapshotsGetCall(sandboxID, limit, nextToken, _callback); + + } + + /** + * + * List all snapshots for the team + * @param sandboxID (optional) + * @param limit Maximum number of items to return per page (optional, default to 100) + * @param nextToken Cursor to start the list from (optional) + * @return List<SnapshotInfo> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully returned snapshots -
401 Authentication error -
500 Server error -
+ */ + public List snapshotsGet(String sandboxID, Integer limit, String nextToken) throws ApiException { + ApiResponse> localVarResp = snapshotsGetWithHttpInfo(sandboxID, limit, nextToken); + return localVarResp.getData(); + } + + /** + * + * List all snapshots for the team + * @param sandboxID (optional) + * @param limit Maximum number of items to return per page (optional, default to 100) + * @param nextToken Cursor to start the list from (optional) + * @return ApiResponse<List<SnapshotInfo>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully returned snapshots -
401 Authentication error -
500 Server error -
+ */ + public ApiResponse> snapshotsGetWithHttpInfo(String sandboxID, Integer limit, String nextToken) throws ApiException { + okhttp3.Call localVarCall = snapshotsGetValidateBeforeCall(sandboxID, limit, nextToken, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * List all snapshots for the team + * @param sandboxID (optional) + * @param limit Maximum number of items to return per page (optional, default to 100) + * @param nextToken Cursor to start the list from (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully returned snapshots -
401 Authentication error -
500 Server error -
+ */ + public okhttp3.Call snapshotsGetAsync(String sandboxID, Integer limit, String nextToken, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = snapshotsGetValidateBeforeCall(sandboxID, limit, nextToken, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/TagsApi.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/TagsApi.java new file mode 100644 index 0000000..a35c72a --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/TagsApi.java @@ -0,0 +1,493 @@ +/* + * E2B API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.openkruise.agents.client.e2b.api; + +import io.openkruise.agents.client.e2b.api.invoker.ApiCallback; +import io.openkruise.agents.client.e2b.api.invoker.ApiClient; +import io.openkruise.agents.client.e2b.api.invoker.ApiException; +import io.openkruise.agents.client.e2b.api.invoker.ApiResponse; +import io.openkruise.agents.client.e2b.api.invoker.Configuration; +import io.openkruise.agents.client.e2b.api.invoker.Pair; +import io.openkruise.agents.client.e2b.api.invoker.ProgressRequestBody; +import io.openkruise.agents.client.e2b.api.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import io.openkruise.agents.client.e2b.api.models.AssignTemplateTagsRequest; +import io.openkruise.agents.client.e2b.api.models.AssignedTemplateTags; +import io.openkruise.agents.client.e2b.api.models.DeleteTemplateTagsRequest; +import io.openkruise.agents.client.e2b.api.models.Error; +import io.openkruise.agents.client.e2b.api.models.TemplateTag; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.GenericType; + +public class TagsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public TagsApi() { + this(Configuration.getDefaultApiClient()); + } + + public TagsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for templatesTagsDelete + * @param deleteTemplateTagsRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
204 Tags deleted successfully -
400 Bad request -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call templatesTagsDeleteCall(DeleteTemplateTagsRequest deleteTemplateTagsRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = deleteTemplateTagsRequest; + + // create path and map variables + String localVarPath = "/templates/tags"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call templatesTagsDeleteValidateBeforeCall(DeleteTemplateTagsRequest deleteTemplateTagsRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'deleteTemplateTagsRequest' is set + if (deleteTemplateTagsRequest == null) { + throw new ApiException("Missing the required parameter 'deleteTemplateTagsRequest' when calling templatesTagsDelete(Async)"); + } + + return templatesTagsDeleteCall(deleteTemplateTagsRequest, _callback); + + } + + /** + * + * Delete multiple tags from templates + * @param deleteTemplateTagsRequest (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
204 Tags deleted successfully -
400 Bad request -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public void templatesTagsDelete(DeleteTemplateTagsRequest deleteTemplateTagsRequest) throws ApiException { + templatesTagsDeleteWithHttpInfo(deleteTemplateTagsRequest); + } + + /** + * + * Delete multiple tags from templates + * @param deleteTemplateTagsRequest (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
204 Tags deleted successfully -
400 Bad request -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public ApiResponse templatesTagsDeleteWithHttpInfo(DeleteTemplateTagsRequest deleteTemplateTagsRequest) throws ApiException { + okhttp3.Call localVarCall = templatesTagsDeleteValidateBeforeCall(deleteTemplateTagsRequest, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * Delete multiple tags from templates + * @param deleteTemplateTagsRequest (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
204 Tags deleted successfully -
400 Bad request -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call templatesTagsDeleteAsync(DeleteTemplateTagsRequest deleteTemplateTagsRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = templatesTagsDeleteValidateBeforeCall(deleteTemplateTagsRequest, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for templatesTagsPost + * @param assignTemplateTagsRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
201 Tag assigned successfully -
400 Bad request -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call templatesTagsPostCall(AssignTemplateTagsRequest assignTemplateTagsRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = assignTemplateTagsRequest; + + // create path and map variables + String localVarPath = "/templates/tags"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call templatesTagsPostValidateBeforeCall(AssignTemplateTagsRequest assignTemplateTagsRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'assignTemplateTagsRequest' is set + if (assignTemplateTagsRequest == null) { + throw new ApiException("Missing the required parameter 'assignTemplateTagsRequest' when calling templatesTagsPost(Async)"); + } + + return templatesTagsPostCall(assignTemplateTagsRequest, _callback); + + } + + /** + * + * Assign tag(s) to a template build + * @param assignTemplateTagsRequest (required) + * @return AssignedTemplateTags + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
201 Tag assigned successfully -
400 Bad request -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public AssignedTemplateTags templatesTagsPost(AssignTemplateTagsRequest assignTemplateTagsRequest) throws ApiException { + ApiResponse localVarResp = templatesTagsPostWithHttpInfo(assignTemplateTagsRequest); + return localVarResp.getData(); + } + + /** + * + * Assign tag(s) to a template build + * @param assignTemplateTagsRequest (required) + * @return ApiResponse<AssignedTemplateTags> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
201 Tag assigned successfully -
400 Bad request -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public ApiResponse templatesTagsPostWithHttpInfo(AssignTemplateTagsRequest assignTemplateTagsRequest) throws ApiException { + okhttp3.Call localVarCall = templatesTagsPostValidateBeforeCall(assignTemplateTagsRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Assign tag(s) to a template build + * @param assignTemplateTagsRequest (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
201 Tag assigned successfully -
400 Bad request -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call templatesTagsPostAsync(AssignTemplateTagsRequest assignTemplateTagsRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = templatesTagsPostValidateBeforeCall(assignTemplateTagsRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for templatesTemplateIDTagsGet + * @param templateID (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 Successfully returned the template tags -
401 Authentication error -
403 Forbidden -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call templatesTemplateIDTagsGetCall(String templateID, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/templates/{templateID}/tags" + .replace("{" + "templateID" + "}", localVarApiClient.escapeString(templateID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call templatesTemplateIDTagsGetValidateBeforeCall(String templateID, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'templateID' is set + if (templateID == null) { + throw new ApiException("Missing the required parameter 'templateID' when calling templatesTemplateIDTagsGet(Async)"); + } + + return templatesTemplateIDTagsGetCall(templateID, _callback); + + } + + /** + * + * List all tags for a template + * @param templateID (required) + * @return List<TemplateTag> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 Successfully returned the template tags -
401 Authentication error -
403 Forbidden -
404 Not found -
500 Server error -
+ */ + public List templatesTemplateIDTagsGet(String templateID) throws ApiException { + ApiResponse> localVarResp = templatesTemplateIDTagsGetWithHttpInfo(templateID); + return localVarResp.getData(); + } + + /** + * + * List all tags for a template + * @param templateID (required) + * @return ApiResponse<List<TemplateTag>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 Successfully returned the template tags -
401 Authentication error -
403 Forbidden -
404 Not found -
500 Server error -
+ */ + public ApiResponse> templatesTemplateIDTagsGetWithHttpInfo(String templateID) throws ApiException { + okhttp3.Call localVarCall = templatesTemplateIDTagsGetValidateBeforeCall(templateID, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * List all tags for a template + * @param templateID (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 Successfully returned the template tags -
401 Authentication error -
403 Forbidden -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call templatesTemplateIDTagsGetAsync(String templateID, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = templatesTemplateIDTagsGetValidateBeforeCall(templateID, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/TemplatesApi.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/TemplatesApi.java new file mode 100644 index 0000000..250667e --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/TemplatesApi.java @@ -0,0 +1,2303 @@ +/* + * E2B API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.openkruise.agents.client.e2b.api; + +import io.openkruise.agents.client.e2b.api.invoker.ApiCallback; +import io.openkruise.agents.client.e2b.api.invoker.ApiClient; +import io.openkruise.agents.client.e2b.api.invoker.ApiException; +import io.openkruise.agents.client.e2b.api.invoker.ApiResponse; +import io.openkruise.agents.client.e2b.api.invoker.Configuration; +import io.openkruise.agents.client.e2b.api.invoker.Pair; +import io.openkruise.agents.client.e2b.api.invoker.ProgressRequestBody; +import io.openkruise.agents.client.e2b.api.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import io.openkruise.agents.client.e2b.api.models.Error; +import io.openkruise.agents.client.e2b.api.models.LogLevel; +import io.openkruise.agents.client.e2b.api.models.LogsDirection; +import io.openkruise.agents.client.e2b.api.models.LogsSource; +import io.openkruise.agents.client.e2b.api.models.TemplateAliasResponse; +import io.openkruise.agents.client.e2b.api.models.TemplateBuildFileUpload; +import io.openkruise.agents.client.e2b.api.models.TemplateBuildInfo; +import io.openkruise.agents.client.e2b.api.models.TemplateBuildLogsResponse; +import io.openkruise.agents.client.e2b.api.models.TemplateBuildRequest; +import io.openkruise.agents.client.e2b.api.models.TemplateBuildRequestV2; +import io.openkruise.agents.client.e2b.api.models.TemplateBuildRequestV3; +import io.openkruise.agents.client.e2b.api.models.TemplateBuildStartV2; +import io.openkruise.agents.client.e2b.api.models.TemplateLegacy; +import io.openkruise.agents.client.e2b.api.models.TemplateRequestResponseV3; +import io.openkruise.agents.client.e2b.api.models.TemplateUpdateRequest; +import io.openkruise.agents.client.e2b.api.models.TemplateUpdateResponse; +import io.openkruise.agents.client.e2b.api.models.TemplateWithBuilds; +import io.openkruise.agents.client.e2b.api.models.TemplatesGet200ResponseInner; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.GenericType; + +public class TemplatesApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public TemplatesApi() { + this(Configuration.getDefaultApiClient()); + } + + public TemplatesApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for templatesAliasesAliasGet + * @param alias (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 Successfully queried template by alias -
400 Bad request -
403 Forbidden -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call templatesAliasesAliasGetCall(String alias, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/templates/aliases/{alias}" + .replace("{" + "alias" + "}", localVarApiClient.escapeString(alias.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call templatesAliasesAliasGetValidateBeforeCall(String alias, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'alias' is set + if (alias == null) { + throw new ApiException("Missing the required parameter 'alias' when calling templatesAliasesAliasGet(Async)"); + } + + return templatesAliasesAliasGetCall(alias, _callback); + + } + + /** + * + * Check if template with given alias exists + * @param alias (required) + * @return TemplateAliasResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 Successfully queried template by alias -
400 Bad request -
403 Forbidden -
404 Not found -
500 Server error -
+ */ + public TemplateAliasResponse templatesAliasesAliasGet(String alias) throws ApiException { + ApiResponse localVarResp = templatesAliasesAliasGetWithHttpInfo(alias); + return localVarResp.getData(); + } + + /** + * + * Check if template with given alias exists + * @param alias (required) + * @return ApiResponse<TemplateAliasResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 Successfully queried template by alias -
400 Bad request -
403 Forbidden -
404 Not found -
500 Server error -
+ */ + public ApiResponse templatesAliasesAliasGetWithHttpInfo(String alias) throws ApiException { + okhttp3.Call localVarCall = templatesAliasesAliasGetValidateBeforeCall(alias, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Check if template with given alias exists + * @param alias (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 Successfully queried template by alias -
400 Bad request -
403 Forbidden -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call templatesAliasesAliasGetAsync(String alias, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = templatesAliasesAliasGetValidateBeforeCall(alias, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for templatesGet + * @param teamID (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully returned all templates -
401 Authentication error -
500 Server error -
+ */ + public okhttp3.Call templatesGetCall(String teamID, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/templates"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (teamID != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("teamID", teamID)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AccessTokenAuth", "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call templatesGetValidateBeforeCall(String teamID, final ApiCallback _callback) throws ApiException { + return templatesGetCall(teamID, _callback); + + } + + /** + * + * List all templates + * @param teamID (optional) + * @return List<TemplatesGet200ResponseInner> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully returned all templates -
401 Authentication error -
500 Server error -
+ */ + public List templatesGet(String teamID) throws ApiException { + ApiResponse> localVarResp = templatesGetWithHttpInfo(teamID); + return localVarResp.getData(); + } + + /** + * + * List all templates + * @param teamID (optional) + * @return ApiResponse<List<TemplatesGet200ResponseInner>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully returned all templates -
401 Authentication error -
500 Server error -
+ */ + public ApiResponse> templatesGetWithHttpInfo(String teamID) throws ApiException { + okhttp3.Call localVarCall = templatesGetValidateBeforeCall(teamID, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * List all templates + * @param teamID (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully returned all templates -
401 Authentication error -
500 Server error -
+ */ + public okhttp3.Call templatesGetAsync(String teamID, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = templatesGetValidateBeforeCall(teamID, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for templatesPost + * @param templateBuildRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
202 The build was accepted -
400 Bad request -
401 Authentication error -
500 Server error -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call templatesPostCall(TemplateBuildRequest templateBuildRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = templateBuildRequest; + + // create path and map variables + String localVarPath = "/templates"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AccessTokenAuth", "AuthProviderBearerAuth", "Supabase1TokenAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call templatesPostValidateBeforeCall(TemplateBuildRequest templateBuildRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'templateBuildRequest' is set + if (templateBuildRequest == null) { + throw new ApiException("Missing the required parameter 'templateBuildRequest' when calling templatesPost(Async)"); + } + + return templatesPostCall(templateBuildRequest, _callback); + + } + + /** + * + * Create a new template + * @param templateBuildRequest (required) + * @return TemplateLegacy + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
202 The build was accepted -
400 Bad request -
401 Authentication error -
500 Server error -
+ * @deprecated + */ + @Deprecated + public TemplateLegacy templatesPost(TemplateBuildRequest templateBuildRequest) throws ApiException { + ApiResponse localVarResp = templatesPostWithHttpInfo(templateBuildRequest); + return localVarResp.getData(); + } + + /** + * + * Create a new template + * @param templateBuildRequest (required) + * @return ApiResponse<TemplateLegacy> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
202 The build was accepted -
400 Bad request -
401 Authentication error -
500 Server error -
+ * @deprecated + */ + @Deprecated + public ApiResponse templatesPostWithHttpInfo(TemplateBuildRequest templateBuildRequest) throws ApiException { + okhttp3.Call localVarCall = templatesPostValidateBeforeCall(templateBuildRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Create a new template + * @param templateBuildRequest (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
202 The build was accepted -
400 Bad request -
401 Authentication error -
500 Server error -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call templatesPostAsync(TemplateBuildRequest templateBuildRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = templatesPostValidateBeforeCall(templateBuildRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for templatesTemplateIDBuildsBuildIDLogsGet + * @param templateID (required) + * @param buildID (required) + * @param cursor Starting timestamp of the logs that should be returned in milliseconds (optional) + * @param limit Maximum number of logs that should be returned (optional, default to 100) + * @param direction (optional) + * @param level (optional) + * @param source Source of the logs that should be returned from (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Successfully returned the template build logs -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call templatesTemplateIDBuildsBuildIDLogsGetCall(String templateID, String buildID, Long cursor, Integer limit, LogsDirection direction, LogLevel level, LogsSource source, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/templates/{templateID}/builds/{buildID}/logs" + .replace("{" + "templateID" + "}", localVarApiClient.escapeString(templateID.toString())) + .replace("{" + "buildID" + "}", localVarApiClient.escapeString(buildID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (cursor != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("cursor", cursor)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (direction != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("direction", direction)); + } + + if (level != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("level", level)); + } + + if (source != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("source", source)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AccessTokenAuth", "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call templatesTemplateIDBuildsBuildIDLogsGetValidateBeforeCall(String templateID, String buildID, Long cursor, Integer limit, LogsDirection direction, LogLevel level, LogsSource source, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'templateID' is set + if (templateID == null) { + throw new ApiException("Missing the required parameter 'templateID' when calling templatesTemplateIDBuildsBuildIDLogsGet(Async)"); + } + + // verify the required parameter 'buildID' is set + if (buildID == null) { + throw new ApiException("Missing the required parameter 'buildID' when calling templatesTemplateIDBuildsBuildIDLogsGet(Async)"); + } + + return templatesTemplateIDBuildsBuildIDLogsGetCall(templateID, buildID, cursor, limit, direction, level, source, _callback); + + } + + /** + * + * Get template build logs + * @param templateID (required) + * @param buildID (required) + * @param cursor Starting timestamp of the logs that should be returned in milliseconds (optional) + * @param limit Maximum number of logs that should be returned (optional, default to 100) + * @param direction (optional) + * @param level (optional) + * @param source Source of the logs that should be returned from (optional) + * @return TemplateBuildLogsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Successfully returned the template build logs -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public TemplateBuildLogsResponse templatesTemplateIDBuildsBuildIDLogsGet(String templateID, String buildID, Long cursor, Integer limit, LogsDirection direction, LogLevel level, LogsSource source) throws ApiException { + ApiResponse localVarResp = templatesTemplateIDBuildsBuildIDLogsGetWithHttpInfo(templateID, buildID, cursor, limit, direction, level, source); + return localVarResp.getData(); + } + + /** + * + * Get template build logs + * @param templateID (required) + * @param buildID (required) + * @param cursor Starting timestamp of the logs that should be returned in milliseconds (optional) + * @param limit Maximum number of logs that should be returned (optional, default to 100) + * @param direction (optional) + * @param level (optional) + * @param source Source of the logs that should be returned from (optional) + * @return ApiResponse<TemplateBuildLogsResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Successfully returned the template build logs -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public ApiResponse templatesTemplateIDBuildsBuildIDLogsGetWithHttpInfo(String templateID, String buildID, Long cursor, Integer limit, LogsDirection direction, LogLevel level, LogsSource source) throws ApiException { + okhttp3.Call localVarCall = templatesTemplateIDBuildsBuildIDLogsGetValidateBeforeCall(templateID, buildID, cursor, limit, direction, level, source, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Get template build logs + * @param templateID (required) + * @param buildID (required) + * @param cursor Starting timestamp of the logs that should be returned in milliseconds (optional) + * @param limit Maximum number of logs that should be returned (optional, default to 100) + * @param direction (optional) + * @param level (optional) + * @param source Source of the logs that should be returned from (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Successfully returned the template build logs -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call templatesTemplateIDBuildsBuildIDLogsGetAsync(String templateID, String buildID, Long cursor, Integer limit, LogsDirection direction, LogLevel level, LogsSource source, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = templatesTemplateIDBuildsBuildIDLogsGetValidateBeforeCall(templateID, buildID, cursor, limit, direction, level, source, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for templatesTemplateIDBuildsBuildIDPost + * @param templateID (required) + * @param buildID (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
202 The build has started -
401 Authentication error -
500 Server error -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call templatesTemplateIDBuildsBuildIDPostCall(String templateID, String buildID, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/templates/{templateID}/builds/{buildID}" + .replace("{" + "templateID" + "}", localVarApiClient.escapeString(templateID.toString())) + .replace("{" + "buildID" + "}", localVarApiClient.escapeString(buildID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AccessTokenAuth", "AuthProviderBearerAuth", "Supabase1TokenAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call templatesTemplateIDBuildsBuildIDPostValidateBeforeCall(String templateID, String buildID, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'templateID' is set + if (templateID == null) { + throw new ApiException("Missing the required parameter 'templateID' when calling templatesTemplateIDBuildsBuildIDPost(Async)"); + } + + // verify the required parameter 'buildID' is set + if (buildID == null) { + throw new ApiException("Missing the required parameter 'buildID' when calling templatesTemplateIDBuildsBuildIDPost(Async)"); + } + + return templatesTemplateIDBuildsBuildIDPostCall(templateID, buildID, _callback); + + } + + /** + * + * Start the build + * @param templateID (required) + * @param buildID (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
202 The build has started -
401 Authentication error -
500 Server error -
+ * @deprecated + */ + @Deprecated + public void templatesTemplateIDBuildsBuildIDPost(String templateID, String buildID) throws ApiException { + templatesTemplateIDBuildsBuildIDPostWithHttpInfo(templateID, buildID); + } + + /** + * + * Start the build + * @param templateID (required) + * @param buildID (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
202 The build has started -
401 Authentication error -
500 Server error -
+ * @deprecated + */ + @Deprecated + public ApiResponse templatesTemplateIDBuildsBuildIDPostWithHttpInfo(String templateID, String buildID) throws ApiException { + okhttp3.Call localVarCall = templatesTemplateIDBuildsBuildIDPostValidateBeforeCall(templateID, buildID, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * Start the build + * @param templateID (required) + * @param buildID (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
202 The build has started -
401 Authentication error -
500 Server error -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call templatesTemplateIDBuildsBuildIDPostAsync(String templateID, String buildID, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = templatesTemplateIDBuildsBuildIDPostValidateBeforeCall(templateID, buildID, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for templatesTemplateIDBuildsBuildIDStatusGet + * @param templateID (required) + * @param buildID (required) + * @param logsOffset Index of the starting build log that should be returned with the template (optional, default to 0) + * @param limit Maximum number of logs that should be returned (optional, default to 100) + * @param level (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Successfully returned the template -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call templatesTemplateIDBuildsBuildIDStatusGetCall(String templateID, String buildID, Integer logsOffset, Integer limit, LogLevel level, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/templates/{templateID}/builds/{buildID}/status" + .replace("{" + "templateID" + "}", localVarApiClient.escapeString(templateID.toString())) + .replace("{" + "buildID" + "}", localVarApiClient.escapeString(buildID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (logsOffset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("logsOffset", logsOffset)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (level != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("level", level)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AccessTokenAuth", "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call templatesTemplateIDBuildsBuildIDStatusGetValidateBeforeCall(String templateID, String buildID, Integer logsOffset, Integer limit, LogLevel level, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'templateID' is set + if (templateID == null) { + throw new ApiException("Missing the required parameter 'templateID' when calling templatesTemplateIDBuildsBuildIDStatusGet(Async)"); + } + + // verify the required parameter 'buildID' is set + if (buildID == null) { + throw new ApiException("Missing the required parameter 'buildID' when calling templatesTemplateIDBuildsBuildIDStatusGet(Async)"); + } + + return templatesTemplateIDBuildsBuildIDStatusGetCall(templateID, buildID, logsOffset, limit, level, _callback); + + } + + /** + * + * Get template build info + * @param templateID (required) + * @param buildID (required) + * @param logsOffset Index of the starting build log that should be returned with the template (optional, default to 0) + * @param limit Maximum number of logs that should be returned (optional, default to 100) + * @param level (optional) + * @return TemplateBuildInfo + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Successfully returned the template -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public TemplateBuildInfo templatesTemplateIDBuildsBuildIDStatusGet(String templateID, String buildID, Integer logsOffset, Integer limit, LogLevel level) throws ApiException { + ApiResponse localVarResp = templatesTemplateIDBuildsBuildIDStatusGetWithHttpInfo(templateID, buildID, logsOffset, limit, level); + return localVarResp.getData(); + } + + /** + * + * Get template build info + * @param templateID (required) + * @param buildID (required) + * @param logsOffset Index of the starting build log that should be returned with the template (optional, default to 0) + * @param limit Maximum number of logs that should be returned (optional, default to 100) + * @param level (optional) + * @return ApiResponse<TemplateBuildInfo> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Successfully returned the template -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public ApiResponse templatesTemplateIDBuildsBuildIDStatusGetWithHttpInfo(String templateID, String buildID, Integer logsOffset, Integer limit, LogLevel level) throws ApiException { + okhttp3.Call localVarCall = templatesTemplateIDBuildsBuildIDStatusGetValidateBeforeCall(templateID, buildID, logsOffset, limit, level, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Get template build info + * @param templateID (required) + * @param buildID (required) + * @param logsOffset Index of the starting build log that should be returned with the template (optional, default to 0) + * @param limit Maximum number of logs that should be returned (optional, default to 100) + * @param level (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Successfully returned the template -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call templatesTemplateIDBuildsBuildIDStatusGetAsync(String templateID, String buildID, Integer logsOffset, Integer limit, LogLevel level, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = templatesTemplateIDBuildsBuildIDStatusGetValidateBeforeCall(templateID, buildID, logsOffset, limit, level, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for templatesTemplateIDDelete + * @param templateID (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
204 The template was deleted successfully -
401 Authentication error -
500 Server error -
+ */ + public okhttp3.Call templatesTemplateIDDeleteCall(String templateID, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/templates/{templateID}" + .replace("{" + "templateID" + "}", localVarApiClient.escapeString(templateID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AccessTokenAuth", "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call templatesTemplateIDDeleteValidateBeforeCall(String templateID, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'templateID' is set + if (templateID == null) { + throw new ApiException("Missing the required parameter 'templateID' when calling templatesTemplateIDDelete(Async)"); + } + + return templatesTemplateIDDeleteCall(templateID, _callback); + + } + + /** + * + * Delete a template + * @param templateID (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
204 The template was deleted successfully -
401 Authentication error -
500 Server error -
+ */ + public void templatesTemplateIDDelete(String templateID) throws ApiException { + templatesTemplateIDDeleteWithHttpInfo(templateID); + } + + /** + * + * Delete a template + * @param templateID (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
204 The template was deleted successfully -
401 Authentication error -
500 Server error -
+ */ + public ApiResponse templatesTemplateIDDeleteWithHttpInfo(String templateID) throws ApiException { + okhttp3.Call localVarCall = templatesTemplateIDDeleteValidateBeforeCall(templateID, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * Delete a template + * @param templateID (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
204 The template was deleted successfully -
401 Authentication error -
500 Server error -
+ */ + public okhttp3.Call templatesTemplateIDDeleteAsync(String templateID, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = templatesTemplateIDDeleteValidateBeforeCall(templateID, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for templatesTemplateIDFilesHashGet + * @param templateID (required) + * @param hash (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
201 The upload link where to upload the tar file -
400 Bad request -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call templatesTemplateIDFilesHashGetCall(String templateID, String hash, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/templates/{templateID}/files/{hash}" + .replace("{" + "templateID" + "}", localVarApiClient.escapeString(templateID.toString())) + .replace("{" + "hash" + "}", localVarApiClient.escapeString(hash.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AccessTokenAuth", "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call templatesTemplateIDFilesHashGetValidateBeforeCall(String templateID, String hash, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'templateID' is set + if (templateID == null) { + throw new ApiException("Missing the required parameter 'templateID' when calling templatesTemplateIDFilesHashGet(Async)"); + } + + // verify the required parameter 'hash' is set + if (hash == null) { + throw new ApiException("Missing the required parameter 'hash' when calling templatesTemplateIDFilesHashGet(Async)"); + } + + return templatesTemplateIDFilesHashGetCall(templateID, hash, _callback); + + } + + /** + * + * Get an upload link for a tar file containing build layer files + * @param templateID (required) + * @param hash (required) + * @return TemplateBuildFileUpload + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
201 The upload link where to upload the tar file -
400 Bad request -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public TemplateBuildFileUpload templatesTemplateIDFilesHashGet(String templateID, String hash) throws ApiException { + ApiResponse localVarResp = templatesTemplateIDFilesHashGetWithHttpInfo(templateID, hash); + return localVarResp.getData(); + } + + /** + * + * Get an upload link for a tar file containing build layer files + * @param templateID (required) + * @param hash (required) + * @return ApiResponse<TemplateBuildFileUpload> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
201 The upload link where to upload the tar file -
400 Bad request -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public ApiResponse templatesTemplateIDFilesHashGetWithHttpInfo(String templateID, String hash) throws ApiException { + okhttp3.Call localVarCall = templatesTemplateIDFilesHashGetValidateBeforeCall(templateID, hash, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Get an upload link for a tar file containing build layer files + * @param templateID (required) + * @param hash (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
201 The upload link where to upload the tar file -
400 Bad request -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call templatesTemplateIDFilesHashGetAsync(String templateID, String hash, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = templatesTemplateIDFilesHashGetValidateBeforeCall(templateID, hash, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for templatesTemplateIDGet + * @param templateID (required) + * @param nextToken Cursor to start the list from (optional) + * @param limit Maximum number of items to return per page (optional, default to 100) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully returned the template with its builds -
401 Authentication error -
500 Server error -
+ */ + public okhttp3.Call templatesTemplateIDGetCall(String templateID, String nextToken, Integer limit, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/templates/{templateID}" + .replace("{" + "templateID" + "}", localVarApiClient.escapeString(templateID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (nextToken != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("nextToken", nextToken)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call templatesTemplateIDGetValidateBeforeCall(String templateID, String nextToken, Integer limit, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'templateID' is set + if (templateID == null) { + throw new ApiException("Missing the required parameter 'templateID' when calling templatesTemplateIDGet(Async)"); + } + + return templatesTemplateIDGetCall(templateID, nextToken, limit, _callback); + + } + + /** + * + * List all builds for a template + * @param templateID (required) + * @param nextToken Cursor to start the list from (optional) + * @param limit Maximum number of items to return per page (optional, default to 100) + * @return TemplateWithBuilds + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully returned the template with its builds -
401 Authentication error -
500 Server error -
+ */ + public TemplateWithBuilds templatesTemplateIDGet(String templateID, String nextToken, Integer limit) throws ApiException { + ApiResponse localVarResp = templatesTemplateIDGetWithHttpInfo(templateID, nextToken, limit); + return localVarResp.getData(); + } + + /** + * + * List all builds for a template + * @param templateID (required) + * @param nextToken Cursor to start the list from (optional) + * @param limit Maximum number of items to return per page (optional, default to 100) + * @return ApiResponse<TemplateWithBuilds> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully returned the template with its builds -
401 Authentication error -
500 Server error -
+ */ + public ApiResponse templatesTemplateIDGetWithHttpInfo(String templateID, String nextToken, Integer limit) throws ApiException { + okhttp3.Call localVarCall = templatesTemplateIDGetValidateBeforeCall(templateID, nextToken, limit, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * List all builds for a template + * @param templateID (required) + * @param nextToken Cursor to start the list from (optional) + * @param limit Maximum number of items to return per page (optional, default to 100) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully returned the template with its builds -
401 Authentication error -
500 Server error -
+ */ + public okhttp3.Call templatesTemplateIDGetAsync(String templateID, String nextToken, Integer limit, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = templatesTemplateIDGetValidateBeforeCall(templateID, nextToken, limit, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for templatesTemplateIDPatch + * @param templateID (required) + * @param templateUpdateRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 The template was updated successfully -
400 Bad request -
401 Authentication error -
500 Server error -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call templatesTemplateIDPatchCall(String templateID, TemplateUpdateRequest templateUpdateRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = templateUpdateRequest; + + // create path and map variables + String localVarPath = "/templates/{templateID}" + .replace("{" + "templateID" + "}", localVarApiClient.escapeString(templateID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AccessTokenAuth", "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call templatesTemplateIDPatchValidateBeforeCall(String templateID, TemplateUpdateRequest templateUpdateRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'templateID' is set + if (templateID == null) { + throw new ApiException("Missing the required parameter 'templateID' when calling templatesTemplateIDPatch(Async)"); + } + + // verify the required parameter 'templateUpdateRequest' is set + if (templateUpdateRequest == null) { + throw new ApiException("Missing the required parameter 'templateUpdateRequest' when calling templatesTemplateIDPatch(Async)"); + } + + return templatesTemplateIDPatchCall(templateID, templateUpdateRequest, _callback); + + } + + /** + * + * Update template + * @param templateID (required) + * @param templateUpdateRequest (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 The template was updated successfully -
400 Bad request -
401 Authentication error -
500 Server error -
+ * @deprecated + */ + @Deprecated + public void templatesTemplateIDPatch(String templateID, TemplateUpdateRequest templateUpdateRequest) throws ApiException { + templatesTemplateIDPatchWithHttpInfo(templateID, templateUpdateRequest); + } + + /** + * + * Update template + * @param templateID (required) + * @param templateUpdateRequest (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 The template was updated successfully -
400 Bad request -
401 Authentication error -
500 Server error -
+ * @deprecated + */ + @Deprecated + public ApiResponse templatesTemplateIDPatchWithHttpInfo(String templateID, TemplateUpdateRequest templateUpdateRequest) throws ApiException { + okhttp3.Call localVarCall = templatesTemplateIDPatchValidateBeforeCall(templateID, templateUpdateRequest, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * Update template + * @param templateID (required) + * @param templateUpdateRequest (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 The template was updated successfully -
400 Bad request -
401 Authentication error -
500 Server error -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call templatesTemplateIDPatchAsync(String templateID, TemplateUpdateRequest templateUpdateRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = templatesTemplateIDPatchValidateBeforeCall(templateID, templateUpdateRequest, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for templatesTemplateIDPost + * @param templateID (required) + * @param templateBuildRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
202 The build was accepted -
401 Authentication error -
500 Server error -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call templatesTemplateIDPostCall(String templateID, TemplateBuildRequest templateBuildRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = templateBuildRequest; + + // create path and map variables + String localVarPath = "/templates/{templateID}" + .replace("{" + "templateID" + "}", localVarApiClient.escapeString(templateID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AccessTokenAuth", "AuthProviderBearerAuth", "Supabase1TokenAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call templatesTemplateIDPostValidateBeforeCall(String templateID, TemplateBuildRequest templateBuildRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'templateID' is set + if (templateID == null) { + throw new ApiException("Missing the required parameter 'templateID' when calling templatesTemplateIDPost(Async)"); + } + + // verify the required parameter 'templateBuildRequest' is set + if (templateBuildRequest == null) { + throw new ApiException("Missing the required parameter 'templateBuildRequest' when calling templatesTemplateIDPost(Async)"); + } + + return templatesTemplateIDPostCall(templateID, templateBuildRequest, _callback); + + } + + /** + * + * Rebuild an template + * @param templateID (required) + * @param templateBuildRequest (required) + * @return TemplateLegacy + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
202 The build was accepted -
401 Authentication error -
500 Server error -
+ * @deprecated + */ + @Deprecated + public TemplateLegacy templatesTemplateIDPost(String templateID, TemplateBuildRequest templateBuildRequest) throws ApiException { + ApiResponse localVarResp = templatesTemplateIDPostWithHttpInfo(templateID, templateBuildRequest); + return localVarResp.getData(); + } + + /** + * + * Rebuild an template + * @param templateID (required) + * @param templateBuildRequest (required) + * @return ApiResponse<TemplateLegacy> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
202 The build was accepted -
401 Authentication error -
500 Server error -
+ * @deprecated + */ + @Deprecated + public ApiResponse templatesTemplateIDPostWithHttpInfo(String templateID, TemplateBuildRequest templateBuildRequest) throws ApiException { + okhttp3.Call localVarCall = templatesTemplateIDPostValidateBeforeCall(templateID, templateBuildRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Rebuild an template + * @param templateID (required) + * @param templateBuildRequest (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
202 The build was accepted -
401 Authentication error -
500 Server error -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call templatesTemplateIDPostAsync(String templateID, TemplateBuildRequest templateBuildRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = templatesTemplateIDPostValidateBeforeCall(templateID, templateBuildRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for v2TemplatesPost + * @param templateBuildRequestV2 (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
202 The build was requested successfully -
400 Bad request -
401 Authentication error -
500 Server error -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call v2TemplatesPostCall(TemplateBuildRequestV2 templateBuildRequestV2, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = templateBuildRequestV2; + + // create path and map variables + String localVarPath = "/v2/templates"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call v2TemplatesPostValidateBeforeCall(TemplateBuildRequestV2 templateBuildRequestV2, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'templateBuildRequestV2' is set + if (templateBuildRequestV2 == null) { + throw new ApiException("Missing the required parameter 'templateBuildRequestV2' when calling v2TemplatesPost(Async)"); + } + + return v2TemplatesPostCall(templateBuildRequestV2, _callback); + + } + + /** + * + * Create a new template + * @param templateBuildRequestV2 (required) + * @return TemplateLegacy + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
202 The build was requested successfully -
400 Bad request -
401 Authentication error -
500 Server error -
+ * @deprecated + */ + @Deprecated + public TemplateLegacy v2TemplatesPost(TemplateBuildRequestV2 templateBuildRequestV2) throws ApiException { + ApiResponse localVarResp = v2TemplatesPostWithHttpInfo(templateBuildRequestV2); + return localVarResp.getData(); + } + + /** + * + * Create a new template + * @param templateBuildRequestV2 (required) + * @return ApiResponse<TemplateLegacy> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
202 The build was requested successfully -
400 Bad request -
401 Authentication error -
500 Server error -
+ * @deprecated + */ + @Deprecated + public ApiResponse v2TemplatesPostWithHttpInfo(TemplateBuildRequestV2 templateBuildRequestV2) throws ApiException { + okhttp3.Call localVarCall = v2TemplatesPostValidateBeforeCall(templateBuildRequestV2, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Create a new template + * @param templateBuildRequestV2 (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
202 The build was requested successfully -
400 Bad request -
401 Authentication error -
500 Server error -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call v2TemplatesPostAsync(TemplateBuildRequestV2 templateBuildRequestV2, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v2TemplatesPostValidateBeforeCall(templateBuildRequestV2, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for v2TemplatesTemplateIDBuildsBuildIDPost + * @param templateID (required) + * @param buildID (required) + * @param templateBuildStartV2 (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
202 The build has started -
401 Authentication error -
500 Server error -
+ */ + public okhttp3.Call v2TemplatesTemplateIDBuildsBuildIDPostCall(String templateID, String buildID, TemplateBuildStartV2 templateBuildStartV2, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = templateBuildStartV2; + + // create path and map variables + String localVarPath = "/v2/templates/{templateID}/builds/{buildID}" + .replace("{" + "templateID" + "}", localVarApiClient.escapeString(templateID.toString())) + .replace("{" + "buildID" + "}", localVarApiClient.escapeString(buildID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v2TemplatesTemplateIDBuildsBuildIDPostValidateBeforeCall(String templateID, String buildID, TemplateBuildStartV2 templateBuildStartV2, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'templateID' is set + if (templateID == null) { + throw new ApiException("Missing the required parameter 'templateID' when calling v2TemplatesTemplateIDBuildsBuildIDPost(Async)"); + } + + // verify the required parameter 'buildID' is set + if (buildID == null) { + throw new ApiException("Missing the required parameter 'buildID' when calling v2TemplatesTemplateIDBuildsBuildIDPost(Async)"); + } + + // verify the required parameter 'templateBuildStartV2' is set + if (templateBuildStartV2 == null) { + throw new ApiException("Missing the required parameter 'templateBuildStartV2' when calling v2TemplatesTemplateIDBuildsBuildIDPost(Async)"); + } + + return v2TemplatesTemplateIDBuildsBuildIDPostCall(templateID, buildID, templateBuildStartV2, _callback); + + } + + /** + * + * Start the build + * @param templateID (required) + * @param buildID (required) + * @param templateBuildStartV2 (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
202 The build has started -
401 Authentication error -
500 Server error -
+ */ + public void v2TemplatesTemplateIDBuildsBuildIDPost(String templateID, String buildID, TemplateBuildStartV2 templateBuildStartV2) throws ApiException { + v2TemplatesTemplateIDBuildsBuildIDPostWithHttpInfo(templateID, buildID, templateBuildStartV2); + } + + /** + * + * Start the build + * @param templateID (required) + * @param buildID (required) + * @param templateBuildStartV2 (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
202 The build has started -
401 Authentication error -
500 Server error -
+ */ + public ApiResponse v2TemplatesTemplateIDBuildsBuildIDPostWithHttpInfo(String templateID, String buildID, TemplateBuildStartV2 templateBuildStartV2) throws ApiException { + okhttp3.Call localVarCall = v2TemplatesTemplateIDBuildsBuildIDPostValidateBeforeCall(templateID, buildID, templateBuildStartV2, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * Start the build + * @param templateID (required) + * @param buildID (required) + * @param templateBuildStartV2 (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
202 The build has started -
401 Authentication error -
500 Server error -
+ */ + public okhttp3.Call v2TemplatesTemplateIDBuildsBuildIDPostAsync(String templateID, String buildID, TemplateBuildStartV2 templateBuildStartV2, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v2TemplatesTemplateIDBuildsBuildIDPostValidateBeforeCall(templateID, buildID, templateBuildStartV2, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for v2TemplatesTemplateIDPatch + * @param templateID (required) + * @param templateUpdateRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 The template was updated successfully -
400 Bad request -
401 Authentication error -
500 Server error -
+ */ + public okhttp3.Call v2TemplatesTemplateIDPatchCall(String templateID, TemplateUpdateRequest templateUpdateRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = templateUpdateRequest; + + // create path and map variables + String localVarPath = "/v2/templates/{templateID}" + .replace("{" + "templateID" + "}", localVarApiClient.escapeString(templateID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AccessTokenAuth", "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v2TemplatesTemplateIDPatchValidateBeforeCall(String templateID, TemplateUpdateRequest templateUpdateRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'templateID' is set + if (templateID == null) { + throw new ApiException("Missing the required parameter 'templateID' when calling v2TemplatesTemplateIDPatch(Async)"); + } + + // verify the required parameter 'templateUpdateRequest' is set + if (templateUpdateRequest == null) { + throw new ApiException("Missing the required parameter 'templateUpdateRequest' when calling v2TemplatesTemplateIDPatch(Async)"); + } + + return v2TemplatesTemplateIDPatchCall(templateID, templateUpdateRequest, _callback); + + } + + /** + * + * Update template + * @param templateID (required) + * @param templateUpdateRequest (required) + * @return TemplateUpdateResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 The template was updated successfully -
400 Bad request -
401 Authentication error -
500 Server error -
+ */ + public TemplateUpdateResponse v2TemplatesTemplateIDPatch(String templateID, TemplateUpdateRequest templateUpdateRequest) throws ApiException { + ApiResponse localVarResp = v2TemplatesTemplateIDPatchWithHttpInfo(templateID, templateUpdateRequest); + return localVarResp.getData(); + } + + /** + * + * Update template + * @param templateID (required) + * @param templateUpdateRequest (required) + * @return ApiResponse<TemplateUpdateResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 The template was updated successfully -
400 Bad request -
401 Authentication error -
500 Server error -
+ */ + public ApiResponse v2TemplatesTemplateIDPatchWithHttpInfo(String templateID, TemplateUpdateRequest templateUpdateRequest) throws ApiException { + okhttp3.Call localVarCall = v2TemplatesTemplateIDPatchValidateBeforeCall(templateID, templateUpdateRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Update template + * @param templateID (required) + * @param templateUpdateRequest (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 The template was updated successfully -
400 Bad request -
401 Authentication error -
500 Server error -
+ */ + public okhttp3.Call v2TemplatesTemplateIDPatchAsync(String templateID, TemplateUpdateRequest templateUpdateRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v2TemplatesTemplateIDPatchValidateBeforeCall(templateID, templateUpdateRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for v3TemplatesPost + * @param templateBuildRequestV3 (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
202 The build was requested successfully -
400 Bad request -
401 Authentication error -
403 Forbidden -
500 Server error -
+ */ + public okhttp3.Call v3TemplatesPostCall(TemplateBuildRequestV3 templateBuildRequestV3, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = templateBuildRequestV3; + + // create path and map variables + String localVarPath = "/v3/templates"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3TemplatesPostValidateBeforeCall(TemplateBuildRequestV3 templateBuildRequestV3, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'templateBuildRequestV3' is set + if (templateBuildRequestV3 == null) { + throw new ApiException("Missing the required parameter 'templateBuildRequestV3' when calling v3TemplatesPost(Async)"); + } + + return v3TemplatesPostCall(templateBuildRequestV3, _callback); + + } + + /** + * + * Create a new template + * @param templateBuildRequestV3 (required) + * @return TemplateRequestResponseV3 + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
202 The build was requested successfully -
400 Bad request -
401 Authentication error -
403 Forbidden -
500 Server error -
+ */ + public TemplateRequestResponseV3 v3TemplatesPost(TemplateBuildRequestV3 templateBuildRequestV3) throws ApiException { + ApiResponse localVarResp = v3TemplatesPostWithHttpInfo(templateBuildRequestV3); + return localVarResp.getData(); + } + + /** + * + * Create a new template + * @param templateBuildRequestV3 (required) + * @return ApiResponse<TemplateRequestResponseV3> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
202 The build was requested successfully -
400 Bad request -
401 Authentication error -
403 Forbidden -
500 Server error -
+ */ + public ApiResponse v3TemplatesPostWithHttpInfo(TemplateBuildRequestV3 templateBuildRequestV3) throws ApiException { + okhttp3.Call localVarCall = v3TemplatesPostValidateBeforeCall(templateBuildRequestV3, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Create a new template + * @param templateBuildRequestV3 (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
202 The build was requested successfully -
400 Bad request -
401 Authentication error -
403 Forbidden -
500 Server error -
+ */ + public okhttp3.Call v3TemplatesPostAsync(TemplateBuildRequestV3 templateBuildRequestV3, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3TemplatesPostValidateBeforeCall(templateBuildRequestV3, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/VolumesApi.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/VolumesApi.java new file mode 100644 index 0000000..f523bfb --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/VolumesApi.java @@ -0,0 +1,601 @@ +/* + * E2B API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.openkruise.agents.client.e2b.api; + +import io.openkruise.agents.client.e2b.api.invoker.ApiCallback; +import io.openkruise.agents.client.e2b.api.invoker.ApiClient; +import io.openkruise.agents.client.e2b.api.invoker.ApiException; +import io.openkruise.agents.client.e2b.api.invoker.ApiResponse; +import io.openkruise.agents.client.e2b.api.invoker.Configuration; +import io.openkruise.agents.client.e2b.api.invoker.Pair; +import io.openkruise.agents.client.e2b.api.invoker.ProgressRequestBody; +import io.openkruise.agents.client.e2b.api.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import io.openkruise.agents.client.e2b.api.models.Error; +import io.openkruise.agents.client.e2b.api.models.NewVolume; +import io.openkruise.agents.client.e2b.api.models.Volume; +import io.openkruise.agents.client.e2b.api.models.VolumeAndToken; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.ws.rs.core.GenericType; + +public class VolumesApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public VolumesApi() { + this(Configuration.getDefaultApiClient()); + } + + public VolumesApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for volumesGet + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully listed all team volumes -
401 Authentication error -
500 Server error -
+ */ + public okhttp3.Call volumesGetCall(final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/volumes"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call volumesGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return volumesGetCall(_callback); + + } + + /** + * + * List all team volumes + * @return List<Volume> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully listed all team volumes -
401 Authentication error -
500 Server error -
+ */ + public List volumesGet() throws ApiException { + ApiResponse> localVarResp = volumesGetWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * + * List all team volumes + * @return ApiResponse<List<Volume>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully listed all team volumes -
401 Authentication error -
500 Server error -
+ */ + public ApiResponse> volumesGetWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = volumesGetValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * List all team volumes + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Successfully listed all team volumes -
401 Authentication error -
500 Server error -
+ */ + public okhttp3.Call volumesGetAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = volumesGetValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for volumesPost + * @param newVolume (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Successfully created a new team volume -
400 Bad request -
401 Authentication error -
500 Server error -
+ */ + public okhttp3.Call volumesPostCall(NewVolume newVolume, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = newVolume; + + // create path and map variables + String localVarPath = "/volumes"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call volumesPostValidateBeforeCall(NewVolume newVolume, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'newVolume' is set + if (newVolume == null) { + throw new ApiException("Missing the required parameter 'newVolume' when calling volumesPost(Async)"); + } + + return volumesPostCall(newVolume, _callback); + + } + + /** + * + * Create a new team volume + * @param newVolume (required) + * @return VolumeAndToken + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Successfully created a new team volume -
400 Bad request -
401 Authentication error -
500 Server error -
+ */ + public VolumeAndToken volumesPost(NewVolume newVolume) throws ApiException { + ApiResponse localVarResp = volumesPostWithHttpInfo(newVolume); + return localVarResp.getData(); + } + + /** + * + * Create a new team volume + * @param newVolume (required) + * @return ApiResponse<VolumeAndToken> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Successfully created a new team volume -
400 Bad request -
401 Authentication error -
500 Server error -
+ */ + public ApiResponse volumesPostWithHttpInfo(NewVolume newVolume) throws ApiException { + okhttp3.Call localVarCall = volumesPostValidateBeforeCall(newVolume, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Create a new team volume + * @param newVolume (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Successfully created a new team volume -
400 Bad request -
401 Authentication error -
500 Server error -
+ */ + public okhttp3.Call volumesPostAsync(NewVolume newVolume, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = volumesPostValidateBeforeCall(newVolume, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for volumesVolumeIDDelete + * @param volumeID (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Successfully deleted a team volume -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call volumesVolumeIDDeleteCall(String volumeID, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/volumes/{volumeID}" + .replace("{" + "volumeID" + "}", localVarApiClient.escapeString(volumeID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call volumesVolumeIDDeleteValidateBeforeCall(String volumeID, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'volumeID' is set + if (volumeID == null) { + throw new ApiException("Missing the required parameter 'volumeID' when calling volumesVolumeIDDelete(Async)"); + } + + return volumesVolumeIDDeleteCall(volumeID, _callback); + + } + + /** + * + * Delete a team volume + * @param volumeID (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Successfully deleted a team volume -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public void volumesVolumeIDDelete(String volumeID) throws ApiException { + volumesVolumeIDDeleteWithHttpInfo(volumeID); + } + + /** + * + * Delete a team volume + * @param volumeID (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Successfully deleted a team volume -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public ApiResponse volumesVolumeIDDeleteWithHttpInfo(String volumeID) throws ApiException { + okhttp3.Call localVarCall = volumesVolumeIDDeleteValidateBeforeCall(volumeID, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * (asynchronously) + * Delete a team volume + * @param volumeID (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Successfully deleted a team volume -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call volumesVolumeIDDeleteAsync(String volumeID, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = volumesVolumeIDDeleteValidateBeforeCall(volumeID, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for volumesVolumeIDGet + * @param volumeID (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Successfully retrieved a team volume -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call volumesVolumeIDGetCall(String volumeID, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/volumes/{volumeID}" + .replace("{" + "volumeID" + "}", localVarApiClient.escapeString(volumeID.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "AuthProviderBearerAuth", "Supabase1TokenAuth", "ApiKeyAuth", "Supabase2TeamAuth", "AuthProviderTeamAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call volumesVolumeIDGetValidateBeforeCall(String volumeID, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'volumeID' is set + if (volumeID == null) { + throw new ApiException("Missing the required parameter 'volumeID' when calling volumesVolumeIDGet(Async)"); + } + + return volumesVolumeIDGetCall(volumeID, _callback); + + } + + /** + * + * Get team volume info + * @param volumeID (required) + * @return VolumeAndToken + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Successfully retrieved a team volume -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public VolumeAndToken volumesVolumeIDGet(String volumeID) throws ApiException { + ApiResponse localVarResp = volumesVolumeIDGetWithHttpInfo(volumeID); + return localVarResp.getData(); + } + + /** + * + * Get team volume info + * @param volumeID (required) + * @return ApiResponse<VolumeAndToken> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Successfully retrieved a team volume -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public ApiResponse volumesVolumeIDGetWithHttpInfo(String volumeID) throws ApiException { + okhttp3.Call localVarCall = volumesVolumeIDGetValidateBeforeCall(volumeID, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Get team volume info + * @param volumeID (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Successfully retrieved a team volume -
401 Authentication error -
404 Not found -
500 Server error -
+ */ + public okhttp3.Call volumesVolumeIDGetAsync(String volumeID, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = volumesVolumeIDGetValidateBeforeCall(volumeID, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/ApiClient.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/ApiClient.java index 7a33449..6673992 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/ApiClient.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/ApiClient.java @@ -103,6 +103,8 @@ public ApiClient() { authentications.put("AccessTokenAuth", new HttpBearerAuth("bearer")); authentications.put("Supabase1TokenAuth", new ApiKeyAuth("header", "X-Supabase-Token")); authentications.put("Supabase2TeamAuth", new ApiKeyAuth("header", "X-Supabase-Team")); + authentications.put("AuthProviderBearerAuth", new HttpBearerAuth("bearer")); + authentications.put("AuthProviderTeamAuth", new ApiKeyAuth("header", "X-Team-ID")); authentications.put("AdminTokenAuth", new ApiKeyAuth("header", "X-Admin-Token")); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); @@ -111,7 +113,7 @@ public ApiClient() { /** * Basic constructor with custom OkHttpClient * - * @param client a {@link OkHttpClient} object + * @param client a {@link okhttp3.OkHttpClient} object */ public ApiClient(OkHttpClient client) { init(); @@ -123,6 +125,8 @@ public ApiClient(OkHttpClient client) { authentications.put("AccessTokenAuth", new HttpBearerAuth("bearer")); authentications.put("Supabase1TokenAuth", new ApiKeyAuth("header", "X-Supabase-Token")); authentications.put("Supabase2TeamAuth", new ApiKeyAuth("header", "X-Supabase-Team")); + authentications.put("AuthProviderBearerAuth", new HttpBearerAuth("bearer")); + authentications.put("AuthProviderTeamAuth", new ApiKeyAuth("header", "X-Team-ID")); authentications.put("AdminTokenAuth", new ApiKeyAuth("header", "X-Admin-Token")); // Prevent the authentications from being modified. authentications = Collections.unmodifiableMap(authentications); @@ -215,7 +219,7 @@ public OkHttpClient getHttpClient() { * * @param newHttpClient An instance of OkHttpClient * @return Api Client - * @throws NullPointerException when newHttpClient is null + * @throws java.lang.NullPointerException when newHttpClient is null */ public ApiClient setHttpClient(OkHttpClient newHttpClient) { this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); @@ -290,7 +294,7 @@ public ApiClient setSslCaCert(InputStream sslCaCert) { /** *

Getter for the field keyManagers.

* - * @return an array of {@link KeyManager} objects + * @return an array of {@link javax.net.ssl.KeyManager} objects */ public KeyManager[] getKeyManagers() { return keyManagers; @@ -312,7 +316,7 @@ public ApiClient setKeyManagers(KeyManager[] managers) { /** *

Getter for the field dateFormat.

* - * @return a {@link DateFormat} object + * @return a {@link java.text.DateFormat} object */ public DateFormat getDateFormat() { return dateFormat; @@ -321,8 +325,8 @@ public DateFormat getDateFormat() { /** *

Setter for the field dateFormat.

* - * @param dateFormat a {@link DateFormat} object - * @return a {@link ApiClient} object + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link io.openkruise.agents.client.e2b.api.invoker.ApiClient} object */ public ApiClient setDateFormat(DateFormat dateFormat) { JSON.setDateFormat(dateFormat); @@ -332,8 +336,8 @@ public ApiClient setDateFormat(DateFormat dateFormat) { /** *

Set SqlDateFormat.

* - * @param dateFormat a {@link DateFormat} object - * @return a {@link ApiClient} object + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link io.openkruise.agents.client.e2b.api.invoker.ApiClient} object */ public ApiClient setSqlDateFormat(DateFormat dateFormat) { JSON.setSqlDateFormat(dateFormat); @@ -343,8 +347,8 @@ public ApiClient setSqlDateFormat(DateFormat dateFormat) { /** *

Set OffsetDateTimeFormat.

* - * @param dateFormat a {@link DateTimeFormatter} object - * @return a {@link ApiClient} object + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link io.openkruise.agents.client.e2b.api.invoker.ApiClient} object */ public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { JSON.setOffsetDateTimeFormat(dateFormat); @@ -354,8 +358,8 @@ public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { /** *

Set LocalDateFormat.

* - * @param dateFormat a {@link DateTimeFormatter} object - * @return a {@link ApiClient} object + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link io.openkruise.agents.client.e2b.api.invoker.ApiClient} object */ public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { JSON.setLocalDateFormat(dateFormat); @@ -366,7 +370,7 @@ public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { *

Set LenientOnJson.

* * @param lenientOnJson a boolean - * @return a {@link ApiClient} object + * @return a {@link io.openkruise.agents.client.e2b.api.invoker.ApiClient} object */ public ApiClient setLenientOnJson(boolean lenientOnJson) { JSON.setLenientOnJson(lenientOnJson); @@ -589,7 +593,7 @@ public int getConnectTimeout() { /** * Sets the connect timeout (in milliseconds). * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. + * {@link java.lang.Integer#MAX_VALUE}. * * @param connectionTimeout connection timeout in milliseconds * @return Api client @@ -611,7 +615,7 @@ public int getReadTimeout() { /** * Sets the read timeout (in milliseconds). * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. + * {@link java.lang.Integer#MAX_VALUE}. * * @param readTimeout read timeout in milliseconds * @return Api client @@ -633,7 +637,7 @@ public int getWriteTimeout() { /** * Sets the write timeout (in milliseconds). * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. + * {@link java.lang.Integer#MAX_VALUE}. * * @param writeTimeout connection timeout in milliseconds * @return Api client @@ -873,7 +877,7 @@ public String escapeString(String str) { * @param response HTTP response * @param returnType The type of the Java object * @return The deserialized Java object - * @throws ApiException If fail to deserialize response body, i.e. cannot read response body + * @throws io.openkruise.agents.client.e2b.api.invoker.ApiException If fail to deserialize response body, i.e. cannot read response body * or the Content-Type of the response is not supported. */ @SuppressWarnings("unchecked") @@ -934,7 +938,7 @@ public T deserialize(Response response, Type returnType) throws ApiException * @param obj The Java object * @param contentType The request Content-Type * @return The serialized request body - * @throws ApiException If fail to serialize the given object + * @throws io.openkruise.agents.client.e2b.api.invoker.ApiException If fail to serialize the given object */ public RequestBody serialize(Object obj, String contentType) throws ApiException { if (obj instanceof byte[]) { @@ -964,7 +968,7 @@ public RequestBody serialize(Object obj, String contentType) throws ApiException * Download file from the given response. * * @param response An instance of the Response object - * @throws ApiException If fail to read file content from response and write to disk + * @throws io.openkruise.agents.client.e2b.api.invoker.ApiException If fail to read file content from response and write to disk * @return Downloaded file */ public File downloadFileFromResponse(Response response) throws ApiException { @@ -984,7 +988,7 @@ public File downloadFileFromResponse(Response response) throws ApiException { * * @param response An instance of the Response object * @return Prepared file for the download - * @throws IOException If fail to prepare file for download + * @throws java.io.IOException If fail to prepare file for download */ public File prepareDownloadFile(Response response) throws IOException { String filename = null; @@ -1028,7 +1032,7 @@ public File prepareDownloadFile(Response response) throws IOException { * @param Type * @param call An instance of the Call object * @return ApiResponse<T> - * @throws ApiException If fail to execute the call + * @throws io.openkruise.agents.client.e2b.api.invoker.ApiException If fail to execute the call */ public ApiResponse execute(Call call) throws ApiException { return execute(call, null); @@ -1043,7 +1047,7 @@ public ApiResponse execute(Call call) throws ApiException { * @return ApiResponse object containing response status, headers and * data, which is a Java object deserialized from response body and would be null * when returnType is null. - * @throws ApiException If fail to execute the call + * @throws io.openkruise.agents.client.e2b.api.invoker.ApiException If fail to execute the call */ public ApiResponse execute(Call call, Type returnType) throws ApiException { try { @@ -1107,7 +1111,7 @@ public void onResponse(Call call, Response response) throws IOException { * @param response Response * @param returnType Return type * @return Type - * @throws ApiException If the response has an unsuccessful status code or + * @throws io.openkruise.agents.client.e2b.api.invoker.ApiException If the response has an unsuccessful status code or * fail to deserialize the response body */ public T handleResponse(Response response, Type returnType) throws ApiException { @@ -1154,7 +1158,7 @@ public T handleResponse(Response response, Type returnType) throws ApiExcept * @param authNames The authentications to apply * @param callback Callback for upload/download progress * @return The HTTP call - * @throws ApiException If fail to serialize the request body object + * @throws io.openkruise.agents.client.e2b.api.invoker.ApiException If fail to serialize the request body object */ public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); @@ -1177,7 +1181,7 @@ public Call buildCall(String baseUrl, String path, String method, List que * @param authNames The authentications to apply * @param callback Callback for upload/download progress * @return The HTTP request - * @throws ApiException If fail to serialize the request body object + * @throws io.openkruise.agents.client.e2b.api.invoker.ApiException If fail to serialize the request body object */ public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { // aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams @@ -1340,7 +1344,7 @@ public void processCookieParams(Map cookieParams, Request.Builde * @param payload HTTP request body * @param method HTTP method * @param uri URI - * @throws ApiException If fails to update the parameters + * @throws io.openkruise.agents.client.e2b.api.invoker.ApiException If fails to update the parameters */ public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException { @@ -1360,7 +1364,7 @@ public void updateParamsForAuth(String[] authNames, List queryParams, Map< * @return RequestBody */ public RequestBody buildRequestBodyFormEncoding(Map formParams) { - FormBody.Builder formBuilder = new FormBody.Builder(); + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); for (Entry param : formParams.entrySet()) { formBuilder.add(param.getKey(), parameterToString(param.getValue())); } @@ -1456,7 +1460,7 @@ private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String k private Interceptor getProgressInterceptor() { return new Interceptor() { @Override - public Response intercept(Chain chain) throws IOException { + public Response intercept(Interceptor.Chain chain) throws IOException { final Request request = chain.request(); final Response originalResponse = chain.proceed(request); if (request.tag() instanceof ApiCallback) { @@ -1482,16 +1486,16 @@ private void applySslSettings() { trustManagers = new TrustManager[]{ new X509TrustManager() { @Override - public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { } @Override - public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { } @Override - public X509Certificate[] getAcceptedIssuers() { - return new X509Certificate[]{}; + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; } } }; @@ -1551,7 +1555,7 @@ private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityExcepti * * @param requestBody The HTTP request object * @return The string representation of the HTTP request body - * @throws ApiException If fail to serialize the request body object into a string + * @throws io.openkruise.agents.client.e2b.api.invoker.ApiException If fail to serialize the request body object into a string */ private String requestBodyToString(RequestBody requestBody) throws ApiException { if (requestBody != null) { diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/ApiException.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/ApiException.java index 7935ad1..c107a7f 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/ApiException.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/ApiException.java @@ -22,7 +22,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; @@ -36,7 +36,7 @@ public ApiException() {} /** *

Constructor for ApiException.

* - * @param throwable a {@link Throwable} object + * @param throwable a {@link java.lang.Throwable} object */ public ApiException(Throwable throwable) { super(throwable); @@ -55,9 +55,9 @@ public ApiException(String message) { *

Constructor for ApiException.

* * @param message the error message - * @param throwable a {@link Throwable} object + * @param throwable a {@link java.lang.Throwable} object * @param code HTTP status code - * @param responseHeaders a {@link Map} of HTTP response headers + * @param responseHeaders a {@link java.util.Map} of HTTP response headers * @param responseBody the response body */ public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { @@ -72,7 +72,7 @@ public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { @@ -83,9 +83,9 @@ public ApiException(String message, int code, Map> response *

Constructor for ApiException.

* * @param message the error message - * @param throwable a {@link Throwable} object + * @param throwable a {@link java.lang.Throwable} object * @param code HTTP status code - * @param responseHeaders a {@link Map} of HTTP response headers + * @param responseHeaders a {@link java.util.Map} of HTTP response headers */ public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { this(message, throwable, code, responseHeaders, null); @@ -95,7 +95,7 @@ public ApiException(String message, Throwable throwable, int code, MapConstructor for ApiException.

* * @param code HTTP status code - * @param responseHeaders a {@link Map} of HTTP response headers + * @param responseHeaders a {@link java.util.Map} of HTTP response headers * @param responseBody the response body */ public ApiException(int code, Map> responseHeaders, String responseBody) { @@ -106,7 +106,7 @@ public ApiException(int code, Map> responseHeaders, String *

Constructor for ApiException.

* * @param code HTTP status code - * @param message a {@link String} object + * @param message a {@link java.lang.String} object */ public ApiException(int code, String message) { super(message); @@ -118,7 +118,7 @@ public ApiException(int code, String message) { * * @param code HTTP status code * @param message the error message - * @param responseHeaders a {@link Map} of HTTP response headers + * @param responseHeaders a {@link java.util.Map} of HTTP response headers * @param responseBody the response body */ public ApiException(int code, String message, Map> responseHeaders, String responseBody) { diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/ApiResponse.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/ApiResponse.java index 7cfbbf0..39f4341 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/ApiResponse.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/ApiResponse.java @@ -59,7 +59,7 @@ public int getStatusCode() { /** *

Get the headers.

* - * @return a {@link Map} of headers + * @return a {@link java.util.Map} of headers */ public Map> getHeaders() { return headers; diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/Configuration.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/Configuration.java index 18ade6d..4c8af4b 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/Configuration.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/Configuration.java @@ -13,7 +13,7 @@ package io.openkruise.agents.client.e2b.api.invoker; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class Configuration { public static final String VERSION = "0.1.0"; diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/JSON.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/JSON.java index b130f5c..191c75a 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/JSON.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/JSON.java @@ -109,6 +109,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.AWSRegistry.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.AdminBuildCancelResult.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.AdminSandboxKillResult.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.AssignTemplateTagsRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.AssignedTemplateTags.CustomTypeAdapterFactory()); @@ -137,15 +138,19 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.NodeStatusChange.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.NodesGet200ResponseInner.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.ResumedSandbox.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.Sandbox.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.SandboxAutoResumeConfig.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.SandboxDetail.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.SandboxLifecycle.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.SandboxLog.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.SandboxLogEntry.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.SandboxLogs.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.SandboxLogsV2Response.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.SandboxMetric.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.SandboxNetworkConfig.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.SandboxNetworkRule.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.SandboxNetworkTransform.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.SandboxNetworkUpdateConfig.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.SandboxResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.SandboxVolumeMount.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.SandboxesGet200ResponseInner.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.SandboxesSandboxIDRefreshesPostRequest.CustomTypeAdapterFactory()); @@ -178,6 +183,8 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.TemplatesGet200ResponseInner.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.UpdateTeamAPIKey.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.Volume.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.VolumeAndToken.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new io.openkruise.agents.client.e2b.api.models.VolumeToken.CustomTypeAdapterFactory()); gson = gsonBuilder.create(); } diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/Pair.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/Pair.java index daf8c54..a099459 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/Pair.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/Pair.java @@ -13,7 +13,7 @@ package io.openkruise.agents.client.e2b.api.invoker; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class Pair { private String name = ""; private String value = ""; diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/StringUtil.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/StringUtil.java index d989c0d..3b20057 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/StringUtil.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/StringUtil.java @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/auth/ApiKeyAuth.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/auth/ApiKeyAuth.java index ee65c94..39bdec0 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/auth/ApiKeyAuth.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/auth/ApiKeyAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/auth/HttpBearerAuth.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/auth/HttpBearerAuth.java index ae64b7a..4783ad2 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/auth/HttpBearerAuth.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/invoker/auth/HttpBearerAuth.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class HttpBearerAuth implements Authentication { private final String scheme; private String bearerToken; diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/AWSRegistry.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/AWSRegistry.java index 736ae23..43e02f7 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/AWSRegistry.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/AWSRegistry.java @@ -50,7 +50,7 @@ /** * AWSRegistry */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class AWSRegistry { /** * Type of registry authentication @@ -361,7 +361,7 @@ public void write(JsonWriter out, AWSRegistry value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -384,7 +384,7 @@ public AWSRegistry read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance AWSRegistry instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/AbstractOpenApiSchema.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/AbstractOpenApiSchema.java index 2a2b5fa..0ada7d7 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/AbstractOpenApiSchema.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/AbstractOpenApiSchema.java @@ -24,7 +24,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/AdminBuildCancelResult.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/AdminBuildCancelResult.java new file mode 100644 index 0000000..d86828f --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/AdminBuildCancelResult.java @@ -0,0 +1,317 @@ +/* + * E2B API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.openkruise.agents.client.e2b.api.models; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import io.openkruise.agents.client.e2b.api.invoker.JSON; + +/** + * AdminBuildCancelResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") +public class AdminBuildCancelResult { + public static final String SERIALIZED_NAME_CANCELLED_COUNT = "cancelledCount"; + @SerializedName(SERIALIZED_NAME_CANCELLED_COUNT) + private Integer cancelledCount; + + public static final String SERIALIZED_NAME_FAILED_COUNT = "failedCount"; + @SerializedName(SERIALIZED_NAME_FAILED_COUNT) + private Integer failedCount; + + public AdminBuildCancelResult() { + } + + public AdminBuildCancelResult cancelledCount(Integer cancelledCount) { + + this.cancelledCount = cancelledCount; + return this; + } + + /** + * Number of builds successfully cancelled + * @return cancelledCount + **/ + @javax.annotation.Nonnull + public Integer getCancelledCount() { + return cancelledCount; + } + + + public void setCancelledCount(Integer cancelledCount) { + this.cancelledCount = cancelledCount; + } + + + public AdminBuildCancelResult failedCount(Integer failedCount) { + + this.failedCount = failedCount; + return this; + } + + /** + * Number of builds that failed to cancel + * @return failedCount + **/ + @javax.annotation.Nonnull + public Integer getFailedCount() { + return failedCount; + } + + + public void setFailedCount(Integer failedCount) { + this.failedCount = failedCount; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AdminBuildCancelResult instance itself + */ + public AdminBuildCancelResult putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdminBuildCancelResult adminBuildCancelResult = (AdminBuildCancelResult) o; + return Objects.equals(this.cancelledCount, adminBuildCancelResult.cancelledCount) && + Objects.equals(this.failedCount, adminBuildCancelResult.failedCount)&& + Objects.equals(this.additionalProperties, adminBuildCancelResult.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(cancelledCount, failedCount, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdminBuildCancelResult {\n"); + sb.append(" cancelledCount: ").append(toIndentedString(cancelledCount)).append("\n"); + sb.append(" failedCount: ").append(toIndentedString(failedCount)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("cancelledCount"); + openapiFields.add("failedCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("cancelledCount"); + openapiRequiredFields.add("failedCount"); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to AdminBuildCancelResult + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!AdminBuildCancelResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AdminBuildCancelResult is not found in the empty JSON string", AdminBuildCancelResult.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AdminBuildCancelResult.openapiRequiredFields) { + if (jsonObj.get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AdminBuildCancelResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AdminBuildCancelResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AdminBuildCancelResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AdminBuildCancelResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AdminBuildCancelResult read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + AdminBuildCancelResult instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AdminBuildCancelResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of AdminBuildCancelResult + * @throws IOException if the JSON string is invalid with respect to AdminBuildCancelResult + */ + public static AdminBuildCancelResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AdminBuildCancelResult.class); + } + + /** + * Convert an instance of AdminBuildCancelResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/AdminSandboxKillResult.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/AdminSandboxKillResult.java index 6f81994..dac7f15 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/AdminSandboxKillResult.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/AdminSandboxKillResult.java @@ -50,7 +50,7 @@ /** * AdminSandboxKillResult */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class AdminSandboxKillResult { public static final String SERIALIZED_NAME_KILLED_COUNT = "killedCount"; @SerializedName(SERIALIZED_NAME_KILLED_COUNT) @@ -246,7 +246,7 @@ public void write(JsonWriter out, AdminSandboxKillResult value) throws IOExcepti obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -269,7 +269,7 @@ public AdminSandboxKillResult read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance AdminSandboxKillResult instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/AssignTemplateTagsRequest.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/AssignTemplateTagsRequest.java index f22fea7..d48ec26 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/AssignTemplateTagsRequest.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/AssignTemplateTagsRequest.java @@ -52,7 +52,7 @@ /** * AssignTemplateTagsRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class AssignTemplateTagsRequest { public static final String SERIALIZED_NAME_TARGET = "target"; @SerializedName(SERIALIZED_NAME_TARGET) @@ -265,7 +265,7 @@ public void write(JsonWriter out, AssignTemplateTagsRequest value) throws IOExce obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -288,7 +288,7 @@ public AssignTemplateTagsRequest read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance AssignTemplateTagsRequest instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/AssignedTemplateTags.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/AssignedTemplateTags.java index 8be3a11..b0dae97 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/AssignedTemplateTags.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/AssignedTemplateTags.java @@ -53,7 +53,7 @@ /** * AssignedTemplateTags */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class AssignedTemplateTags { public static final String SERIALIZED_NAME_TAGS = "tags"; @SerializedName(SERIALIZED_NAME_TAGS) @@ -266,7 +266,7 @@ public void write(JsonWriter out, AssignedTemplateTags value) throws IOException obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -289,7 +289,7 @@ public AssignedTemplateTags read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance AssignedTemplateTags instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/BuildLogEntry.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/BuildLogEntry.java index 3b3336f..a502326 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/BuildLogEntry.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/BuildLogEntry.java @@ -52,7 +52,7 @@ /** * BuildLogEntry */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class BuildLogEntry { public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; @SerializedName(SERIALIZED_NAME_TIMESTAMP) @@ -311,7 +311,7 @@ public void write(JsonWriter out, BuildLogEntry value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -334,7 +334,7 @@ public BuildLogEntry read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance BuildLogEntry instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/BuildStatusReason.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/BuildStatusReason.java index a0cf89a..8f0b9c9 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/BuildStatusReason.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/BuildStatusReason.java @@ -53,7 +53,7 @@ /** * BuildStatusReason */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class BuildStatusReason { public static final String SERIALIZED_NAME_MESSAGE = "message"; @SerializedName(SERIALIZED_NAME_MESSAGE) @@ -304,7 +304,7 @@ public void write(JsonWriter out, BuildStatusReason value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -327,7 +327,7 @@ public BuildStatusReason read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance BuildStatusReason instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/ConnectSandbox.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/ConnectSandbox.java index 2abc6fa..950c44f 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/ConnectSandbox.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/ConnectSandbox.java @@ -50,7 +50,7 @@ /** * ConnectSandbox */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class ConnectSandbox { public static final String SERIALIZED_NAME_TIMEOUT = "timeout"; @SerializedName(SERIALIZED_NAME_TIMEOUT) @@ -218,7 +218,7 @@ public void write(JsonWriter out, ConnectSandbox value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -241,7 +241,7 @@ public ConnectSandbox read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance ConnectSandbox instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/CreatedAccessToken.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/CreatedAccessToken.java index 583803f..103a386 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/CreatedAccessToken.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/CreatedAccessToken.java @@ -53,7 +53,7 @@ /** * CreatedAccessToken */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class CreatedAccessToken { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @@ -347,7 +347,7 @@ public void write(JsonWriter out, CreatedAccessToken value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -370,7 +370,7 @@ public CreatedAccessToken read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance CreatedAccessToken instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/CreatedTeamAPIKey.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/CreatedTeamAPIKey.java index 3fe0125..85cc400 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/CreatedTeamAPIKey.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/CreatedTeamAPIKey.java @@ -55,7 +55,7 @@ /** * CreatedTeamAPIKey */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class CreatedTeamAPIKey { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @@ -420,7 +420,7 @@ public void write(JsonWriter out, CreatedTeamAPIKey value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -443,7 +443,7 @@ public CreatedTeamAPIKey read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance CreatedTeamAPIKey instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/DeleteTemplateTagsRequest.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/DeleteTemplateTagsRequest.java index 6a9eb8f..43bc146 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/DeleteTemplateTagsRequest.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/DeleteTemplateTagsRequest.java @@ -52,7 +52,7 @@ /** * DeleteTemplateTagsRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class DeleteTemplateTagsRequest { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -265,7 +265,7 @@ public void write(JsonWriter out, DeleteTemplateTagsRequest value) throws IOExce obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -288,7 +288,7 @@ public DeleteTemplateTagsRequest read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance DeleteTemplateTagsRequest instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/DiskMetrics.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/DiskMetrics.java index 8deab9b..8c907a5 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/DiskMetrics.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/DiskMetrics.java @@ -50,7 +50,7 @@ /** * DiskMetrics */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class DiskMetrics { public static final String SERIALIZED_NAME_MOUNT_POINT = "mountPoint"; @SerializedName(SERIALIZED_NAME_MOUNT_POINT) @@ -342,7 +342,7 @@ public void write(JsonWriter out, DiskMetrics value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -365,7 +365,7 @@ public DiskMetrics read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance DiskMetrics instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/Error.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/Error.java index 571f374..6c2928a 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/Error.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/Error.java @@ -50,7 +50,7 @@ /** * Error */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class Error { public static final String SERIALIZED_NAME_CODE = "code"; @SerializedName(SERIALIZED_NAME_CODE) @@ -249,7 +249,7 @@ public void write(JsonWriter out, Error value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -272,7 +272,7 @@ public Error read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance Error instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/FromImageRegistry.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/FromImageRegistry.java index 219b7cf..b3685f4 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/FromImageRegistry.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/FromImageRegistry.java @@ -58,7 +58,7 @@ import io.openkruise.agents.client.e2b.api.invoker.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class FromImageRegistry extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(FromImageRegistry.class.getName()); diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/GCPRegistry.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/GCPRegistry.java index 8e19b1f..d0ca07d 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/GCPRegistry.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/GCPRegistry.java @@ -50,7 +50,7 @@ /** * GCPRegistry */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class GCPRegistry { /** * Type of registry authentication @@ -297,7 +297,7 @@ public void write(JsonWriter out, GCPRegistry value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -320,7 +320,7 @@ public GCPRegistry read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance GCPRegistry instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/GeneralRegistry.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/GeneralRegistry.java index 5cee369..f14f300 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/GeneralRegistry.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/GeneralRegistry.java @@ -50,7 +50,7 @@ /** * GeneralRegistry */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class GeneralRegistry { /** * Type of registry authentication @@ -329,7 +329,7 @@ public void write(JsonWriter out, GeneralRegistry value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -352,7 +352,7 @@ public GeneralRegistry read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance GeneralRegistry instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/IdentifierMaskingDetails.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/IdentifierMaskingDetails.java index 998ac56..1901871 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/IdentifierMaskingDetails.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/IdentifierMaskingDetails.java @@ -50,7 +50,7 @@ /** * IdentifierMaskingDetails */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class IdentifierMaskingDetails { public static final String SERIALIZED_NAME_PREFIX = "prefix"; @SerializedName(SERIALIZED_NAME_PREFIX) @@ -313,7 +313,7 @@ public void write(JsonWriter out, IdentifierMaskingDetails value) throws IOExcep obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -336,7 +336,7 @@ public IdentifierMaskingDetails read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance IdentifierMaskingDetails instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/ListedSandbox.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/ListedSandbox.java index 757c85b..a00c73e 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/ListedSandbox.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/ListedSandbox.java @@ -57,7 +57,7 @@ /** * ListedSandbox */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class ListedSandbox { public static final String SERIALIZED_NAME_TEMPLATE_I_D = "templateID"; @SerializedName(SERIALIZED_NAME_TEMPLATE_I_D) @@ -622,7 +622,7 @@ public void write(JsonWriter out, ListedSandbox value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -645,7 +645,7 @@ public ListedSandbox read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance ListedSandbox instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/MachineInfo.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/MachineInfo.java index f139605..16006f2 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/MachineInfo.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/MachineInfo.java @@ -50,7 +50,7 @@ /** * MachineInfo */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class MachineInfo { public static final String SERIALIZED_NAME_CPU_FAMILY = "cpuFamily"; @SerializedName(SERIALIZED_NAME_CPU_FAMILY) @@ -316,7 +316,7 @@ public void write(JsonWriter out, MachineInfo value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -339,7 +339,7 @@ public MachineInfo read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance MachineInfo instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/MaxTeamMetric.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/MaxTeamMetric.java index 799e3cf..c98239d 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/MaxTeamMetric.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/MaxTeamMetric.java @@ -52,7 +52,7 @@ /** * Team metric with timestamp */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class MaxTeamMetric { public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; @Deprecated @@ -282,7 +282,7 @@ public void write(JsonWriter out, MaxTeamMetric value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -305,7 +305,7 @@ public MaxTeamMetric read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance MaxTeamMetric instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NewAccessToken.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NewAccessToken.java index 3836b3d..9cb4b1a 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NewAccessToken.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NewAccessToken.java @@ -50,7 +50,7 @@ /** * NewAccessToken */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class NewAccessToken { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -220,7 +220,7 @@ public void write(JsonWriter out, NewAccessToken value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -243,7 +243,7 @@ public NewAccessToken read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance NewAccessToken instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NewSandbox.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NewSandbox.java index 3435e43..71a0a38 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NewSandbox.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NewSandbox.java @@ -58,7 +58,7 @@ /** * NewSandbox */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class NewSandbox { public static final String SERIALIZED_NAME_TEMPLATE_I_D = "templateID"; @SerializedName(SERIALIZED_NAME_TEMPLATE_I_D) @@ -574,7 +574,7 @@ public void write(JsonWriter out, NewSandbox value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -597,7 +597,7 @@ public NewSandbox read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance NewSandbox instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NewTeamAPIKey.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NewTeamAPIKey.java index 0c31cf9..3fcaa4f 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NewTeamAPIKey.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NewTeamAPIKey.java @@ -50,7 +50,7 @@ /** * NewTeamAPIKey */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class NewTeamAPIKey { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -220,7 +220,7 @@ public void write(JsonWriter out, NewTeamAPIKey value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -243,7 +243,7 @@ public NewTeamAPIKey read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance NewTeamAPIKey instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NewVolume.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NewVolume.java index 8bb2b11..19c2e57 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NewVolume.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NewVolume.java @@ -50,7 +50,7 @@ /** * NewVolume */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class NewVolume { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -220,7 +220,7 @@ public void write(JsonWriter out, NewVolume value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -243,7 +243,7 @@ public NewVolume read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance NewVolume instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/Node.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/Node.java index bc8d0a6..fbc6ead 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/Node.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/Node.java @@ -53,7 +53,7 @@ /** * Node */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class Node { public static final String SERIALIZED_NAME_VERSION = "version"; @SerializedName(SERIALIZED_NAME_VERSION) @@ -63,11 +63,6 @@ public class Node { @SerializedName(SERIALIZED_NAME_COMMIT) private String commit; - public static final String SERIALIZED_NAME_NODE_I_D = "nodeID"; - @Deprecated - @SerializedName(SERIALIZED_NAME_NODE_I_D) - private String nodeID; - public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) private String id; @@ -153,31 +148,6 @@ public void setCommit(String commit) { } - @Deprecated - public Node nodeID(String nodeID) { - - this.nodeID = nodeID; - return this; - } - - /** - * Identifier of the nomad node - * @return nodeID - * @deprecated - **/ - @Deprecated - @javax.annotation.Nonnull - public String getNodeID() { - return nodeID; - } - - - @Deprecated - public void setNodeID(String nodeID) { - this.nodeID = nodeID; - } - - public Node id(String id) { this.id = id; @@ -444,7 +414,6 @@ public boolean equals(Object o) { Node node = (Node) o; return Objects.equals(this.version, node.version) && Objects.equals(this.commit, node.commit) && - Objects.equals(this.nodeID, node.nodeID) && Objects.equals(this.id, node.id) && Objects.equals(this.serviceInstanceID, node.serviceInstanceID) && Objects.equals(this.clusterID, node.clusterID) && @@ -460,7 +429,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(version, commit, nodeID, id, serviceInstanceID, clusterID, machineInfo, status, sandboxCount, metrics, createSuccesses, createFails, sandboxStartingCount, additionalProperties); + return Objects.hash(version, commit, id, serviceInstanceID, clusterID, machineInfo, status, sandboxCount, metrics, createSuccesses, createFails, sandboxStartingCount, additionalProperties); } @Override @@ -469,7 +438,6 @@ public String toString() { sb.append("class Node {\n"); sb.append(" version: ").append(toIndentedString(version)).append("\n"); sb.append(" commit: ").append(toIndentedString(commit)).append("\n"); - sb.append(" nodeID: ").append(toIndentedString(nodeID)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" serviceInstanceID: ").append(toIndentedString(serviceInstanceID)).append("\n"); sb.append(" clusterID: ").append(toIndentedString(clusterID)).append("\n"); @@ -505,7 +473,6 @@ private String toIndentedString(Object o) { openapiFields = new HashSet(); openapiFields.add("version"); openapiFields.add("commit"); - openapiFields.add("nodeID"); openapiFields.add("id"); openapiFields.add("serviceInstanceID"); openapiFields.add("clusterID"); @@ -521,7 +488,6 @@ private String toIndentedString(Object o) { openapiRequiredFields = new HashSet(); openapiRequiredFields.add("version"); openapiRequiredFields.add("commit"); - openapiRequiredFields.add("nodeID"); openapiRequiredFields.add("id"); openapiRequiredFields.add("serviceInstanceID"); openapiRequiredFields.add("clusterID"); @@ -559,9 +525,6 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (!jsonObj.get("commit").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `commit` to be a primitive type in the JSON string but got `%s`", jsonObj.get("commit").toString())); } - if (!jsonObj.get("nodeID").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `nodeID` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nodeID").toString())); - } if (!jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } @@ -595,7 +558,7 @@ public void write(JsonWriter out, Node value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -618,7 +581,7 @@ public Node read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance Node instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NodeDetail.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NodeDetail.java index 64a0453..d4b72c9 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NodeDetail.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NodeDetail.java @@ -20,7 +20,6 @@ import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.openkruise.agents.client.e2b.api.models.ListedSandbox; import io.openkruise.agents.client.e2b.api.models.MachineInfo; import io.openkruise.agents.client.e2b.api.models.NodeMetrics; import io.openkruise.agents.client.e2b.api.models.NodeStatus; @@ -56,7 +55,7 @@ /** * NodeDetail */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class NodeDetail { public static final String SERIALIZED_NAME_CLUSTER_I_D = "clusterID"; @SerializedName(SERIALIZED_NAME_CLUSTER_I_D) @@ -78,11 +77,6 @@ public class NodeDetail { @SerializedName(SERIALIZED_NAME_SERVICE_INSTANCE_I_D) private String serviceInstanceID; - public static final String SERIALIZED_NAME_NODE_I_D = "nodeID"; - @Deprecated - @SerializedName(SERIALIZED_NAME_NODE_I_D) - private String nodeID; - public static final String SERIALIZED_NAME_MACHINE_INFO = "machineInfo"; @SerializedName(SERIALIZED_NAME_MACHINE_INFO) private MachineInfo machineInfo; @@ -91,9 +85,9 @@ public class NodeDetail { @SerializedName(SERIALIZED_NAME_STATUS) private NodeStatus status; - public static final String SERIALIZED_NAME_SANDBOXES = "sandboxes"; - @SerializedName(SERIALIZED_NAME_SANDBOXES) - private List sandboxes = new ArrayList<>(); + public static final String SERIALIZED_NAME_SANDBOX_COUNT = "sandboxCount"; + @SerializedName(SERIALIZED_NAME_SANDBOX_COUNT) + private Integer sandboxCount; public static final String SERIALIZED_NAME_METRICS = "metrics"; @SerializedName(SERIALIZED_NAME_METRICS) @@ -219,31 +213,6 @@ public void setServiceInstanceID(String serviceInstanceID) { } - @Deprecated - public NodeDetail nodeID(String nodeID) { - - this.nodeID = nodeID; - return this; - } - - /** - * Identifier of the nomad node - * @return nodeID - * @deprecated - **/ - @Deprecated - @javax.annotation.Nonnull - public String getNodeID() { - return nodeID; - } - - - @Deprecated - public void setNodeID(String nodeID) { - this.nodeID = nodeID; - } - - public NodeDetail machineInfo(MachineInfo machineInfo) { this.machineInfo = machineInfo; @@ -286,32 +255,24 @@ public void setStatus(NodeStatus status) { } - public NodeDetail sandboxes(List sandboxes) { + public NodeDetail sandboxCount(Integer sandboxCount) { - this.sandboxes = sandboxes; - return this; - } - - public NodeDetail addSandboxesItem(ListedSandbox sandboxesItem) { - if (this.sandboxes == null) { - this.sandboxes = new ArrayList<>(); - } - this.sandboxes.add(sandboxesItem); + this.sandboxCount = sandboxCount; return this; } /** - * List of sandboxes running on the node - * @return sandboxes + * Number of sandboxes running on the node + * @return sandboxCount **/ @javax.annotation.Nonnull - public List getSandboxes() { - return sandboxes; + public Integer getSandboxCount() { + return sandboxCount; } - public void setSandboxes(List sandboxes) { - this.sandboxes = sandboxes; + public void setSandboxCount(Integer sandboxCount) { + this.sandboxCount = sandboxCount; } @@ -466,10 +427,9 @@ public boolean equals(Object o) { Objects.equals(this.commit, nodeDetail.commit) && Objects.equals(this.id, nodeDetail.id) && Objects.equals(this.serviceInstanceID, nodeDetail.serviceInstanceID) && - Objects.equals(this.nodeID, nodeDetail.nodeID) && Objects.equals(this.machineInfo, nodeDetail.machineInfo) && Objects.equals(this.status, nodeDetail.status) && - Objects.equals(this.sandboxes, nodeDetail.sandboxes) && + Objects.equals(this.sandboxCount, nodeDetail.sandboxCount) && Objects.equals(this.metrics, nodeDetail.metrics) && Objects.equals(this.cachedBuilds, nodeDetail.cachedBuilds) && Objects.equals(this.createSuccesses, nodeDetail.createSuccesses) && @@ -479,7 +439,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(clusterID, version, commit, id, serviceInstanceID, nodeID, machineInfo, status, sandboxes, metrics, cachedBuilds, createSuccesses, createFails, additionalProperties); + return Objects.hash(clusterID, version, commit, id, serviceInstanceID, machineInfo, status, sandboxCount, metrics, cachedBuilds, createSuccesses, createFails, additionalProperties); } @Override @@ -491,10 +451,9 @@ public String toString() { sb.append(" commit: ").append(toIndentedString(commit)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" serviceInstanceID: ").append(toIndentedString(serviceInstanceID)).append("\n"); - sb.append(" nodeID: ").append(toIndentedString(nodeID)).append("\n"); sb.append(" machineInfo: ").append(toIndentedString(machineInfo)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" sandboxes: ").append(toIndentedString(sandboxes)).append("\n"); + sb.append(" sandboxCount: ").append(toIndentedString(sandboxCount)).append("\n"); sb.append(" metrics: ").append(toIndentedString(metrics)).append("\n"); sb.append(" cachedBuilds: ").append(toIndentedString(cachedBuilds)).append("\n"); sb.append(" createSuccesses: ").append(toIndentedString(createSuccesses)).append("\n"); @@ -527,10 +486,9 @@ private String toIndentedString(Object o) { openapiFields.add("commit"); openapiFields.add("id"); openapiFields.add("serviceInstanceID"); - openapiFields.add("nodeID"); openapiFields.add("machineInfo"); openapiFields.add("status"); - openapiFields.add("sandboxes"); + openapiFields.add("sandboxCount"); openapiFields.add("metrics"); openapiFields.add("cachedBuilds"); openapiFields.add("createSuccesses"); @@ -543,10 +501,9 @@ private String toIndentedString(Object o) { openapiRequiredFields.add("commit"); openapiRequiredFields.add("id"); openapiRequiredFields.add("serviceInstanceID"); - openapiRequiredFields.add("nodeID"); openapiRequiredFields.add("machineInfo"); openapiRequiredFields.add("status"); - openapiRequiredFields.add("sandboxes"); + openapiRequiredFields.add("sandboxCount"); openapiRequiredFields.add("metrics"); openapiRequiredFields.add("cachedBuilds"); openapiRequiredFields.add("createSuccesses"); @@ -587,21 +544,8 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (!jsonObj.get("serviceInstanceID").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `serviceInstanceID` to be a primitive type in the JSON string but got `%s`", jsonObj.get("serviceInstanceID").toString())); } - if (!jsonObj.get("nodeID").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `nodeID` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nodeID").toString())); - } // validate the required field `machineInfo` MachineInfo.validateJsonObject(jsonObj.getAsJsonObject("machineInfo")); - // ensure the json data is an array - if (!jsonObj.get("sandboxes").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `sandboxes` to be an array in the JSON string but got `%s`", jsonObj.get("sandboxes").toString())); - } - - JsonArray jsonArraysandboxes = jsonObj.getAsJsonArray("sandboxes"); - // validate the required field `sandboxes` (array) - for (int i = 0; i < jsonArraysandboxes.size(); i++) { - ListedSandbox.validateJsonObject(jsonArraysandboxes.get(i).getAsJsonObject()); - }; // validate the required field `metrics` NodeMetrics.validateJsonObject(jsonObj.getAsJsonObject("metrics")); // ensure the required json array is present @@ -630,7 +574,7 @@ public void write(JsonWriter out, NodeDetail value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -653,7 +597,7 @@ public NodeDetail read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance NodeDetail instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NodeMetrics.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NodeMetrics.java index 38c079f..c96c0ad 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NodeMetrics.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NodeMetrics.java @@ -53,7 +53,7 @@ /** * Node metrics */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class NodeMetrics { public static final String SERIALIZED_NAME_ALLOCATED_C_P_U = "allocatedCPU"; @SerializedName(SERIALIZED_NAME_ALLOCATED_C_P_U) @@ -412,7 +412,7 @@ public void write(JsonWriter out, NodeMetrics value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -435,7 +435,7 @@ public NodeMetrics read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance NodeMetrics instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NodeStatus.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NodeStatus.java index 4b422d7..7f1a45d 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NodeStatus.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NodeStatus.java @@ -24,7 +24,7 @@ import com.google.gson.stream.JsonWriter; /** - * Status of the node + * Status of the node. - draining: the node is bound to be shut down. It will not accept new sandboxes and will stop once all existing sandboxes are done. - standby: the node is not actively used, but it can return to ready and continue serving traffic. */ @JsonAdapter(NodeStatus.Adapter.class) public enum NodeStatus { @@ -35,7 +35,9 @@ public enum NodeStatus { NodeStatusConnecting("connecting"), - NodeStatusUnhealthy("unhealthy"); + NodeStatusUnhealthy("unhealthy"), + + NodeStatusStandby("standby"); private String value; diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NodeStatusChange.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NodeStatusChange.java index 2c7e94d..e8352e5 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NodeStatusChange.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NodeStatusChange.java @@ -52,7 +52,7 @@ /** * NodeStatusChange */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class NodeStatusChange { public static final String SERIALIZED_NAME_CLUSTER_I_D = "clusterID"; @SerializedName(SERIALIZED_NAME_CLUSTER_I_D) @@ -250,7 +250,7 @@ public void write(JsonWriter out, NodeStatusChange value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -273,7 +273,7 @@ public NodeStatusChange read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance NodeStatusChange instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NodesGet200ResponseInner.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NodesGet200ResponseInner.java index 72196d6..81dcf6d 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NodesGet200ResponseInner.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/NodesGet200ResponseInner.java @@ -53,7 +53,7 @@ /** * NodesGet200ResponseInner */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class NodesGet200ResponseInner { public static final String SERIALIZED_NAME_VERSION = "version"; @SerializedName(SERIALIZED_NAME_VERSION) @@ -63,11 +63,6 @@ public class NodesGet200ResponseInner { @SerializedName(SERIALIZED_NAME_COMMIT) private String commit; - public static final String SERIALIZED_NAME_NODE_I_D = "nodeID"; - @Deprecated - @SerializedName(SERIALIZED_NAME_NODE_I_D) - private String nodeID; - public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) private String id; @@ -153,31 +148,6 @@ public void setCommit(String commit) { } - @Deprecated - public NodesGet200ResponseInner nodeID(String nodeID) { - - this.nodeID = nodeID; - return this; - } - - /** - * Identifier of the nomad node - * @return nodeID - * @deprecated - **/ - @Deprecated - @javax.annotation.Nonnull - public String getNodeID() { - return nodeID; - } - - - @Deprecated - public void setNodeID(String nodeID) { - this.nodeID = nodeID; - } - - public NodesGet200ResponseInner id(String id) { this.id = id; @@ -444,7 +414,6 @@ public boolean equals(Object o) { NodesGet200ResponseInner nodesGet200ResponseInner = (NodesGet200ResponseInner) o; return Objects.equals(this.version, nodesGet200ResponseInner.version) && Objects.equals(this.commit, nodesGet200ResponseInner.commit) && - Objects.equals(this.nodeID, nodesGet200ResponseInner.nodeID) && Objects.equals(this.id, nodesGet200ResponseInner.id) && Objects.equals(this.serviceInstanceID, nodesGet200ResponseInner.serviceInstanceID) && Objects.equals(this.clusterID, nodesGet200ResponseInner.clusterID) && @@ -460,7 +429,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(version, commit, nodeID, id, serviceInstanceID, clusterID, machineInfo, status, sandboxCount, metrics, createSuccesses, createFails, sandboxStartingCount, additionalProperties); + return Objects.hash(version, commit, id, serviceInstanceID, clusterID, machineInfo, status, sandboxCount, metrics, createSuccesses, createFails, sandboxStartingCount, additionalProperties); } @Override @@ -469,7 +438,6 @@ public String toString() { sb.append("class NodesGet200ResponseInner {\n"); sb.append(" version: ").append(toIndentedString(version)).append("\n"); sb.append(" commit: ").append(toIndentedString(commit)).append("\n"); - sb.append(" nodeID: ").append(toIndentedString(nodeID)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" serviceInstanceID: ").append(toIndentedString(serviceInstanceID)).append("\n"); sb.append(" clusterID: ").append(toIndentedString(clusterID)).append("\n"); @@ -505,7 +473,6 @@ private String toIndentedString(Object o) { openapiFields = new HashSet(); openapiFields.add("version"); openapiFields.add("commit"); - openapiFields.add("nodeID"); openapiFields.add("id"); openapiFields.add("serviceInstanceID"); openapiFields.add("clusterID"); @@ -521,7 +488,6 @@ private String toIndentedString(Object o) { openapiRequiredFields = new HashSet(); openapiRequiredFields.add("version"); openapiRequiredFields.add("commit"); - openapiRequiredFields.add("nodeID"); openapiRequiredFields.add("id"); openapiRequiredFields.add("serviceInstanceID"); openapiRequiredFields.add("clusterID"); @@ -559,9 +525,6 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (!jsonObj.get("commit").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `commit` to be a primitive type in the JSON string but got `%s`", jsonObj.get("commit").toString())); } - if (!jsonObj.get("nodeID").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `nodeID` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nodeID").toString())); - } if (!jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } @@ -595,7 +558,7 @@ public void write(JsonWriter out, NodesGet200ResponseInner value) throws IOExcep obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -618,7 +581,7 @@ public NodesGet200ResponseInner read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance NodesGet200ResponseInner instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/ResumedSandbox.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/ResumedSandbox.java index 0bbf976..a399e02 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/ResumedSandbox.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/ResumedSandbox.java @@ -50,7 +50,7 @@ /** * ResumedSandbox */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class ResumedSandbox { public static final String SERIALIZED_NAME_TIMEOUT = "timeout"; @SerializedName(SERIALIZED_NAME_TIMEOUT) @@ -243,7 +243,7 @@ public void write(JsonWriter out, ResumedSandbox value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -266,7 +266,7 @@ public ResumedSandbox read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance ResumedSandbox instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxAutoResumeConfig.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxAutoResumeConfig.java index 104efa8..c49e554 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxAutoResumeConfig.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxAutoResumeConfig.java @@ -50,7 +50,7 @@ /** * Auto-resume configuration for paused sandboxes. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class SandboxAutoResumeConfig { public static final String SERIALIZED_NAME_ENABLED = "enabled"; @SerializedName(SERIALIZED_NAME_ENABLED) @@ -217,7 +217,7 @@ public void write(JsonWriter out, SandboxAutoResumeConfig value) throws IOExcept obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -240,7 +240,7 @@ public SandboxAutoResumeConfig read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance SandboxAutoResumeConfig instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxDetail.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxDetail.java index fa4098e..1b18742 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxDetail.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxDetail.java @@ -20,6 +20,8 @@ import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; +import io.openkruise.agents.client.e2b.api.models.SandboxLifecycle; +import io.openkruise.agents.client.e2b.api.models.SandboxNetworkConfig; import io.openkruise.agents.client.e2b.api.models.SandboxState; import io.openkruise.agents.client.e2b.api.models.SandboxVolumeMount; import java.io.IOException; @@ -58,7 +60,7 @@ /** * SandboxDetail */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class SandboxDetail { public static final String SERIALIZED_NAME_TEMPLATE_I_D = "templateID"; @SerializedName(SERIALIZED_NAME_TEMPLATE_I_D) @@ -93,6 +95,10 @@ public class SandboxDetail { @SerializedName(SERIALIZED_NAME_ENVD_ACCESS_TOKEN) private String envdAccessToken; + public static final String SERIALIZED_NAME_ALLOW_INTERNET_ACCESS = "allowInternetAccess"; + @SerializedName(SERIALIZED_NAME_ALLOW_INTERNET_ACCESS) + private Boolean allowInternetAccess; + public static final String SERIALIZED_NAME_DOMAIN = "domain"; @SerializedName(SERIALIZED_NAME_DOMAIN) private String domain; @@ -117,6 +123,14 @@ public class SandboxDetail { @SerializedName(SERIALIZED_NAME_STATE) private SandboxState state; + public static final String SERIALIZED_NAME_NETWORK = "network"; + @SerializedName(SERIALIZED_NAME_NETWORK) + private SandboxNetworkConfig network; + + public static final String SERIALIZED_NAME_LIFECYCLE = "lifecycle"; + @SerializedName(SERIALIZED_NAME_LIFECYCLE) + private SandboxLifecycle lifecycle; + public static final String SERIALIZED_NAME_VOLUME_MOUNTS = "volumeMounts"; @SerializedName(SERIALIZED_NAME_VOLUME_MOUNTS) private List volumeMounts; @@ -296,6 +310,27 @@ public void setEnvdAccessToken(String envdAccessToken) { } + public SandboxDetail allowInternetAccess(Boolean allowInternetAccess) { + + this.allowInternetAccess = allowInternetAccess; + return this; + } + + /** + * Whether internet access was explicitly enabled or disabled for the sandbox. Null means it was not explicitly set. + * @return allowInternetAccess + **/ + @javax.annotation.Nullable + public Boolean getAllowInternetAccess() { + return allowInternetAccess; + } + + + public void setAllowInternetAccess(Boolean allowInternetAccess) { + this.allowInternetAccess = allowInternetAccess; + } + + public SandboxDetail domain(String domain) { this.domain = domain; @@ -433,6 +468,48 @@ public void setState(SandboxState state) { } + public SandboxDetail network(SandboxNetworkConfig network) { + + this.network = network; + return this; + } + + /** + * Get network + * @return network + **/ + @javax.annotation.Nullable + public SandboxNetworkConfig getNetwork() { + return network; + } + + + public void setNetwork(SandboxNetworkConfig network) { + this.network = network; + } + + + public SandboxDetail lifecycle(SandboxLifecycle lifecycle) { + + this.lifecycle = lifecycle; + return this; + } + + /** + * Get lifecycle + * @return lifecycle + **/ + @javax.annotation.Nullable + public SandboxLifecycle getLifecycle() { + return lifecycle; + } + + + public void setLifecycle(SandboxLifecycle lifecycle) { + this.lifecycle = lifecycle; + } + + public SandboxDetail volumeMounts(List volumeMounts) { this.volumeMounts = volumeMounts; @@ -524,12 +601,15 @@ public boolean equals(Object o) { Objects.equals(this.endAt, sandboxDetail.endAt) && Objects.equals(this.envdVersion, sandboxDetail.envdVersion) && Objects.equals(this.envdAccessToken, sandboxDetail.envdAccessToken) && + Objects.equals(this.allowInternetAccess, sandboxDetail.allowInternetAccess) && Objects.equals(this.domain, sandboxDetail.domain) && Objects.equals(this.cpuCount, sandboxDetail.cpuCount) && Objects.equals(this.memoryMB, sandboxDetail.memoryMB) && Objects.equals(this.diskSizeMB, sandboxDetail.diskSizeMB) && Objects.equals(this.metadata, sandboxDetail.metadata) && Objects.equals(this.state, sandboxDetail.state) && + Objects.equals(this.network, sandboxDetail.network) && + Objects.equals(this.lifecycle, sandboxDetail.lifecycle) && Objects.equals(this.volumeMounts, sandboxDetail.volumeMounts)&& Objects.equals(this.additionalProperties, sandboxDetail.additionalProperties); } @@ -540,7 +620,7 @@ private static boolean equalsNullable(JsonNullable a, JsonNullable b) @Override public int hashCode() { - return Objects.hash(templateID, alias, sandboxID, clientID, startedAt, endAt, envdVersion, envdAccessToken, domain, cpuCount, memoryMB, diskSizeMB, metadata, state, volumeMounts, additionalProperties); + return Objects.hash(templateID, alias, sandboxID, clientID, startedAt, endAt, envdVersion, envdAccessToken, allowInternetAccess, domain, cpuCount, memoryMB, diskSizeMB, metadata, state, network, lifecycle, volumeMounts, additionalProperties); } private static int hashCodeNullable(JsonNullable a) { @@ -562,12 +642,15 @@ public String toString() { sb.append(" endAt: ").append(toIndentedString(endAt)).append("\n"); sb.append(" envdVersion: ").append(toIndentedString(envdVersion)).append("\n"); sb.append(" envdAccessToken: ").append(toIndentedString(envdAccessToken)).append("\n"); + sb.append(" allowInternetAccess: ").append(toIndentedString(allowInternetAccess)).append("\n"); sb.append(" domain: ").append(toIndentedString(domain)).append("\n"); sb.append(" cpuCount: ").append(toIndentedString(cpuCount)).append("\n"); sb.append(" memoryMB: ").append(toIndentedString(memoryMB)).append("\n"); sb.append(" diskSizeMB: ").append(toIndentedString(diskSizeMB)).append("\n"); sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" network: ").append(toIndentedString(network)).append("\n"); + sb.append(" lifecycle: ").append(toIndentedString(lifecycle)).append("\n"); sb.append(" volumeMounts: ").append(toIndentedString(volumeMounts)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); @@ -600,12 +683,15 @@ private String toIndentedString(Object o) { openapiFields.add("endAt"); openapiFields.add("envdVersion"); openapiFields.add("envdAccessToken"); + openapiFields.add("allowInternetAccess"); openapiFields.add("domain"); openapiFields.add("cpuCount"); openapiFields.add("memoryMB"); openapiFields.add("diskSizeMB"); openapiFields.add("metadata"); openapiFields.add("state"); + openapiFields.add("network"); + openapiFields.add("lifecycle"); openapiFields.add("volumeMounts"); // a set of required properties/fields (JSON key names) @@ -662,6 +748,14 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if ((jsonObj.get("domain") != null && !jsonObj.get("domain").isJsonNull()) && !jsonObj.get("domain").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `domain` to be a primitive type in the JSON string but got `%s`", jsonObj.get("domain").toString())); } + // validate the optional field `network` + if (jsonObj.get("network") != null && !jsonObj.get("network").isJsonNull()) { + SandboxNetworkConfig.validateJsonObject(jsonObj.getAsJsonObject("network")); + } + // validate the optional field `lifecycle` + if (jsonObj.get("lifecycle") != null && !jsonObj.get("lifecycle").isJsonNull()) { + SandboxLifecycle.validateJsonObject(jsonObj.getAsJsonObject("lifecycle")); + } if (jsonObj.get("volumeMounts") != null && !jsonObj.get("volumeMounts").isJsonNull()) { JsonArray jsonArrayvolumeMounts = jsonObj.getAsJsonArray("volumeMounts"); if (jsonArrayvolumeMounts != null) { @@ -696,7 +790,7 @@ public void write(JsonWriter out, SandboxDetail value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -719,7 +813,7 @@ public SandboxDetail read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance SandboxDetail instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxLifecycle.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxLifecycle.java new file mode 100644 index 0000000..80ed6f7 --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxLifecycle.java @@ -0,0 +1,318 @@ +/* + * E2B API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.openkruise.agents.client.e2b.api.models; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.openkruise.agents.client.e2b.api.models.SandboxOnTimeout; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import io.openkruise.agents.client.e2b.api.invoker.JSON; + +/** + * Sandbox lifecycle policy returned by sandbox info. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") +public class SandboxLifecycle { + public static final String SERIALIZED_NAME_AUTO_RESUME = "autoResume"; + @SerializedName(SERIALIZED_NAME_AUTO_RESUME) + private Boolean autoResume; + + public static final String SERIALIZED_NAME_ON_TIMEOUT = "onTimeout"; + @SerializedName(SERIALIZED_NAME_ON_TIMEOUT) + private SandboxOnTimeout onTimeout; + + public SandboxLifecycle() { + } + + public SandboxLifecycle autoResume(Boolean autoResume) { + + this.autoResume = autoResume; + return this; + } + + /** + * Whether the sandbox can auto-resume. + * @return autoResume + **/ + @javax.annotation.Nonnull + public Boolean getAutoResume() { + return autoResume; + } + + + public void setAutoResume(Boolean autoResume) { + this.autoResume = autoResume; + } + + + public SandboxLifecycle onTimeout(SandboxOnTimeout onTimeout) { + + this.onTimeout = onTimeout; + return this; + } + + /** + * Get onTimeout + * @return onTimeout + **/ + @javax.annotation.Nonnull + public SandboxOnTimeout getOnTimeout() { + return onTimeout; + } + + + public void setOnTimeout(SandboxOnTimeout onTimeout) { + this.onTimeout = onTimeout; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SandboxLifecycle instance itself + */ + public SandboxLifecycle putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SandboxLifecycle sandboxLifecycle = (SandboxLifecycle) o; + return Objects.equals(this.autoResume, sandboxLifecycle.autoResume) && + Objects.equals(this.onTimeout, sandboxLifecycle.onTimeout)&& + Objects.equals(this.additionalProperties, sandboxLifecycle.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(autoResume, onTimeout, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SandboxLifecycle {\n"); + sb.append(" autoResume: ").append(toIndentedString(autoResume)).append("\n"); + sb.append(" onTimeout: ").append(toIndentedString(onTimeout)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("autoResume"); + openapiFields.add("onTimeout"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("autoResume"); + openapiRequiredFields.add("onTimeout"); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to SandboxLifecycle + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!SandboxLifecycle.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SandboxLifecycle is not found in the empty JSON string", SandboxLifecycle.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SandboxLifecycle.openapiRequiredFields) { + if (jsonObj.get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SandboxLifecycle.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SandboxLifecycle' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SandboxLifecycle.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SandboxLifecycle value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SandboxLifecycle read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + SandboxLifecycle instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SandboxLifecycle given an JSON string + * + * @param jsonString JSON string + * @return An instance of SandboxLifecycle + * @throws IOException if the JSON string is invalid with respect to SandboxLifecycle + */ + public static SandboxLifecycle fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SandboxLifecycle.class); + } + + /** + * Convert an instance of SandboxLifecycle to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxLog.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxLog.java index e440f2a..db76055 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxLog.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxLog.java @@ -51,7 +51,7 @@ /** * Log entry with timestamp and line */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class SandboxLog { public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; @SerializedName(SERIALIZED_NAME_TIMESTAMP) @@ -250,7 +250,7 @@ public void write(JsonWriter out, SandboxLog value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -273,7 +273,7 @@ public SandboxLog read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance SandboxLog instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxLogEntry.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxLogEntry.java index 31944a3..6de49cb 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxLogEntry.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxLogEntry.java @@ -54,7 +54,7 @@ /** * SandboxLogEntry */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class SandboxLogEntry { public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; @SerializedName(SERIALIZED_NAME_TIMESTAMP) @@ -319,7 +319,7 @@ public void write(JsonWriter out, SandboxLogEntry value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -342,7 +342,7 @@ public SandboxLogEntry read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance SandboxLogEntry instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxLogs.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxLogs.java index b61bb02..ef67250 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxLogs.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxLogs.java @@ -54,7 +54,7 @@ /** * SandboxLogs */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class SandboxLogs { public static final String SERIALIZED_NAME_LOGS = "logs"; @SerializedName(SERIALIZED_NAME_LOGS) @@ -286,7 +286,7 @@ public void write(JsonWriter out, SandboxLogs value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -309,7 +309,7 @@ public SandboxLogs read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance SandboxLogs instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxLogsV2Response.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxLogsV2Response.java index ba57207..0ba2228 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxLogsV2Response.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxLogsV2Response.java @@ -53,7 +53,7 @@ /** * SandboxLogsV2Response */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class SandboxLogsV2Response { public static final String SERIALIZED_NAME_LOGS = "logs"; @SerializedName(SERIALIZED_NAME_LOGS) @@ -238,7 +238,7 @@ public void write(JsonWriter out, SandboxLogsV2Response value) throws IOExceptio obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -261,7 +261,7 @@ public SandboxLogsV2Response read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance SandboxLogsV2Response instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxMetric.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxMetric.java index 269444b..325226a 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxMetric.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxMetric.java @@ -51,7 +51,7 @@ /** * Metric entry with timestamp and line */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class SandboxMetric { public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; @Deprecated @@ -78,6 +78,10 @@ public class SandboxMetric { @SerializedName(SERIALIZED_NAME_MEM_TOTAL) private Long memTotal; + public static final String SERIALIZED_NAME_MEM_CACHE = "memCache"; + @SerializedName(SERIALIZED_NAME_MEM_CACHE) + private Long memCache; + public static final String SERIALIZED_NAME_DISK_USED = "diskUsed"; @SerializedName(SERIALIZED_NAME_DISK_USED) private Long diskUsed; @@ -219,6 +223,27 @@ public void setMemTotal(Long memTotal) { } + public SandboxMetric memCache(Long memCache) { + + this.memCache = memCache; + return this; + } + + /** + * Cached memory (page cache) in bytes + * @return memCache + **/ + @javax.annotation.Nonnull + public Long getMemCache() { + return memCache; + } + + + public void setMemCache(Long memCache) { + this.memCache = memCache; + } + + public SandboxMetric diskUsed(Long diskUsed) { this.diskUsed = diskUsed; @@ -321,6 +346,7 @@ public boolean equals(Object o) { Objects.equals(this.cpuUsedPct, sandboxMetric.cpuUsedPct) && Objects.equals(this.memUsed, sandboxMetric.memUsed) && Objects.equals(this.memTotal, sandboxMetric.memTotal) && + Objects.equals(this.memCache, sandboxMetric.memCache) && Objects.equals(this.diskUsed, sandboxMetric.diskUsed) && Objects.equals(this.diskTotal, sandboxMetric.diskTotal)&& Objects.equals(this.additionalProperties, sandboxMetric.additionalProperties); @@ -328,7 +354,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(timestamp, timestampUnix, cpuCount, cpuUsedPct, memUsed, memTotal, diskUsed, diskTotal, additionalProperties); + return Objects.hash(timestamp, timestampUnix, cpuCount, cpuUsedPct, memUsed, memTotal, memCache, diskUsed, diskTotal, additionalProperties); } @Override @@ -341,6 +367,7 @@ public String toString() { sb.append(" cpuUsedPct: ").append(toIndentedString(cpuUsedPct)).append("\n"); sb.append(" memUsed: ").append(toIndentedString(memUsed)).append("\n"); sb.append(" memTotal: ").append(toIndentedString(memTotal)).append("\n"); + sb.append(" memCache: ").append(toIndentedString(memCache)).append("\n"); sb.append(" diskUsed: ").append(toIndentedString(diskUsed)).append("\n"); sb.append(" diskTotal: ").append(toIndentedString(diskTotal)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); @@ -372,6 +399,7 @@ private String toIndentedString(Object o) { openapiFields.add("cpuUsedPct"); openapiFields.add("memUsed"); openapiFields.add("memTotal"); + openapiFields.add("memCache"); openapiFields.add("diskUsed"); openapiFields.add("diskTotal"); @@ -383,6 +411,7 @@ private String toIndentedString(Object o) { openapiRequiredFields.add("cpuUsedPct"); openapiRequiredFields.add("memUsed"); openapiRequiredFields.add("memTotal"); + openapiRequiredFields.add("memCache"); openapiRequiredFields.add("diskUsed"); openapiRequiredFields.add("diskTotal"); } @@ -426,7 +455,7 @@ public void write(JsonWriter out, SandboxMetric value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -449,7 +478,7 @@ public SandboxMetric read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance SandboxMetric instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxNetworkConfig.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxNetworkConfig.java index 754843e..093e94d 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxNetworkConfig.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxNetworkConfig.java @@ -20,9 +20,12 @@ import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; +import io.openkruise.agents.client.e2b.api.models.SandboxNetworkRule; import java.io.IOException; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -52,7 +55,7 @@ /** * SandboxNetworkConfig */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class SandboxNetworkConfig { public static final String SERIALIZED_NAME_ALLOW_PUBLIC_TRAFFIC = "allowPublicTraffic"; @SerializedName(SERIALIZED_NAME_ALLOW_PUBLIC_TRAFFIC) @@ -70,6 +73,10 @@ public class SandboxNetworkConfig { @SerializedName(SERIALIZED_NAME_MASK_REQUEST_HOST) private String maskRequestHost; + public static final String SERIALIZED_NAME_RULES = "rules"; + @SerializedName(SERIALIZED_NAME_RULES) + private Map> rules = new HashMap<>(); + public SandboxNetworkConfig() { } @@ -109,7 +116,7 @@ public SandboxNetworkConfig addAllowOutItem(String allowOutItem) { } /** - * List of allowed CIDR blocks or IP addresses for egress traffic. Allowed addresses always take precedence over blocked addresses. + * List of allowed destinations for egress traffic. Each entry can be a CIDR block (e.g. \"8.8.8.8/32\"), a bare IP address (e.g. \"8.8.8.8\"), or a domain name (e.g. \"example.com\", \"*.example.com\"). Allowed entries always take precedence over denied entries. * @return allowOut **/ @javax.annotation.Nullable @@ -138,7 +145,7 @@ public SandboxNetworkConfig addDenyOutItem(String denyOutItem) { } /** - * List of denied CIDR blocks or IP addresses for egress traffic + * List of denied CIDR blocks or IP addresses for egress traffic. Domain names are not supported for deny rules. * @return denyOut **/ @javax.annotation.Nullable @@ -172,6 +179,35 @@ public void setMaskRequestHost(String maskRequestHost) { this.maskRequestHost = maskRequestHost; } + + public SandboxNetworkConfig rules(Map> rules) { + + this.rules = rules; + return this; + } + + public SandboxNetworkConfig putRulesItem(String key, List rulesItem) { + if (this.rules == null) { + this.rules = new HashMap<>(); + } + this.rules.put(key, rulesItem); + return this; + } + + /** + * Per-domain transform rules applied to matching egress HTTP/HTTPS requests. Keys are domains (e.g. \"api.example.com\", \"example.com\"). A domain listed here is not automatically allowed - use allowOut to permit the traffic. + * @return rules + **/ + @javax.annotation.Nullable + public Map> getRules() { + return rules; + } + + + public void setRules(Map> rules) { + this.rules = rules; + } + /** * A container for additional, undeclared properties. * This is a holder for any undeclared properties as specified with @@ -230,13 +266,14 @@ public boolean equals(Object o) { return Objects.equals(this.allowPublicTraffic, sandboxNetworkConfig.allowPublicTraffic) && Objects.equals(this.allowOut, sandboxNetworkConfig.allowOut) && Objects.equals(this.denyOut, sandboxNetworkConfig.denyOut) && - Objects.equals(this.maskRequestHost, sandboxNetworkConfig.maskRequestHost)&& + Objects.equals(this.maskRequestHost, sandboxNetworkConfig.maskRequestHost) && + Objects.equals(this.rules, sandboxNetworkConfig.rules)&& Objects.equals(this.additionalProperties, sandboxNetworkConfig.additionalProperties); } @Override public int hashCode() { - return Objects.hash(allowPublicTraffic, allowOut, denyOut, maskRequestHost, additionalProperties); + return Objects.hash(allowPublicTraffic, allowOut, denyOut, maskRequestHost, rules, additionalProperties); } @Override @@ -247,6 +284,7 @@ public String toString() { sb.append(" allowOut: ").append(toIndentedString(allowOut)).append("\n"); sb.append(" denyOut: ").append(toIndentedString(denyOut)).append("\n"); sb.append(" maskRequestHost: ").append(toIndentedString(maskRequestHost)).append("\n"); + sb.append(" rules: ").append(toIndentedString(rules)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -274,6 +312,7 @@ private String toIndentedString(Object o) { openapiFields.add("allowOut"); openapiFields.add("denyOut"); openapiFields.add("maskRequestHost"); + openapiFields.add("rules"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); @@ -322,7 +361,7 @@ public void write(JsonWriter out, SandboxNetworkConfig value) throws IOException obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -345,7 +384,7 @@ public SandboxNetworkConfig read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance SandboxNetworkConfig instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxNetworkRule.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxNetworkRule.java new file mode 100644 index 0000000..be030a1 --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxNetworkRule.java @@ -0,0 +1,285 @@ +/* + * E2B API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.openkruise.agents.client.e2b.api.models; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.openkruise.agents.client.e2b.api.models.SandboxNetworkTransform; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import io.openkruise.agents.client.e2b.api.invoker.JSON; + +/** + * Transform rule applied to egress requests matching a domain pattern. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") +public class SandboxNetworkRule { + public static final String SERIALIZED_NAME_TRANSFORM = "transform"; + @SerializedName(SERIALIZED_NAME_TRANSFORM) + private SandboxNetworkTransform transform; + + public SandboxNetworkRule() { + } + + public SandboxNetworkRule transform(SandboxNetworkTransform transform) { + + this.transform = transform; + return this; + } + + /** + * Get transform + * @return transform + **/ + @javax.annotation.Nullable + public SandboxNetworkTransform getTransform() { + return transform; + } + + + public void setTransform(SandboxNetworkTransform transform) { + this.transform = transform; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SandboxNetworkRule instance itself + */ + public SandboxNetworkRule putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SandboxNetworkRule sandboxNetworkRule = (SandboxNetworkRule) o; + return Objects.equals(this.transform, sandboxNetworkRule.transform)&& + Objects.equals(this.additionalProperties, sandboxNetworkRule.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(transform, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SandboxNetworkRule {\n"); + sb.append(" transform: ").append(toIndentedString(transform)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("transform"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to SandboxNetworkRule + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!SandboxNetworkRule.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SandboxNetworkRule is not found in the empty JSON string", SandboxNetworkRule.openapiRequiredFields.toString())); + } + } + // validate the optional field `transform` + if (jsonObj.get("transform") != null && !jsonObj.get("transform").isJsonNull()) { + SandboxNetworkTransform.validateJsonObject(jsonObj.getAsJsonObject("transform")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SandboxNetworkRule.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SandboxNetworkRule' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SandboxNetworkRule.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SandboxNetworkRule value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SandboxNetworkRule read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + SandboxNetworkRule instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SandboxNetworkRule given an JSON string + * + * @param jsonString JSON string + * @return An instance of SandboxNetworkRule + * @throws IOException if the JSON string is invalid with respect to SandboxNetworkRule + */ + public static SandboxNetworkRule fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SandboxNetworkRule.class); + } + + /** + * Convert an instance of SandboxNetworkRule to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxNetworkTransform.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxNetworkTransform.java new file mode 100644 index 0000000..427ada9 --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxNetworkTransform.java @@ -0,0 +1,290 @@ +/* + * E2B API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.openkruise.agents.client.e2b.api.models; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import io.openkruise.agents.client.e2b.api.invoker.JSON; + +/** + * Transformations applied to matching egress requests before forwarding. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") +public class SandboxNetworkTransform { + public static final String SERIALIZED_NAME_HEADERS = "headers"; + @SerializedName(SERIALIZED_NAME_HEADERS) + private Map headers = new HashMap<>(); + + public SandboxNetworkTransform() { + } + + public SandboxNetworkTransform headers(Map headers) { + + this.headers = headers; + return this; + } + + public SandboxNetworkTransform putHeadersItem(String key, String headersItem) { + if (this.headers == null) { + this.headers = new HashMap<>(); + } + this.headers.put(key, headersItem); + return this; + } + + /** + * HTTP headers to inject or override in matching requests. An existing header with the same name is replaced. Values are plain strings; secret resolution happens client-side before sending to the API. + * @return headers + **/ + @javax.annotation.Nullable + public Map getHeaders() { + return headers; + } + + + public void setHeaders(Map headers) { + this.headers = headers; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SandboxNetworkTransform instance itself + */ + public SandboxNetworkTransform putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SandboxNetworkTransform sandboxNetworkTransform = (SandboxNetworkTransform) o; + return Objects.equals(this.headers, sandboxNetworkTransform.headers)&& + Objects.equals(this.additionalProperties, sandboxNetworkTransform.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(headers, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SandboxNetworkTransform {\n"); + sb.append(" headers: ").append(toIndentedString(headers)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("headers"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to SandboxNetworkTransform + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!SandboxNetworkTransform.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SandboxNetworkTransform is not found in the empty JSON string", SandboxNetworkTransform.openapiRequiredFields.toString())); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SandboxNetworkTransform.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SandboxNetworkTransform' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SandboxNetworkTransform.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SandboxNetworkTransform value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SandboxNetworkTransform read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + SandboxNetworkTransform instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SandboxNetworkTransform given an JSON string + * + * @param jsonString JSON string + * @return An instance of SandboxNetworkTransform + * @throws IOException if the JSON string is invalid with respect to SandboxNetworkTransform + */ + public static SandboxNetworkTransform fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SandboxNetworkTransform.class); + } + + /** + * Convert an instance of SandboxNetworkTransform to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxNetworkUpdateConfig.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxNetworkUpdateConfig.java new file mode 100644 index 0000000..244f1ea --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxNetworkUpdateConfig.java @@ -0,0 +1,401 @@ +/* + * E2B API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.openkruise.agents.client.e2b.api.models; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.openkruise.agents.client.e2b.api.models.SandboxNetworkRule; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import io.openkruise.agents.client.e2b.api.invoker.JSON; + +/** + * Network configuration update for a running sandbox. Replaces the current egress rules with the provided configuration. Omitting a field clears it. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") +public class SandboxNetworkUpdateConfig { + public static final String SERIALIZED_NAME_ALLOW_OUT = "allowOut"; + @SerializedName(SERIALIZED_NAME_ALLOW_OUT) + private List allowOut; + + public static final String SERIALIZED_NAME_DENY_OUT = "denyOut"; + @SerializedName(SERIALIZED_NAME_DENY_OUT) + private List denyOut; + + public static final String SERIALIZED_NAME_RULES = "rules"; + @SerializedName(SERIALIZED_NAME_RULES) + private Map> rules = new HashMap<>(); + + public static final String SERIALIZED_NAME_ALLOW_INTERNET_ACCESS = "allow_internet_access"; + @SerializedName(SERIALIZED_NAME_ALLOW_INTERNET_ACCESS) + private Boolean allowInternetAccess; + + public SandboxNetworkUpdateConfig() { + } + + public SandboxNetworkUpdateConfig allowOut(List allowOut) { + + this.allowOut = allowOut; + return this; + } + + public SandboxNetworkUpdateConfig addAllowOutItem(String allowOutItem) { + if (this.allowOut == null) { + this.allowOut = new ArrayList<>(); + } + this.allowOut.add(allowOutItem); + return this; + } + + /** + * List of allowed destinations for egress traffic. Each entry can be a CIDR block (e.g. \"8.8.8.8/32\"), a bare IP address (e.g. \"8.8.8.8\"), or a domain name (e.g. \"example.com\", \"*.example.com\"). Allowed entries always take precedence over denied entries. + * @return allowOut + **/ + @javax.annotation.Nullable + public List getAllowOut() { + return allowOut; + } + + + public void setAllowOut(List allowOut) { + this.allowOut = allowOut; + } + + + public SandboxNetworkUpdateConfig denyOut(List denyOut) { + + this.denyOut = denyOut; + return this; + } + + public SandboxNetworkUpdateConfig addDenyOutItem(String denyOutItem) { + if (this.denyOut == null) { + this.denyOut = new ArrayList<>(); + } + this.denyOut.add(denyOutItem); + return this; + } + + /** + * List of denied CIDR blocks or IP addresses for egress traffic. Domain names are not supported for deny rules. + * @return denyOut + **/ + @javax.annotation.Nullable + public List getDenyOut() { + return denyOut; + } + + + public void setDenyOut(List denyOut) { + this.denyOut = denyOut; + } + + + public SandboxNetworkUpdateConfig rules(Map> rules) { + + this.rules = rules; + return this; + } + + public SandboxNetworkUpdateConfig putRulesItem(String key, List rulesItem) { + if (this.rules == null) { + this.rules = new HashMap<>(); + } + this.rules.put(key, rulesItem); + return this; + } + + /** + * Per-domain transform rules. Replaces all existing rules when provided. + * @return rules + **/ + @javax.annotation.Nullable + public Map> getRules() { + return rules; + } + + + public void setRules(Map> rules) { + this.rules = rules; + } + + + public SandboxNetworkUpdateConfig allowInternetAccess(Boolean allowInternetAccess) { + + this.allowInternetAccess = allowInternetAccess; + return this; + } + + /** + * Allow sandbox to access the internet. When set to false, it behaves the same as specifying denyOut to 0.0.0.0/0 in the network config. + * @return allowInternetAccess + **/ + @javax.annotation.Nullable + public Boolean getAllowInternetAccess() { + return allowInternetAccess; + } + + + public void setAllowInternetAccess(Boolean allowInternetAccess) { + this.allowInternetAccess = allowInternetAccess; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SandboxNetworkUpdateConfig instance itself + */ + public SandboxNetworkUpdateConfig putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SandboxNetworkUpdateConfig sandboxNetworkUpdateConfig = (SandboxNetworkUpdateConfig) o; + return Objects.equals(this.allowOut, sandboxNetworkUpdateConfig.allowOut) && + Objects.equals(this.denyOut, sandboxNetworkUpdateConfig.denyOut) && + Objects.equals(this.rules, sandboxNetworkUpdateConfig.rules) && + Objects.equals(this.allowInternetAccess, sandboxNetworkUpdateConfig.allowInternetAccess)&& + Objects.equals(this.additionalProperties, sandboxNetworkUpdateConfig.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(allowOut, denyOut, rules, allowInternetAccess, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SandboxNetworkUpdateConfig {\n"); + sb.append(" allowOut: ").append(toIndentedString(allowOut)).append("\n"); + sb.append(" denyOut: ").append(toIndentedString(denyOut)).append("\n"); + sb.append(" rules: ").append(toIndentedString(rules)).append("\n"); + sb.append(" allowInternetAccess: ").append(toIndentedString(allowInternetAccess)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("allowOut"); + openapiFields.add("denyOut"); + openapiFields.add("rules"); + openapiFields.add("allow_internet_access"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to SandboxNetworkUpdateConfig + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!SandboxNetworkUpdateConfig.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SandboxNetworkUpdateConfig is not found in the empty JSON string", SandboxNetworkUpdateConfig.openapiRequiredFields.toString())); + } + } + // ensure the optional json data is an array if present + if (jsonObj.get("allowOut") != null && !jsonObj.get("allowOut").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `allowOut` to be an array in the JSON string but got `%s`", jsonObj.get("allowOut").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("denyOut") != null && !jsonObj.get("denyOut").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `denyOut` to be an array in the JSON string but got `%s`", jsonObj.get("denyOut").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SandboxNetworkUpdateConfig.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SandboxNetworkUpdateConfig' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SandboxNetworkUpdateConfig.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SandboxNetworkUpdateConfig value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SandboxNetworkUpdateConfig read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + SandboxNetworkUpdateConfig instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SandboxNetworkUpdateConfig given an JSON string + * + * @param jsonString JSON string + * @return An instance of SandboxNetworkUpdateConfig + * @throws IOException if the JSON string is invalid with respect to SandboxNetworkUpdateConfig + */ + public static SandboxNetworkUpdateConfig fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SandboxNetworkUpdateConfig.class); + } + + /** + * Convert an instance of SandboxNetworkUpdateConfig to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxOnTimeout.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxOnTimeout.java new file mode 100644 index 0000000..1c0ba52 --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxOnTimeout.java @@ -0,0 +1,73 @@ +/* + * E2B API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.openkruise.agents.client.e2b.api.models; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Action taken when the sandbox times out. + */ +@JsonAdapter(SandboxOnTimeout.Adapter.class) +public enum SandboxOnTimeout { + + KILL("kill"), + + PAUSE("pause"); + + private String value; + + SandboxOnTimeout(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SandboxOnTimeout fromValue(String value) { + for (SandboxOnTimeout b : SandboxOnTimeout.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SandboxOnTimeout enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SandboxOnTimeout read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SandboxOnTimeout.fromValue(value); + } + } +} + diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/Sandbox.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxResponse.java similarity index 84% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/Sandbox.java rename to k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxResponse.java index f6a0eb8..5d72877 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/Sandbox.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxResponse.java @@ -49,10 +49,10 @@ import io.openkruise.agents.client.e2b.api.invoker.JSON; /** - * Sandbox + * SandboxResponse */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") -public class Sandbox { +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") +public class SandboxResponse { public static final String SERIALIZED_NAME_TEMPLATE_I_D = "templateID"; @SerializedName(SERIALIZED_NAME_TEMPLATE_I_D) private String templateID; @@ -86,10 +86,10 @@ public class Sandbox { @SerializedName(SERIALIZED_NAME_DOMAIN) private String domain; - public Sandbox() { + public SandboxResponse() { } - public Sandbox templateID(String templateID) { + public SandboxResponse templateID(String templateID) { this.templateID = templateID; return this; @@ -110,7 +110,7 @@ public void setTemplateID(String templateID) { } - public Sandbox sandboxID(String sandboxID) { + public SandboxResponse sandboxID(String sandboxID) { this.sandboxID = sandboxID; return this; @@ -131,7 +131,7 @@ public void setSandboxID(String sandboxID) { } - public Sandbox alias(String alias) { + public SandboxResponse alias(String alias) { this.alias = alias; return this; @@ -153,7 +153,7 @@ public void setAlias(String alias) { @Deprecated - public Sandbox clientID(String clientID) { + public SandboxResponse clientID(String clientID) { this.clientID = clientID; return this; @@ -177,7 +177,7 @@ public void setClientID(String clientID) { } - public Sandbox envdVersion(String envdVersion) { + public SandboxResponse envdVersion(String envdVersion) { this.envdVersion = envdVersion; return this; @@ -198,7 +198,7 @@ public void setEnvdVersion(String envdVersion) { } - public Sandbox envdAccessToken(String envdAccessToken) { + public SandboxResponse envdAccessToken(String envdAccessToken) { this.envdAccessToken = envdAccessToken; return this; @@ -219,7 +219,7 @@ public void setEnvdAccessToken(String envdAccessToken) { } - public Sandbox trafficAccessToken(String trafficAccessToken) { + public SandboxResponse trafficAccessToken(String trafficAccessToken) { this.trafficAccessToken = trafficAccessToken; return this; @@ -240,7 +240,7 @@ public void setTrafficAccessToken(String trafficAccessToken) { } - public Sandbox domain(String domain) { + public SandboxResponse domain(String domain) { this.domain = domain; return this; @@ -273,9 +273,9 @@ public void setDomain(String domain) { * * @param key name of the property * @param value value of the property - * @return the Sandbox instance itself + * @return the SandboxResponse instance itself */ - public Sandbox putAdditionalProperty(String key, Object value) { + public SandboxResponse putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -314,16 +314,16 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - Sandbox sandbox = (Sandbox) o; - return Objects.equals(this.templateID, sandbox.templateID) && - Objects.equals(this.sandboxID, sandbox.sandboxID) && - Objects.equals(this.alias, sandbox.alias) && - Objects.equals(this.clientID, sandbox.clientID) && - Objects.equals(this.envdVersion, sandbox.envdVersion) && - Objects.equals(this.envdAccessToken, sandbox.envdAccessToken) && - Objects.equals(this.trafficAccessToken, sandbox.trafficAccessToken) && - Objects.equals(this.domain, sandbox.domain)&& - Objects.equals(this.additionalProperties, sandbox.additionalProperties); + SandboxResponse sandboxResponse = (SandboxResponse) o; + return Objects.equals(this.templateID, sandboxResponse.templateID) && + Objects.equals(this.sandboxID, sandboxResponse.sandboxID) && + Objects.equals(this.alias, sandboxResponse.alias) && + Objects.equals(this.clientID, sandboxResponse.clientID) && + Objects.equals(this.envdVersion, sandboxResponse.envdVersion) && + Objects.equals(this.envdAccessToken, sandboxResponse.envdAccessToken) && + Objects.equals(this.trafficAccessToken, sandboxResponse.trafficAccessToken) && + Objects.equals(this.domain, sandboxResponse.domain)&& + Objects.equals(this.additionalProperties, sandboxResponse.additionalProperties); } private static boolean equalsNullable(JsonNullable a, JsonNullable b) { @@ -345,7 +345,7 @@ private static int hashCodeNullable(JsonNullable a) { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class Sandbox {\n"); + sb.append("class SandboxResponse {\n"); sb.append(" templateID: ").append(toIndentedString(templateID)).append("\n"); sb.append(" sandboxID: ").append(toIndentedString(sandboxID)).append("\n"); sb.append(" alias: ").append(toIndentedString(alias)).append("\n"); @@ -398,17 +398,17 @@ private String toIndentedString(Object o) { * Validates the JSON Object and throws an exception if issues found * * @param jsonObj JSON Object - * @throws IOException if the JSON Object is invalid with respect to Sandbox + * @throws IOException if the JSON Object is invalid with respect to SandboxResponse */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { - if (!Sandbox.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Sandbox is not found in the empty JSON string", Sandbox.openapiRequiredFields.toString())); + if (!SandboxResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SandboxResponse is not found in the empty JSON string", SandboxResponse.openapiRequiredFields.toString())); } } // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Sandbox.openapiRequiredFields) { + for (String requiredField : SandboxResponse.openapiRequiredFields) { if (jsonObj.get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); } @@ -443,21 +443,21 @@ public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!Sandbox.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Sandbox' and its subtypes + if (!SandboxResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SandboxResponse' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Sandbox.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SandboxResponse.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, Sandbox value) throws IOException { + public void write(JsonWriter out, SandboxResponse value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -475,12 +475,12 @@ else if (entry.getValue() instanceof Character) } @Override - public Sandbox read(JsonReader in) throws IOException { + public SandboxResponse read(JsonReader in) throws IOException { JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); validateJsonObject(jsonObj); // store additional fields in the deserialized instance - Sandbox instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + SandboxResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) @@ -506,18 +506,18 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } /** - * Create an instance of Sandbox given an JSON string + * Create an instance of SandboxResponse given an JSON string * * @param jsonString JSON string - * @return An instance of Sandbox - * @throws IOException if the JSON string is invalid with respect to Sandbox + * @return An instance of SandboxResponse + * @throws IOException if the JSON string is invalid with respect to SandboxResponse */ - public static Sandbox fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Sandbox.class); + public static SandboxResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SandboxResponse.class); } /** - * Convert an instance of Sandbox to an JSON string + * Convert an instance of SandboxResponse to an JSON string * * @return JSON string */ diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxVolumeMount.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxVolumeMount.java index bd2550b..45d358e 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxVolumeMount.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxVolumeMount.java @@ -50,7 +50,7 @@ /** * SandboxVolumeMount */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class SandboxVolumeMount { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -252,7 +252,7 @@ public void write(JsonWriter out, SandboxVolumeMount value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -275,7 +275,7 @@ public SandboxVolumeMount read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance SandboxVolumeMount instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxesGet200ResponseInner.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxesGet200ResponseInner.java index f454c2d..ad5cb22 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxesGet200ResponseInner.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxesGet200ResponseInner.java @@ -57,7 +57,7 @@ /** * SandboxesGet200ResponseInner */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class SandboxesGet200ResponseInner { public static final String SERIALIZED_NAME_TEMPLATE_I_D = "templateID"; @SerializedName(SERIALIZED_NAME_TEMPLATE_I_D) @@ -622,7 +622,7 @@ public void write(JsonWriter out, SandboxesGet200ResponseInner value) throws IOE obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -645,7 +645,7 @@ public SandboxesGet200ResponseInner read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance SandboxesGet200ResponseInner instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxesSandboxIDRefreshesPostRequest.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxesSandboxIDRefreshesPostRequest.java index 2739559..062d99e 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxesSandboxIDRefreshesPostRequest.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxesSandboxIDRefreshesPostRequest.java @@ -50,7 +50,7 @@ /** * SandboxesSandboxIDRefreshesPostRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class SandboxesSandboxIDRefreshesPostRequest { public static final String SERIALIZED_NAME_DURATION = "duration"; @SerializedName(SERIALIZED_NAME_DURATION) @@ -211,7 +211,7 @@ public void write(JsonWriter out, SandboxesSandboxIDRefreshesPostRequest value) obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -234,7 +234,7 @@ public SandboxesSandboxIDRefreshesPostRequest read(JsonReader in) throws IOExcep validateJsonObject(jsonObj); // store additional fields in the deserialized instance SandboxesSandboxIDRefreshesPostRequest instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxesSandboxIDSnapshotsPostRequest.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxesSandboxIDSnapshotsPostRequest.java index 47f6baa..2d5f24d 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxesSandboxIDSnapshotsPostRequest.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxesSandboxIDSnapshotsPostRequest.java @@ -50,7 +50,7 @@ /** * SandboxesSandboxIDSnapshotsPostRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class SandboxesSandboxIDSnapshotsPostRequest { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -212,7 +212,7 @@ public void write(JsonWriter out, SandboxesSandboxIDSnapshotsPostRequest value) obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -235,7 +235,7 @@ public SandboxesSandboxIDSnapshotsPostRequest read(JsonReader in) throws IOExcep validateJsonObject(jsonObj); // store additional fields in the deserialized instance SandboxesSandboxIDSnapshotsPostRequest instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxesSandboxIDTimeoutPostRequest.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxesSandboxIDTimeoutPostRequest.java index 0ecc26b..27da1a8 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxesSandboxIDTimeoutPostRequest.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxesSandboxIDTimeoutPostRequest.java @@ -50,7 +50,7 @@ /** * SandboxesSandboxIDTimeoutPostRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class SandboxesSandboxIDTimeoutPostRequest { public static final String SERIALIZED_NAME_TIMEOUT = "timeout"; @SerializedName(SERIALIZED_NAME_TIMEOUT) @@ -218,7 +218,7 @@ public void write(JsonWriter out, SandboxesSandboxIDTimeoutPostRequest value) th obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -241,7 +241,7 @@ public SandboxesSandboxIDTimeoutPostRequest read(JsonReader in) throws IOExcepti validateJsonObject(jsonObj); // store additional fields in the deserialized instance SandboxesSandboxIDTimeoutPostRequest instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxesWithMetrics.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxesWithMetrics.java index af5330c..8cf5e9e 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxesWithMetrics.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SandboxesWithMetrics.java @@ -53,7 +53,7 @@ /** * SandboxesWithMetrics */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class SandboxesWithMetrics { public static final String SERIALIZED_NAME_SANDBOXES = "sandboxes"; @SerializedName(SERIALIZED_NAME_SANDBOXES) @@ -228,7 +228,7 @@ public void write(JsonWriter out, SandboxesWithMetrics value) throws IOException obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -251,7 +251,7 @@ public SandboxesWithMetrics read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance SandboxesWithMetrics instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SnapshotInfo.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SnapshotInfo.java index 8b0b5e6..f56b15f 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SnapshotInfo.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/SnapshotInfo.java @@ -52,7 +52,7 @@ /** * SnapshotInfo */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class SnapshotInfo { public static final String SERIALIZED_NAME_SNAPSHOT_I_D = "snapshotID"; @SerializedName(SERIALIZED_NAME_SNAPSHOT_I_D) @@ -72,7 +72,7 @@ public SnapshotInfo snapshotID(String snapshotID) { } /** - * Identifier of the snapshot template + * Identifier of the snapshot template including the tag. Uses namespace/alias when a name was provided (e.g. team-slug/my-snapshot:default), otherwise falls back to the raw template ID (e.g. abc123:default). * @return snapshotID **/ @javax.annotation.Nonnull @@ -265,7 +265,7 @@ public void write(JsonWriter out, SnapshotInfo value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -288,7 +288,7 @@ public SnapshotInfo read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance SnapshotInfo instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/Team.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/Team.java index beb492d..c3b5058 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/Team.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/Team.java @@ -50,7 +50,7 @@ /** * Team */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class Team { public static final String SERIALIZED_NAME_TEAM_I_D = "teamID"; @SerializedName(SERIALIZED_NAME_TEAM_I_D) @@ -313,7 +313,7 @@ public void write(JsonWriter out, Team value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -336,7 +336,7 @@ public Team read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance Team instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TeamAPIKey.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TeamAPIKey.java index 42f137e..7d65739 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TeamAPIKey.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TeamAPIKey.java @@ -55,7 +55,7 @@ /** * TeamAPIKey */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class TeamAPIKey { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @@ -388,7 +388,7 @@ public void write(JsonWriter out, TeamAPIKey value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -411,7 +411,7 @@ public TeamAPIKey read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance TeamAPIKey instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TeamMetric.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TeamMetric.java index ca9697e..066fe23 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TeamMetric.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TeamMetric.java @@ -51,7 +51,7 @@ /** * Team metric with timestamp */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class TeamMetric { public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; @Deprecated @@ -310,7 +310,7 @@ public void write(JsonWriter out, TeamMetric value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -333,7 +333,7 @@ public TeamMetric read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance TeamMetric instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TeamUser.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TeamUser.java index 32e1a4f..6e76446 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TeamUser.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TeamUser.java @@ -51,13 +51,14 @@ /** * TeamUser */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class TeamUser { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) private UUID id; public static final String SERIALIZED_NAME_EMAIL = "email"; + @Deprecated @SerializedName(SERIALIZED_NAME_EMAIL) private String email; @@ -85,6 +86,7 @@ public void setId(UUID id) { } + @Deprecated public TeamUser email(String email) { this.email = email; @@ -94,13 +96,16 @@ public TeamUser email(String email) { /** * Email of the user * @return email + * @deprecated **/ - @javax.annotation.Nonnull + @Deprecated + @javax.annotation.Nullable public String getEmail() { return email; } + @Deprecated public void setEmail(String email) { this.email = email; } @@ -253,7 +258,7 @@ public void write(JsonWriter out, TeamUser value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -276,7 +281,7 @@ public TeamUser read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance TeamUser instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TeamsGet200ResponseInner.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TeamsGet200ResponseInner.java index 334a383..58d7713 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TeamsGet200ResponseInner.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TeamsGet200ResponseInner.java @@ -50,7 +50,7 @@ /** * TeamsGet200ResponseInner */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class TeamsGet200ResponseInner { public static final String SERIALIZED_NAME_TEAM_I_D = "teamID"; @SerializedName(SERIALIZED_NAME_TEAM_I_D) @@ -313,7 +313,7 @@ public void write(JsonWriter out, TeamsGet200ResponseInner value) throws IOExcep obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -336,7 +336,7 @@ public TeamsGet200ResponseInner read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance TeamsGet200ResponseInner instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/Template.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/Template.java index 156511e..12c74e5 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/Template.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/Template.java @@ -55,7 +55,7 @@ /** * Template */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class Template { public static final String SERIALIZED_NAME_TEMPLATE_I_D = "templateID"; @SerializedName(SERIALIZED_NAME_TEMPLATE_I_D) @@ -704,7 +704,7 @@ public void write(JsonWriter out, Template value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -727,7 +727,7 @@ public Template read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance Template instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateAliasResponse.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateAliasResponse.java index 965baed..57c550a 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateAliasResponse.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateAliasResponse.java @@ -50,7 +50,7 @@ /** * TemplateAliasResponse */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class TemplateAliasResponse { public static final String SERIALIZED_NAME_TEMPLATE_I_D = "templateID"; @SerializedName(SERIALIZED_NAME_TEMPLATE_I_D) @@ -249,7 +249,7 @@ public void write(JsonWriter out, TemplateAliasResponse value) throws IOExceptio obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -272,7 +272,7 @@ public TemplateAliasResponse read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance TemplateAliasResponse instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuild.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuild.java index 561968a..efad866 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuild.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuild.java @@ -53,7 +53,7 @@ /** * TemplateBuild */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class TemplateBuild { public static final String SERIALIZED_NAME_BUILD_I_D = "buildID"; @SerializedName(SERIALIZED_NAME_BUILD_I_D) @@ -458,7 +458,7 @@ public void write(JsonWriter out, TemplateBuild value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -481,7 +481,7 @@ public TemplateBuild read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance TemplateBuild instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildFileUpload.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildFileUpload.java index 0aa7e98..503073a 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildFileUpload.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildFileUpload.java @@ -50,7 +50,7 @@ /** * TemplateBuildFileUpload */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class TemplateBuildFileUpload { public static final String SERIALIZED_NAME_PRESENT = "present"; @SerializedName(SERIALIZED_NAME_PRESENT) @@ -248,7 +248,7 @@ public void write(JsonWriter out, TemplateBuildFileUpload value) throws IOExcept obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -271,7 +271,7 @@ public TemplateBuildFileUpload read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance TemplateBuildFileUpload instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildInfo.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildInfo.java index 7eed541..8d19d66 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildInfo.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildInfo.java @@ -55,7 +55,7 @@ /** * TemplateBuildInfo */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class TemplateBuildInfo { public static final String SERIALIZED_NAME_LOGS = "logs"; @SerializedName(SERIALIZED_NAME_LOGS) @@ -408,7 +408,7 @@ public void write(JsonWriter out, TemplateBuildInfo value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -431,7 +431,7 @@ public TemplateBuildInfo read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance TemplateBuildInfo instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildLogsResponse.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildLogsResponse.java index 8f91e07..fefc338 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildLogsResponse.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildLogsResponse.java @@ -53,7 +53,7 @@ /** * TemplateBuildLogsResponse */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class TemplateBuildLogsResponse { public static final String SERIALIZED_NAME_LOGS = "logs"; @SerializedName(SERIALIZED_NAME_LOGS) @@ -238,7 +238,7 @@ public void write(JsonWriter out, TemplateBuildLogsResponse value) throws IOExce obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -261,7 +261,7 @@ public TemplateBuildLogsResponse read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance TemplateBuildLogsResponse instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildRequest.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildRequest.java index 6482078..7ed8bb7 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildRequest.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildRequest.java @@ -50,7 +50,7 @@ /** * TemplateBuildRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class TemplateBuildRequest { public static final String SERIALIZED_NAME_ALIAS = "alias"; @SerializedName(SERIALIZED_NAME_ALIAS) @@ -402,7 +402,7 @@ public void write(JsonWriter out, TemplateBuildRequest value) throws IOException obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -425,7 +425,7 @@ public TemplateBuildRequest read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance TemplateBuildRequest instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildRequestV2.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildRequestV2.java index ab40121..566881c 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildRequestV2.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildRequestV2.java @@ -50,7 +50,7 @@ /** * TemplateBuildRequestV2 */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class TemplateBuildRequestV2 { public static final String SERIALIZED_NAME_ALIAS = "alias"; @SerializedName(SERIALIZED_NAME_ALIAS) @@ -314,7 +314,7 @@ public void write(JsonWriter out, TemplateBuildRequestV2 value) throws IOExcepti obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -337,7 +337,7 @@ public TemplateBuildRequestV2 read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance TemplateBuildRequestV2 instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildRequestV3.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildRequestV3.java index e74aadb..8abd212 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildRequestV3.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildRequestV3.java @@ -52,7 +52,7 @@ /** * TemplateBuildRequestV3 */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class TemplateBuildRequestV3 { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -384,7 +384,7 @@ public void write(JsonWriter out, TemplateBuildRequestV3 value) throws IOExcepti obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -407,7 +407,7 @@ public TemplateBuildRequestV3 read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance TemplateBuildRequestV3 instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildStartV2.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildStartV2.java index 46acfc8..5b05f22 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildStartV2.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateBuildStartV2.java @@ -54,7 +54,7 @@ /** * TemplateBuildStartV2 */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class TemplateBuildStartV2 { public static final String SERIALIZED_NAME_FROM_IMAGE = "fromImage"; @SerializedName(SERIALIZED_NAME_FROM_IMAGE) @@ -419,7 +419,7 @@ public void write(JsonWriter out, TemplateBuildStartV2 value) throws IOException obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -442,7 +442,7 @@ public TemplateBuildStartV2 read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance TemplateBuildStartV2 instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateLegacy.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateLegacy.java index 0cbd965..5abf9f6 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateLegacy.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateLegacy.java @@ -54,7 +54,7 @@ /** * TemplateLegacy */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class TemplateLegacy { public static final String SERIALIZED_NAME_TEMPLATE_I_D = "templateID"; @SerializedName(SERIALIZED_NAME_TEMPLATE_I_D) @@ -626,7 +626,7 @@ public void write(JsonWriter out, TemplateLegacy value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -649,7 +649,7 @@ public TemplateLegacy read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance TemplateLegacy instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateRequestResponseV3.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateRequestResponseV3.java index a5dec98..b75186c 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateRequestResponseV3.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateRequestResponseV3.java @@ -52,7 +52,7 @@ /** * TemplateRequestResponseV3 */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class TemplateRequestResponseV3 { public static final String SERIALIZED_NAME_TEMPLATE_I_D = "templateID"; @SerializedName(SERIALIZED_NAME_TEMPLATE_I_D) @@ -417,7 +417,7 @@ public void write(JsonWriter out, TemplateRequestResponseV3 value) throws IOExce obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -440,7 +440,7 @@ public TemplateRequestResponseV3 read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance TemplateRequestResponseV3 instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateStep.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateStep.java index 99d2127..3bad1c4 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateStep.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateStep.java @@ -52,7 +52,7 @@ /** * Step in the template build process */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class TemplateStep { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @@ -321,7 +321,7 @@ public void write(JsonWriter out, TemplateStep value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -344,7 +344,7 @@ public TemplateStep read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance TemplateStep instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateTag.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateTag.java index 8aec3c8..a984815 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateTag.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateTag.java @@ -52,7 +52,7 @@ /** * TemplateTag */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class TemplateTag { public static final String SERIALIZED_NAME_TAG = "tag"; @SerializedName(SERIALIZED_NAME_TAG) @@ -283,7 +283,7 @@ public void write(JsonWriter out, TemplateTag value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -306,7 +306,7 @@ public TemplateTag read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance TemplateTag instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateUpdateRequest.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateUpdateRequest.java index be103f1..bd8cf4a 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateUpdateRequest.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateUpdateRequest.java @@ -50,7 +50,7 @@ /** * TemplateUpdateRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class TemplateUpdateRequest { public static final String SERIALIZED_NAME_PUBLIC = "public"; @SerializedName(SERIALIZED_NAME_PUBLIC) @@ -209,7 +209,7 @@ public void write(JsonWriter out, TemplateUpdateRequest value) throws IOExceptio obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -232,7 +232,7 @@ public TemplateUpdateRequest read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance TemplateUpdateRequest instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateUpdateResponse.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateUpdateResponse.java index 1496b8c..cc8ba95 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateUpdateResponse.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateUpdateResponse.java @@ -52,7 +52,7 @@ /** * TemplateUpdateResponse */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class TemplateUpdateResponse { public static final String SERIALIZED_NAME_NAMES = "names"; @SerializedName(SERIALIZED_NAME_NAMES) @@ -233,7 +233,7 @@ public void write(JsonWriter out, TemplateUpdateResponse value) throws IOExcepti obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -256,7 +256,7 @@ public TemplateUpdateResponse read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance TemplateUpdateResponse instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateWithBuilds.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateWithBuilds.java index 911c074..a82eac9 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateWithBuilds.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplateWithBuilds.java @@ -54,7 +54,7 @@ /** * TemplateWithBuilds */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class TemplateWithBuilds { public static final String SERIALIZED_NAME_TEMPLATE_I_D = "templateID"; @SerializedName(SERIALIZED_NAME_TEMPLATE_I_D) @@ -507,7 +507,7 @@ public void write(JsonWriter out, TemplateWithBuilds value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -530,7 +530,7 @@ public TemplateWithBuilds read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance TemplateWithBuilds instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplatesGet200ResponseInner.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplatesGet200ResponseInner.java index 6be03a6..6717510 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplatesGet200ResponseInner.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/TemplatesGet200ResponseInner.java @@ -55,7 +55,7 @@ /** * TemplatesGet200ResponseInner */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class TemplatesGet200ResponseInner { public static final String SERIALIZED_NAME_TEMPLATE_I_D = "templateID"; @SerializedName(SERIALIZED_NAME_TEMPLATE_I_D) @@ -704,7 +704,7 @@ public void write(JsonWriter out, TemplatesGet200ResponseInner value) throws IOE obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -727,7 +727,7 @@ public TemplatesGet200ResponseInner read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance TemplatesGet200ResponseInner instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/UpdateTeamAPIKey.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/UpdateTeamAPIKey.java index d745ce7..0e535f6 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/UpdateTeamAPIKey.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/UpdateTeamAPIKey.java @@ -50,7 +50,7 @@ /** * UpdateTeamAPIKey */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class UpdateTeamAPIKey { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -220,7 +220,7 @@ public void write(JsonWriter out, UpdateTeamAPIKey value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -243,7 +243,7 @@ public UpdateTeamAPIKey read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance UpdateTeamAPIKey instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/Volume.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/Volume.java index 34d381c..4b59676 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/Volume.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/Volume.java @@ -50,7 +50,7 @@ /** * Volume */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-13T16:02:01.263+08:00[Asia/Shanghai]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") public class Volume { public static final String SERIALIZED_NAME_VOLUME_I_D = "volumeID"; @SerializedName(SERIALIZED_NAME_VOLUME_I_D) @@ -252,7 +252,7 @@ public void write(JsonWriter out, Volume value) throws IOException { obj.remove("additionalProperties"); // serialize additional properties if (value.getAdditionalProperties() != null) { - for (Entry entry : value.getAdditionalProperties().entrySet()) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { if (entry.getValue() instanceof String) obj.addProperty(entry.getKey(), (String) entry.getValue()); else if (entry.getValue() instanceof Number) @@ -275,7 +275,7 @@ public Volume read(JsonReader in) throws IOException { validateJsonObject(jsonObj); // store additional fields in the deserialized instance Volume instance = thisAdapter.fromJsonTree(jsonObj); - for (Entry entry : jsonObj.entrySet()) { + for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type if (entry.getValue().getAsJsonPrimitive().isString()) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/VolumeAndToken.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/VolumeAndToken.java new file mode 100644 index 0000000..9817548 --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/VolumeAndToken.java @@ -0,0 +1,355 @@ +/* + * E2B API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.openkruise.agents.client.e2b.api.models; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import io.openkruise.agents.client.e2b.api.invoker.JSON; + +/** + * VolumeAndToken + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") +public class VolumeAndToken { + public static final String SERIALIZED_NAME_VOLUME_I_D = "volumeID"; + @SerializedName(SERIALIZED_NAME_VOLUME_I_D) + private String volumeID; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_TOKEN = "token"; + @SerializedName(SERIALIZED_NAME_TOKEN) + private String token; + + public VolumeAndToken() { + } + + public VolumeAndToken volumeID(String volumeID) { + + this.volumeID = volumeID; + return this; + } + + /** + * ID of the volume + * @return volumeID + **/ + @javax.annotation.Nonnull + public String getVolumeID() { + return volumeID; + } + + + public void setVolumeID(String volumeID) { + this.volumeID = volumeID; + } + + + public VolumeAndToken name(String name) { + + this.name = name; + return this; + } + + /** + * Name of the volume + * @return name + **/ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public VolumeAndToken token(String token) { + + this.token = token; + return this; + } + + /** + * Auth token to use for interacting with volume content + * @return token + **/ + @javax.annotation.Nonnull + public String getToken() { + return token; + } + + + public void setToken(String token) { + this.token = token; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the VolumeAndToken instance itself + */ + public VolumeAndToken putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VolumeAndToken volumeAndToken = (VolumeAndToken) o; + return Objects.equals(this.volumeID, volumeAndToken.volumeID) && + Objects.equals(this.name, volumeAndToken.name) && + Objects.equals(this.token, volumeAndToken.token)&& + Objects.equals(this.additionalProperties, volumeAndToken.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(volumeID, name, token, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VolumeAndToken {\n"); + sb.append(" volumeID: ").append(toIndentedString(volumeID)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("volumeID"); + openapiFields.add("name"); + openapiFields.add("token"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("volumeID"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("token"); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to VolumeAndToken + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!VolumeAndToken.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in VolumeAndToken is not found in the empty JSON string", VolumeAndToken.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VolumeAndToken.openapiRequiredFields) { + if (jsonObj.get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + } + } + if (!jsonObj.get("volumeID").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `volumeID` to be a primitive type in the JSON string but got `%s`", jsonObj.get("volumeID").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("token").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("token").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VolumeAndToken.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VolumeAndToken' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(VolumeAndToken.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, VolumeAndToken value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public VolumeAndToken read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + VolumeAndToken instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of VolumeAndToken given an JSON string + * + * @param jsonString JSON string + * @return An instance of VolumeAndToken + * @throws IOException if the JSON string is invalid with respect to VolumeAndToken + */ + public static VolumeAndToken fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VolumeAndToken.class); + } + + /** + * Convert an instance of VolumeAndToken to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/VolumeToken.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/VolumeToken.java new file mode 100644 index 0000000..bdbdd21 --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/api/models/VolumeToken.java @@ -0,0 +1,291 @@ +/* + * E2B API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.openkruise.agents.client.e2b.api.models; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import io.openkruise.agents.client.e2b.api.invoker.JSON; + +/** + * VolumeToken + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-10T15:28:00.691+08:00[Asia/Shanghai]") +public class VolumeToken { + public static final String SERIALIZED_NAME_TOKEN = "token"; + @SerializedName(SERIALIZED_NAME_TOKEN) + private String token; + + public VolumeToken() { + } + + public VolumeToken token(String token) { + + this.token = token; + return this; + } + + /** + * Get token + * @return token + **/ + @javax.annotation.Nonnull + public String getToken() { + return token; + } + + + public void setToken(String token) { + this.token = token; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the VolumeToken instance itself + */ + public VolumeToken putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VolumeToken volumeToken = (VolumeToken) o; + return Objects.equals(this.token, volumeToken.token)&& + Objects.equals(this.additionalProperties, volumeToken.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(token, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VolumeToken {\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("token"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("token"); + } + + /** + * Validates the JSON Object and throws an exception if issues found + * + * @param jsonObj JSON Object + * @throws IOException if the JSON Object is invalid with respect to VolumeToken + */ + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + if (jsonObj == null) { + if (!VolumeToken.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null + throw new IllegalArgumentException(String.format("The required field(s) %s in VolumeToken is not found in the empty JSON string", VolumeToken.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VolumeToken.openapiRequiredFields) { + if (jsonObj.get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString())); + } + } + if (!jsonObj.get("token").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("token").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VolumeToken.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VolumeToken' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(VolumeToken.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, VolumeToken value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public VolumeToken read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + validateJsonObject(jsonObj); + // store additional fields in the deserialized instance + VolumeToken instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of VolumeToken given an JSON string + * + * @param jsonString JSON string + * @return An instance of VolumeToken + * @throws IOException if the JSON string is invalid with respect to VolumeToken + */ + public static VolumeToken fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VolumeToken.class); + } + + /** + * Convert an instance of VolumeToken to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/config/ConnectionConfig.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/config/ConnectionConfig.java deleted file mode 100644 index d94778a..0000000 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/config/ConnectionConfig.java +++ /dev/null @@ -1,292 +0,0 @@ -package io.openkruise.agents.client.e2b.config; - -import com.google.protobuf.MessageOrBuilder; -import com.google.protobuf.util.JsonFormat; -import io.grpc.ManagedChannel; -import io.grpc.ManagedChannelBuilder; -import io.grpc.Metadata; -import io.grpc.stub.MetadataUtils; -import io.openkruise.agents.client.e2b.utils.PathModifyingInterceptor; -import io.openkruise.agents.client.e2b.utils.RpcUtils; -import io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.MediaType; -import okhttp3.Request; -import okhttp3.Request.Builder; -import okhttp3.RequestBody; - -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -public class ConnectionConfig { - public static final int ENVD_PORT = 49983; - public static final int KEEPALIVE_PING_INTERVAL_SEC = 50; - public static final String KEEPALIVE_PING_HEADER = "Keepalive-Ping-Interval"; - public static final long DEFAULT_REQUEST_TIMEOUT_MS = 60_000; - - private final String domain; - private final boolean debug; - private final String apiKey; - private final String accessToken; - private final String apiUrl; - private final String sandboxUrl; - private final long requestTimeoutMs; - private final Map headers; - private final Map extraSandboxHeaders; - - public ConnectionConfig() { - this(new Builder()); - } - - private ConnectionConfig(Builder builder) { - this.debug = builder.debug != null ? builder.debug : getEnvBool("E2B_DEBUG", false); - this.domain = builder.domain != null ? builder.domain : getEnvVar("E2B_DOMAIN", "e2b.app"); - this.apiKey = builder.apiKey != null ? builder.apiKey : getEnvVar("E2B_API_KEY", null); - this.accessToken = builder.accessToken != null ? builder.accessToken : getEnvVar("E2B_ACCESS_TOKEN", null); - this.apiUrl = builder.apiUrl != null ? builder.apiUrl : getEnvVar("E2B_API_URL", null); - this.sandboxUrl = builder.sandboxUrl != null ? builder.sandboxUrl : getEnvVar("E2B_SANDBOX_URL", null); - this.requestTimeoutMs = builder.requestTimeoutMs != null ? builder.requestTimeoutMs - : DEFAULT_REQUEST_TIMEOUT_MS; - this.headers = new HashMap<>(builder.headers); - this.headers.put("User-Agent", "e2b-java-sdk/0.1.0"); - this.extraSandboxHeaders = new HashMap<>(builder.extraSandboxHeaders); - } - - public static String getDomainFromEnv() { - String value = System.getenv("E2B_DOMAIN"); - return value != null ? value : "e2b.app"; - } - - public static boolean getDebugFromEnv() { - String value = System.getenv("E2B_DEBUG"); - return value != null && value.equalsIgnoreCase("true"); - } - - public static String getApiKeyFromEnv() { - return System.getenv("E2B_API_KEY"); - } - - public static String getAccessTokenFromEnv() { - return System.getenv("E2B_ACCESS_TOKEN"); - } - - public static String getApiUrlFromEnv() { - return System.getenv("E2B_API_URL"); - } - - public static String getSandboxUrlFromEnv() { - return System.getenv("E2B_SANDBOX_URL"); - } - - private String getEnvVar(String name, String defaultValue) { - String value = System.getenv(name); - return value != null ? value : defaultValue; - } - - private boolean getEnvBool(String name, boolean defaultValue) { - String value = System.getenv(name); - return value != null ? Boolean.parseBoolean(value) : defaultValue; - } - - public String getDomain() { - return domain; - } - - public boolean isDebug() { - return debug; - } - - public String getApiKey() { - return apiKey; - } - - public String getAccessToken() { - return accessToken; - } - - public String getApiUrl() { - if (apiUrl != null) { - return apiUrl; - } - return debug ? "http://localhost/kruise/api" : "https://api." + domain; - } - - public String getSandboxUrl(String sandboxId, String sandboxDomain) { - if (sandboxUrl != null) { - return sandboxUrl; - } - String protocol = debug ? "http" : "https"; - String host = getSandboxHost(sandboxId, sandboxDomain); - return protocol + "://" + host; - } - - public String getSandboxHost(String sandboxId, String sandboxDomain) { - if (debug) { - return sandboxDomain != null ? sandboxDomain : domain; - } - return String.format("%d-%s.%s", ENVD_PORT, sandboxId, sandboxDomain != null ? sandboxDomain : domain); - } - - public long getRequestTimeoutMs() { - return requestTimeoutMs; - } - - public long getRequestTimeoutMs(Long overrideTimeoutMs) { - if (overrideTimeoutMs != null) { - return overrideTimeoutMs; - } - return requestTimeoutMs; - } - - public Map getHeaders() { - return new HashMap<>(headers); - } - - public Map getSandboxHeaders() { - Map sandboxHeaders = new HashMap<>(headers); - sandboxHeaders.putAll(extraSandboxHeaders); - return sandboxHeaders; - } - - public ManagedChannel createChannel(String sandboxId, String token, String sandboxDomain) { - String target = getSandboxHost(sandboxId, sandboxDomain); - - ManagedChannelBuilder builder = NettyChannelBuilder.forTarget(target); - - if (debug) { - builder.usePlaintext(); - // build path - builder.intercept(new PathModifyingInterceptor(sandboxId, ENVD_PORT)); - } else { - builder.useTransportSecurity(); - } - - Metadata metadata = RpcUtils.createFullMetadata( - sandboxId, ENVD_PORT, apiKey, token, getSandboxHeaders() - ); - - return builder.intercept(MetadataUtils.newAttachHeadersInterceptor(metadata)) - .keepAliveTime(50, TimeUnit.SECONDS) - .keepAliveTimeout(50, TimeUnit.SECONDS) - .keepAliveWithoutCalls(true) - .maxInboundMessageSize(32 * 1024 * 1024) - .directExecutor() - .build(); - } - - public static class Builder { - private String domain; - private Boolean debug; - private String apiKey; - private String accessToken; - private String apiUrl; - private String sandboxUrl; - private Long requestTimeoutMs; - private Map headers = new HashMap<>(); - private Map extraSandboxHeaders = new HashMap<>(); - - public Builder domain(String domain) { - this.domain = domain; - return this; - } - - public Builder debug(boolean debug) { - this.debug = debug; - return this; - } - - public Builder apiKey(String apiKey) { - this.apiKey = apiKey; - return this; - } - - public Builder accessToken(String accessToken) { - this.accessToken = accessToken; - return this; - } - - public Builder apiUrl(String apiUrl) { - this.apiUrl = apiUrl; - return this; - } - - public Builder sandboxUrl(String sandboxUrl) { - this.sandboxUrl = sandboxUrl; - return this; - } - - public Builder requestTimeoutMs(long requestTimeoutMs) { - this.requestTimeoutMs = requestTimeoutMs; - return this; - } - - public Builder headers(Map headers) { - this.headers = headers != null ? new HashMap<>(headers) : new HashMap<>(); - return this; - } - - public Builder addHeader(String key, String value) { - this.headers.put(key, value); - return this; - } - - public Builder extraSandboxHeaders(Map extraSandboxHeaders) { - this.extraSandboxHeaders = extraSandboxHeaders != null ? new HashMap<>(extraSandboxHeaders) - : new HashMap<>(); - return this; - } - - public Builder addExtraSandboxHeader(String key, String value) { - this.extraSandboxHeaders.put(key, value); - return this; - } - - public ConnectionConfig build() { - return new ConnectionConfig(this); - } - } - - public Request buildHttpRequest(String serviceName, String methodName, MessageOrBuilder params, String sandboxId) { - try { - String jsonPayload = JsonFormat.printer().print(params); - RequestBody requestBody = RequestBody.create(jsonPayload, MediaType.parse("application/json")); - - return new Request.Builder() - .url(getHttpUrlBuilder(sandboxId).addPathSegment(serviceName).addPathSegment(methodName).build()) - .post(requestBody) - .headers(getHttpHeaders(sandboxId)) - .build(); - } catch (Exception e) { - throw new RuntimeException(String.format("build http request Failed to %s", methodName), e); - } - } - - private HttpUrl.Builder getHttpUrlBuilder(String sandboxId) { - String protocol = debug ? "http" : "https"; - String host = debug ? domain : String.format("%d-%s.%s", ConnectionConfig.ENVD_PORT, - sandboxId, domain); - if (debug) { - return new HttpUrl.Builder() - .scheme(protocol) - .host(host) - .addPathSegments("kruise") - .addPathSegments(sandboxId) - .addPathSegments(String.valueOf(ConnectionConfig.ENVD_PORT)); - } else { - return new HttpUrl.Builder() - .scheme(protocol) - .host(host); - } - } - - private Headers getHttpHeaders(String sandboxId) { - Headers.Builder builder = new Headers.Builder() - .add("X-API-Key", apiKey) - .add("Authorization", "Basic cm9vdDo=") - .add("E2b-Sandbox-Id", sandboxId) - .add("E2b-Sandbox-Port", String.valueOf(ConnectionConfig.ENVD_PORT)); - return builder.build(); - } -} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/example/SandboxClientExample.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/example/SandboxClientExample.java deleted file mode 100644 index da95509..0000000 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/example/SandboxClientExample.java +++ /dev/null @@ -1,255 +0,0 @@ -package io.openkruise.agents.client.e2b.example; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import io.openkruise.agents.client.e2b.api.invoker.ApiException; -import io.openkruise.agents.client.e2b.api.models.NewSandbox; -import io.openkruise.agents.client.e2b.api.models.Sandbox; -import io.openkruise.agents.client.e2b.config.ConnectionConfig; -import io.openkruise.agents.client.e2b.sandbox.SandboxClient; -import io.openkruise.agents.client.e2b.sandbox.commands.CommandHandle; -import io.openkruise.agents.client.e2b.sandbox.commands.CommandResult; -import io.openkruise.agents.client.e2b.sandbox.commands.Commands; -import io.openkruise.agents.client.e2b.sandbox.commands.Commands.ProcessInfo; -import io.openkruise.agents.client.e2b.sandbox.filesystem.Filesystem; -import io.openkruise.agents.client.e2b.sandbox.filesystem.Filesystem.EntryInfo; - -public class SandboxClientExample { - private static final String API_KEY = "key"; - private static final String SANDBOX_DOMAIN = "your.domain.com"; - - public static void main(String[] args) throws ApiException { - String sandboxId = ""; - // Configure connection parameters - ConnectionConfig config = new ConnectionConfig.Builder() - .apiKey(API_KEY) - .domain(SANDBOX_DOMAIN) - .build(); - - SandboxClient client = new SandboxClient(config); - try { - NewSandbox newSandbox = new NewSandbox(); - newSandbox.setTemplateID("code-interpreter"); - newSandbox.setTimeout(3600); - Sandbox sandbox = client.createSandbox(newSandbox); - sandboxId = sandbox.getSandboxID(); - System.out.println("Successfully connected to sandbox: " + sandboxId); - - System.out.println("\n--- Process Operations Demo ---"); - demonstrateCommandOperations(client.commands()); - - // Perform comprehensive filesystem operations - System.out.println("\n--- Filesystem Operations Demo ---"); - demonstrateFileOperations(client.filesystem()); - - client.deleteSandbox(sandboxId); - System.out.println("Successfully delete to sandbox: " + sandboxId); - - // Close client after completing operations - client.close(); - System.out.println("\nSandbox client closed"); - - } catch (Exception e) { - System.err.println("An error occurred: " + e.getMessage()); - e.printStackTrace(); - if (sandboxId != "") { - client.deleteSandbox(sandboxId); - client.close(); - } - } - } - - private static void demonstrateCommandOperations(Commands commands) { - try { - System.out.println("\n1. Testing run() method:"); - // Run a simple command to display current working directory - CommandResult result = commands.run("pwd"); - System.out.println( - "Run 'pwd' command result - Exit code: " + result.getExitCode() + ", Output: " + result.getStdout()); - - // Run a command with options - using compatible map creation - Map envs = new HashMap<>(); - envs.put("TEST_VAR", "test_value"); - Commands.RunOptions options = new Commands.RunOptions() - .cwd("/tmp") - .envs(envs); - CommandResult resultWithOptions = commands.run("echo $TEST_VAR && pwd", options); - System.out.println("Run command with options result - Exit code: " + resultWithOptions.getExitCode() + - ", Output: " + resultWithOptions.getStdout()); - - System.out.println("\n2. Testing list() method:"); - // List all processes in the sandbox - List processList = commands.list(); - System.out.println("Current processes count: " + processList.size()); - for (ProcessInfo process : processList) { - System.out.println(" - PID: " + process.getPid() + ", Command: " + process.getCmd() + - ", Working Directory: " + process.getCwd()); - } - - System.out.println("\n3. Testing runBackground() method (to demonstrate other operations):"); - // Start a long-running command in the background for testing other operations - CommandHandle handle = commands.runBackground("sleep 60", new Commands.RunOptions()); - long pid = handle.getPid(); - System.out.println("Started background process with PID: " + pid); - - // Wait a moment for the process to start - Thread.sleep(1000); - - System.out.println("\n4. Testing list() method again to see the new process:"); - processList = commands.list(); - System.out.println("Updated processes count: " + processList.size()); - boolean foundNewProcess = false; - for (ProcessInfo process : processList) { - System.out.println(" - PID: " + process.getPid() + ", Command: " + process.getCmd() + - ", Working Directory: " + process.getCwd()); - if (process.getPid() == pid) { - foundNewProcess = true; - System.out.println(" ^ Found our background process"); - } - } - if (!foundNewProcess) { - System.out.println(" - Could not find our background process in the list"); - } - - System.out.println("\n5. Testing sendInput() method:"); - // Test sendInput - though this would typically be used with interactive processes - try { - commands.sendInput((int)pid, "sample input\n"); - System.out.println("Sent input to process PID: " + pid); - } catch (Exception e) { - System.out.println( - "Sending input failed (this is expected for non-interactive processes): " + e.getMessage()); - } - - System.out.println("\n6. Testing connect() method:"); - // Connect to the running process - try { - CommandHandle connectedHandle = commands.connect((int)pid); - System.out.println("Connected to process PID: " + connectedHandle.getPid()); - - // Wait briefly and then disconnect - Thread.sleep(1000); - connectedHandle.close(); - System.out.println("Disconnected from process"); - } catch (Exception e) { - System.out.println("Connecting to process failed (expected for sleep command): " + e.getMessage()); - } - - System.out.println("\n7. Testing closeStdin() method:"); - // Close stdin of the process - try { - commands.closeStdin((int)pid); - System.out.println("Closed stdin for process PID: " + pid); - } catch (Exception e) { - System.out.println("Closing stdin failed: " + e.getMessage()); - } - - System.out.println("\n8. Testing kill() method:"); - // Kill the background process - boolean killed = commands.kill((int)pid); - System.out.println("Attempted to kill process PID: " + pid + ", Success: " + killed); - - // Verify the process was killed by listing processes again - Thread.sleep(1000); - processList = commands.list(); - boolean processStillRunning = false; - for (ProcessInfo process : processList) { - if (process.getPid() == pid) { - processStillRunning = true; - break; - } - } - if (!processStillRunning) { - System.out.println("Verified: Process " + pid + " is no longer running"); - } else { - System.out.println("Warning: Process " + pid + " still appears to be running"); - } - - System.out.println("Command operations demonstration completed."); - - } catch (Exception e) { - System.err.println("Error during command operations: " + e.getMessage()); - e.printStackTrace(); - } - } - - private static void demonstrateFileOperations(Filesystem filesystem) { - try { - // 1. Create a test directory - String testDir = "/tmp/test_" + System.currentTimeMillis(); - System.out.println("\n1. Creating directory: " + testDir); - boolean created = filesystem.makeDir(testDir); - System.out.println("Directory created: " + created); - - // 2. Check if directory exists - System.out.println("\n2. Checking if directory exists: " + testDir); - boolean exists = filesystem.exists(testDir); - System.out.println("Directory exists: " + exists); - - // 3. Get directory information - System.out.println("\n3. Getting directory information for: " + testDir); - EntryInfo dirInfo = filesystem.getInfo(testDir); - System.out.println("Directory info: " + dirInfo); - - // 4. Create a subdirectory - String subDir = testDir + "/subdir"; - System.out.println("\n4. Creating subdirectory: " + subDir); - boolean subCreated = filesystem.makeDir(subDir); - System.out.println("Subdirectory created: " + subCreated); - - // 5. List the test directory contents - System.out.println("\n5. Listing contents of: " + testDir); - List dirContents = filesystem.listDir(testDir, 1); - System.out.println("Items in directory: " + dirContents.size()); - for (EntryInfo item : dirContents) { - System.out.println(" - " + item.getType() + " " + item.getName() + " (size: " + item.getSize() + ")"); - } - - // 6. Move/rename the subdirectory - String newSubDir = testDir + "/renamed_subdir"; - System.out.println("\n6. Moving " + subDir + " to " + newSubDir); - boolean moved = filesystem.move(subDir, newSubDir); - System.out.println("Move operation successful: " + moved); - - // 7. List the test directory contents again to see the rename - System.out.println("\n7. Listing contents of: " + testDir + " after move operation"); - dirContents = filesystem.listDir(testDir, 1); - System.out.println("Items in directory: " + dirContents.size()); - for (EntryInfo item : dirContents) { - System.out.println(" - " + item.getType() + " " + item.getName() + " (size: " + item.getSize() + ")"); - } - - // 8. Create another test directory to demonstrate exists functionality - String anotherDir = testDir + "/another_test_dir"; - System.out.println("\n8. Creating another directory: " + anotherDir); - filesystem.makeDir(anotherDir); - System.out.println("Another directory created: " + anotherDir); - - // 9. Check if the new directory exists - System.out.println("\n9. Checking if " + anotherDir + " exists"); - boolean anotherExists = filesystem.exists(anotherDir); - System.out.println("Directory exists: " + anotherExists); - - // 10. Get info for the new directory - System.out.println("\n10. Getting information for: " + anotherDir); - EntryInfo anotherInfo = filesystem.getInfo(anotherDir); - System.out.println("Another directory info: " + anotherInfo); - - // 11. Remove the test directories - System.out.println("\n11. Removing test directory and its contents: " + testDir); - filesystem.remove(testDir); - System.out.println("Directory removed: " + testDir); - - // 12. Verify removal - System.out.println("\n12. Verifying directory removal"); - boolean stillExists = filesystem.exists(testDir); - System.out.println("Directory still exists after removal: " + stillExists); - - } catch (Exception e) { - System.err.println("Error during filesystem operations: " + e.getMessage()); - e.printStackTrace(); - } - } -} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/exceptions/AuthenticationException.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/exceptions/AuthenticationException.java deleted file mode 100644 index 671cecb..0000000 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/exceptions/AuthenticationException.java +++ /dev/null @@ -1,7 +0,0 @@ -package io.openkruise.agents.client.e2b.exceptions; - -public class AuthenticationException extends SandboxException { - public AuthenticationException(String message) { - super(message); - } -} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/exceptions/InvalidArgumentException.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/exceptions/InvalidArgumentException.java deleted file mode 100644 index 9ee6f6c..0000000 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/exceptions/InvalidArgumentException.java +++ /dev/null @@ -1,7 +0,0 @@ -package io.openkruise.agents.client.e2b.exceptions; - -public class InvalidArgumentException extends SandboxException { - public InvalidArgumentException(String message) { - super(message); - } -} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/exceptions/NotFoundException.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/exceptions/NotFoundException.java deleted file mode 100644 index 49da8ae..0000000 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/exceptions/NotFoundException.java +++ /dev/null @@ -1,7 +0,0 @@ -package io.openkruise.agents.client.e2b.exceptions; - -public class NotFoundException extends SandboxException { - public NotFoundException(String message) { - super(message); - } -} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/exceptions/TimeoutException.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/exceptions/TimeoutException.java deleted file mode 100644 index faa1610..0000000 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/exceptions/TimeoutException.java +++ /dev/null @@ -1,7 +0,0 @@ -package io.openkruise.agents.client.e2b.exceptions; - -public class TimeoutException extends SandboxException { - public TimeoutException(String message) { - super(message); - } -} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/sandbox/SandboxClient.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/sandbox/SandboxClient.java deleted file mode 100644 index 8410091..0000000 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/sandbox/SandboxClient.java +++ /dev/null @@ -1,205 +0,0 @@ -package io.openkruise.agents.client.e2b.sandbox; - -import io.grpc.ManagedChannel; -import io.openkruise.agents.client.e2b.api.SandboxesApi; -import io.openkruise.agents.client.e2b.api.invoker.ApiClient; -import io.openkruise.agents.client.e2b.api.invoker.ApiException; -import io.openkruise.agents.client.e2b.api.invoker.Configuration; -import io.openkruise.agents.client.e2b.api.models.NewSandbox; -import io.openkruise.agents.client.e2b.api.models.Sandbox; -import io.openkruise.agents.client.e2b.api.models.SandboxState; -import io.openkruise.agents.client.e2b.api.models.SandboxesGet200ResponseInner; -import io.openkruise.agents.client.e2b.api.models.SandboxDetail; -import io.openkruise.agents.client.e2b.api.models.SandboxMetric; -import io.openkruise.agents.client.e2b.api.models.ConnectSandbox; -import io.openkruise.agents.client.e2b.config.ConnectionConfig; -import io.openkruise.agents.client.e2b.sandbox.commands.Commands; -import io.openkruise.agents.client.e2b.sandbox.filesystem.Filesystem; - -import java.util.List; - -public class SandboxClient { - private ConnectionConfig config; - private SandboxesApi sandboxesApi; - private Sandbox sandbox; - private ManagedChannel channel; - private Commands commands; - private Filesystem filesystem; - - public SandboxClient(ConnectionConfig config) { - this.config = config; - - // Initialize ApiClient - ApiClient apiClient = Configuration.getDefaultApiClient(); - apiClient.setBasePath(config.getApiUrl()); - apiClient.addDefaultHeader("X-API-Key", config.getApiKey()); - this.sandboxesApi = new SandboxesApi(apiClient); - } - - /** - * Create a new sandbox - * - * @param newSandbox Sandbox configuration - * @return Created sandbox object - * @throws ApiException API call exception - */ - public Sandbox createSandbox(NewSandbox newSandbox) throws ApiException { - Sandbox sandbox = sandboxesApi.sandboxesPost(newSandbox); - initializeSandbox(sandbox); - return sandbox; - } - - /** - * Connect to an existing sandbox - * - * @param sandboxId Sandbox ID - * @param connectSandbox Connection configuration - * @return Connected sandbox object - * @throws ApiException API call exception - */ - public Sandbox connectSandbox(String sandboxId, ConnectSandbox connectSandbox) throws ApiException { - Sandbox sandbox = sandboxesApi.sandboxesSandboxIDConnectPost(sandboxId, connectSandbox); - initializeSandbox(sandbox); - return sandbox; - } - - /** - * Connect to an existing sandbox (using default configuration) - * - * @param sandboxId Sandbox ID - * @return Connected sandbox object - * @throws ApiException API call exception - */ - public Sandbox connectSandbox(String sandboxId) throws ApiException { - ConnectSandbox connectSandbox = new ConnectSandbox(); - return connectSandbox(sandboxId, connectSandbox); - } - - /** - * Connect to an existing sandbox (using custom timeout) - * - * @param sandboxId Sandbox ID - * @param timeout Timeout in seconds, must be between 0 and 2592000 - * @return Connected sandbox object - * @throws ApiException API call exception - */ - public Sandbox connectSandbox(String sandboxId, Integer timeout) throws ApiException { - ConnectSandbox connectSandbox = new ConnectSandbox(); - // Validate timeout value is within valid range - if (timeout != null && (timeout < 0 || timeout > 2592000)) { - throw new IllegalArgumentException("Timeout must be between 0 and 2592000 seconds (30 days)"); - } - connectSandbox.setTimeout(timeout != null ? timeout : 3600); - return connectSandbox(sandboxId, connectSandbox); - } - - /** - * Get sandbox details - * - * @param sandboxId Sandbox ID - * @return Sandbox details - * @throws ApiException API call exception - */ - public SandboxDetail getSandboxDetail(String sandboxId) throws ApiException { - return sandboxesApi.sandboxesSandboxIDGet(sandboxId); - } - - /** - * Get all sandboxes list - * - * @return Sandbox list - * @throws ApiException API call exception - */ - public List listSandboxes(String metadata, List state, String nextToken, Integer limit) throws ApiException { - return sandboxesApi.v2SandboxesGet(metadata, state, nextToken, null); - } - - /** - * Delete specified sandbox - * - * @param sandboxId Sandbox ID - * @throws ApiException API call exception - */ - public void deleteSandbox(String sandboxId) throws ApiException { - sandboxesApi.sandboxesSandboxIDDelete(sandboxId); - } - - /** - * Get sandbox metrics - * - * @param sandboxId Sandbox ID - * @return Sandbox metrics - * @throws ApiException API call exception - */ - public List getSandboxMetric(String sandboxId, Long start, Long end) throws ApiException { - return sandboxesApi.sandboxesSandboxIDMetricsGet(sandboxId, start, end); - } - - /** - * Initialize sandbox connection information - * - * @param sandbox Sandbox object - */ - private void initializeSandbox(Sandbox sandbox) { - this.sandbox = sandbox; - // Clear previous connection and component instances - cleanup(); - } - - /** - * Clean up resources - */ - private void cleanup() { - if (channel != null && !channel.isShutdown()) { - channel.shutdown(); - } - this.channel = null; - this.commands = null; - this.filesystem = null; - } - - /** - * Get Commands interface for command operations - * If no connection is established, a gRPC connection to the sandbox will be established first - * - * @return Commands interface - */ - public Commands commands() { - if (sandbox == null) { - throw new IllegalStateException("No sandbox connected. Call createSandbox() or connectSandbox() first."); - } - if (commands == null) { - if (channel == null) { - channel = config.createChannel(sandbox.getSandboxID(), sandbox.getEnvdAccessToken(), sandbox.getDomain()); - } - commands = new Commands(sandbox, channel, config); - } - return commands; - } - - /** - * Get Filesystem interface for file operations - * If no connection is established, a gRPC connection to the sandbox will be established first - * - * @return Filesystem interface - */ - public Filesystem filesystem() { - if (sandbox == null) { - throw new IllegalStateException("No sandbox connected. Call createSandbox() or connectSandbox() first."); - } - if (filesystem == null) { - if (channel == null) { - channel = config.createChannel(sandbox.getSandboxID(), sandbox.getEnvdAccessToken(), sandbox.getDomain()); - } - filesystem = new Filesystem(sandbox, channel, config); - } - return filesystem; - } - - /** - * Close the sandbox client and release all resources - */ - public void close() { - cleanup(); - } -} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/sandbox/commands/CommandHandle.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/sandbox/commands/CommandHandle.java deleted file mode 100644 index 31b0d4b..0000000 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/sandbox/commands/CommandHandle.java +++ /dev/null @@ -1,186 +0,0 @@ -package io.openkruise.agents.client.e2b.sandbox.commands; - -import io.grpc.StatusRuntimeException; -import io.openkruise.agents.client.e2b.envd.process.ProcessGrpc; -import io.openkruise.agents.client.e2b.envd.process.StartResponse; -import io.openkruise.agents.client.e2b.envd.process.ProcessEvent; -import io.openkruise.agents.client.e2b.envd.process.ProcessInput; -import io.openkruise.agents.client.e2b.envd.process.ProcessSelector; -import io.openkruise.agents.client.e2b.envd.process.SendInputRequest; -import io.openkruise.agents.client.e2b.envd.process.SendSignalRequest; -import io.openkruise.agents.client.e2b.envd.process.Signal; -import io.openkruise.agents.client.e2b.config.ConnectionConfig; -import io.openkruise.agents.client.e2b.exceptions.SandboxException; -import io.openkruise.agents.client.e2b.utils.RpcUtils; - -import com.google.protobuf.ByteString; - -import java.util.Iterator; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.Consumer; - -public class CommandHandle implements AutoCloseable { - private final long pid; - private final Iterator events; - private final ProcessGrpc.ProcessBlockingStub processStub; - private final ConnectionConfig config; - private final StringBuilder stdout = new StringBuilder(); - private final StringBuilder stderr = new StringBuilder(); - private final AtomicInteger exitCode = new AtomicInteger(-1); - private final AtomicBoolean completed = new AtomicBoolean(false); - private final AtomicBoolean closed = new AtomicBoolean(false); - - private final Consumer onStdout; - private final Consumer onStderr; - - public CommandHandle(long pid, Iterator events, - ProcessGrpc.ProcessBlockingStub processStub, - ConnectionConfig config, - Consumer onStdout, Consumer onStderr) { - if (pid <= 0) { - throw new IllegalArgumentException("PID must be positive, got: " + pid); - } - this.pid = pid; - this.events = events; - this.processStub = processStub; - this.config = config; - this.onStdout = onStdout; - this.onStderr = onStderr; - } - - public long getPid() { - return pid; - } - - public boolean isCompleted() { - return completed.get(); - } - - public CommandResult waitForCompletion() { - if (completed.get()) { - return createResult(); - } - - try { - while (events != null && events.hasNext()) { - StartResponse response = events.next(); - processResponse(response); - - if (completed.get()) { - break; - } - } - } catch (StatusRuntimeException e) { - throw RpcUtils.handleRpcException(e); - } catch (Exception e) { - throw new SandboxException("Error while waiting for command completion", e); - } finally { - synchronized (this) { - completed.set(true); - close(); - } - } - - return createResult(); - } - - private CommandResult createResult() { - return new CommandResult(stdout.toString(), stderr.toString(), exitCode.get()); - } - - private void processResponse(StartResponse response) { - if (!response.hasEvent()) { - return; - } - - ProcessEvent event = response.getEvent(); - - if (event.hasData()) { - ProcessEvent.DataEvent dataEvent = event.getData(); - - if (dataEvent.hasStdout()) { - String out = dataEvent.getStdout().toStringUtf8(); - synchronized (stdout) { - stdout.append(out); - } - if (onStdout != null) { - onStdout.accept(out); - } - } - - if (dataEvent.hasStderr()) { - String err = dataEvent.getStderr().toStringUtf8(); - synchronized (stderr) { - stderr.append(err); - } - if (onStderr != null) { - onStderr.accept(err); - } - } - } - - if (event.hasEnd()) { - ProcessEvent.EndEvent endEvent = event.getEnd(); - exitCode.set(endEvent.getExitCode()); - completed.set(true); - } - } - - public void sendStdin(String data) { - if (data == null) { - throw new IllegalArgumentException("Data cannot be null"); - } - if (completed.get()) { - throw new IllegalStateException("Process has already completed"); - } - - SendInputRequest request = SendInputRequest.newBuilder() - .setProcess(ProcessSelector.newBuilder().setPid((int)pid).build()) - .setInput(ProcessInput.newBuilder() - .setStdin(ByteString.copyFromUtf8(data)) - .build()) - .build(); - - try { - processStub.withDeadlineAfter(config.getRequestTimeoutMs(), TimeUnit.MILLISECONDS) - .sendInput(request); - } catch (StatusRuntimeException e) { - throw RpcUtils.handleRpcException(e); - } - } - - public boolean kill() { - return kill(Signal.SIGNAL_SIGKILL); - } - - public boolean kill(Signal signal) { - if (completed.get()) { - return false; - } - - SendSignalRequest request = SendSignalRequest.newBuilder() - .setProcess(ProcessSelector.newBuilder().setPid((int)pid).build()) - .setSignal(signal) - .build(); - - try { - processStub.withDeadlineAfter(config.getRequestTimeoutMs(), TimeUnit.MILLISECONDS) - .sendSignal(request); - exitCode.set(-1); - completed.set(true); - return true; - } catch (StatusRuntimeException e) { - if (RpcUtils.isNotFoundError(e)) { - return false; - } - throw RpcUtils.handleRpcException(e); - } - } - - @Override - public void close() { - closed.compareAndSet(false, true); - } -} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/sandbox/filesystem/Filesystem.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/sandbox/filesystem/Filesystem.java deleted file mode 100644 index bd86ee7..0000000 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/sandbox/filesystem/Filesystem.java +++ /dev/null @@ -1,352 +0,0 @@ -package io.openkruise.agents.client.e2b.sandbox.filesystem; - -import com.google.protobuf.util.JsonFormat; -import io.grpc.ManagedChannel; -import io.grpc.StatusRuntimeException; -import io.openkruise.agents.client.e2b.api.models.Sandbox; -import io.openkruise.agents.client.e2b.config.ConnectionConfig; -import io.openkruise.agents.client.e2b.envd.filesystem.*; -import io.openkruise.agents.client.e2b.exceptions.SandboxException; -import io.openkruise.agents.client.e2b.utils.RpcUtils; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; - -import java.io.IOException; -import java.io.Reader; -import java.net.HttpURLConnection; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.concurrent.TimeUnit; -import java.util.function.Consumer; - -public class Filesystem { - public static final String SERVICE_NAME = "filesystem.Filesystem"; - private static final JsonFormat.Parser PROTO_PARSER = JsonFormat.parser().ignoringUnknownFields(); - private final Sandbox sandbox; - private final FilesystemGrpc.FilesystemBlockingStub blockingStub; - private final ConnectionConfig config; - private final OkHttpClient httpClient; - - public Filesystem(Sandbox sandbox, ManagedChannel channel, ConnectionConfig config) { - this.sandbox = Objects.requireNonNull(sandbox, "sandbox cannot be null"); - this.blockingStub = FilesystemGrpc.newBlockingStub(channel).withMaxInboundMessageSize(32 * 1024 * 1024) - .withMaxOutboundMessageSize(32 * 1024 * 1024); - this.config = Objects.requireNonNull(config, "ConnectionConfig cannot be null"); - - this.httpClient = new OkHttpClient.Builder().connectTimeout(config.getRequestTimeoutMs(), TimeUnit.MILLISECONDS) - .readTimeout(config.getRequestTimeoutMs(), TimeUnit.MILLISECONDS).build(); - } - - /** - * List entries in a directory. - * - * @param path path to the directory - * @return list of entries in the directory - */ - public List listDir(String path) { - if (path == null || path.trim().isEmpty()) { - throw new IllegalArgumentException("Path cannot be null or empty"); - } - return listDir(path, 1); - } - - /** - * List entries in a directory with specified depth. - * - * @param path path to the directory - * @param depth depth of the directory to list - * @return list of entries in the directory - */ - public List listDir(String path, int depth) { - if (path == null || path.trim().isEmpty()) { - throw new IllegalArgumentException("Path cannot be null or empty"); - } - if (depth < 1) { - throw new IllegalArgumentException("Depth must be at least 1"); - } - - try { - ListDirRequest params = ListDirRequest.newBuilder().setPath(path).setDepth(depth).build(); - - Request request = config.buildHttpRequest(SERVICE_NAME, "ListDir", params, sandbox.getSandboxID()); - - // noinspection WithSSRFCheckingInspection - Response response = httpClient.newCall(request).execute(); - if (!response.isSuccessful()) { - throw new IOException("ListDir HTTP request failed: " + response.code() + " " + response.message()); - } - - Reader reader = response.body().charStream(); - // Parse the JSON response back to protobuf - ListDirResponse.Builder builder = ListDirResponse.newBuilder(); - PROTO_PARSER.merge(reader, builder); - ListDirResponse listDirResponse = builder.build(); - - List entries = new ArrayList<>(listDirResponse.getEntriesCount()); - for (io.openkruise.agents.client.e2b.envd.filesystem.EntryInfo entry : - listDirResponse.getEntriesList()) { - entries.add(toEntryInfo(entry)); - } - return entries; - } catch (Exception e) { - throw new RuntimeException("Failed to listDir", e); - } - } - - /** - * Create a new directory and all directories along the way if needed on the specified path. - * - * @param path path to a new directory - * @return true if the directory was created, false if it already exists - */ - public boolean makeDir(String path) { - try { - MakeDirRequest params = MakeDirRequest.newBuilder() - .setPath(path) - .build(); - - Request request = config.buildHttpRequest(SERVICE_NAME, "MakeDir", params, sandbox.getSandboxID()); - - // noinspection WithSSRFCheckingInspection - Response response = httpClient.newCall(request).execute(); - if (!response.isSuccessful()) { - throw new IOException("MakeDir HTTP request failed: " + response.code() + " " + response.message()); - } - return response.isSuccessful(); - } catch (Exception e) { - throw new RuntimeException("Failed to makeDir", e); - } - } - - /** - * Rename a file or directory. - * - * @param oldPath path to the file or directory to rename - * @param newPath new path for the file or directory - * @return information about renamed file or directory - */ - public boolean move(String oldPath, String newPath) { - try { - MoveRequest params = MoveRequest.newBuilder() - .setSource(oldPath) - .setDestination(newPath) - .build(); - - Request request = config.buildHttpRequest(SERVICE_NAME, "Move", params, sandbox.getSandboxID()); - - // noinspection WithSSRFCheckingInspection - Response response = httpClient.newCall(request).execute(); - if (!response.isSuccessful()) { - throw new IOException("Move HTTP request failed: " + response.code() + " " + response.message()); - } - - return response.isSuccessful(); - } catch (Exception e) { - throw new RuntimeException("Failed to move", e); - } - } - - /** - * Remove a file or directory. - * - * @param path path to a file or directory - */ - public boolean remove(String path) { - try { - RemoveRequest params = RemoveRequest.newBuilder() - .setPath(path) - .build(); - - Request request = config.buildHttpRequest(SERVICE_NAME, "Remove", params, sandbox.getSandboxID()); - - // noinspection WithSSRFCheckingInspection - Response response = httpClient.newCall(request).execute(); - if (!response.isSuccessful()) { - throw new IOException("Remove HTTP request failed: " + response.code() + " " + response.message()); - } - return response.isSuccessful(); - } catch (Exception e) { - throw new RuntimeException("Failed to remove", e); - } - } - - /** - * Check if a file or a directory exists. - * - * @param path path to a file or a directory - * @return true if the file or directory exists, false otherwise - */ - public boolean exists(String path) { - try { - StatRequest params = StatRequest.newBuilder() - .setPath(path) - .build(); - - Request request = config.buildHttpRequest(SERVICE_NAME, "Stat", params, sandbox.getSandboxID()); - - // noinspection WithSSRFCheckingInspection - Response response = httpClient.newCall(request).execute(); - if (response.code() == HttpURLConnection.HTTP_NOT_FOUND) { - return false; - } - if (!response.isSuccessful()) { - throw new IOException("Stat HTTP request failed: " + response.code() + " " + response.message()); - } - return response.isSuccessful(); - } catch (Exception e) { - throw new RuntimeException("Failed to exists", e); - } - } - - /** - * Get information about a file or directory. - * - * @param path path to a file or directory - * @return information about the file or directory - */ - public EntryInfo getInfo(String path) { - try { - StatRequest params = StatRequest.newBuilder() - .setPath(path) - .build(); - - Request request = config.buildHttpRequest(SERVICE_NAME, "Stat", params, sandbox.getSandboxID()); - - // noinspection WithSSRFCheckingInspection - Response response = httpClient.newCall(request).execute(); - if (!response.isSuccessful()) { - throw new IOException("Stat HTTP request failed: " + response.code() + " " + response.message()); - } - - Reader reader = response.body().charStream(); - // Parse the JSON response back to protobuf - StatResponse.Builder builder = StatResponse.newBuilder(); - PROTO_PARSER.merge(reader, builder); - StatResponse statResponse = builder.build(); - - return toEntryInfo(statResponse.getEntry()); - } catch (Exception e) { - throw new RuntimeException("Failed to Remove", e); - } - } - - /** - * Start watching a directory for filesystem events. - * - * @param path path to directory to watch - * @param onEvent callback to call when an event in the directory occurs - * @return WatchHandle object for stopping watching directory - */ - public WatchHandle watchDir(String path, Consumer onEvent) { - return watchDir(path, false, onEvent); - } - - /** - * Start watching a directory for filesystem events. - * - * @param path path to directory to watch - * @param recursive whether to watch subdirectories recursively - * @param onEvent callback to call when an event in the directory occurs - * @return WatchHandle object for stopping watching directory - */ - public WatchHandle watchDir(String path, boolean recursive, Consumer onEvent) { - WatchDirRequest request = WatchDirRequest.newBuilder().setPath(path).setRecursive(recursive).build(); - - try { - // This is a blocking stub, so we'll need to implement the streaming logic differently - // For now, we'll create a streaming stub for this specific operation - FilesystemGrpc.FilesystemStub streamingStub = FilesystemGrpc.newStub(blockingStub.getChannel()); - - // Create a stream observer to handle responses - io.grpc.stub.StreamObserver responseObserver = new WatchDirResponseObserver(onEvent); - - streamingStub.withDeadlineAfter(config.getRequestTimeoutMs(), TimeUnit.MILLISECONDS).watchDir(request, - responseObserver); - - return new WatchHandle(responseObserver); - } catch (StatusRuntimeException e) { - throw RpcUtils.handleRpcException(e); - } - } - - private EntryInfo toEntryInfo(io.openkruise.agents.client.e2b.envd.filesystem.EntryInfo entry) { - return new EntryInfo(entry.getName(), mapFileType(entry.getType()), entry.getPath(), entry.getSize(), - entry.getMode(), entry.getPermissions(), entry.getOwner(), entry.getGroup(), - entry.hasModifiedTime() ? entry.getModifiedTime() : null, - entry.hasSymlinkTarget() ? entry.getSymlinkTarget() : null); - } - - private FileType mapFileType(io.openkruise.agents.client.e2b.envd.filesystem.FileType fileType) { - switch (fileType) { - case FILE_TYPE_DIRECTORY: - return FileType.DIR; - case FILE_TYPE_FILE: - return FileType.FILE; - case FILE_TYPE_SYMLINK: - return FileType.SYMLINK; - default: - throw new SandboxException("Unknown file type: " + fileType); - } - } - - public enum FileType { - FILE, - DIR, - SYMLINK - } - - public static class EntryInfo { - private final String name; - private final FileType type; - private final String path; - private final long size; - private final int mode; - private final String permissions; - private final String owner; - private final String group; - private final com.google.protobuf.Timestamp modifiedTime; // 使用正确的Timestamp类型 - private final String symlinkTarget; - - public EntryInfo(String name, FileType type, String path, long size, int mode, String permissions, String owner, - String group, com.google.protobuf.Timestamp modifiedTime, String symlinkTarget) { - this.name = name; - this.type = type; - this.path = path; - this.size = size; - this.mode = mode; - this.permissions = permissions; - this.owner = owner; - this.group = group; - this.modifiedTime = modifiedTime; - this.symlinkTarget = symlinkTarget; - } - - // Getters - public String getName() {return name;} - - public FileType getType() {return type;} - - public String getPath() {return path;} - - public long getSize() {return size;} - - public int getMode() {return mode;} - - public String getPermissions() {return permissions;} - - public String getOwner() {return owner;} - - public String getGroup() {return group;} - - public com.google.protobuf.Timestamp getModifiedTime() {return modifiedTime;} // 更准确的类型 - - public String getSymlinkTarget() {return symlinkTarget;} - - @Override - public String toString() { - return String.format("EntryInfo{name='%s', type=%s, path='%s', size=%d}", name, type, path, size); - } - } -} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/utils/PathModifyingInterceptor.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/utils/PathModifyingInterceptor.java deleted file mode 100644 index 278bb83..0000000 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/utils/PathModifyingInterceptor.java +++ /dev/null @@ -1,32 +0,0 @@ -package io.openkruise.agents.client.e2b.utils; - -import io.grpc.*; - -public class PathModifyingInterceptor implements ClientInterceptor { - private final String sandboxId; - private final int port; - - public PathModifyingInterceptor(String sandboxId, int port) { - this.sandboxId = sandboxId; - this.port = port; - } - - @Override - public ClientCall interceptCall( - MethodDescriptor method, - CallOptions callOptions, - Channel next) { - - // debug build path: kruise/{sandboxId}/{port}/method - String newPath = String.format("kruise/%s/%d/%s", - sandboxId, port, method.getFullMethodName()); - - // create MethodDescriptor,update fullMethodName - MethodDescriptor modifiedMethod = method.toBuilder() - .setFullMethodName(newPath) - .build(); - - return next.newCall(modifiedMethod, callOptions); - } -} - diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/utils/RpcUtils.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/utils/RpcUtils.java deleted file mode 100644 index c76cb8d..0000000 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/utils/RpcUtils.java +++ /dev/null @@ -1,127 +0,0 @@ -package io.openkruise.agents.client.e2b.utils; - -import io.grpc.Metadata; -import io.grpc.Status; -import io.grpc.StatusRuntimeException; - -import io.openkruise.agents.client.e2b.exceptions.AuthenticationException; -import io.openkruise.agents.client.e2b.exceptions.InvalidArgumentException; -import io.openkruise.agents.client.e2b.exceptions.NotFoundException; -import io.openkruise.agents.client.e2b.exceptions.SandboxException; -import io.openkruise.agents.client.e2b.exceptions.TimeoutException; - -import java.util.Map; - -public class RpcUtils { - public static Metadata createAuthMetadata(String apiKey, String envdAccessToken) { - Metadata metadata = new Metadata(); - - // 添加 API Key - if (apiKey != null && !apiKey.isEmpty()) { - Metadata.Key apiKeyHeader = Metadata.Key.of("X-API-Key", Metadata.ASCII_STRING_MARSHALLER); - metadata.put(apiKeyHeader, apiKey); - } - - // 添加 Access Token(用于 envd 通信) - if (envdAccessToken != null && !envdAccessToken.isEmpty()) { - Metadata.Key tokenHeader = Metadata.Key.of("X-Access-Token", Metadata.ASCII_STRING_MARSHALLER); - metadata.put(tokenHeader, envdAccessToken); - } - - // 添加 Authorization - Metadata.Key authorizationHeader = Metadata.Key.of("Authorization", Metadata.ASCII_STRING_MARSHALLER); - metadata.put(authorizationHeader, "Basic cm9vdDo="); - - return metadata; - } - - public static Metadata createSandboxMetadata(String sandboxId, int envdPort) { - Metadata metadata = new Metadata(); - - Metadata.Key sandboxIdHeader = Metadata.Key.of("E2b-Sandbox-Id", Metadata.ASCII_STRING_MARSHALLER); - metadata.put(sandboxIdHeader, sandboxId); - - Metadata.Key sandboxPortHeader = Metadata.Key.of("E2b-Sandbox-Port", Metadata.ASCII_STRING_MARSHALLER); - metadata.put(sandboxPortHeader, String.valueOf(envdPort)); - - return metadata; - } - - public static Metadata createCustomHeadersMetadata(Map headers) { - Metadata metadata = new Metadata(); - if (headers != null) { - headers.forEach((key, value) -> - metadata.put(Metadata.Key.of(key, Metadata.ASCII_STRING_MARSHALLER), value) - ); - } - return metadata; - } - - public static Metadata mergeMetadata(Metadata... metadataList) { - Metadata merged = new Metadata(); - for (Metadata metadata : metadataList) { - if (metadata != null) { - merged.merge(metadata); - } - } - return merged; - } - - public static Metadata createFullMetadata(String sandboxId, int envdPort, - String apiKey, String accessToken, - Map customHeaders) { - Metadata authMetadata = createAuthMetadata(apiKey, accessToken); - Metadata sandboxMetadata = createSandboxMetadata(sandboxId, envdPort); - Metadata customMetadata = createCustomHeadersMetadata(customHeaders); - - return mergeMetadata(authMetadata, sandboxMetadata, customMetadata); - } - - public static Metadata createKeepaliveMetadata(int intervalSeconds) { - Metadata metadata = new Metadata(); - Metadata.Key keepaliveHeader = Metadata.Key.of("Keepalive-Ping", Metadata.ASCII_STRING_MARSHALLER); - metadata.put(keepaliveHeader, String.valueOf(intervalSeconds)); - return metadata; - } - - public static SandboxException handleRpcException(StatusRuntimeException e) { - Status status = e.getStatus(); - - switch (status.getCode()) { - case INVALID_ARGUMENT: - return new InvalidArgumentException(status.getDescription()); - - case UNAUTHENTICATED: - return new AuthenticationException(status.getDescription()); - - case NOT_FOUND: - return new NotFoundException(status.getDescription()); - - case UNAVAILABLE: - return new SandboxException("Sandbox unavailable: " + status.getDescription()); - - case CANCELLED: - return new TimeoutException( - status.getDescription() + ": This error is likely due to exceeding 'requestTimeoutMs'. " + - "You can pass the request timeout value as an option when making the request." - ); - - case DEADLINE_EXCEEDED: - return new TimeoutException( - status.getDescription() + ": This error is likely due to exceeding 'timeoutMs' — " + - "the total time a long running request (like command execution or directory watch) can be " - + "active. " - + - "It can be modified by passing 'timeoutMs' when making the request. Use '0' to disable the " - + "timeout." - ); - - default: - return new SandboxException(status.getCode() + ": " + status.getDescription()); - } - } - - public static boolean isNotFoundError(StatusRuntimeException e) { - return e.getStatus().getCode() == Status.Code.NOT_FOUND; - } -} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/examples/e2b/SandboxApiManagerExample.java b/k8s/java/src/main/java/io/openkruise/agents/client/examples/e2b/SandboxApiManagerExample.java new file mode 100644 index 0000000..0553494 --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/examples/e2b/SandboxApiManagerExample.java @@ -0,0 +1,78 @@ +package io.openkruise.agents.client.examples.e2b; + +import java.util.List; + +import io.openkruise.agents.client.e2b.ConnectionConfig; +import io.openkruise.agents.client.e2b.Sandbox; +import io.openkruise.agents.client.e2b.SandboxApi; +import io.openkruise.agents.client.e2b.SandboxInfo; +import io.openkruise.agents.client.e2b.api.invoker.ApiException; + +/** + * SandboxApi usage example + *

+ * Demonstrates complete sandbox lifecycle management via SandboxApi, + * including: create, list, pause, get info, reconnect, set timeout, destroy. + */ +public class SandboxApiManagerExample { + private static final String API_KEY = "your-api-key"; + private static final String SANDBOX_DOMAIN = "your.domain.com"; + private static final String TEMPLATE = "code-interpreter"; + + public static void main(String[] args) throws ApiException { + // 1. Build connection configuration + ConnectionConfig config = new ConnectionConfig.Builder() + .apiKey(API_KEY) + .domain(SANDBOX_DOMAIN) + .build(); + + SandboxApi api = new SandboxApi(config); + String sandboxId = null; + + try { + // 2. Create sandbox + Sandbox sandbox = api.create(TEMPLATE); + sandboxId = sandbox.getSandboxID(); + System.out.println("Sandbox created successfully, sandboxId: " + sandboxId); + + // 3. List sandboxes + List sandboxList = api.list(); + System.out.println("Current sandbox count: " + sandboxList.size()); + + // 4. Get sandbox details + SandboxInfo info = api.getInfo(sandboxId); + System.out.println("Sandbox status: " + info); + + // 5. Set timeout (in seconds) + api.setTimeout(sandboxId, 600); + System.out.println("Timeout set to 600 seconds"); + + // 6. Pause sandbox + api.pause(sandboxId); + System.out.println("Sandbox paused"); + + // 7. Reconnect sandbox (resume from pause) + api.connect(sandboxId); + System.out.println("Sandbox reconnected"); + + // 8. Destroy sandbox + api.kill(sandboxId); + sandboxId = null; + System.out.println("Sandbox destroyed"); + + } catch (Exception e) { + System.err.println("Operation error: " + e.getMessage()); + e.printStackTrace(); + } finally { + // Ensure sandbox resources are released + if (sandboxId != null) { + try { + api.kill(sandboxId); + System.out.println("Sandbox cleaned up: " + sandboxId); + } catch (Exception ignored) { + System.out.println("Sandbox cleanup error: " + sandboxId); + } + } + } + } +} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/examples/e2b/SandboxCommandsExample.java b/k8s/java/src/main/java/io/openkruise/agents/client/examples/e2b/SandboxCommandsExample.java new file mode 100644 index 0000000..833c5b8 --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/examples/e2b/SandboxCommandsExample.java @@ -0,0 +1,170 @@ +package io.openkruise.agents.client.examples.e2b; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import io.openkruise.agents.client.e2b.ConnectionConfig; +import io.openkruise.agents.client.e2b.Sandbox; +import io.openkruise.agents.client.e2b.SandboxApi; +import io.openkruise.agents.client.runtime.commands.CommandHandle; +import io.openkruise.agents.client.runtime.commands.CommandResult; +import io.openkruise.agents.client.runtime.commands.Commands; +import io.openkruise.agents.client.runtime.commands.Commands.ProcessInfo; + +/** + * E2B mode Commands complete usage example + */ +public class SandboxCommandsExample { + private static final String API_KEY = "your-api-key"; + private static final String SANDBOX_DOMAIN = "your.domain.com"; + private static final String TEMPLATE = "code-interpreter"; + + public static void main(String[] args) { + System.out.println("========== E2B Sandbox Commands Java SDK Example =========="); + + // ========== 1. Connection configuration ========== + ConnectionConfig config = new ConnectionConfig.Builder() + .apiKey(API_KEY) + .domain(SANDBOX_DOMAIN) + .build(); + + SandboxApi api = new SandboxApi(config); + String sandboxId = null; + + try { + Sandbox sandbox = api.create(TEMPLATE); + sandboxId = sandbox.getSandboxID(); + System.out.println("Sandbox created successfully, sandboxId: " + sandboxId); + + System.out.printf("Created successfully, sandboxId: %s%n", sandbox.getSandboxID()); + System.out.printf("Sandbox URL: %s%n", sandbox.getSandboxURL()); + + // ========== 4. Command operations demo ========== + System.out.println("\n--- Command Operations Demo ---"); + demonstrateCommandOperations(sandbox.Commands); + + System.out.println("\n========== Example Completed =========="); + } catch (Exception e) { + System.err.println("Operation error: " + e.getMessage()); + e.printStackTrace(); + } finally { + // Ensure sandbox resources are released + if (sandboxId != null) { + try { + api.kill(sandboxId); + System.out.println("Sandbox cleaned up: " + sandboxId); + } catch (Exception ignored) { + System.out.println("Sandbox cleanup error: " + sandboxId); + } + } + } + } + + // ======================== Command operations demo ======================== + + private static void demonstrateCommandOperations(Commands commands) { + // [1] Execute simple command + System.out.println("\n[1] Execute 'pwd'..."); + try { + CommandResult result = commands.run("pwd"); + System.out.printf(" Exit: %d, Stdout: %s", result.getExitCode(), result.getStdout()); + } catch (Exception e) { + System.err.println(" Error: " + e.getMessage()); + } + + // [2] Execute command with environment variables and working directory + System.out.println("\n[2] Execute command with env vars and cwd..."); + try { + Map envs = new HashMap<>(); + envs.put("TEST_VAR", "hello-from-java-sdk"); + + CommandResult result = commands.run("echo $TEST_VAR && pwd", + new Commands.RunOptions().envs(envs).cwd("/tmp")); + System.out.printf(" Exit: %d, Stdout: %s", result.getExitCode(), result.getStdout()); + } catch (Exception e) { + System.err.println(" Error: " + e.getMessage()); + } + + // [3] List current processes + System.out.println("\n[3] List current processes..."); + listProcesses(commands); + + // [4] Start background process + System.out.println("\n[4] Start background process: sleep 60..."); + CommandHandle handle = null; + long pid = 0; + try { + handle = commands.runBackground("sleep 60", new Commands.RunOptions()); + pid = handle.getPid(); + System.out.printf(" Background process started, PID: %d%n", pid); + Thread.sleep(1000); + } catch (Exception e) { + System.err.println(" Failed to start background process: " + e.getMessage()); + return; + } + + // [5] Verify process appears in list + System.out.println("\n[5] List processes again (should include new process)..."); + listProcesses(commands); + + // [6] Send stdin + System.out.println("\n[6] Send stdin to background process..."); + try { + commands.sendInput((int) pid, "sample input\n"); + System.out.printf(" Sent input to PID %d%n", pid); + } catch (Exception e) { + System.out.printf(" Failed to send stdin (expected for non-interactive process): %s%n", e.getMessage()); + } + + // [7] Kill background process + System.out.println("\n[7] Kill background process..."); + try { + boolean killed = commands.kill((int) pid); + System.out.printf(" Kill PID %d: %s%n", pid, killed); + } catch (Exception e) { + System.err.println(" Kill failed: " + e.getMessage()); + } + + // [8] Verify process terminated + try { + Thread.sleep(1000); + } catch (InterruptedException ignored) {} + System.out.println("\n[8] Verify process terminated..."); + if (isProcessRunning(commands, pid)) { + System.out.printf(" Warning: Process %d is still running%n", pid); + } else { + System.out.printf(" Confirmed: Process %d has terminated%n", pid); + } + + // 关闭 handle + if (handle != null) { + handle.close(); + } + } + + private static void listProcesses(Commands commands) { + try { + List processes = commands.list(); + System.out.printf(" Running processes: %d%n", processes.size()); + for (ProcessInfo p : processes) { + System.out.printf(" - PID: %d, Cmd: %s, Cwd: %s%n", + p.getPid(), p.getCmd(), p.getCwd()); + } + } catch (Exception e) { + System.err.println(" Failed to list processes: " + e.getMessage()); + } + } + + private static boolean isProcessRunning(Commands commands, long pid) { + try { + List processes = commands.list(); + for (ProcessInfo p : processes) { + if (p.getPid() == pid) { + return true; + } + } + } catch (Exception ignored) {} + return false; + } +} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/examples/e2b/SandboxFilesExample.java b/k8s/java/src/main/java/io/openkruise/agents/client/examples/e2b/SandboxFilesExample.java new file mode 100644 index 0000000..5cfbd39 --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/examples/e2b/SandboxFilesExample.java @@ -0,0 +1,199 @@ +package io.openkruise.agents.client.examples.e2b; + +import java.util.List; + +import io.openkruise.agents.client.e2b.ConnectionConfig; +import io.openkruise.agents.client.e2b.Sandbox; +import io.openkruise.agents.client.e2b.SandboxApi; +import io.openkruise.agents.client.runtime.filesystem.Filesystem; +import io.openkruise.agents.client.runtime.filesystem.Filesystem.EntryInfo; +import io.openkruise.agents.client.runtime.filesystem.Filesystem.WriteInfo; + +/** + * E2B mode Files complete usage example + */ +public class SandboxFilesExample { + private static final String API_KEY = "your-api-key"; + private static final String SANDBOX_DOMAIN = "your.domain.com"; + private static final String TEMPLATE = "code-interpreter"; + + public static void main(String[] args) { + System.out.println("========== E2B Sandbox Files Java SDK Example =========="); + + // ========== 1. Connection configuration ========== + ConnectionConfig config = new ConnectionConfig.Builder() + .apiKey(API_KEY) + .domain(SANDBOX_DOMAIN) + .build(); + + SandboxApi api = new SandboxApi(config); + String sandboxId = null; + + try { + Sandbox sandbox = api.create(TEMPLATE); + sandboxId = sandbox.getSandboxID(); + System.out.println("Sandbox created successfully, sandboxId: " + sandboxId); + + System.out.printf("Created successfully, sandboxId: %s%n", sandbox.getSandboxID()); + System.out.printf("Sandbox URL: %s%n", sandbox.getSandboxURL()); + + // ========== 4. File operations demo ========== + System.out.println("\n--- File Operations Demo ---"); + demonstrateFileOperations(sandbox.Files); + + System.out.println("\n========== Example Completed =========="); + } catch (Exception e) { + System.err.println("Operation error: " + e.getMessage()); + e.printStackTrace(); + } finally { + // Ensure sandbox resources are released + if (sandboxId != null) { + try { + api.kill(sandboxId); + System.out.println("Sandbox cleaned up: " + sandboxId); + } catch (Exception ignored) { + System.out.println("Sandbox cleanup error: " + sandboxId); + } + } + } + } + + // ======================== File operations demo ======================== + + private static void demonstrateFileOperations(Filesystem files) { + String testDir = "/tmp/test_" + System.nanoTime(); + String subDir = testDir + "/subdir"; + String renamedDir = testDir + "/renamed_subdir"; + + // [1] Create directory + System.out.printf("%n[1] Create directory: %s%n", testDir); + try { + boolean created = files.makeDir(testDir); + System.out.printf(" Directory created: %s%n", created); + } catch (Exception e) { + System.err.println(" Creation failed: " + e.getMessage()); + return; + } + + // [2] Check if exists + System.out.printf("%n[2] Check if directory exists: %s%n", testDir); + try { + boolean exists = files.exists(testDir); + System.out.printf(" Exists: %s%n", exists); + } catch (Exception e) { + System.err.println(" Check failed: " + e.getMessage()); + } + + // [3] Get directory info + System.out.printf("%n[3] Get directory info: %s%n", testDir); + try { + EntryInfo info = files.getInfo(testDir); + System.out.printf(" Name: %s, Type: %s, Size: %d%n", info.getName(), info.getType(), info.getSize()); + } catch (Exception e) { + System.err.println(" Failed to get info: " + e.getMessage()); + } + + // [4] Create subdirectory and list parent directory + System.out.printf("%n[4] Create subdirectory: %s%n", subDir); + try { + files.makeDir(subDir); + listEntries(files, testDir); + } catch (Exception e) { + System.err.println(" Operation failed: " + e.getMessage()); + } + + // [5] Rename subdirectory + System.out.printf("%n[5] Rename %s -> %s%n", subDir, renamedDir); + try { + files.move(subDir, renamedDir); + System.out.println(" Renamed successfully"); + listEntries(files, testDir); + } catch (Exception e) { + System.err.println(" Rename failed: " + e.getMessage()); + } + + // [6] Write text file + String testFile = testDir + "/hello.txt"; + System.out.printf("%n[6] Write file: %s%n", testFile); + try { + WriteInfo writeInfo = files.writeText(testFile, "Hello from Java SDK!\n你好,世界!\n"); + System.out.printf(" Write succeeded, path: %s, type: %s%n", writeInfo.getPath(), writeInfo.getType()); + } catch (Exception e) { + System.err.println(" Write failed: " + e.getMessage()); + } + + // [7] Read text file + System.out.printf("%n[7] Read file: %s%n", testFile); + try { + String content = files.readText(testFile); + System.out.printf(" File content:%n%s", content); + } catch (Exception e) { + System.err.println(" Read failed: " + e.getMessage()); + } + + // [8] Write binary file + String binFile = testDir + "/data.bin"; + System.out.printf("%n[8] Write binary file: %s%n", binFile); + try { + byte[] binaryData = new byte[]{0x00, 0x01, 0x02, 0x03, (byte) 0xFF}; + WriteInfo writeInfo = files.write(binFile, binaryData); + System.out.printf(" Write succeeded, path: %s%n", writeInfo.getPath()); + } catch (Exception e) { + System.err.println(" Write failed: " + e.getMessage()); + } + + // [9] Read binary file and verify + System.out.printf("%n[9] Read binary file: %s%n", binFile); + try { + byte[] readBack = files.read(binFile); + System.out.printf(" Read %d bytes, first byte: 0x%02X, last byte: 0x%02X%n", + readBack.length, readBack[0], readBack[readBack.length - 1]); + } catch (Exception e) { + System.err.println(" Read failed: " + e.getMessage()); + } + + // [10] Overwrite existing file + System.out.printf("%n[10] Overwrite: %s%n", testFile); + try { + files.writeText(testFile, "Overwritten content\n"); + String newContent = files.readText(testFile); + System.out.printf(" Content after overwrite: %s", newContent); + } catch (Exception e) { + System.err.println(" Overwrite failed: " + e.getMessage()); + } + + // [11] List directory (verify files created) + System.out.printf("%n[11] List directory contents: %s%n", testDir); + listEntries(files, testDir); + + // [12] Delete directory + System.out.printf("%n[12] Delete directory: %s%n", testDir); + try { + files.remove(testDir); + System.out.println(" Directory deleted"); + } catch (Exception e) { + System.err.println(" Delete failed: " + e.getMessage()); + } + + // [13] Verify deletion + System.out.printf("%n[13] Verify deletion: %s%n", testDir); + try { + boolean exists = files.exists(testDir); + System.out.printf(" Exists after deletion: %s%n", exists); + } catch (Exception e) { + System.err.println(" Verification failed: " + e.getMessage()); + } + } + + private static void listEntries(Filesystem files, String path) { + try { + List entries = files.listDir(path); + System.out.printf(" Entries in %s: %d%n", path, entries.size()); + for (EntryInfo e : entries) { + System.out.printf(" - %s %s (size: %d)%n", e.getType(), e.getName(), e.getSize()); + } + } catch (Exception e) { + System.err.println(" Failed to list directory: " + e.getMessage()); + } + } +} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/examples/runtime/K8sDirectConnectExample.java b/k8s/java/src/main/java/io/openkruise/agents/client/examples/runtime/K8sDirectConnectExample.java new file mode 100644 index 0000000..4294b0e --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/examples/runtime/K8sDirectConnectExample.java @@ -0,0 +1,60 @@ +package io.openkruise.agents.client.examples.runtime; + +import io.openkruise.agents.client.runtime.RuntimeConfig; +import io.openkruise.agents.client.runtime.RuntimeClient; +import io.openkruise.agents.client.runtime.commands.CommandResult; +import io.openkruise.agents.client.runtime.filesystem.Filesystem.EntryInfo; + +import java.util.List; + +public class K8sDirectConnectExample { + + public static void main(String[] args) { + // Sandbox gateway address + // In cluster: "sandbox-gateway.sandbox-system.svc:7788" + // Local development: "127.0.0.1:7788" + String domain = "sandbox-gateway.sandbox-system.svc:7788"; + String namespace = "default"; + String sandboxName = "your-sandbox-name"; + + // Build RuntimeConfig + RuntimeConfig config = new RuntimeConfig.Builder() + .domain(domain) + .scheme("http") + .build(); + + try (RuntimeClient client = RuntimeClient.newFromK8s(namespace, sandboxName, config)) { + System.out.println("Runtime URL: " + client.getRuntimeURL()); + System.out.println("Sandbox ID: " + client.getSandboxID()); + + // Execute command + CommandResult result = client.Commands.run("uname -a"); + System.out.println("uname: " + result.getStdout()); + + // List directory + List entries = client.Files.listDir("/"); + System.out.println("Root directory file count: " + entries.size()); + for (EntryInfo entry : entries) { + System.out.println(" " + entry); + } + + // Create directory + client.Files.makeDir("/tmp/test-dir"); + + // Check if file exists + boolean exists = client.Files.exists("/tmp/test-dir"); + System.out.println("/tmp/test-dir exists: " + exists); + + // Execute multiple commands + CommandResult whoami = client.Commands.run("whoami"); + System.out.println("Current user: " + whoami.getStdout().trim()); + + CommandResult pwd = client.Commands.run("pwd"); + System.out.println("Working directory: " + pwd.getStdout().trim()); + + } catch (Exception e) { + System.err.println("K8s direct connection error: " + e.getMessage()); + e.printStackTrace(); + } + } +} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/EnvdMethods.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/EnvdMethods.java new file mode 100644 index 0000000..9955ac0 --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/EnvdMethods.java @@ -0,0 +1,55 @@ +package io.openkruise.agents.client.runtime; + +/** + * Centralized constants for envd runtime service names and method names. + *

+ * Avoids hardcoding strings in Commands / Filesystem modules for easier maintenance and debugging. + */ +public final class EnvdMethods { + + private EnvdMethods() {} + + // Process service + + /** Process service name */ + public static final String PROCESS_SERVICE = "process.Process"; + + /** List all processes */ + public static final String PROCESS_LIST = "List"; + /** Start a process (Server-Streaming) */ + public static final String PROCESS_START = "Start"; + /** Connect to an existing process (Server-Streaming) */ + public static final String PROCESS_CONNECT = "Connect"; + /** Send standard input */ + public static final String PROCESS_SEND_INPUT = "SendInput"; + /** Send a signal */ + public static final String PROCESS_SEND_SIGNAL = "SendSignal"; + /** Close standard input */ + public static final String PROCESS_CLOSE_STDIN = "CloseStdin"; + + // Filesystem service + + /** Filesystem service name */ + public static final String FILESYSTEM_SERVICE = "filesystem.Filesystem"; + + /** List directory contents */ + public static final String FS_LIST_DIR = "ListDir"; + /** Create a directory */ + public static final String FS_MAKE_DIR = "MakeDir"; + /** Move/rename */ + public static final String FS_MOVE = "Move"; + /** Delete a file or directory */ + public static final String FS_REMOVE = "Remove"; + /** Get file/directory information */ + public static final String FS_STAT = "Stat"; + /** Watch directory changes (Server-Streaming) */ + public static final String FS_WATCH_DIR = "WatchDir"; + + // File content read/write (HTTP route) + + /** HTTP route path for file content read/write */ + public static final String FILES_ROUTE = "/files"; + + /** Default username for file read/write */ + public static final String DEFAULT_USERNAME = "root"; +} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/K8sHelper.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/K8sHelper.java new file mode 100644 index 0000000..0c9dabc --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/K8sHelper.java @@ -0,0 +1,50 @@ +package io.openkruise.agents.client.runtime; + +import io.fabric8.kubernetes.client.KubernetesClient; +import io.fabric8.kubernetes.client.KubernetesClientBuilder; +import io.openkruise.agents.client.v2.models.Sandbox; + +import java.util.Map; + +/** + * K8sHelper provides Kubernetes interaction capabilities for querying Sandbox CR to obtain runtimeToken. + *

+ * Implemented using fabric8 kubernetes-client and v2 CRD model for type-safe CR queries. + *

+ * kubeconfig resolution order (handled automatically by fabric8): + * KUBECONFIG environment variable → ~/.kube/config → in-cluster config + */ +class K8sHelper { + + /** Sandbox CR annotation key storing runtime access token */ + static final String ANNOTATION_RUNTIME_ACCESS_TOKEN = "agents.kruise.io/runtime-access-token"; + + /** + * Extracts runtimeToken from Sandbox CR annotations. + * + * @param namespace K8s namespace where the sandbox resides + * @param sandboxName sandbox resource name + * @return runtimeToken value, or null if not present + * @throws Exception if K8s query fails + */ + static String getRuntimeToken(String namespace, String sandboxName) throws Exception { + try (KubernetesClient client = new KubernetesClientBuilder().build()) { + Sandbox sandbox = client.resources(Sandbox.class) + .inNamespace(namespace) + .withName(sandboxName) + .get(); + + if (sandbox == null) { + throw new RuntimeException( + String.format("Sandbox CR %s/%s not found", namespace, sandboxName)); + } + + Map annotations = sandbox.getMetadata().getAnnotations(); + if (annotations != null) { + return annotations.get(ANNOTATION_RUNTIME_ACCESS_TOKEN); + } + + return null; + } + } +} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/README_zh-CH.md b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/README_zh-CH.md new file mode 100644 index 0000000..93ddb32 --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/README_zh-CH.md @@ -0,0 +1,214 @@ +# Runtime Java SDK(运行时客户端) + +## 依赖导入 + +Maven 仓库:该包未发布到官方 Maven 仓库,你需要手动下载项目并打包成 JAR 文件使用。 + +--- + +## 包结构 + +``` +runtime/ +├── RuntimeClient.java # 统一入口:create / newFromK8s +├── RuntimeConfig.java # Builder 模式配置:Domain / Scheme / RuntimeToken / ... +├── K8sHelper.java # 从 Sandbox CR annotation 提取 runtimeToken +├── EnvdMethods.java # envd gRPC 服务名和方法名常量 +├── commands/ # 命令执行 +│ ├── Commands.java # Run / Start / Kill / SendStdin / List / ConnectToProcess +│ ├── CommandHandle.java # 后台进程句柄:waitForCompletion / kill +│ └── CommandResult.java # 命令执行结果:stdout / stderr / exitCode +├── filesystem/ # 文件系统 +│ ├── Filesystem.java # ListDir / Read / Write / MakeDir / Remove / Watch +│ ├── WatchHandle.java # 目录监听句柄 +│ └── WatchDirResponseObserver.java +├── utils/ # 工具类 +│ └── ConnectStreamReader.java # Connect Protocol 流式响应解析 +├── exceptions/ # 异常 +│ └── SandboxException.java +└── envd/ # protobuf 生成代码 + ├── process/ # envd Process gRPC + └── filesystem/ # envd Filesystem gRPC +``` + +--- + +## 快速开始 + +在集群内或有 kubeconfig 权限时,使用 `newFromK8s` 自动从 Sandbox CR 解析 `sandboxID` 和 `runtimeToken`: + +```java +import io.openkruise.agents.client.runtime.*; +import io.openkruise.agents.client.runtime.commands.CommandResult; + +public class QuickStart { + public static void main(String[] args) throws Exception { + // domain 是 sandbox gateway 的地址 + // 集群内访问:K8s Service DNS,如 "sandbox-gateway.sandbox-system.svc:7788" + // 本地开发:port-forward 地址,如 "127.0.0.1:7788" + RuntimeConfig config = new RuntimeConfig.Builder() + .domain("sandbox-gateway.sandbox-system.svc:7788") + .scheme("http") + .build(); + + try (RuntimeClient client = RuntimeClient.newFromK8s("default", "your-sandbox-name", config)) { + System.out.println("Runtime URL: " + client.getRuntimeURL()); + + CommandResult res = client.Commands.run("uname -a"); + System.out.println(res.getStdout()); + } + } +} +``` + +**关键说明:** + +- `newFromK8s` 查询 Sandbox CR 并从 annotation `agents.kruise.io/runtime-access-token` 提取 `runtimeToken` +- `sandboxID` 格式为 `namespace--name`(双横线连接) +- kubeconfig 解析顺序:`KUBECONFIG` 环境变量 → `~/.kube/config` → in-cluster config + +完整演示:[K8sDirectConnectExample.java](../examples/runtime/K8sDirectConnectExample.java) + +--- + +## 连接配置(RuntimeConfig) + +运行时客户端**不涉及 Protocol**,只需 `Scheme` + `Domain` 即可确定 envd 地址(`://`)。 + +### Builder 方法 + +通过 `new RuntimeConfig.Builder().xxx().build()` 构建: + +| 方法 | 说明 | +|----------------------------------------|------------------------------------------------| +| `.domain(String)` | envd 域名,默认 `domain.app` | +| `.scheme(String)` | URL scheme,默认 `http` | +| `.runtimeToken(String)` | 运行时 Token,写入请求头 `X-Access-Token` | +| `.runtimeUrl(String)` | **最高优先级**:直接覆盖 URL 拼装,`getSandboxURL()` 直接返回此值 | +| `.apiKey(String)` | API Key,写入请求头 `X-API-Key` | +| `.authHeader(String)` | 覆盖默认的 Authorization 头 | +| `.headers(Map)` | 合并多个自定义 headers | +| `.addHeader(String key, String value)` | 添加单个自定义 header | +| `.requestTimeoutMs(long)` | HTTP 超时(毫秒),默认 60000 | + +### 优先级 + +`runtimeUrl`(显式覆盖) > `scheme` + `domain` 拼装 > 默认值 + +--- + +## 命令执行(Commands) + +通过 `client.Commands` 操作容器内进程。底层走 envd 的 `Process` gRPC 服务,命令统一通过 `/bin/bash -l -c ` 执行。 + +### 方法 + +| 方法 | 说明 | +|-----------------------------------------|---------------------------------------| +| `run(String cmd)` | **前台执行**:启动命令并等待完成,返回 `CommandResult` | +| `run(String cmd, RunOptions options)` | 前台执行(带选项) | +| `start(String cmd, RunOptions options)` | **后台启动**:返回 `CommandHandle`,调用方决定何时等待 | +| `list()` | 列出所有运行中的进程,返回 `List` | +| `kill(int pid)` | 向指定 PID 发送 SIGKILL | +| `sendStdin(int pid, String data)` | 向指定进程的 stdin 写入数据 | +| `connectToProcess(int pid)` | 重新连接到已运行的进程,订阅其后续输出 | + +### RunOptions + +```java +RunOptions opts = new RunOptions() + .envs(Map.of("LANG", "C")) // 环境变量 + .cwd("/tmp") // 工作目录 + .onStdout(line -> System.out.print(line)) // 流式 stdout 回调 + .onStderr(line -> System.err.print(line)); // 流式 stderr 回调 +``` + +### CommandHandle + +由 `start` / `connectToProcess` 返回,用于交互或等待: + +| 方法 | 说明 | +|-----------------------|---------------------------| +| `getPid()` | 返回进程 PID | +| `isCompleted()` | 是否已完成 | +| `waitForCompletion()` | 阻塞等待结束,返回 `CommandResult` | +| `kill()` | 终止进程 | +| `close()` | 关闭(实现 `AutoCloseable`) | + +### CommandResult + +| 字段 | 类型 | 说明 | +|------------|----------|------| +| `stdout` | `String` | 标准输出 | +| `stderr` | `String` | 标准错误 | +| `exitCode` | `int` | 退出码 | + +### 示例 + +```java +// 前台执行 +CommandResult res = client.Commands.run("pwd"); +System.out.println(res.getStdout()); + +// 带选项执行 + 流式输出 +CommandResult res2 = client.Commands.run("ls -la /tmp", + new RunOptions().cwd("/tmp").onStdout(System.out::print)); + +// 后台启动 + 主动 Kill +CommandHandle handle = client.Commands.start("sleep 60", new RunOptions()); +System.out.println("pid = " + handle.getPid()); +handle.kill(); +handle.close(); + +// 列出进程 +List procs = client.Commands.list(); +for (ProcessInfo p : procs) { + System.out.printf("PID: %d, Cmd: %s%n", p.getPid(), p.getCmd()); +} +``` + +--- + +## 文件系统(Filesystem) + +通过 `client.Files` 操作容器内文件。元数据操作走 envd Filesystem gRPC,文件内容读写走 HTTP `/files` 端点。 + +### 方法 + +| 方法 | 说明 | +|-------------------------------------------------------------------------------|--------------------------| +| `listDir(String path)` | 列出目录条目(depth=1) | +| `listDir(String path, int depth)` | 列出目录条目(指定深度) | +| `exists(String path)` | 路径是否存在 | +| `getInfo(String path)` | 获取文件/目录信息,返回 `EntryInfo` | +| `makeDir(String path)` | 递归创建目录;已存在返回 `false` | +| `remove(String path)` | 删除文件或目录 | +| `read(String path)` | 读取文件内容(`byte[]`) | +| `readText(String path)` | 读取文件内容(`String`,UTF-8) | +| `write(String path, byte[] data)` | 写入文件(二进制),自动创建父目录 | +| `writeText(String path, String content)` | 写入文件(文本,UTF-8) | +| `watchDir(String path, Consumer onEvent)` | 监听目录变更事件 | +| `watchDir(String path, boolean recursive, Consumer onEvent)` | 监听目录变更事件(支持递归) | + +### 示例 + +```java +// 目录操作 +client.Files.makeDir("/tmp/work"); +List entries = client.Files.listDir("/tmp"); +client.Files.remove("/tmp/work"); + +// 文件读写 +client.Files.writeText("/tmp/hello.txt", "Hello, World!"); +String content = client.Files.readText("/tmp/hello.txt"); +System.out.println(content); // Hello, World! + +// 二进制读写 +client.Files.write("/tmp/data.bin", new byte[]{0x01, 0x02, 0x03}); +byte[] data = client.Files.read("/tmp/data.bin"); + +// 目录监听 +WatchHandle wh = client.Files.watchDir("/tmp", true, event -> + System.out.printf("Event: %s %s%n", event.getType(), event.getPath())); +wh.close(); +``` diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/RuntimeClient.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/RuntimeClient.java new file mode 100644 index 0000000..de46764 --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/RuntimeClient.java @@ -0,0 +1,82 @@ +package io.openkruise.agents.client.runtime; + +import io.openkruise.agents.client.runtime.commands.Commands; +import io.openkruise.agents.client.runtime.filesystem.Filesystem; +import okhttp3.OkHttpClient; + +import java.util.Objects; + +/** + * Unified entry point for the Runtime layer, providing command execution and file operations based on OkHttp + Connect Protocol. + */ +public class RuntimeClient implements AutoCloseable { + public final Commands Commands; + public final Filesystem Files; + + private final String sandboxID; + private final RuntimeConfig config; + private final String runtimeURL; + + private RuntimeClient(String sandboxID, RuntimeConfig config, + OkHttpClient httpClient, OkHttpClient streamingClient) { + this.sandboxID = Objects.requireNonNull(sandboxID, "sandboxID cannot be null"); + this.config = Objects.requireNonNull(config, "config cannot be null"); + this.runtimeURL = config.getSandboxURL(sandboxID); + + this.Commands = new Commands(sandboxID, config, httpClient, streamingClient); + this.Files = new Filesystem(sandboxID, config, httpClient, streamingClient); + } + + public static RuntimeClient create(String sandboxID, RuntimeConfig config) { + OkHttpClient httpClient = config.getOrCreateHttpClient(); + OkHttpClient streamingClient = config.getOrCreateStreamingHttpClient(); + return new RuntimeClient(sandboxID, config, httpClient, streamingClient); + } + + /** + * Automatically builds by querying Sandbox CR via K8s, extracting runtimeToken from annotations. + */ + public static RuntimeClient newFromK8s(String namespace, String sandboxName, RuntimeConfig config) + throws Exception { + String sandboxID = namespace + "--" + sandboxName; + + String runtimeToken = K8sHelper.getRuntimeToken(namespace, sandboxName); + + // Rebuild config if runtimeToken is obtained + if (runtimeToken != null && !runtimeToken.isEmpty()) { + config = new RuntimeConfig.Builder() + .domain(config.getDomain()) + .scheme(config.getScheme()) + .runtimeUrl(config.getRuntimeUrl()) + .authHeader(config.getAuthHeader()) + .apiKey(config.getApiKey()) + .headers(config.getHeaders()) + .requestTimeoutMs(config.getRequestTimeoutMs()) + .runtimeToken(runtimeToken) + .build(); + } + + return create(sandboxID, config); + } + + public String getSandboxID() { + return sandboxID; + } + + public String getRuntimeURL() { + return runtimeURL; + } + + public RuntimeConfig getConfig() { + return config; + } + + @Override + public void close() { + } + + @Override + public String toString() { + return "RuntimeClient{sandboxID='" + sandboxID + "', runtimeURL='" + runtimeURL + "'}"; + } +} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/RuntimeConfig.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/RuntimeConfig.java new file mode 100644 index 0000000..8cb31aa --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/RuntimeConfig.java @@ -0,0 +1,282 @@ +package io.openkruise.agents.client.runtime; + +import com.google.protobuf.Message; +import com.google.protobuf.MessageOrBuilder; +import com.google.protobuf.util.JsonFormat; +import okhttp3.MediaType; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * Runtime direct connection configuration with Builder pattern. Use subclass {@code E2bRuntimeConfig} for E2B mode. + */ +public class RuntimeConfig { + + private static final String DEFAULT_DOMAIN = "domain.app"; + private static final String DEFAULT_SCHEME = "http"; + private static final long DEFAULT_REQUEST_TIMEOUT_MS = 60_000L; + static final String DEFAULT_AUTH_HEADER = "Basic cm9vdDo="; + + private final String domain; + private final String scheme; + private final String runtimeToken; + private final String runtimeUrl; + private final String authHeader; + private final String apiKey; + private final Map headers; + private final long requestTimeoutMs; + + protected RuntimeConfig(Builder builder) { + this.domain = builder.domain; + this.scheme = builder.scheme; + this.runtimeToken = builder.runtimeToken; + this.runtimeUrl = builder.runtimeUrl; + this.authHeader = builder.authHeader; + this.apiKey = builder.apiKey; + this.headers = Collections.unmodifiableMap(new HashMap<>(builder.headers)); + this.requestTimeoutMs = builder.requestTimeoutMs; + } + + /** + * Runtime base URL, overridable by subclasses. Returns runtimeUrl if set, otherwise combines scheme+domain. + */ + public String getSandboxURL(String sandboxID) { + if (runtimeUrl != null && !runtimeUrl.isEmpty()) { + return runtimeUrl; + } + // Default: :// + return String.format("%s://%s", getScheme(), domain); + } + + /** + * Builds common authentication headers (Authorization, X-Access-Token, X-API-Key, e2b-sandbox-id, etc.), extensible by subclasses. + */ + public Map getSandboxHeaders(String sandboxID) { + Map result = new HashMap<>(5 + headers.size()); + + String auth = (authHeader != null && !authHeader.isEmpty()) ? authHeader : DEFAULT_AUTH_HEADER; + result.put("Authorization", auth); + + if (runtimeToken != null && !runtimeToken.isEmpty()) { + result.put("X-Access-Token", runtimeToken); + } + + if (apiKey != null && !apiKey.isEmpty()) { + result.put("X-API-Key", apiKey); + } + + if (sandboxID != null && !sandboxID.isEmpty()) { + result.put("e2b-sandbox-id", sandboxID); + } + + result.putAll(headers); + return result; + } + + private static final MediaType JSON_MEDIA_TYPE = MediaType.get("application/json; charset=utf-8"); + private static final MediaType CONNECT_PROTO_MEDIA_TYPE = MediaType.get("application/connect+proto"); + private static final JsonFormat.Printer PROTO_PRINTER = JsonFormat.printer().omittingInsignificantWhitespace(); + + private volatile OkHttpClient sharedHttpClient; + private volatile OkHttpClient sharedStreamingClient; + private final Object httpClientLock = new Object(); + + /** + * Shared OkHttpClient with double-checked locking lazy initialization, reused by all RuntimeClients. + */ + public OkHttpClient getOrCreateHttpClient() { + if (sharedHttpClient == null) { + synchronized (httpClientLock) { + if (sharedHttpClient == null) { + sharedHttpClient = new OkHttpClient.Builder() + .connectTimeout(requestTimeoutMs, TimeUnit.MILLISECONDS) + .readTimeout(requestTimeoutMs, TimeUnit.MILLISECONDS) + .writeTimeout(requestTimeoutMs, TimeUnit.MILLISECONDS) + .build(); + } + } + } + return sharedHttpClient; + } + + /** + * Shared streaming OkHttpClient (no read timeout), reused by all RuntimeClients. + */ + public OkHttpClient getOrCreateStreamingHttpClient() { + if (sharedStreamingClient == null) { + synchronized (httpClientLock) { + if (sharedStreamingClient == null) { + sharedStreamingClient = new OkHttpClient.Builder() + .connectTimeout(requestTimeoutMs, TimeUnit.MILLISECONDS) + .readTimeout(0, TimeUnit.MILLISECONDS) + .writeTimeout(requestTimeoutMs, TimeUnit.MILLISECONDS) + .build(); + } + } + } + return sharedStreamingClient; + } + + /** + * Builds HTTP/JSON unary call requests (List, SendInput, etc.). + */ + public Request buildHttpRequest(String serviceName, String methodName, + MessageOrBuilder message, String sandboxID) { + try { + String jsonBody = PROTO_PRINTER.print(message); + String url = String.format("%s/%s/%s", getSandboxURL(sandboxID), serviceName, methodName); + + Request.Builder reqBuilder = new Request.Builder() + .url(url) + .post(RequestBody.create(jsonBody, JSON_MEDIA_TYPE)); + + // Set request headers + Map hdrs = getSandboxHeaders(sandboxID); + for (Map.Entry entry : hdrs.entrySet()) { + reqBuilder.addHeader(entry.getKey(), entry.getValue()); + } + + return reqBuilder.build(); + } catch (Exception e) { + throw new RuntimeException("Failed to build HTTP request", e); + } + } + + /** + * Builds Connect Protocol streaming requests (Server-Streaming, e.g., Start, Connect). + * Frame format: 1 byte flags (0x00) + 4 bytes big-endian length + protobuf body. + */ + public Request buildStreamingRequest(String serviceName, String methodName, + Message message, String sandboxID) { + String url = String.format("%s/%s/%s", getSandboxURL(sandboxID), serviceName, methodName); + + // Connect Protocol streaming request: body needs to be wrapped in Enveloped-Message + // Frame format: 1 byte flags (0x00=data) + 4 bytes big-endian payload length + payload + byte[] payload = message.toByteArray(); + byte[] enveloped = new byte[5 + payload.length]; + enveloped[0] = 0x00; + enveloped[1] = (byte)((payload.length >> 24) & 0xFF); + enveloped[2] = (byte)((payload.length >> 16) & 0xFF); + enveloped[3] = (byte)((payload.length >> 8) & 0xFF); + enveloped[4] = (byte)(payload.length & 0xFF); + System.arraycopy(payload, 0, enveloped, 5, payload.length); + + Request.Builder reqBuilder = new Request.Builder() + .url(url) + .post(RequestBody.create(enveloped, CONNECT_PROTO_MEDIA_TYPE)) + .addHeader("Connect-Protocol-Version", "1"); + + Map hdrs = getSandboxHeaders(sandboxID); + for (Map.Entry entry : hdrs.entrySet()) { + reqBuilder.addHeader(entry.getKey(), entry.getValue()); + } + + return reqBuilder.build(); + } + + public String getDomain() { + return domain; + } + + public String getScheme() { + return (scheme != null && !scheme.isEmpty()) ? scheme : DEFAULT_SCHEME; + } + + public String getRuntimeToken() { + return runtimeToken; + } + + public String getRuntimeUrl() { + return runtimeUrl; + } + + public String getAuthHeader() { + return authHeader; + } + + public String getApiKey() { + return apiKey; + } + + public Map getHeaders() { + return headers; + } + + public long getRequestTimeoutMs() { + return requestTimeoutMs; + } + + /** + * Builder pattern, extensible by subclasses. + */ + public static class Builder { + protected String domain = DEFAULT_DOMAIN; + protected String scheme = DEFAULT_SCHEME; + protected String runtimeToken; + protected String runtimeUrl; + protected String authHeader = DEFAULT_AUTH_HEADER; + protected String apiKey; + protected Map headers = new HashMap<>(); + protected long requestTimeoutMs = DEFAULT_REQUEST_TIMEOUT_MS; + + public Builder() {} + + public Builder domain(String domain) { + this.domain = domain; + return this; + } + + public Builder scheme(String scheme) { + this.scheme = scheme; + return this; + } + + public Builder runtimeToken(String runtimeToken) { + this.runtimeToken = runtimeToken; + return this; + } + + /** + * Sets direct runtime URL; getSandboxURL() returns this URL directly when set. + */ + public Builder runtimeUrl(String runtimeUrl) { + this.runtimeUrl = runtimeUrl; + return this; + } + + public Builder authHeader(String authHeader) { + this.authHeader = authHeader; + return this; + } + + public Builder apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + public Builder headers(Map headers) { + this.headers.putAll(headers); + return this; + } + + public Builder addHeader(String key, String value) { + this.headers.put(key, value); + return this; + } + + public Builder requestTimeoutMs(long requestTimeoutMs) { + this.requestTimeoutMs = requestTimeoutMs; + return this; + } + + public RuntimeConfig build() { + return new RuntimeConfig(this); + } + } +} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/commands/CommandHandle.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/commands/CommandHandle.java new file mode 100644 index 0000000..e50160e --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/commands/CommandHandle.java @@ -0,0 +1,153 @@ +package io.openkruise.agents.client.runtime.commands; + +import io.openkruise.agents.client.runtime.envd.process.StartResponse; +import io.openkruise.agents.client.runtime.envd.process.ProcessEvent; +import io.openkruise.agents.client.runtime.exceptions.SandboxException; +import io.openkruise.agents.client.runtime.utils.ConnectStreamReader; + +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Consumer; + +/** + * CommandHandle represents a handle to a running command. + *

+ * Reads streaming events from OkHttp Response via Connect Protocol Server-Streaming. + * Provides {@link #waitForCompletion()} to block until command completes, and {@link #kill()} to terminate the command. + */ +public class CommandHandle implements AutoCloseable { + private final long pid; + private final ConnectStreamReader streamReader; + private final Runnable killAction; + private final StringBuilder stdout = new StringBuilder(); + private final StringBuilder stderr = new StringBuilder(); + private final AtomicInteger exitCode = new AtomicInteger(-1); + private final AtomicBoolean completed = new AtomicBoolean(false); + private final AtomicBoolean closed = new AtomicBoolean(false); + + private final Consumer onStdout; + private final Consumer onStderr; + + /** + * @param pid Process PID + * @param streamReader Connect Protocol streaming reader + * @param killAction Callback to terminate the command (calls Commands.kill) + * @param onStdout stdout callback + * @param onStderr stderr callback + */ + public CommandHandle(long pid, ConnectStreamReader streamReader, + Runnable killAction, + Consumer onStdout, Consumer onStderr) { + if (pid <= 0) { + throw new IllegalArgumentException("PID must be positive, got: " + pid); + } + this.pid = pid; + this.streamReader = streamReader; + this.killAction = killAction; + this.onStdout = onStdout; + this.onStderr = onStderr; + } + + public long getPid() { + return pid; + } + + public boolean isCompleted() { + return completed.get(); + } + + /** + * Blocks until the command execution completes and returns the result. + */ + public CommandResult waitForCompletion() { + if (completed.get()) { + return createResult(); + } + + try { + while (streamReader != null && streamReader.hasNext()) { + StartResponse response = streamReader.next(); + processResponse(response); + + if (completed.get()) { + break; + } + } + } catch (Exception e) { + throw new SandboxException("Error while waiting for command completion", e); + } finally { + synchronized (this) { + completed.set(true); + close(); + } + } + + return createResult(); + } + + private CommandResult createResult() { + return new CommandResult(stdout.toString(), stderr.toString(), exitCode.get()); + } + + private void processResponse(StartResponse response) { + if (!response.hasEvent()) { + return; + } + + ProcessEvent event = response.getEvent(); + + if (event.hasData()) { + ProcessEvent.DataEvent dataEvent = event.getData(); + + if (dataEvent.hasStdout()) { + String out = dataEvent.getStdout().toStringUtf8(); + synchronized (stdout) { + stdout.append(out); + } + if (onStdout != null) { + onStdout.accept(out); + } + } + + if (dataEvent.hasStderr()) { + String err = dataEvent.getStderr().toStringUtf8(); + synchronized (stderr) { + stderr.append(err); + } + if (onStderr != null) { + onStderr.accept(err); + } + } + } + + if (event.hasEnd()) { + ProcessEvent.EndEvent endEvent = event.getEnd(); + exitCode.set(endEvent.getExitCode()); + completed.set(true); + } + } + + /** + * Terminates the command (SIGKILL). + */ + public boolean kill() { + if (completed.get()) { + return false; + } + if (killAction != null) { + killAction.run(); + } + exitCode.set(-1); + completed.set(true); + return true; + } + + @Override + public void close() { + if (closed.compareAndSet(false, true)) { + if (streamReader != null) { + streamReader.close(); + } + } + } +} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/sandbox/commands/CommandResult.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/commands/CommandResult.java similarity index 96% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/sandbox/commands/CommandResult.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/commands/CommandResult.java index 19595f1..ba84c28 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/sandbox/commands/CommandResult.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/commands/CommandResult.java @@ -1,4 +1,4 @@ -package io.openkruise.agents.client.e2b.sandbox.commands; +package io.openkruise.agents.client.runtime.commands; import java.util.Objects; diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/sandbox/commands/Commands.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/commands/Commands.java similarity index 64% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/sandbox/commands/Commands.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/commands/Commands.java index c44a82b..4ef9037 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/sandbox/commands/Commands.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/commands/Commands.java @@ -1,51 +1,55 @@ -package io.openkruise.agents.client.e2b.sandbox.commands; +package io.openkruise.agents.client.runtime.commands; import com.google.protobuf.util.JsonFormat; -import io.grpc.ManagedChannel; -import io.grpc.StatusRuntimeException; -import io.openkruise.agents.client.e2b.api.models.Sandbox; -import io.openkruise.agents.client.e2b.config.ConnectionConfig; -import io.openkruise.agents.client.e2b.envd.process.*; -import io.openkruise.agents.client.e2b.exceptions.SandboxException; -import io.openkruise.agents.client.e2b.utils.RpcUtils; +import io.openkruise.agents.client.runtime.EnvdMethods; +import io.openkruise.agents.client.runtime.RuntimeConfig; +import io.openkruise.agents.client.runtime.envd.process.*; +import io.openkruise.agents.client.runtime.exceptions.SandboxException; +import io.openkruise.agents.client.runtime.utils.ConnectStreamReader; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; import java.io.IOException; +import java.io.InputStream; import java.io.Reader; import java.net.HttpURLConnection; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Objects; -import java.util.concurrent.TimeUnit; import java.util.function.Consumer; +/** + * Commands provides command execution functionality within the sandbox. + *

+ * All implemented based on OkHttp + Connect Protocol, without depending on gRPC. + *

    + *
  • Unary calls (List, SendInput, SendSignal, CloseStdin): HTTP/JSON POST
  • + *
  • Streaming calls (Start, Connect): Connect Protocol Server-Streaming (protobuf frames)
  • + *
+ */ public class Commands { - public static final String SERVICE_NAME = "process.Process"; private static final JsonFormat.Parser PROTO_PARSER = JsonFormat.parser().ignoringUnknownFields(); - private final Sandbox sandbox; - private final ProcessGrpc.ProcessBlockingStub blockingStub; - private final ConnectionConfig config; + private final String sandboxID; + private final RuntimeConfig config; private final OkHttpClient httpClient; + private final OkHttpClient streamingClient; - public Commands(Sandbox sandbox, ManagedChannel channel, ConnectionConfig config) { - this.sandbox = Objects.requireNonNull(sandbox, "sandbox cannot be null"); - this.blockingStub = ProcessGrpc.newBlockingStub(channel); - this.config = Objects.requireNonNull(config, "ConnectionConfig cannot be null"); - this.httpClient = new OkHttpClient.Builder().connectTimeout(config.getRequestTimeoutMs(), TimeUnit.MILLISECONDS) - .readTimeout(config.getRequestTimeoutMs(), TimeUnit.MILLISECONDS).build(); + public Commands(String sandboxID, RuntimeConfig config, OkHttpClient httpClient, OkHttpClient streamingClient) { + this.sandboxID = Objects.requireNonNull(sandboxID, "sandboxID cannot be null"); + this.config = Objects.requireNonNull(config, "RuntimeConfig cannot be null"); + this.httpClient = Objects.requireNonNull(httpClient, "httpClient cannot be null"); + this.streamingClient = Objects.requireNonNull(streamingClient, "streamingClient cannot be null"); } public List list() { try { ListRequest params = ListRequest.newBuilder().build(); - Request request = config.buildHttpRequest(SERVICE_NAME, "List", params, sandbox.getSandboxID()); + Request request = config.buildHttpRequest(EnvdMethods.PROCESS_SERVICE, EnvdMethods.PROCESS_LIST, params, sandboxID); // noinspection WithSSRFCheckingInspection Response response = httpClient.newCall(request).execute(); @@ -60,7 +64,7 @@ public List list() { ListResponse listResponse = builder.build(); List entries = new ArrayList<>(listResponse.getProcessesCount()); - for (io.openkruise.agents.client.e2b.envd.process.ProcessInfo entry : + for (io.openkruise.agents.client.runtime.envd.process.ProcessInfo entry : listResponse.getProcessesList()) { entries.add(toProcessInfo(entry)); } @@ -70,7 +74,7 @@ public List list() { } } - private ProcessInfo toProcessInfo(io.openkruise.agents.client.e2b.envd.process.ProcessInfo p) { + private ProcessInfo toProcessInfo(io.openkruise.agents.client.runtime.envd.process.ProcessInfo p) { return new ProcessInfo( p.getPid(), p.hasTag() ? p.getTag() : null, @@ -105,8 +109,11 @@ public CommandHandle runBackground(String cmd, RunOptions options) { options = new RunOptions(); } + String shell = (options.getShell() != null && !options.getShell().isEmpty()) + ? options.getShell() : "/bin/bash"; + ProcessConfig.Builder processConfig = ProcessConfig.newBuilder() - .setCmd("/bin/bash") + .setCmd(shell) .addArgs("-l") .addArgs("-c") .addArgs(cmd); @@ -119,37 +126,51 @@ public CommandHandle runBackground(String cmd, RunOptions options) { processConfig.putAllEnvs(options.getEnvs()); } - StartRequest request = StartRequest.newBuilder() + StartRequest startReq = StartRequest.newBuilder() .setProcess(processConfig) .setStdin(options.isStdin()) .build(); - Iterator events; + // Initiate request via Connect Protocol Server-Streaming + Request httpRequest = config.buildStreamingRequest(EnvdMethods.PROCESS_SERVICE, EnvdMethods.PROCESS_START, startReq, sandboxID); + Response response; try { - events = blockingStub - .withDeadlineAfter( - options.getTimeoutMs() != null ? options.getTimeoutMs() : config.getRequestTimeoutMs(), - TimeUnit.MILLISECONDS) - .start(request); - } catch (StatusRuntimeException e) { - throw RpcUtils.handleRpcException(e); + // noinspection WithSSRFCheckingInspection + response = streamingClient.newCall(httpRequest).execute(); + if (!response.isSuccessful()) { + throw new IOException("Start HTTP request failed: " + response.code() + " " + response.message()); + } + } catch (IOException e) { + throw new SandboxException("Failed to start process", e); } - if (!events.hasNext()) { + // Parse Connect Protocol frames from response stream + InputStream responseStream = response.body().byteStream(); + ConnectStreamReader streamReader = + new ConnectStreamReader<>(responseStream, StartResponse.parser()); + + if (!streamReader.hasNext()) { + String trailerError = streamReader.getTrailerError(); + streamReader.close(); + if (trailerError != null) { + throw new SandboxException("Failed to start process: " + trailerError); + } throw new SandboxException("Failed to start process: no response from server"); } - StartResponse firstEvent = events.next(); + StartResponse firstEvent = streamReader.next(); if (!firstEvent.hasEvent() || !firstEvent.getEvent().hasStart()) { + streamReader.close(); throw new SandboxException("Failed to start process: invalid response from server"); } long pid = firstEvent.getEvent().getStart().getPid(); if (pid <= 0) { + streamReader.close(); throw new SandboxException("Failed to start process: invalid PID received"); } - return new CommandHandle(pid, events, blockingStub, config, + return new CommandHandle(pid, streamReader, () -> kill((int) pid), options.getOnStdout(), options.getOnStderr()); } @@ -167,7 +188,7 @@ public void sendInput(int pid, String data) { .build(); try { - Request request = config.buildHttpRequest(SERVICE_NAME, "SendInput", params, sandbox.getSandboxID()); + Request request = config.buildHttpRequest(EnvdMethods.PROCESS_SERVICE, EnvdMethods.PROCESS_SEND_INPUT, params, sandboxID); // noinspection WithSSRFCheckingInspection Response response = httpClient.newCall(request).execute(); @@ -192,7 +213,7 @@ public boolean sendSignal(int pid, Signal signal) { .build(); try { - Request request = config.buildHttpRequest(SERVICE_NAME, "SendSignal", params, sandbox.getSandboxID()); + Request request = config.buildHttpRequest(EnvdMethods.PROCESS_SERVICE, EnvdMethods.PROCESS_SEND_SIGNAL, params, sandboxID); // noinspection WithSSRFCheckingInspection Response response = httpClient.newCall(request).execute(); @@ -215,7 +236,7 @@ public void closeStdin(int pid) { .build(); try { - Request request = config.buildHttpRequest(SERVICE_NAME, "CloseStdin", params, sandbox.getSandboxID()); + Request request = config.buildHttpRequest(EnvdMethods.PROCESS_SERVICE, EnvdMethods.PROCESS_CLOSE_STDIN, params, sandboxID); // noinspection WithSSRFCheckingInspection Response response = httpClient.newCall(request).execute(); @@ -230,40 +251,58 @@ public void closeStdin(int pid) { public CommandHandle connect(int pid) { validatePid(pid); - ConnectRequest request = ConnectRequest.newBuilder() - .setProcess(ProcessSelector.newBuilder().setPid((int)pid).build()) + ConnectRequest connectReq = ConnectRequest.newBuilder() + .setProcess(ProcessSelector.newBuilder().setPid(pid).build()) .build(); - Iterator events; + // Initiate request via Connect Protocol Server-Streaming + Request httpRequest = config.buildStreamingRequest(EnvdMethods.PROCESS_SERVICE, EnvdMethods.PROCESS_CONNECT, connectReq, sandboxID); + Response response; try { - events = blockingStub - .withDeadlineAfter(config.getRequestTimeoutMs(), TimeUnit.MILLISECONDS) - .connect(request); - } catch (StatusRuntimeException e) { - throw RpcUtils.handleRpcException(e); + // noinspection WithSSRFCheckingInspection + response = streamingClient.newCall(httpRequest).execute(); + if (!response.isSuccessful()) { + throw new IOException("Connect HTTP request failed: " + response.code() + " " + response.message()); + } + } catch (IOException e) { + throw new SandboxException("Failed to connect to process", e); } - if (!events.hasNext()) { + // Parse Connect Protocol frames from response stream + // Connect method returns ConnectResponse, needs to be converted to StartResponse format + InputStream responseStream = response.body().byteStream(); + ConnectStreamReader connectReader = + new ConnectStreamReader<>(responseStream, ConnectResponse.parser()); + + if (!connectReader.hasNext()) { + connectReader.close(); throw new SandboxException("Failed to connect to process: no response from server"); } - ConnectResponse firstResponse = events.next(); + ConnectResponse firstResponse = connectReader.next(); if (!firstResponse.hasEvent()) { + connectReader.close(); throw new SandboxException("Failed to connect to process: invalid response from server"); } ProcessEvent event = firstResponse.getEvent(); if (!event.hasStart()) { + connectReader.close(); throw new SandboxException("Failed to connect to process: expected start event"); } long connectedPid = event.getStart().getPid(); if (connectedPid != pid) { + connectReader.close(); throw new SandboxException( "Failed to connect to process: PID mismatch, expected " + pid + " but got " + connectedPid); } - return new CommandHandle(pid, new ConnectResponseIterator(events), blockingStub, config, null, null); + // Adapt ConnectResponse stream to StartResponse stream + ConnectStreamReader adaptedReader = + new ConnectResponseAdapter(connectReader); + + return new CommandHandle(pid, adaptedReader, () -> kill(pid), null, null); } private void validatePid(int pid) { @@ -272,10 +311,14 @@ private void validatePid(int pid) { } } - private static class ConnectResponseIterator implements Iterator { - private final Iterator delegate; + /** + * Adapter that adapts ConnectResponse stream to StartResponse stream. + */ + private static class ConnectResponseAdapter extends ConnectStreamReader { + private final ConnectStreamReader delegate; - ConnectResponseIterator(Iterator delegate) { + ConnectResponseAdapter(ConnectStreamReader delegate) { + super(new java.io.ByteArrayInputStream(new byte[0]), StartResponse.parser()); this.delegate = delegate; } @@ -290,15 +333,20 @@ public StartResponse next() { if (!response.hasEvent()) { return StartResponse.getDefaultInstance(); } - - ProcessEvent event = response.getEvent(); return StartResponse.newBuilder() - .setEvent(event) + .setEvent(response.getEvent()) .build(); } + + @Override + public void close() { + delegate.close(); + } } public static class RunOptions { + /** Default shell, prefers /bin/bash, can be overridden to /bin/sh, etc. */ + private String shell; private String cwd; private Map envs; private boolean stdin = false; @@ -306,6 +354,15 @@ public static class RunOptions { private Consumer onStdout; private Consumer onStderr; + /** + * Sets the shell used to execute commands (default: /bin/bash). + * If /bin/bash is not available in the sandbox, can be set to /bin/sh. + */ + public RunOptions shell(String shell) { + this.shell = shell; + return this; + } + public RunOptions cwd(String cwd) { this.cwd = cwd; return this; @@ -367,6 +424,10 @@ public Consumer getOnStdout() { public Consumer getOnStderr() { return onStderr; } + + public String getShell() { + return shell; + } } public static class ProcessInfo { diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/CreateWatcherRequest.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/CreateWatcherRequest.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/CreateWatcherRequest.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/CreateWatcherRequest.java index 714abd6..bc5fb27 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/CreateWatcherRequest.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/CreateWatcherRequest.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; /** * Protobuf type {@code filesystem.CreateWatcherRequest} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/CreateWatcherRequestOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/CreateWatcherRequestOrBuilder.java similarity index 92% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/CreateWatcherRequestOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/CreateWatcherRequestOrBuilder.java index 9fe4db5..b479a2d 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/CreateWatcherRequestOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/CreateWatcherRequestOrBuilder.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; @com.google.protobuf.Generated public interface CreateWatcherRequestOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/CreateWatcherResponse.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/CreateWatcherResponse.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/CreateWatcherResponse.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/CreateWatcherResponse.java index 2b98aad..04d314b 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/CreateWatcherResponse.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/CreateWatcherResponse.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; /** * Protobuf type {@code filesystem.CreateWatcherResponse} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/CreateWatcherResponseOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/CreateWatcherResponseOrBuilder.java similarity index 91% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/CreateWatcherResponseOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/CreateWatcherResponseOrBuilder.java index 252e879..11d6a6f 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/CreateWatcherResponseOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/CreateWatcherResponseOrBuilder.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; @com.google.protobuf.Generated public interface CreateWatcherResponseOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/EntryInfo.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/EntryInfo.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/EntryInfo.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/EntryInfo.java index 7ba1f80..91f46d2 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/EntryInfo.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/EntryInfo.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; /** * Protobuf type {@code filesystem.EntryInfo} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/EntryInfoOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/EntryInfoOrBuilder.java similarity index 98% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/EntryInfoOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/EntryInfoOrBuilder.java index 61af1ac..82eed15 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/EntryInfoOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/EntryInfoOrBuilder.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; @com.google.protobuf.Generated public interface EntryInfoOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/EventType.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/EventType.java similarity index 98% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/EventType.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/EventType.java index ae2059d..e99b514 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/EventType.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/EventType.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; /** * Protobuf enum {@code filesystem.EventType} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/FileType.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/FileType.java similarity index 98% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/FileType.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/FileType.java index 412d7f2..f59a394 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/FileType.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/FileType.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; /** * Protobuf enum {@code filesystem.FileType} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/FilesystemEvent.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/FilesystemEvent.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/FilesystemEvent.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/FilesystemEvent.java index 7af07ac..9d9fbb0 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/FilesystemEvent.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/FilesystemEvent.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; /** * Protobuf type {@code filesystem.FilesystemEvent} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/FilesystemEventOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/FilesystemEventOrBuilder.java similarity index 93% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/FilesystemEventOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/FilesystemEventOrBuilder.java index 087ec26..35494ee 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/FilesystemEventOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/FilesystemEventOrBuilder.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; @com.google.protobuf.Generated public interface FilesystemEventOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/FilesystemGrpc.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/FilesystemGrpc.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/FilesystemGrpc.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/FilesystemGrpc.java index 690e286..bd30eb8 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/FilesystemGrpc.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/FilesystemGrpc.java @@ -1,4 +1,4 @@ -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; import static io.grpc.MethodDescriptor.generateFullMethodName; diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/FilesystemProto.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/FilesystemProto.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/FilesystemProto.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/FilesystemProto.java index 65cf4c4..b2e94ba 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/FilesystemProto.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/FilesystemProto.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; @com.google.protobuf.Generated public final class FilesystemProto extends com.google.protobuf.GeneratedFile { diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/GetWatcherEventsRequest.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/GetWatcherEventsRequest.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/GetWatcherEventsRequest.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/GetWatcherEventsRequest.java index 9b768dd..404d300 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/GetWatcherEventsRequest.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/GetWatcherEventsRequest.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; /** * Protobuf type {@code filesystem.GetWatcherEventsRequest} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/GetWatcherEventsRequestOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/GetWatcherEventsRequestOrBuilder.java similarity index 91% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/GetWatcherEventsRequestOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/GetWatcherEventsRequestOrBuilder.java index 1319e15..a339295 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/GetWatcherEventsRequestOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/GetWatcherEventsRequestOrBuilder.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; @com.google.protobuf.Generated public interface GetWatcherEventsRequestOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/GetWatcherEventsResponse.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/GetWatcherEventsResponse.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/GetWatcherEventsResponse.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/GetWatcherEventsResponse.java index 8208820..d6ee044 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/GetWatcherEventsResponse.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/GetWatcherEventsResponse.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; /** * Protobuf type {@code filesystem.GetWatcherEventsResponse} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/GetWatcherEventsResponseOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/GetWatcherEventsResponseOrBuilder.java similarity index 95% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/GetWatcherEventsResponseOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/GetWatcherEventsResponseOrBuilder.java index c31e308..5a5f605 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/GetWatcherEventsResponseOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/GetWatcherEventsResponseOrBuilder.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; @com.google.protobuf.Generated public interface GetWatcherEventsResponseOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/ListDirRequest.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/ListDirRequest.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/ListDirRequest.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/ListDirRequest.java index a4ae27c..c6931cf 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/ListDirRequest.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/ListDirRequest.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; /** * Protobuf type {@code filesystem.ListDirRequest} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/ListDirRequestOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/ListDirRequestOrBuilder.java similarity index 92% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/ListDirRequestOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/ListDirRequestOrBuilder.java index 388beae..5abecb8 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/ListDirRequestOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/ListDirRequestOrBuilder.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; @com.google.protobuf.Generated public interface ListDirRequestOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/ListDirResponse.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/ListDirResponse.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/ListDirResponse.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/ListDirResponse.java index 654b0e0..c333073 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/ListDirResponse.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/ListDirResponse.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; /** * Protobuf type {@code filesystem.ListDirResponse} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/ListDirResponseOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/ListDirResponseOrBuilder.java similarity index 94% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/ListDirResponseOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/ListDirResponseOrBuilder.java index 3985b17..6926a10 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/ListDirResponseOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/ListDirResponseOrBuilder.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; @com.google.protobuf.Generated public interface ListDirResponseOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/MakeDirRequest.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/MakeDirRequest.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/MakeDirRequest.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/MakeDirRequest.java index fe749ee..20ba50e 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/MakeDirRequest.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/MakeDirRequest.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; /** * Protobuf type {@code filesystem.MakeDirRequest} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/MakeDirRequestOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/MakeDirRequestOrBuilder.java similarity index 91% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/MakeDirRequestOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/MakeDirRequestOrBuilder.java index 05cc9a1..6d9d692 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/MakeDirRequestOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/MakeDirRequestOrBuilder.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; @com.google.protobuf.Generated public interface MakeDirRequestOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/MakeDirResponse.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/MakeDirResponse.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/MakeDirResponse.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/MakeDirResponse.java index 9b10f2d..cab3e67 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/MakeDirResponse.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/MakeDirResponse.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; /** * Protobuf type {@code filesystem.MakeDirResponse} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/MakeDirResponseOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/MakeDirResponseOrBuilder.java similarity index 92% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/MakeDirResponseOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/MakeDirResponseOrBuilder.java index 474b8bb..b38d00a 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/MakeDirResponseOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/MakeDirResponseOrBuilder.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; @com.google.protobuf.Generated public interface MakeDirResponseOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/MoveRequest.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/MoveRequest.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/MoveRequest.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/MoveRequest.java index 171b62b..8917743 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/MoveRequest.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/MoveRequest.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; /** * Protobuf type {@code filesystem.MoveRequest} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/MoveRequestOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/MoveRequestOrBuilder.java similarity index 94% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/MoveRequestOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/MoveRequestOrBuilder.java index 1cda862..f7c4584 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/MoveRequestOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/MoveRequestOrBuilder.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; @com.google.protobuf.Generated public interface MoveRequestOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/MoveResponse.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/MoveResponse.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/MoveResponse.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/MoveResponse.java index fecc964..25c9d2f 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/MoveResponse.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/MoveResponse.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; /** * Protobuf type {@code filesystem.MoveResponse} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/MoveResponseOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/MoveResponseOrBuilder.java similarity index 92% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/MoveResponseOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/MoveResponseOrBuilder.java index d0dd6f8..00cfd06 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/MoveResponseOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/MoveResponseOrBuilder.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; @com.google.protobuf.Generated public interface MoveResponseOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/RemoveRequest.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/RemoveRequest.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/RemoveRequest.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/RemoveRequest.java index a8a7327..51e78d6 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/RemoveRequest.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/RemoveRequest.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; /** * Protobuf type {@code filesystem.RemoveRequest} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/RemoveRequestOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/RemoveRequestOrBuilder.java similarity index 91% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/RemoveRequestOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/RemoveRequestOrBuilder.java index 4ce2c30..6c86952 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/RemoveRequestOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/RemoveRequestOrBuilder.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; @com.google.protobuf.Generated public interface RemoveRequestOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/RemoveResponse.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/RemoveResponse.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/RemoveResponse.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/RemoveResponse.java index 7867945..beb6cff 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/RemoveResponse.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/RemoveResponse.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; /** * Protobuf type {@code filesystem.RemoveResponse} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/RemoveResponseOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/RemoveResponseOrBuilder.java similarity index 85% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/RemoveResponseOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/RemoveResponseOrBuilder.java index 1978694..2153dd9 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/RemoveResponseOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/RemoveResponseOrBuilder.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; @com.google.protobuf.Generated public interface RemoveResponseOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/RemoveWatcherRequest.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/RemoveWatcherRequest.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/RemoveWatcherRequest.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/RemoveWatcherRequest.java index 34c4eb2..bcfc0d1 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/RemoveWatcherRequest.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/RemoveWatcherRequest.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; /** * Protobuf type {@code filesystem.RemoveWatcherRequest} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/RemoveWatcherRequestOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/RemoveWatcherRequestOrBuilder.java similarity index 91% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/RemoveWatcherRequestOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/RemoveWatcherRequestOrBuilder.java index 86ebb72..61b50ca 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/RemoveWatcherRequestOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/RemoveWatcherRequestOrBuilder.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; @com.google.protobuf.Generated public interface RemoveWatcherRequestOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/RemoveWatcherResponse.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/RemoveWatcherResponse.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/RemoveWatcherResponse.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/RemoveWatcherResponse.java index ecc1220..ffb74e6 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/RemoveWatcherResponse.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/RemoveWatcherResponse.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; /** * Protobuf type {@code filesystem.RemoveWatcherResponse} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/RemoveWatcherResponseOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/RemoveWatcherResponseOrBuilder.java similarity index 86% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/RemoveWatcherResponseOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/RemoveWatcherResponseOrBuilder.java index a499f91..456efe6 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/RemoveWatcherResponseOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/RemoveWatcherResponseOrBuilder.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; @com.google.protobuf.Generated public interface RemoveWatcherResponseOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/StatRequest.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/StatRequest.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/StatRequest.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/StatRequest.java index 4d9e8b3..6fe4ec2 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/StatRequest.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/StatRequest.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; /** * Protobuf type {@code filesystem.StatRequest} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/StatRequestOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/StatRequestOrBuilder.java similarity index 91% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/StatRequestOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/StatRequestOrBuilder.java index bb65069..b8621aa 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/StatRequestOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/StatRequestOrBuilder.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; @com.google.protobuf.Generated public interface StatRequestOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/StatResponse.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/StatResponse.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/StatResponse.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/StatResponse.java index d8138b8..e904a55 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/StatResponse.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/StatResponse.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; /** * Protobuf type {@code filesystem.StatResponse} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/StatResponseOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/StatResponseOrBuilder.java similarity index 92% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/StatResponseOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/StatResponseOrBuilder.java index acfcc77..f88da7a 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/StatResponseOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/StatResponseOrBuilder.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; @com.google.protobuf.Generated public interface StatResponseOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/WatchDirRequest.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/WatchDirRequest.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/WatchDirRequest.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/WatchDirRequest.java index 4cb62ae..bc94946 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/WatchDirRequest.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/WatchDirRequest.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; /** * Protobuf type {@code filesystem.WatchDirRequest} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/WatchDirRequestOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/WatchDirRequestOrBuilder.java similarity index 92% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/WatchDirRequestOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/WatchDirRequestOrBuilder.java index 400a277..6abd42d 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/WatchDirRequestOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/WatchDirRequestOrBuilder.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; @com.google.protobuf.Generated public interface WatchDirRequestOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/WatchDirResponse.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/WatchDirResponse.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/WatchDirResponse.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/WatchDirResponse.java index ccca453..8cb293d 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/WatchDirResponse.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/WatchDirResponse.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; /** * Protobuf type {@code filesystem.WatchDirResponse} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/WatchDirResponseOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/WatchDirResponseOrBuilder.java similarity index 96% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/WatchDirResponseOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/WatchDirResponseOrBuilder.java index 58a1967..1695648 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/filesystem/WatchDirResponseOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/filesystem/WatchDirResponseOrBuilder.java @@ -3,7 +3,7 @@ // source: filesystem/filesystem.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.filesystem; +package io.openkruise.agents.client.runtime.envd.filesystem; @com.google.protobuf.Generated public interface WatchDirResponseOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/CloseStdinRequest.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/CloseStdinRequest.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/CloseStdinRequest.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/CloseStdinRequest.java index 54b4ed0..3ab8f06 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/CloseStdinRequest.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/CloseStdinRequest.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; /** * Protobuf type {@code process.CloseStdinRequest} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/CloseStdinRequestOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/CloseStdinRequestOrBuilder.java similarity index 93% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/CloseStdinRequestOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/CloseStdinRequestOrBuilder.java index f287527..5101124 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/CloseStdinRequestOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/CloseStdinRequestOrBuilder.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; @com.google.protobuf.Generated public interface CloseStdinRequestOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/CloseStdinResponse.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/CloseStdinResponse.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/CloseStdinResponse.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/CloseStdinResponse.java index 4642d5b..2704631 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/CloseStdinResponse.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/CloseStdinResponse.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; /** * Protobuf type {@code process.CloseStdinResponse} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/CloseStdinResponseOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/CloseStdinResponseOrBuilder.java similarity index 86% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/CloseStdinResponseOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/CloseStdinResponseOrBuilder.java index 5d3f426..07f54e5 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/CloseStdinResponseOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/CloseStdinResponseOrBuilder.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; @com.google.protobuf.Generated public interface CloseStdinResponseOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ConnectRequest.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ConnectRequest.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ConnectRequest.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ConnectRequest.java index 40b0977..1711bdf 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ConnectRequest.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ConnectRequest.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; /** * Protobuf type {@code process.ConnectRequest} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ConnectRequestOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ConnectRequestOrBuilder.java similarity index 93% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ConnectRequestOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ConnectRequestOrBuilder.java index d4b82e4..ff911e4 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ConnectRequestOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ConnectRequestOrBuilder.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; @com.google.protobuf.Generated public interface ConnectRequestOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ConnectResponse.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ConnectResponse.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ConnectResponse.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ConnectResponse.java index a70167e..93bdf8a 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ConnectResponse.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ConnectResponse.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; /** * Protobuf type {@code process.ConnectResponse} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ConnectResponseOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ConnectResponseOrBuilder.java similarity index 93% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ConnectResponseOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ConnectResponseOrBuilder.java index 2076475..a800e6b 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ConnectResponseOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ConnectResponseOrBuilder.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; @com.google.protobuf.Generated public interface ConnectResponseOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ListRequest.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ListRequest.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ListRequest.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ListRequest.java index 999c553..c0bd4ee 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ListRequest.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ListRequest.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; /** * Protobuf type {@code process.ListRequest} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ListRequestOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ListRequestOrBuilder.java similarity index 85% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ListRequestOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ListRequestOrBuilder.java index b0c5848..d826088 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ListRequestOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ListRequestOrBuilder.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; @com.google.protobuf.Generated public interface ListRequestOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ListResponse.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ListResponse.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ListResponse.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ListResponse.java index 1e89ba0..2fa813a 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ListResponse.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ListResponse.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; /** * Protobuf type {@code process.ListResponse} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ListResponseOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ListResponseOrBuilder.java similarity index 95% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ListResponseOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ListResponseOrBuilder.java index 5ed6aa7..a86538e 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ListResponseOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ListResponseOrBuilder.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; @com.google.protobuf.Generated public interface ListResponseOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/PTY.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/PTY.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/PTY.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/PTY.java index 23cb2f1..a05a403 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/PTY.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/PTY.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; /** * Protobuf type {@code process.PTY} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/PTYOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/PTYOrBuilder.java similarity index 92% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/PTYOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/PTYOrBuilder.java index 0dc5e74..b3c7bce 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/PTYOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/PTYOrBuilder.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; @com.google.protobuf.Generated public interface PTYOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessConfig.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessConfig.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessConfig.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessConfig.java index 5f7f3cc..e56b980 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessConfig.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessConfig.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; /** * Protobuf type {@code process.ProcessConfig} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessConfigOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessConfigOrBuilder.java similarity index 97% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessConfigOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessConfigOrBuilder.java index bcc1df5..606359e 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessConfigOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessConfigOrBuilder.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; @com.google.protobuf.Generated public interface ProcessConfigOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessEvent.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessEvent.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessEvent.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessEvent.java index 23de4a8..3fc0413 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessEvent.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessEvent.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; /** * Protobuf type {@code process.ProcessEvent} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessEventOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessEventOrBuilder.java similarity index 97% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessEventOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessEventOrBuilder.java index 1f7d416..1da0d27 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessEventOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessEventOrBuilder.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; @com.google.protobuf.Generated public interface ProcessEventOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessGrpc.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessGrpc.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessGrpc.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessGrpc.java index b3cea67..f40ccf7 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessGrpc.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessGrpc.java @@ -1,4 +1,4 @@ -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; import static io.grpc.MethodDescriptor.generateFullMethodName; diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessInfo.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessInfo.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessInfo.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessInfo.java index e211947..4b1c93e 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessInfo.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessInfo.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; /** * Protobuf type {@code process.ProcessInfo} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessInfoOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessInfoOrBuilder.java similarity index 95% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessInfoOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessInfoOrBuilder.java index be07114..b7c82b0 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessInfoOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessInfoOrBuilder.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; @com.google.protobuf.Generated public interface ProcessInfoOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessInput.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessInput.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessInput.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessInput.java index 842c384..7f43489 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessInput.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessInput.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; /** * Protobuf type {@code process.ProcessInput} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessInputOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessInputOrBuilder.java similarity index 94% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessInputOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessInputOrBuilder.java index a8526fb..e66c473 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessInputOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessInputOrBuilder.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; @com.google.protobuf.Generated public interface ProcessInputOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessProto.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessProto.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessProto.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessProto.java index c68bcfe..7046501 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessProto.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessProto.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; @com.google.protobuf.Generated public final class ProcessProto extends com.google.protobuf.GeneratedFile { diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessSelector.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessSelector.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessSelector.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessSelector.java index 8e44df6..6e72b88 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessSelector.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessSelector.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; /** * Protobuf type {@code process.ProcessSelector} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessSelectorOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessSelectorOrBuilder.java similarity index 94% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessSelectorOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessSelectorOrBuilder.java index fc714dc..acd1631 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/ProcessSelectorOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/ProcessSelectorOrBuilder.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; @com.google.protobuf.Generated public interface ProcessSelectorOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/SendInputRequest.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/SendInputRequest.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/SendInputRequest.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/SendInputRequest.java index a59b4c3..903d9b2 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/SendInputRequest.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/SendInputRequest.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; /** * Protobuf type {@code process.SendInputRequest} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/SendInputRequestOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/SendInputRequestOrBuilder.java similarity index 95% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/SendInputRequestOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/SendInputRequestOrBuilder.java index 18d9651..437be41 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/SendInputRequestOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/SendInputRequestOrBuilder.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; @com.google.protobuf.Generated public interface SendInputRequestOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/SendInputResponse.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/SendInputResponse.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/SendInputResponse.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/SendInputResponse.java index 7358a59..d8627bd 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/SendInputResponse.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/SendInputResponse.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; /** * Protobuf type {@code process.SendInputResponse} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/SendInputResponseOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/SendInputResponseOrBuilder.java similarity index 86% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/SendInputResponseOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/SendInputResponseOrBuilder.java index 9a30d69..fb3a296 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/SendInputResponseOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/SendInputResponseOrBuilder.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; @com.google.protobuf.Generated public interface SendInputResponseOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/SendSignalRequest.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/SendSignalRequest.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/SendSignalRequest.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/SendSignalRequest.java index 4174d5d..0534ea1 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/SendSignalRequest.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/SendSignalRequest.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; /** * Protobuf type {@code process.SendSignalRequest} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/SendSignalRequestOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/SendSignalRequestOrBuilder.java similarity index 95% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/SendSignalRequestOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/SendSignalRequestOrBuilder.java index 00bbbe9..93c6317 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/SendSignalRequestOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/SendSignalRequestOrBuilder.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; @com.google.protobuf.Generated public interface SendSignalRequestOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/SendSignalResponse.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/SendSignalResponse.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/SendSignalResponse.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/SendSignalResponse.java index fe5b463..4542962 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/SendSignalResponse.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/SendSignalResponse.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; /** * Protobuf type {@code process.SendSignalResponse} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/SendSignalResponseOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/SendSignalResponseOrBuilder.java similarity index 86% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/SendSignalResponseOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/SendSignalResponseOrBuilder.java index 2555917..0b27251 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/SendSignalResponseOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/SendSignalResponseOrBuilder.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; @com.google.protobuf.Generated public interface SendSignalResponseOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/Signal.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/Signal.java similarity index 98% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/Signal.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/Signal.java index 24f4e8d..c8c3207 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/Signal.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/Signal.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; /** * Protobuf enum {@code process.Signal} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/StartRequest.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/StartRequest.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/StartRequest.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/StartRequest.java index c6f2a12..b7419e2 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/StartRequest.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/StartRequest.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; /** * Protobuf type {@code process.StartRequest} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/StartRequestOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/StartRequestOrBuilder.java similarity index 97% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/StartRequestOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/StartRequestOrBuilder.java index ce01ccb..9dac063 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/StartRequestOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/StartRequestOrBuilder.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; @com.google.protobuf.Generated public interface StartRequestOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/StartResponse.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/StartResponse.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/StartResponse.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/StartResponse.java index f3bec7f..9da76d3 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/StartResponse.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/StartResponse.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; /** * Protobuf type {@code process.StartResponse} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/StartResponseOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/StartResponseOrBuilder.java similarity index 93% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/StartResponseOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/StartResponseOrBuilder.java index 6a0235b..2386eea 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/StartResponseOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/StartResponseOrBuilder.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; @com.google.protobuf.Generated public interface StartResponseOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/StreamInputRequest.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/StreamInputRequest.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/StreamInputRequest.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/StreamInputRequest.java index c9c7255..80cef44 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/StreamInputRequest.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/StreamInputRequest.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; /** * Protobuf type {@code process.StreamInputRequest} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/StreamInputRequestOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/StreamInputRequestOrBuilder.java similarity index 97% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/StreamInputRequestOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/StreamInputRequestOrBuilder.java index eed98d0..c3d2bb5 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/StreamInputRequestOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/StreamInputRequestOrBuilder.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; @com.google.protobuf.Generated public interface StreamInputRequestOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/StreamInputResponse.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/StreamInputResponse.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/StreamInputResponse.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/StreamInputResponse.java index 794aafe..3b4fffa 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/StreamInputResponse.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/StreamInputResponse.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; /** * Protobuf type {@code process.StreamInputResponse} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/StreamInputResponseOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/StreamInputResponseOrBuilder.java similarity index 86% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/StreamInputResponseOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/StreamInputResponseOrBuilder.java index 57c4391..c1808b5 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/StreamInputResponseOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/StreamInputResponseOrBuilder.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; @com.google.protobuf.Generated public interface StreamInputResponseOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/UpdateRequest.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/UpdateRequest.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/UpdateRequest.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/UpdateRequest.java index a70d588..424dbcb 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/UpdateRequest.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/UpdateRequest.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; /** * Protobuf type {@code process.UpdateRequest} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/UpdateRequestOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/UpdateRequestOrBuilder.java similarity index 95% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/UpdateRequestOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/UpdateRequestOrBuilder.java index c5364be..32fa6b1 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/UpdateRequestOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/UpdateRequestOrBuilder.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; @com.google.protobuf.Generated public interface UpdateRequestOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/UpdateResponse.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/UpdateResponse.java similarity index 99% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/UpdateResponse.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/UpdateResponse.java index 95e0dfe..87a4a96 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/UpdateResponse.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/UpdateResponse.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; /** * Protobuf type {@code process.UpdateResponse} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/UpdateResponseOrBuilder.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/UpdateResponseOrBuilder.java similarity index 86% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/UpdateResponseOrBuilder.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/UpdateResponseOrBuilder.java index 6065b91..237d920 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/envd/process/UpdateResponseOrBuilder.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/envd/process/UpdateResponseOrBuilder.java @@ -3,7 +3,7 @@ // source: process/process.proto // Protobuf Java Version: 4.34.0 -package io.openkruise.agents.client.e2b.envd.process; +package io.openkruise.agents.client.runtime.envd.process; @com.google.protobuf.Generated public interface UpdateResponseOrBuilder extends diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/exceptions/SandboxException.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/exceptions/SandboxException.java similarity index 69% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/exceptions/SandboxException.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/exceptions/SandboxException.java index df25994..880abd7 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/exceptions/SandboxException.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/exceptions/SandboxException.java @@ -1,6 +1,10 @@ -package io.openkruise.agents.client.e2b.exceptions; +package io.openkruise.agents.client.runtime.exceptions; +/** + * Sandbox exception for runtime errors. + */ public class SandboxException extends RuntimeException { + public SandboxException(String message) { super(message); } @@ -9,4 +13,3 @@ public SandboxException(String message, Throwable cause) { super(message, cause); } } - diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/filesystem/Filesystem.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/filesystem/Filesystem.java new file mode 100644 index 0000000..db55fda --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/filesystem/Filesystem.java @@ -0,0 +1,613 @@ +package io.openkruise.agents.client.runtime.filesystem; + +import com.google.protobuf.util.JsonFormat; +import io.openkruise.agents.client.runtime.EnvdMethods; +import io.openkruise.agents.client.runtime.RuntimeConfig; +import io.openkruise.agents.client.runtime.envd.filesystem.*; +import io.openkruise.agents.client.runtime.exceptions.SandboxException; +import io.openkruise.agents.client.runtime.utils.ConnectStreamReader; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; + +import java.io.IOException; +import java.io.InputStream; +import java.io.Reader; +import java.net.HttpURLConnection; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Consumer; + +/** + * Filesystem provides filesystem operation functionality within the sandbox. + *

+ * All implemented based on OkHttp + Connect Protocol, without depending on gRPC. + */ +public class Filesystem { + private static final JsonFormat.Parser PROTO_PARSER = JsonFormat.parser().ignoringUnknownFields(); + private final String sandboxID; + private final RuntimeConfig config; + private final OkHttpClient httpClient; + private final OkHttpClient streamingClient; + + public Filesystem(String sandboxID, RuntimeConfig config, OkHttpClient httpClient, OkHttpClient streamingClient) { + this.sandboxID = Objects.requireNonNull(sandboxID, "sandboxID cannot be null"); + this.config = Objects.requireNonNull(config, "RuntimeConfig cannot be null"); + this.httpClient = Objects.requireNonNull(httpClient, "httpClient cannot be null"); + this.streamingClient = Objects.requireNonNull(streamingClient, "streamingClient cannot be null"); + } + + /** + * List entries in a directory. + * + * @param path path to the directory + * @return list of entries in the directory + */ + public List listDir(String path) { + if (path == null || path.trim().isEmpty()) { + throw new IllegalArgumentException("Path cannot be null or empty"); + } + return listDir(path, 1); + } + + /** + * List entries in a directory with specified depth. + * + * @param path path to the directory + * @param depth depth of the directory to list + * @return list of entries in the directory + */ + public List listDir(String path, int depth) { + if (path == null || path.trim().isEmpty()) { + throw new IllegalArgumentException("Path cannot be null or empty"); + } + if (depth < 1) { + throw new IllegalArgumentException("Depth must be at least 1"); + } + + try { + ListDirRequest params = ListDirRequest.newBuilder().setPath(path).setDepth(depth).build(); + + Request request = config.buildHttpRequest(EnvdMethods.FILESYSTEM_SERVICE, EnvdMethods.FS_LIST_DIR, params, sandboxID); + + // noinspection WithSSRFCheckingInspection + Response response = httpClient.newCall(request).execute(); + if (!response.isSuccessful()) { + throw new IOException("ListDir HTTP request failed: " + response.code() + " " + response.message()); + } + + Reader reader = response.body().charStream(); + // Parse the JSON response back to protobuf + ListDirResponse.Builder builder = ListDirResponse.newBuilder(); + PROTO_PARSER.merge(reader, builder); + ListDirResponse listDirResponse = builder.build(); + + List entries = new ArrayList<>(listDirResponse.getEntriesCount()); + for (io.openkruise.agents.client.runtime.envd.filesystem.EntryInfo entry : + listDirResponse.getEntriesList()) { + entries.add(toEntryInfo(entry)); + } + return entries; + } catch (Exception e) { + throw new RuntimeException("Failed to listDir", e); + } + } + + /** + * Create a new directory and all directories along the way if needed on the specified path. + * + * @param path path to a new directory + * @return true if the directory was created, false if it already exists + */ + public boolean makeDir(String path) { + try { + MakeDirRequest params = MakeDirRequest.newBuilder() + .setPath(path) + .build(); + + Request request = config.buildHttpRequest(EnvdMethods.FILESYSTEM_SERVICE, EnvdMethods.FS_MAKE_DIR, params, sandboxID); + + // noinspection WithSSRFCheckingInspection + Response response = httpClient.newCall(request).execute(); + if (!response.isSuccessful()) { + throw new IOException("MakeDir HTTP request failed: " + response.code() + " " + response.message()); + } + return response.isSuccessful(); + } catch (Exception e) { + throw new RuntimeException("Failed to makeDir", e); + } + } + + /** + * Rename a file or directory. + * + * @param oldPath path to the file or directory to rename + * @param newPath new path for the file or directory + * @return information about renamed file or directory + */ + public boolean move(String oldPath, String newPath) { + try { + MoveRequest params = MoveRequest.newBuilder() + .setSource(oldPath) + .setDestination(newPath) + .build(); + + Request request = config.buildHttpRequest(EnvdMethods.FILESYSTEM_SERVICE, EnvdMethods.FS_MOVE, params, sandboxID); + + // noinspection WithSSRFCheckingInspection + Response response = httpClient.newCall(request).execute(); + if (!response.isSuccessful()) { + throw new IOException("Move HTTP request failed: " + response.code() + " " + response.message()); + } + + return response.isSuccessful(); + } catch (Exception e) { + throw new RuntimeException("Failed to move", e); + } + } + + /** + * Remove a file or directory. + * + * @param path path to a file or directory + */ + public boolean remove(String path) { + try { + RemoveRequest params = RemoveRequest.newBuilder() + .setPath(path) + .build(); + + Request request = config.buildHttpRequest(EnvdMethods.FILESYSTEM_SERVICE, EnvdMethods.FS_REMOVE, params, sandboxID); + + // noinspection WithSSRFCheckingInspection + Response response = httpClient.newCall(request).execute(); + if (!response.isSuccessful()) { + throw new IOException("Remove HTTP request failed: " + response.code() + " " + response.message()); + } + return response.isSuccessful(); + } catch (Exception e) { + throw new RuntimeException("Failed to remove", e); + } + } + + /** + * Check if a file or a directory exists. + * + * @param path path to a file or a directory + * @return true if the file or directory exists, false otherwise + */ + public boolean exists(String path) { + try { + StatRequest params = StatRequest.newBuilder() + .setPath(path) + .build(); + + Request request = config.buildHttpRequest(EnvdMethods.FILESYSTEM_SERVICE, EnvdMethods.FS_STAT, params, sandboxID); + + // noinspection WithSSRFCheckingInspection + Response response = httpClient.newCall(request).execute(); + if (response.code() == HttpURLConnection.HTTP_NOT_FOUND) { + return false; + } + if (!response.isSuccessful()) { + throw new IOException("Stat HTTP request failed: " + response.code() + " " + response.message()); + } + return response.isSuccessful(); + } catch (Exception e) { + throw new RuntimeException("Failed to exists", e); + } + } + + /** + * Get information about a file or directory. + * + * @param path path to a file or directory + * @return information about the file or directory + */ + public EntryInfo getInfo(String path) { + try { + StatRequest params = StatRequest.newBuilder() + .setPath(path) + .build(); + + Request request = config.buildHttpRequest(EnvdMethods.FILESYSTEM_SERVICE, EnvdMethods.FS_STAT, params, sandboxID); + + // noinspection WithSSRFCheckingInspection + Response response = httpClient.newCall(request).execute(); + if (!response.isSuccessful()) { + throw new IOException("Stat HTTP request failed: " + response.code() + " " + response.message()); + } + + Reader reader = response.body().charStream(); + // Parse the JSON response back to protobuf + StatResponse.Builder builder = StatResponse.newBuilder(); + PROTO_PARSER.merge(reader, builder); + StatResponse statResponse = builder.build(); + + return toEntryInfo(statResponse.getEntry()); + } catch (Exception e) { + throw new RuntimeException("Failed to Remove", e); + } + } + + /** + * Reads file content and returns byte array. + * + * @param path file path + * @return file content + */ + public byte[] read(String path) { + return read(path, EnvdMethods.DEFAULT_USERNAME); + } + + /** + * Reads file content and returns byte array. + * + * @param path file path + * @param user username executing the operation + * @return file content + */ + public byte[] read(String path, String user) { + if (path == null || path.trim().isEmpty()) { + throw new IllegalArgumentException("Path cannot be null or empty"); + } + if (user == null || user.isEmpty()) { + user = EnvdMethods.DEFAULT_USERNAME; + } + + String baseUrl = config.getSandboxURL(sandboxID); + String fileUrl = String.format("%s%s?path=%s&username=%s", baseUrl, EnvdMethods.FILES_ROUTE, + urlEncode(path), urlEncode(user)); + + Request request = new Request.Builder() + .url(fileUrl) + .get() + .build(); + request = addSandboxHeaders(request); + + try { + Response response = httpClient.newCall(request).execute(); + if (response.code() == HttpURLConnection.HTTP_NOT_FOUND) { + throw new RuntimeException("File not found: " + path); + } + if (!response.isSuccessful()) { + String body = response.body() != null ? response.body().string() : ""; + throw new IOException("Read file failed (status " + response.code() + "): " + body); + } + return response.body().bytes(); + } catch (IOException e) { + throw new RuntimeException("Failed to read file: " + path, e); + } + } + + /** + * Reads file content and returns string (UTF-8). + * + * @param path file path + * @return file content as string + */ + public String readText(String path) { + return new String(read(path), StandardCharsets.UTF_8); + } + + /** + * Reads file content and returns string (UTF-8). + * + * @param path file path + * @param user username executing the operation + * @return file content as string + */ + public String readText(String path, String user) { + return new String(read(path, user), StandardCharsets.UTF_8); + } + + /** + * Writes file content. Creates the file if it doesn't exist, overwrites if it does. + * Parent directories are created automatically if they don't exist. + * + * @param path file path + * @param data file content + * @return write result information + */ + public WriteInfo write(String path, byte[] data) { + return write(path, data, EnvdMethods.DEFAULT_USERNAME); + } + + /** + * Writes file content. Creates the file if it doesn't exist, overwrites if it does. + * + * @param path file path + * @param data file content + * @param user username executing the operation + * @return write result information + */ + public WriteInfo write(String path, byte[] data, String user) { + if (path == null || path.trim().isEmpty()) { + throw new IllegalArgumentException("Path cannot be null or empty"); + } + if (data == null) { + throw new IllegalArgumentException("Data cannot be null"); + } + if (user == null || user.isEmpty()) { + user = EnvdMethods.DEFAULT_USERNAME; + } + + String baseUrl = config.getSandboxURL(sandboxID); + String fileUrl = String.format("%s%s?path=%s&username=%s", baseUrl, EnvdMethods.FILES_ROUTE, + urlEncode(path), urlEncode(user)); + + // Build multipart/form-data request body + okhttp3.MultipartBody requestBody = new okhttp3.MultipartBody.Builder() + .setType(okhttp3.MultipartBody.FORM) + .addFormDataPart("file", path, + okhttp3.RequestBody.create(data, okhttp3.MediaType.get("application/octet-stream"))) + .build(); + + Request request = new Request.Builder() + .url(fileUrl) + .post(requestBody) + .build(); + request = addSandboxHeaders(request); + + try { + Response response = httpClient.newCall(request).execute(); + if (response.code() != HttpURLConnection.HTTP_OK + && response.code() != HttpURLConnection.HTTP_CREATED) { + String body = response.body() != null ? response.body().string() : ""; + throw new IOException("Write file failed (status " + response.code() + "): " + body); + } + + // Try to parse response + String respBody = response.body() != null ? response.body().string() : ""; + if (!respBody.isEmpty()) { + try { + com.google.gson.JsonArray arr = com.google.gson.JsonParser.parseString(respBody).getAsJsonArray(); + if (arr.size() > 0) { + com.google.gson.JsonObject obj = arr.get(0).getAsJsonObject(); + return new WriteInfo( + obj.has("path") ? obj.get("path").getAsString() : path, + obj.has("type") ? obj.get("type").getAsString() : "file"); + } + } catch (Exception ignored) { + // Return basic info if parsing fails + } + } + return new WriteInfo(path, "file"); + } catch (IOException e) { + throw new RuntimeException("Failed to write file: " + path, e); + } + } + + /** + * Writes text content to file (UTF-8). + * + * @param path file path + * @param content text content + * @return write result information + */ + public WriteInfo writeText(String path, String content) { + return write(path, content.getBytes(StandardCharsets.UTF_8)); + } + + /** + * Writes text content to file (UTF-8). + * + * @param path file path + * @param content text content + * @param user username executing the operation + * @return write result information + */ + public WriteInfo writeText(String path, String content, String user) { + return write(path, content.getBytes(StandardCharsets.UTF_8), user); + } + + // ======================== Directory watching ======================== + + /** + * Start watching a directory for filesystem events. + * + * @param path path to directory to watch + * @param onEvent callback to call when an event in the directory occurs + * @return WatchHandle object for stopping watching directory + */ + public WatchHandle watchDir(String path, Consumer onEvent) { + return watchDir(path, false, onEvent); + } + + /** + * Start watching a directory for filesystem events. + * + * @param path path to directory to watch + * @param recursive whether to watch subdirectories recursively + * @param onEvent callback to call when an event in the directory occurs + * @return WatchHandle object for stopping watching directory + */ + public WatchHandle watchDir(String path, boolean recursive, Consumer onEvent) { + WatchDirRequest watchReq = WatchDirRequest.newBuilder().setPath(path).setRecursive(recursive).build(); + + // Initiate request via Connect Protocol Server-Streaming + Request httpRequest = config.buildStreamingRequest(EnvdMethods.FILESYSTEM_SERVICE, EnvdMethods.FS_WATCH_DIR, watchReq, sandboxID); + Response response; + try { + // noinspection WithSSRFCheckingInspection + response = streamingClient.newCall(httpRequest).execute(); + if (!response.isSuccessful()) { + throw new IOException("WatchDir HTTP request failed: " + response.code() + " " + response.message()); + } + } catch (IOException e) { + throw new SandboxException("Failed to watch directory", e); + } + + InputStream responseStream = response.body().byteStream(); + ConnectStreamReader streamReader = + new ConnectStreamReader<>(responseStream, WatchDirResponse.parser()); + + // Start background thread to read event stream + Thread watchThread = new Thread(() -> { + try { + while (streamReader.hasNext()) { + WatchDirResponse watchResponse = streamReader.next(); + // WatchDirResponse is oneof event { StartEvent, FilesystemEvent, KeepAlive } + if (watchResponse.hasFilesystem()) { + FilesystemEvent fsEvent = watchResponse.getFilesystem(); + WatchHandle.FilesystemEvent event = new WatchHandle.FilesystemEvent( + fsEvent.getName(), + mapEventType(fsEvent.getType())); + if (onEvent != null) { + onEvent.accept(event); + } + } + // Ignore start and keepalive events + } + } catch (Exception e) { + // stream closed or error + } finally { + streamReader.close(); + } + }, "watchDir-" + path); + watchThread.setDaemon(true); + watchThread.start(); + + return new WatchHandle(streamReader); + } + + private WatchHandle.FilesystemEventType mapEventType(EventType eventType) { + switch (eventType) { + case EVENT_TYPE_CHMOD: + return WatchHandle.FilesystemEventType.CHMOD; + case EVENT_TYPE_CREATE: + return WatchHandle.FilesystemEventType.CREATE; + case EVENT_TYPE_REMOVE: + return WatchHandle.FilesystemEventType.REMOVE; + case EVENT_TYPE_RENAME: + return WatchHandle.FilesystemEventType.RENAME; + case EVENT_TYPE_WRITE: + return WatchHandle.FilesystemEventType.WRITE; + default: + return WatchHandle.FilesystemEventType.WRITE; + } + } + + private EntryInfo toEntryInfo(io.openkruise.agents.client.runtime.envd.filesystem.EntryInfo entry) { + return new EntryInfo(entry.getName(), mapFileType(entry.getType()), entry.getPath(), entry.getSize(), + entry.getMode(), entry.getPermissions(), entry.getOwner(), entry.getGroup(), + entry.hasModifiedTime() ? entry.getModifiedTime() : null, + entry.hasSymlinkTarget() ? entry.getSymlinkTarget() : null); + } + + private FileType mapFileType(io.openkruise.agents.client.runtime.envd.filesystem.FileType fileType) { + switch (fileType) { + case FILE_TYPE_DIRECTORY: + return FileType.DIR; + case FILE_TYPE_FILE: + return FileType.FILE; + case FILE_TYPE_SYMLINK: + return FileType.SYMLINK; + default: + throw new SandboxException("Unknown file type: " + fileType); + } + } + + public enum FileType { + FILE, + DIR, + SYMLINK + } + + public static class EntryInfo { + private final String name; + private final FileType type; + private final String path; + private final long size; + private final int mode; + private final String permissions; + private final String owner; + private final String group; + private final com.google.protobuf.Timestamp modifiedTime; // Use correct Timestamp type + private final String symlinkTarget; + + public EntryInfo(String name, FileType type, String path, long size, int mode, String permissions, String owner, + String group, com.google.protobuf.Timestamp modifiedTime, String symlinkTarget) { + this.name = name; + this.type = type; + this.path = path; + this.size = size; + this.mode = mode; + this.permissions = permissions; + this.owner = owner; + this.group = group; + this.modifiedTime = modifiedTime; + this.symlinkTarget = symlinkTarget; + } + + // Getters + public String getName() {return name;} + + public FileType getType() {return type;} + + public String getPath() {return path;} + + public long getSize() {return size;} + + public int getMode() {return mode;} + + public String getPermissions() {return permissions;} + + public String getOwner() {return owner;} + + public String getGroup() {return group;} + + public com.google.protobuf.Timestamp getModifiedTime() {return modifiedTime;} // More accurate type + + public String getSymlinkTarget() {return symlinkTarget;} + + @Override + public String toString() { + return String.format("EntryInfo{name='%s', type=%s, path='%s', size=%d}", name, type, path, size); + } + } + + /** + * File write result information. + */ + public static class WriteInfo { + private final String path; + private final String type; + + public WriteInfo(String path, String type) { + this.path = path; + this.type = type; + } + + public String getPath() {return path;} + + public String getType() {return type;} + + @Override + public String toString() { + return "WriteInfo{path='" + path + "', type='" + type + "'}"; + } + } + + // ======================== Internal helper methods ======================== + + private String urlEncode(String value) { + try { + return java.net.URLEncoder.encode(value, "UTF-8"); + } catch (java.io.UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + } + + private Request addSandboxHeaders(Request original) { + Map hdrs = config.getSandboxHeaders(sandboxID); + Request.Builder builder = original.newBuilder(); + for (Map.Entry entry : hdrs.entrySet()) { + builder.addHeader(entry.getKey(), entry.getValue()); + } + return builder.build(); + } +} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/sandbox/filesystem/WatchDirResponseObserver.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/filesystem/WatchDirResponseObserver.java similarity index 63% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/sandbox/filesystem/WatchDirResponseObserver.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/filesystem/WatchDirResponseObserver.java index 416dbc9..fa8efe1 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/sandbox/filesystem/WatchDirResponseObserver.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/filesystem/WatchDirResponseObserver.java @@ -1,12 +1,16 @@ -package io.openkruise.agents.client.e2b.sandbox.filesystem; +package io.openkruise.agents.client.runtime.filesystem; import io.grpc.stub.StreamObserver; -import io.openkruise.agents.client.e2b.envd.filesystem.EventType; -import io.openkruise.agents.client.e2b.envd.filesystem.FilesystemEvent; -import io.openkruise.agents.client.e2b.envd.filesystem.WatchDirResponse; +import io.openkruise.agents.client.runtime.envd.filesystem.EventType; +import io.openkruise.agents.client.runtime.envd.filesystem.FilesystemEvent; +import io.openkruise.agents.client.runtime.envd.filesystem.WatchDirResponse; import java.util.function.Consumer; +/** + * Observer for handling WatchDirResponse stream events. + * Converts protobuf WatchDirResponse to WatchHandle.FilesystemEvent and notifies the consumer. + */ public class WatchDirResponseObserver implements StreamObserver { private final Consumer onEvent; @@ -16,7 +20,8 @@ public WatchDirResponseObserver(Consumer onEvent) { @Override public void onNext(WatchDirResponse response) { - // Process the response + // Process the response - check if it's a filesystem event + // Note: WatchDirResponse uses oneof field, so we need to check the event case if (response.getEventCase() == WatchDirResponse.EventCase.FILESYSTEM) { FilesystemEvent fsEvent = response.getFilesystem(); @@ -34,12 +39,21 @@ public void onNext(WatchDirResponse response) { @Override public void onError(Throwable t) { + System.err.println("Error in WatchDirResponseObserver: " + t.getMessage()); + t.printStackTrace(); } @Override public void onCompleted() { + // Empty implementation - stream completed } + /** + * Map protobuf EventType to WatchHandle.FilesystemEventType. + * + * @param eventType protobuf EventType enum + * @return corresponding WatchHandle.FilesystemEventType, or null if unmapped + */ private WatchHandle.FilesystemEventType mapEventType(EventType eventType) { switch (eventType) { case EVENT_TYPE_CHMOD: diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/sandbox/filesystem/WatchHandle.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/filesystem/WatchHandle.java similarity index 59% rename from k8s/java/src/main/java/io/openkruise/agents/client/e2b/sandbox/filesystem/WatchHandle.java rename to k8s/java/src/main/java/io/openkruise/agents/client/runtime/filesystem/WatchHandle.java index e0566f4..b42baa7 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/sandbox/filesystem/WatchHandle.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/filesystem/WatchHandle.java @@ -1,29 +1,31 @@ -package io.openkruise.agents.client.e2b.sandbox.filesystem; +package io.openkruise.agents.client.runtime.filesystem; -import io.grpc.stub.StreamObserver; -import io.openkruise.agents.client.e2b.envd.filesystem.EventType; -import io.openkruise.agents.client.e2b.envd.filesystem.WatchDirResponse; +import io.openkruise.agents.client.runtime.utils.ConnectStreamReader; -import java.util.function.Consumer; +import java.io.Closeable; +/** + * WatchHandle represents a handle to a directory event stream being watched. + *

+ * Stops watching and closes the underlying HTTP stream via {@link #stop()}. + */ public class WatchHandle { - private final StreamObserver responseObserver; + private final Closeable streamReader; private volatile boolean stopped = false; - public WatchHandle(StreamObserver responseObserver) { - this.responseObserver = responseObserver; + public WatchHandle(Closeable streamReader) { + this.streamReader = streamReader; } /** - * Stop watching the directory. + * Stops watching the directory. */ public void stop() { if (!stopped) { try { - // 使用onCompleted而不是onCompleted来结束观察者 - responseObserver.onCompleted(); + streamReader.close(); } catch (Exception e) { - System.err.println("Error completing the response observer: " + e.getMessage()); + System.err.println("Error closing stream reader: " + e.getMessage()); } finally { stopped = true; } diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/utils/ConnectStreamReader.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/utils/ConnectStreamReader.java new file mode 100644 index 0000000..4b14457 --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/utils/ConnectStreamReader.java @@ -0,0 +1,149 @@ +package io.openkruise.agents.client.runtime.utils; + +import com.google.protobuf.InvalidProtocolBufferException; +import com.google.protobuf.Message; +import com.google.protobuf.Parser; + +import java.io.Closeable; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.Iterator; +import java.util.NoSuchElementException; + +/** + * Connect Protocol Server-Streaming frame parser. + * + * @param protobuf message type + */ +public class ConnectStreamReader implements Iterator, Closeable { + private static final int FLAG_TRAILER = 0x02; + private static final int HEADER_SIZE = 5; + private static final int MAX_FRAME_SIZE = 32 * 1024 * 1024; + + private final InputStream inputStream; + private final Parser parser; + private T nextMessage; + private boolean done; + private boolean closed; + private String trailerError; + private IOException lastError; + + public ConnectStreamReader(InputStream inputStream, Parser parser) { + this.inputStream = inputStream; + this.parser = parser; + } + + @Override + public boolean hasNext() { + if (done || closed) { + return false; + } + if (nextMessage != null) { + return true; + } + try { + nextMessage = readNextFrame(); + return nextMessage != null; + } catch (IOException e) { + lastError = e; + done = true; + return false; + } + } + + @Override + public T next() { + if (!hasNext()) { + throw new NoSuchElementException("No more messages in stream"); + } + T msg = nextMessage; + nextMessage = null; + return msg; + } + + private T readNextFrame() throws IOException { + byte[] header = new byte[HEADER_SIZE]; + if (readFully(header, 0, HEADER_SIZE) < HEADER_SIZE) { + done = true; + return null; + } + + int flags = header[0] & 0xFF; + int length = ((header[1] & 0xFF) << 24) + | ((header[2] & 0xFF) << 16) + | ((header[3] & 0xFF) << 8) + | (header[4] & 0xFF); + + if (length < 0 || length > MAX_FRAME_SIZE) { + throw new IOException("Invalid frame length: " + length); + } + + byte[] payload = new byte[length]; + if (readFully(payload, 0, length) < length) { + throw new IOException("Unexpected end of stream: expected " + length + " bytes"); + } + + // Trailer frame indicates end of stream + if ((flags & FLAG_TRAILER) != 0) { + done = true; + parseTrailerError(payload); + return null; + } + + try { + return parser.parseFrom(payload); + } catch (InvalidProtocolBufferException e) { + throw new IOException("Failed to parse protobuf message", e); + } + } + + private void parseTrailerError(byte[] payload) { + if (payload.length == 0) { + return; + } + String trailerJson = new String(payload, StandardCharsets.UTF_8); + // Connect Protocol trailer: {"error":{"code":"...","message":"..."}} + if (trailerJson.contains("\"error\"")) { + trailerError = trailerJson; + } + } + + private int readFully(byte[] buf, int off, int len) throws IOException { + int total = 0; + while (total < len) { + int n = inputStream.read(buf, off + total, len - total); + if (n < 0) { + break; + } + total += n; + } + return total; + } + + /** + * Error message from trailer frame, available after hasNext() returns false. + */ + public String getTrailerError() { + return trailerError; + } + + /** + * If hasNext() returns false due to an IO exception, this method can retrieve it. + */ + public IOException getLastError() { + return lastError; + } + + @Override + public void close() { + if (!closed) { + closed = true; + done = true; + try { + inputStream.close(); + } catch (IOException ignored) { + } + } + } +} From 9c5ccd31ba22c5061a07cf804794c86c5602257b Mon Sep 17 00:00:00 2001 From: zhaoqing Date: Fri, 12 Jun 2026 17:45:10 +0800 Subject: [PATCH 2/5] update for code review --- .../openkruise/agents/client/e2b/Sandbox.java | 10 +- .../agents/client/e2b/SandboxInfo.java | 338 ++++++++++++------ .../client/e2b/SandboxNotFoundException.java | 3 - .../examples/e2b/SandboxCommandsExample.java | 2 +- .../examples/e2b/SandboxFilesExample.java | 2 +- .../runtime/K8sDirectConnectExample.java | 12 +- .../agents/client/runtime/K8sHelper.java | 12 +- .../agents/client/runtime/RuntimeClient.java | 15 +- .../agents/client/runtime/RuntimeConfig.java | 25 ++ .../runtime/commands/CommandHandle.java | 30 +- .../client/runtime/commands/Commands.java | 90 +++-- .../exceptions/K8sOperationException.java | 15 + .../client/runtime/filesystem/Filesystem.java | 103 +++--- .../runtime/filesystem/WatchHandle.java | 11 +- .../runtime/utils/ConnectStreamReader.java | 2 +- .../client/runtime/utils/MessageStream.java | 26 ++ 16 files changed, 445 insertions(+), 251 deletions(-) create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/runtime/exceptions/K8sOperationException.java create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/runtime/utils/MessageStream.java diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/Sandbox.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/Sandbox.java index 288e7ac..50888e3 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/Sandbox.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/Sandbox.java @@ -16,9 +16,9 @@ public class Sandbox implements AutoCloseable { private static final Logger LOG = Logger.getLogger(Sandbox.class.getName()); /** Command execution within the sandbox */ - public final Commands Commands; + public final Commands commands; /** File operations within the sandbox */ - public final Filesystem Files; + public final Filesystem files; private final String sandboxID; private final ConnectionConfig config; @@ -32,8 +32,8 @@ public class Sandbox implements AutoCloseable { E2bRuntimeConfig runtimeConfig = E2bRuntimeConfig.fromConnectionConfig(config, envdAccessToken); this.runtimeClient = RuntimeClient.create(sandboxID, runtimeConfig); - this.Commands = runtimeClient.Commands; - this.Files = runtimeClient.Files; + this.commands = runtimeClient.commands; + this.files = runtimeClient.files; } public String getSandboxID() { @@ -60,7 +60,7 @@ public void close() { } try { sandboxApi.kill(sandboxID); - } catch (ApiException e) { + } catch (Exception e) { LOG.log(Level.WARNING, "Failed to kill sandbox " + sandboxID + " on close()", e); } } diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/SandboxInfo.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/SandboxInfo.java index 454581e..118359c 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/SandboxInfo.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/SandboxInfo.java @@ -7,162 +7,146 @@ import io.openkruise.agents.client.e2b.api.models.SandboxesGet200ResponseInner; import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; /** - * Sandbox information, used uniformly for list() and getInfo() return values. + * Immutable sandbox information, used uniformly for list() and getInfo() return values. * Fields unique to detail are null when returned by list(). */ public class SandboxInfo { - private String sandboxID; - private String templateID; - private String alias; - private String clientID; - private OffsetDateTime startedAt; - private OffsetDateTime endAt; - private Integer cpuCount; - private Integer memoryMB; - private Integer diskSizeMB; - private String envdVersion; - private Map metadata; - private String state; - private List volumeMounts; - - private String envdAccessToken; - private String domain; - private Boolean allowInternetAccess; - private SandboxNetworkConfig network; - private SandboxLifecycle lifecycle; - - public SandboxInfo() { + private final String sandboxID; + private final String templateID; + private final String alias; + private final String clientID; + private final OffsetDateTime startedAt; + private final OffsetDateTime endAt; + private final Integer cpuCount; + private final Integer memoryMB; + private final Integer diskSizeMB; + private final String envdVersion; + private final Map metadata; + private final String state; + private final List volumeMounts; + + private final String envdAccessToken; + private final String domain; + private final Boolean allowInternetAccess; + private final SandboxNetworkConfig network; + private final SandboxLifecycle lifecycle; + + private SandboxInfo(Builder builder) { + this.sandboxID = builder.sandboxID; + this.templateID = builder.templateID; + this.alias = builder.alias; + this.clientID = builder.clientID; + this.startedAt = builder.startedAt; + this.endAt = builder.endAt; + this.cpuCount = builder.cpuCount; + this.memoryMB = builder.memoryMB; + this.diskSizeMB = builder.diskSizeMB; + this.envdVersion = builder.envdVersion; + this.state = builder.state; + this.metadata = builder.metadata != null + ? Collections.unmodifiableMap(new HashMap<>(builder.metadata)) : null; + this.volumeMounts = builder.volumeMounts != null + ? Collections.unmodifiableList(new ArrayList<>(builder.volumeMounts)) : null; + this.envdAccessToken = builder.envdAccessToken; + this.domain = builder.domain; + this.allowInternetAccess = builder.allowInternetAccess; + this.network = builder.network; + this.lifecycle = builder.lifecycle; } static SandboxInfo fromListResponse(SandboxesGet200ResponseInner sb) { - return fillCommon(new SandboxInfo(), - sb.getSandboxID(), sb.getTemplateID(), sb.getAlias(), sb.getClientID(), - sb.getStartedAt(), sb.getEndAt(), sb.getCpuCount(), sb.getMemoryMB(), - sb.getDiskSizeMB(), sb.getEnvdVersion(), - sb.getState() != null ? sb.getState().getValue() : null, - sb.getMetadata(), sb.getVolumeMounts()); + return new Builder() + .sandboxID(sb.getSandboxID()) + .templateID(sb.getTemplateID()) + .alias(sb.getAlias()) + .clientID(sb.getClientID()) + .startedAt(sb.getStartedAt()) + .endAt(sb.getEndAt()) + .cpuCount(sb.getCpuCount()) + .memoryMB(sb.getMemoryMB()) + .diskSizeMB(sb.getDiskSizeMB()) + .envdVersion(sb.getEnvdVersion()) + .state(sb.getState() != null ? sb.getState().getValue() : null) + .metadata(sb.getMetadata()) + .volumeMounts(sb.getVolumeMounts()) + .build(); } static SandboxInfo fromDetail(SandboxDetail resp) { - SandboxInfo info = fillCommon(new SandboxInfo(), - resp.getSandboxID(), resp.getTemplateID(), resp.getAlias(), resp.getClientID(), - resp.getStartedAt(), resp.getEndAt(), resp.getCpuCount(), resp.getMemoryMB(), - resp.getDiskSizeMB(), resp.getEnvdVersion(), - resp.getState() != null ? resp.getState().getValue() : null, - resp.getMetadata(), resp.getVolumeMounts()); - info.envdAccessToken = resp.getEnvdAccessToken(); - info.domain = resp.getDomain(); - info.allowInternetAccess = resp.getAllowInternetAccess(); - info.network = resp.getNetwork(); - info.lifecycle = resp.getLifecycle(); - return info; + return new Builder() + .sandboxID(resp.getSandboxID()) + .templateID(resp.getTemplateID()) + .alias(resp.getAlias()) + .clientID(resp.getClientID()) + .startedAt(resp.getStartedAt()) + .endAt(resp.getEndAt()) + .cpuCount(resp.getCpuCount()) + .memoryMB(resp.getMemoryMB()) + .diskSizeMB(resp.getDiskSizeMB()) + .envdVersion(resp.getEnvdVersion()) + .state(resp.getState() != null ? resp.getState().getValue() : null) + .metadata(resp.getMetadata()) + .volumeMounts(resp.getVolumeMounts()) + .envdAccessToken(resp.getEnvdAccessToken()) + .domain(resp.getDomain()) + .allowInternetAccess(resp.getAllowInternetAccess()) + .network(resp.getNetwork()) + .lifecycle(resp.getLifecycle()) + .build(); } - private static SandboxInfo fillCommon(SandboxInfo info, - String sandboxID, String templateID, String alias, String clientID, - OffsetDateTime startedAt, OffsetDateTime endAt, - Integer cpuCount, Integer memoryMB, Integer diskSizeMB, - String envdVersion, String state, - Map metadata, List volumeMounts) { - info.sandboxID = sandboxID; - info.templateID = templateID; - info.alias = alias; - info.clientID = clientID; - info.startedAt = startedAt; - info.endAt = endAt; - info.cpuCount = cpuCount; - info.memoryMB = memoryMB; - info.diskSizeMB = diskSizeMB; - info.envdVersion = envdVersion; - info.state = state; - info.metadata = metadata; - info.volumeMounts = volumeMounts; - return info; - } - - public String getSandboxID() {return sandboxID;} - - public void setSandboxID(String sandboxID) {this.sandboxID = sandboxID;} - - public String getTemplateID() {return templateID;} - - public void setTemplateID(String templateID) {this.templateID = templateID;} - - public String getAlias() {return alias;} - - public void setAlias(String alias) {this.alias = alias;} - - public String getClientID() {return clientID;} - - public void setClientID(String clientID) {this.clientID = clientID;} - - public OffsetDateTime getStartedAt() {return startedAt;} - - public void setStartedAt(OffsetDateTime startedAt) {this.startedAt = startedAt;} + // Getters only — no setters, immutable by design - public OffsetDateTime getEndAt() {return endAt;} + public String getSandboxID() { return sandboxID; } - public void setEndAt(OffsetDateTime endAt) {this.endAt = endAt;} + public String getTemplateID() { return templateID; } - public Integer getCpuCount() {return cpuCount;} + public String getAlias() { return alias; } - public void setCpuCount(Integer cpuCount) {this.cpuCount = cpuCount;} + public String getClientID() { return clientID; } - public Integer getMemoryMB() {return memoryMB;} + public OffsetDateTime getStartedAt() { return startedAt; } - public void setMemoryMB(Integer memoryMB) {this.memoryMB = memoryMB;} + public OffsetDateTime getEndAt() { return endAt; } - public Integer getDiskSizeMB() {return diskSizeMB;} + public Integer getCpuCount() { return cpuCount; } - public void setDiskSizeMB(Integer diskSizeMB) {this.diskSizeMB = diskSizeMB;} + public Integer getMemoryMB() { return memoryMB; } - public String getEnvdVersion() {return envdVersion;} + public Integer getDiskSizeMB() { return diskSizeMB; } - public void setEnvdVersion(String envdVersion) {this.envdVersion = envdVersion;} + public String getEnvdVersion() { return envdVersion; } - public Map getMetadata() {return metadata;} + public Map getMetadata() { return metadata; } - public void setMetadata(Map metadata) {this.metadata = metadata;} + public String getState() { return state; } - public String getState() {return state;} + public List getVolumeMounts() { return volumeMounts; } - public void setState(String state) {this.state = state;} + public String getEnvdAccessToken() { return envdAccessToken; } - public List getVolumeMounts() {return volumeMounts;} + public String getDomain() { return domain; } - public void setVolumeMounts(List volumeMounts) {this.volumeMounts = volumeMounts;} + public Boolean getAllowInternetAccess() { return allowInternetAccess; } - public String getEnvdAccessToken() {return envdAccessToken;} + public SandboxNetworkConfig getNetwork() { return network; } - public void setEnvdAccessToken(String envdAccessToken) {this.envdAccessToken = envdAccessToken;} - - public String getDomain() {return domain;} - - public void setDomain(String domain) {this.domain = domain;} - - public Boolean getAllowInternetAccess() {return allowInternetAccess;} - - public void setAllowInternetAccess(Boolean allowInternetAccess) {this.allowInternetAccess = allowInternetAccess;} - - public SandboxNetworkConfig getNetwork() {return network;} - - public void setNetwork(SandboxNetworkConfig network) {this.network = network;} - - public SandboxLifecycle getLifecycle() {return lifecycle;} - - public void setLifecycle(SandboxLifecycle lifecycle) {this.lifecycle = lifecycle;} + public SandboxLifecycle getLifecycle() { return lifecycle; } @Override public boolean equals(Object o) { - if (this == o) {return true;} - if (o == null || getClass() != o.getClass()) {return false;} - SandboxInfo that = (SandboxInfo)o; + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } + SandboxInfo that = (SandboxInfo) o; return Objects.equals(sandboxID, that.sandboxID); } @@ -183,4 +167,122 @@ public String toString() { ", diskSizeMB=" + diskSizeMB + '}'; } + + /** + * Builder for constructing SandboxInfo instances. + */ + public static class Builder { + private String sandboxID; + private String templateID; + private String alias; + private String clientID; + private OffsetDateTime startedAt; + private OffsetDateTime endAt; + private Integer cpuCount; + private Integer memoryMB; + private Integer diskSizeMB; + private String envdVersion; + private Map metadata; + private String state; + private List volumeMounts; + private String envdAccessToken; + private String domain; + private Boolean allowInternetAccess; + private SandboxNetworkConfig network; + private SandboxLifecycle lifecycle; + + public Builder sandboxID(String sandboxID) { + this.sandboxID = sandboxID; + return this; + } + + public Builder templateID(String templateID) { + this.templateID = templateID; + return this; + } + + public Builder alias(String alias) { + this.alias = alias; + return this; + } + + public Builder clientID(String clientID) { + this.clientID = clientID; + return this; + } + + public Builder startedAt(OffsetDateTime startedAt) { + this.startedAt = startedAt; + return this; + } + + public Builder endAt(OffsetDateTime endAt) { + this.endAt = endAt; + return this; + } + + public Builder cpuCount(Integer cpuCount) { + this.cpuCount = cpuCount; + return this; + } + + public Builder memoryMB(Integer memoryMB) { + this.memoryMB = memoryMB; + return this; + } + + public Builder diskSizeMB(Integer diskSizeMB) { + this.diskSizeMB = diskSizeMB; + return this; + } + + public Builder envdVersion(String envdVersion) { + this.envdVersion = envdVersion; + return this; + } + + public Builder state(String state) { + this.state = state; + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = metadata; + return this; + } + + public Builder volumeMounts(List volumeMounts) { + this.volumeMounts = volumeMounts; + return this; + } + + public Builder envdAccessToken(String envdAccessToken) { + this.envdAccessToken = envdAccessToken; + return this; + } + + public Builder domain(String domain) { + this.domain = domain; + return this; + } + + public Builder allowInternetAccess(Boolean allowInternetAccess) { + this.allowInternetAccess = allowInternetAccess; + return this; + } + + public Builder network(SandboxNetworkConfig network) { + this.network = network; + return this; + } + + public Builder lifecycle(SandboxLifecycle lifecycle) { + this.lifecycle = lifecycle; + return this; + } + + public SandboxInfo build() { + return new SandboxInfo(this); + } + } } diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/SandboxNotFoundException.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/SandboxNotFoundException.java index cffba78..7ca5e17 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/SandboxNotFoundException.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/SandboxNotFoundException.java @@ -2,9 +2,6 @@ import io.openkruise.agents.client.e2b.api.invoker.ApiException; -import java.util.List; -import java.util.Map; - /** * Thrown when the specified sandbox does not exist (HTTP 404). */ diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/examples/e2b/SandboxCommandsExample.java b/k8s/java/src/main/java/io/openkruise/agents/client/examples/e2b/SandboxCommandsExample.java index 833c5b8..42890fb 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/examples/e2b/SandboxCommandsExample.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/examples/e2b/SandboxCommandsExample.java @@ -42,7 +42,7 @@ public static void main(String[] args) { // ========== 4. Command operations demo ========== System.out.println("\n--- Command Operations Demo ---"); - demonstrateCommandOperations(sandbox.Commands); + demonstrateCommandOperations(sandbox.commands); System.out.println("\n========== Example Completed =========="); } catch (Exception e) { diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/examples/e2b/SandboxFilesExample.java b/k8s/java/src/main/java/io/openkruise/agents/client/examples/e2b/SandboxFilesExample.java index 5cfbd39..baeb00c 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/examples/e2b/SandboxFilesExample.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/examples/e2b/SandboxFilesExample.java @@ -39,7 +39,7 @@ public static void main(String[] args) { // ========== 4. File operations demo ========== System.out.println("\n--- File Operations Demo ---"); - demonstrateFileOperations(sandbox.Files); + demonstrateFileOperations(sandbox.files); System.out.println("\n========== Example Completed =========="); } catch (Exception e) { diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/examples/runtime/K8sDirectConnectExample.java b/k8s/java/src/main/java/io/openkruise/agents/client/examples/runtime/K8sDirectConnectExample.java index 4294b0e..c9e657a 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/examples/runtime/K8sDirectConnectExample.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/examples/runtime/K8sDirectConnectExample.java @@ -28,28 +28,28 @@ public static void main(String[] args) { System.out.println("Sandbox ID: " + client.getSandboxID()); // Execute command - CommandResult result = client.Commands.run("uname -a"); + CommandResult result = client.commands.run("uname -a"); System.out.println("uname: " + result.getStdout()); // List directory - List entries = client.Files.listDir("/"); + List entries = client.files.listDir("/"); System.out.println("Root directory file count: " + entries.size()); for (EntryInfo entry : entries) { System.out.println(" " + entry); } // Create directory - client.Files.makeDir("/tmp/test-dir"); + client.files.makeDir("/tmp/test-dir"); // Check if file exists - boolean exists = client.Files.exists("/tmp/test-dir"); + boolean exists = client.files.exists("/tmp/test-dir"); System.out.println("/tmp/test-dir exists: " + exists); // Execute multiple commands - CommandResult whoami = client.Commands.run("whoami"); + CommandResult whoami = client.commands.run("whoami"); System.out.println("Current user: " + whoami.getStdout().trim()); - CommandResult pwd = client.Commands.run("pwd"); + CommandResult pwd = client.commands.run("pwd"); System.out.println("Working directory: " + pwd.getStdout().trim()); } catch (Exception e) { diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/K8sHelper.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/K8sHelper.java index 0c9dabc..56cd06e 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/K8sHelper.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/K8sHelper.java @@ -2,6 +2,7 @@ import io.fabric8.kubernetes.client.KubernetesClient; import io.fabric8.kubernetes.client.KubernetesClientBuilder; +import io.openkruise.agents.client.runtime.exceptions.K8sOperationException; import io.openkruise.agents.client.v2.models.Sandbox; import java.util.Map; @@ -25,9 +26,9 @@ class K8sHelper { * @param namespace K8s namespace where the sandbox resides * @param sandboxName sandbox resource name * @return runtimeToken value, or null if not present - * @throws Exception if K8s query fails + * @throws K8sOperationException if K8s query fails or Sandbox CR not found */ - static String getRuntimeToken(String namespace, String sandboxName) throws Exception { + static String getRuntimeToken(String namespace, String sandboxName) throws K8sOperationException { try (KubernetesClient client = new KubernetesClientBuilder().build()) { Sandbox sandbox = client.resources(Sandbox.class) .inNamespace(namespace) @@ -35,7 +36,7 @@ static String getRuntimeToken(String namespace, String sandboxName) throws Excep .get(); if (sandbox == null) { - throw new RuntimeException( + throw new K8sOperationException( String.format("Sandbox CR %s/%s not found", namespace, sandboxName)); } @@ -45,6 +46,11 @@ static String getRuntimeToken(String namespace, String sandboxName) throws Excep } return null; + } catch (K8sOperationException e) { + throw e; + } catch (Exception e) { + throw new K8sOperationException( + String.format("Failed to query Sandbox CR %s/%s", namespace, sandboxName), e); } } } diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/RuntimeClient.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/RuntimeClient.java index de46764..b8d8a14 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/RuntimeClient.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/RuntimeClient.java @@ -1,17 +1,19 @@ package io.openkruise.agents.client.runtime; import io.openkruise.agents.client.runtime.commands.Commands; +import io.openkruise.agents.client.runtime.exceptions.K8sOperationException; import io.openkruise.agents.client.runtime.filesystem.Filesystem; import okhttp3.OkHttpClient; import java.util.Objects; /** - * Unified entry point for the Runtime layer, providing command execution and file operations based on OkHttp + Connect Protocol. + * Unified entry point for the Runtime layer, providing command execution and file operations based on OkHttp + Connect + * Protocol. */ public class RuntimeClient implements AutoCloseable { - public final Commands Commands; - public final Filesystem Files; + public final Commands commands; + public final Filesystem files; private final String sandboxID; private final RuntimeConfig config; @@ -23,8 +25,8 @@ private RuntimeClient(String sandboxID, RuntimeConfig config, this.config = Objects.requireNonNull(config, "config cannot be null"); this.runtimeURL = config.getSandboxURL(sandboxID); - this.Commands = new Commands(sandboxID, config, httpClient, streamingClient); - this.Files = new Filesystem(sandboxID, config, httpClient, streamingClient); + this.commands = new Commands(sandboxID, config, httpClient, streamingClient); + this.files = new Filesystem(sandboxID, config, httpClient, streamingClient); } public static RuntimeClient create(String sandboxID, RuntimeConfig config) { @@ -37,7 +39,7 @@ public static RuntimeClient create(String sandboxID, RuntimeConfig config) { * Automatically builds by querying Sandbox CR via K8s, extracting runtimeToken from annotations. */ public static RuntimeClient newFromK8s(String namespace, String sandboxName, RuntimeConfig config) - throws Exception { + throws K8sOperationException { String sandboxID = namespace + "--" + sandboxName; String runtimeToken = K8sHelper.getRuntimeToken(namespace, sandboxName); @@ -73,6 +75,7 @@ public RuntimeConfig getConfig() { @Override public void close() { + config.shutdown(); } @Override diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/RuntimeConfig.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/RuntimeConfig.java index 8cb31aa..f6dda20 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/RuntimeConfig.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/RuntimeConfig.java @@ -86,11 +86,15 @@ public Map getSandboxHeaders(String sandboxID) { private volatile OkHttpClient sharedHttpClient; private volatile OkHttpClient sharedStreamingClient; private final Object httpClientLock = new Object(); + private volatile boolean shutdown; /** * Shared OkHttpClient with double-checked locking lazy initialization, reused by all RuntimeClients. */ public OkHttpClient getOrCreateHttpClient() { + if (shutdown) { + throw new IllegalStateException("RuntimeConfig has been shut down"); + } if (sharedHttpClient == null) { synchronized (httpClientLock) { if (sharedHttpClient == null) { @@ -109,6 +113,9 @@ public OkHttpClient getOrCreateHttpClient() { * Shared streaming OkHttpClient (no read timeout), reused by all RuntimeClients. */ public OkHttpClient getOrCreateStreamingHttpClient() { + if (shutdown) { + throw new IllegalStateException("RuntimeConfig has been shut down"); + } if (sharedStreamingClient == null) { synchronized (httpClientLock) { if (sharedStreamingClient == null) { @@ -123,6 +130,24 @@ public OkHttpClient getOrCreateStreamingHttpClient() { return sharedStreamingClient; } + /** + * Shuts down the shared OkHttpClient thread pools (Dispatcher and ConnectionPool). + * Should be called when all RuntimeClients using this config are no longer needed. + */ + public void shutdown() { + synchronized (httpClientLock) { + shutdown = true; + if (sharedHttpClient != null) { + sharedHttpClient.dispatcher().executorService().shutdown(); + sharedHttpClient.connectionPool().evictAll(); + } + if (sharedStreamingClient != null) { + sharedStreamingClient.dispatcher().executorService().shutdown(); + sharedStreamingClient.connectionPool().evictAll(); + } + } + } + /** * Builds HTTP/JSON unary call requests (List, SendInput, etc.). */ diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/commands/CommandHandle.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/commands/CommandHandle.java index e50160e..2221764 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/commands/CommandHandle.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/commands/CommandHandle.java @@ -3,7 +3,8 @@ import io.openkruise.agents.client.runtime.envd.process.StartResponse; import io.openkruise.agents.client.runtime.envd.process.ProcessEvent; import io.openkruise.agents.client.runtime.exceptions.SandboxException; -import io.openkruise.agents.client.runtime.utils.ConnectStreamReader; +import io.openkruise.agents.client.runtime.utils.MessageStream; +import okhttp3.Response; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; @@ -17,7 +18,8 @@ */ public class CommandHandle implements AutoCloseable { private final long pid; - private final ConnectStreamReader streamReader; + private final MessageStream streamReader; + private final Response streamingResponse; private final Runnable killAction; private final StringBuilder stdout = new StringBuilder(); private final StringBuilder stderr = new StringBuilder(); @@ -29,13 +31,15 @@ public class CommandHandle implements AutoCloseable { private final Consumer onStderr; /** - * @param pid Process PID - * @param streamReader Connect Protocol streaming reader - * @param killAction Callback to terminate the command (calls Commands.kill) - * @param onStdout stdout callback - * @param onStderr stderr callback + * @param pid Process PID + * @param streamReader Message stream reader (ConnectStreamReader or adapter) + * @param streamingResponse OkHttp Response to close when handle is closed + * @param killAction Callback to terminate the command (calls Commands.kill) + * @param onStdout stdout callback + * @param onStderr stderr callback */ - public CommandHandle(long pid, ConnectStreamReader streamReader, + public CommandHandle(long pid, MessageStream streamReader, + Response streamingResponse, Runnable killAction, Consumer onStdout, Consumer onStderr) { if (pid <= 0) { @@ -43,6 +47,7 @@ public CommandHandle(long pid, ConnectStreamReader streamReader, } this.pid = pid; this.streamReader = streamReader; + this.streamingResponse = streamingResponse; this.killAction = killAction; this.onStdout = onStdout; this.onStderr = onStderr; @@ -146,7 +151,14 @@ public boolean kill() { public void close() { if (closed.compareAndSet(false, true)) { if (streamReader != null) { - streamReader.close(); + try { + streamReader.close(); + } catch (Exception e) { + // Resource cleanup, ignore close exceptions + } + } + if (streamingResponse != null) { + streamingResponse.close(); } } } diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/commands/Commands.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/commands/Commands.java index 4ef9037..405f2ff 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/commands/Commands.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/commands/Commands.java @@ -6,6 +6,7 @@ import io.openkruise.agents.client.runtime.envd.process.*; import io.openkruise.agents.client.runtime.exceptions.SandboxException; import io.openkruise.agents.client.runtime.utils.ConnectStreamReader; +import io.openkruise.agents.client.runtime.utils.MessageStream; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; @@ -46,19 +47,15 @@ public Commands(String sandboxID, RuntimeConfig config, OkHttpClient httpClient, } public List list() { - try { - ListRequest params = ListRequest.newBuilder().build(); - - Request request = config.buildHttpRequest(EnvdMethods.PROCESS_SERVICE, EnvdMethods.PROCESS_LIST, params, sandboxID); + ListRequest params = ListRequest.newBuilder().build(); + Request request = config.buildHttpRequest(EnvdMethods.PROCESS_SERVICE, EnvdMethods.PROCESS_LIST, params, sandboxID); - // noinspection WithSSRFCheckingInspection - Response response = httpClient.newCall(request).execute(); + try (Response response = httpClient.newCall(request).execute()) { if (!response.isSuccessful()) { throw new IOException("List HTTP request failed: " + response.code() + " " + response.message()); } Reader reader = response.body().charStream(); - // Parse the JSON response back to protobuf ListResponse.Builder builder = ListResponse.newBuilder(); PROTO_PARSER.merge(reader, builder); ListResponse listResponse = builder.build(); @@ -137,12 +134,14 @@ public CommandHandle runBackground(String cmd, RunOptions options) { try { // noinspection WithSSRFCheckingInspection response = streamingClient.newCall(httpRequest).execute(); - if (!response.isSuccessful()) { - throw new IOException("Start HTTP request failed: " + response.code() + " " + response.message()); - } } catch (IOException e) { throw new SandboxException("Failed to start process", e); } + if (!response.isSuccessful()) { + String msg = "Start HTTP request failed: " + response.code() + " " + response.message(); + response.close(); + throw new SandboxException(msg); + } // Parse Connect Protocol frames from response stream InputStream responseStream = response.body().byteStream(); @@ -152,6 +151,7 @@ public CommandHandle runBackground(String cmd, RunOptions options) { if (!streamReader.hasNext()) { String trailerError = streamReader.getTrailerError(); streamReader.close(); + response.close(); if (trailerError != null) { throw new SandboxException("Failed to start process: " + trailerError); } @@ -161,16 +161,18 @@ public CommandHandle runBackground(String cmd, RunOptions options) { StartResponse firstEvent = streamReader.next(); if (!firstEvent.hasEvent() || !firstEvent.getEvent().hasStart()) { streamReader.close(); + response.close(); throw new SandboxException("Failed to start process: invalid response from server"); } long pid = firstEvent.getEvent().getStart().getPid(); if (pid <= 0) { streamReader.close(); + response.close(); throw new SandboxException("Failed to start process: invalid PID received"); } - return new CommandHandle(pid, streamReader, () -> kill((int) pid), + return new CommandHandle(pid, streamReader, response, () -> kill((int) pid), options.getOnStdout(), options.getOnStderr()); } @@ -190,10 +192,10 @@ public void sendInput(int pid, String data) { try { Request request = config.buildHttpRequest(EnvdMethods.PROCESS_SERVICE, EnvdMethods.PROCESS_SEND_INPUT, params, sandboxID); - // noinspection WithSSRFCheckingInspection - Response response = httpClient.newCall(request).execute(); - if (!response.isSuccessful()) { - throw new IOException("SendInput HTTP request failed: " + response.code() + " " + response.message()); + try (Response response = httpClient.newCall(request).execute()) { + if (!response.isSuccessful()) { + throw new IOException("SendInput HTTP request failed: " + response.code() + " " + response.message()); + } } } catch (Exception e) { throw new RuntimeException("Failed to send input", e); @@ -215,15 +217,15 @@ public boolean sendSignal(int pid, Signal signal) { try { Request request = config.buildHttpRequest(EnvdMethods.PROCESS_SERVICE, EnvdMethods.PROCESS_SEND_SIGNAL, params, sandboxID); - // noinspection WithSSRFCheckingInspection - Response response = httpClient.newCall(request).execute(); - if (response.code() == HttpURLConnection.HTTP_NOT_FOUND) { - return false; + try (Response response = httpClient.newCall(request).execute()) { + if (response.code() == HttpURLConnection.HTTP_NOT_FOUND) { + return false; + } + if (!response.isSuccessful()) { + throw new IOException("SendSignal HTTP request failed: " + response.code() + " " + response.message()); + } + return response.isSuccessful(); } - if (!response.isSuccessful()) { - throw new IOException("SendInput HTTP request failed: " + response.code() + " " + response.message()); - } - return response.isSuccessful(); } catch (Exception e) { throw new RuntimeException("Failed to send kill", e); } @@ -238,10 +240,10 @@ public void closeStdin(int pid) { try { Request request = config.buildHttpRequest(EnvdMethods.PROCESS_SERVICE, EnvdMethods.PROCESS_CLOSE_STDIN, params, sandboxID); - // noinspection WithSSRFCheckingInspection - Response response = httpClient.newCall(request).execute(); - if (!response.isSuccessful()) { - throw new IOException("CloseStdin HTTP request failed: " + response.code() + " " + response.message()); + try (Response response = httpClient.newCall(request).execute()) { + if (!response.isSuccessful()) { + throw new IOException("CloseStdin HTTP request failed: " + response.code() + " " + response.message()); + } } } catch (Exception e) { throw new RuntimeException("Failed to closeStdin", e); @@ -261,12 +263,14 @@ public CommandHandle connect(int pid) { try { // noinspection WithSSRFCheckingInspection response = streamingClient.newCall(httpRequest).execute(); - if (!response.isSuccessful()) { - throw new IOException("Connect HTTP request failed: " + response.code() + " " + response.message()); - } } catch (IOException e) { throw new SandboxException("Failed to connect to process", e); } + if (!response.isSuccessful()) { + String msg = "Connect HTTP request failed: " + response.code() + " " + response.message(); + response.close(); + throw new SandboxException(msg); + } // Parse Connect Protocol frames from response stream // Connect method returns ConnectResponse, needs to be converted to StartResponse format @@ -276,33 +280,37 @@ public CommandHandle connect(int pid) { if (!connectReader.hasNext()) { connectReader.close(); + response.close(); throw new SandboxException("Failed to connect to process: no response from server"); } ConnectResponse firstResponse = connectReader.next(); if (!firstResponse.hasEvent()) { connectReader.close(); + response.close(); throw new SandboxException("Failed to connect to process: invalid response from server"); } ProcessEvent event = firstResponse.getEvent(); if (!event.hasStart()) { connectReader.close(); + response.close(); throw new SandboxException("Failed to connect to process: expected start event"); } long connectedPid = event.getStart().getPid(); if (connectedPid != pid) { connectReader.close(); + response.close(); throw new SandboxException( "Failed to connect to process: PID mismatch, expected " + pid + " but got " + connectedPid); } // Adapt ConnectResponse stream to StartResponse stream - ConnectStreamReader adaptedReader = - new ConnectResponseAdapter(connectReader); + MessageStream adaptedReader = + new ConnectResponseAdapter(connectReader, response); - return new CommandHandle(pid, adaptedReader, () -> kill(pid), null, null); + return new CommandHandle(pid, adaptedReader, response, () -> kill(pid), null, null); } private void validatePid(int pid) { @@ -314,12 +322,13 @@ private void validatePid(int pid) { /** * Adapter that adapts ConnectResponse stream to StartResponse stream. */ - private static class ConnectResponseAdapter extends ConnectStreamReader { + private static class ConnectResponseAdapter implements MessageStream { private final ConnectStreamReader delegate; + private final Response response; - ConnectResponseAdapter(ConnectStreamReader delegate) { - super(new java.io.ByteArrayInputStream(new byte[0]), StartResponse.parser()); + ConnectResponseAdapter(ConnectStreamReader delegate, Response response) { this.delegate = delegate; + this.response = response; } @Override @@ -329,18 +338,21 @@ public boolean hasNext() { @Override public StartResponse next() { - ConnectResponse response = delegate.next(); - if (!response.hasEvent()) { + ConnectResponse connResponse = delegate.next(); + if (!connResponse.hasEvent()) { return StartResponse.getDefaultInstance(); } return StartResponse.newBuilder() - .setEvent(response.getEvent()) + .setEvent(connResponse.getEvent()) .build(); } @Override public void close() { delegate.close(); + if (response != null) { + response.close(); + } } } diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/exceptions/K8sOperationException.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/exceptions/K8sOperationException.java new file mode 100644 index 0000000..e6e683c --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/exceptions/K8sOperationException.java @@ -0,0 +1,15 @@ +package io.openkruise.agents.client.runtime.exceptions; + +/** + * Exception thrown when Kubernetes API operations fail (e.g., Sandbox CR not found, API call errors). + */ +public class K8sOperationException extends RuntimeException { + + public K8sOperationException(String message) { + super(message); + } + + public K8sOperationException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/filesystem/Filesystem.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/filesystem/Filesystem.java index db55fda..2c1a2d1 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/filesystem/Filesystem.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/filesystem/Filesystem.java @@ -20,6 +20,8 @@ import java.util.Map; import java.util.Objects; import java.util.function.Consumer; +import java.util.logging.Level; +import java.util.logging.Logger; /** * Filesystem provides filesystem operation functionality within the sandbox. @@ -27,6 +29,7 @@ * All implemented based on OkHttp + Connect Protocol, without depending on gRPC. */ public class Filesystem { + private static final Logger LOG = Logger.getLogger(Filesystem.class.getName()); private static final JsonFormat.Parser PROTO_PARSER = JsonFormat.parser().ignoringUnknownFields(); private final String sandboxID; private final RuntimeConfig config; @@ -68,19 +71,15 @@ public List listDir(String path, int depth) { throw new IllegalArgumentException("Depth must be at least 1"); } - try { - ListDirRequest params = ListDirRequest.newBuilder().setPath(path).setDepth(depth).build(); - - Request request = config.buildHttpRequest(EnvdMethods.FILESYSTEM_SERVICE, EnvdMethods.FS_LIST_DIR, params, sandboxID); + ListDirRequest params = ListDirRequest.newBuilder().setPath(path).setDepth(depth).build(); + Request request = config.buildHttpRequest(EnvdMethods.FILESYSTEM_SERVICE, EnvdMethods.FS_LIST_DIR, params, sandboxID); - // noinspection WithSSRFCheckingInspection - Response response = httpClient.newCall(request).execute(); + try (Response response = httpClient.newCall(request).execute()) { if (!response.isSuccessful()) { throw new IOException("ListDir HTTP request failed: " + response.code() + " " + response.message()); } Reader reader = response.body().charStream(); - // Parse the JSON response back to protobuf ListDirResponse.Builder builder = ListDirResponse.newBuilder(); PROTO_PARSER.merge(reader, builder); ListDirResponse listDirResponse = builder.build(); @@ -103,15 +102,13 @@ public List listDir(String path, int depth) { * @return true if the directory was created, false if it already exists */ public boolean makeDir(String path) { - try { - MakeDirRequest params = MakeDirRequest.newBuilder() - .setPath(path) - .build(); + MakeDirRequest params = MakeDirRequest.newBuilder() + .setPath(path) + .build(); - Request request = config.buildHttpRequest(EnvdMethods.FILESYSTEM_SERVICE, EnvdMethods.FS_MAKE_DIR, params, sandboxID); + Request request = config.buildHttpRequest(EnvdMethods.FILESYSTEM_SERVICE, EnvdMethods.FS_MAKE_DIR, params, sandboxID); - // noinspection WithSSRFCheckingInspection - Response response = httpClient.newCall(request).execute(); + try (Response response = httpClient.newCall(request).execute()) { if (!response.isSuccessful()) { throw new IOException("MakeDir HTTP request failed: " + response.code() + " " + response.message()); } @@ -129,20 +126,17 @@ public boolean makeDir(String path) { * @return information about renamed file or directory */ public boolean move(String oldPath, String newPath) { - try { - MoveRequest params = MoveRequest.newBuilder() - .setSource(oldPath) - .setDestination(newPath) - .build(); + MoveRequest params = MoveRequest.newBuilder() + .setSource(oldPath) + .setDestination(newPath) + .build(); - Request request = config.buildHttpRequest(EnvdMethods.FILESYSTEM_SERVICE, EnvdMethods.FS_MOVE, params, sandboxID); + Request request = config.buildHttpRequest(EnvdMethods.FILESYSTEM_SERVICE, EnvdMethods.FS_MOVE, params, sandboxID); - // noinspection WithSSRFCheckingInspection - Response response = httpClient.newCall(request).execute(); + try (Response response = httpClient.newCall(request).execute()) { if (!response.isSuccessful()) { throw new IOException("Move HTTP request failed: " + response.code() + " " + response.message()); } - return response.isSuccessful(); } catch (Exception e) { throw new RuntimeException("Failed to move", e); @@ -155,15 +149,13 @@ public boolean move(String oldPath, String newPath) { * @param path path to a file or directory */ public boolean remove(String path) { - try { - RemoveRequest params = RemoveRequest.newBuilder() - .setPath(path) - .build(); + RemoveRequest params = RemoveRequest.newBuilder() + .setPath(path) + .build(); - Request request = config.buildHttpRequest(EnvdMethods.FILESYSTEM_SERVICE, EnvdMethods.FS_REMOVE, params, sandboxID); + Request request = config.buildHttpRequest(EnvdMethods.FILESYSTEM_SERVICE, EnvdMethods.FS_REMOVE, params, sandboxID); - // noinspection WithSSRFCheckingInspection - Response response = httpClient.newCall(request).execute(); + try (Response response = httpClient.newCall(request).execute()) { if (!response.isSuccessful()) { throw new IOException("Remove HTTP request failed: " + response.code() + " " + response.message()); } @@ -180,15 +172,13 @@ public boolean remove(String path) { * @return true if the file or directory exists, false otherwise */ public boolean exists(String path) { - try { - StatRequest params = StatRequest.newBuilder() - .setPath(path) - .build(); + StatRequest params = StatRequest.newBuilder() + .setPath(path) + .build(); - Request request = config.buildHttpRequest(EnvdMethods.FILESYSTEM_SERVICE, EnvdMethods.FS_STAT, params, sandboxID); + Request request = config.buildHttpRequest(EnvdMethods.FILESYSTEM_SERVICE, EnvdMethods.FS_STAT, params, sandboxID); - // noinspection WithSSRFCheckingInspection - Response response = httpClient.newCall(request).execute(); + try (Response response = httpClient.newCall(request).execute()) { if (response.code() == HttpURLConnection.HTTP_NOT_FOUND) { return false; } @@ -197,7 +187,7 @@ public boolean exists(String path) { } return response.isSuccessful(); } catch (Exception e) { - throw new RuntimeException("Failed to exists", e); + throw new RuntimeException("Failed to check if file exists: " + path, e); } } @@ -208,28 +198,25 @@ public boolean exists(String path) { * @return information about the file or directory */ public EntryInfo getInfo(String path) { - try { - StatRequest params = StatRequest.newBuilder() - .setPath(path) - .build(); + StatRequest params = StatRequest.newBuilder() + .setPath(path) + .build(); - Request request = config.buildHttpRequest(EnvdMethods.FILESYSTEM_SERVICE, EnvdMethods.FS_STAT, params, sandboxID); + Request request = config.buildHttpRequest(EnvdMethods.FILESYSTEM_SERVICE, EnvdMethods.FS_STAT, params, sandboxID); - // noinspection WithSSRFCheckingInspection - Response response = httpClient.newCall(request).execute(); + try (Response response = httpClient.newCall(request).execute()) { if (!response.isSuccessful()) { throw new IOException("Stat HTTP request failed: " + response.code() + " " + response.message()); } Reader reader = response.body().charStream(); - // Parse the JSON response back to protobuf StatResponse.Builder builder = StatResponse.newBuilder(); PROTO_PARSER.merge(reader, builder); StatResponse statResponse = builder.build(); return toEntryInfo(statResponse.getEntry()); } catch (Exception e) { - throw new RuntimeException("Failed to Remove", e); + throw new RuntimeException("Failed to get file info: " + path, e); } } @@ -268,8 +255,7 @@ public byte[] read(String path, String user) { .build(); request = addSandboxHeaders(request); - try { - Response response = httpClient.newCall(request).execute(); + try (Response response = httpClient.newCall(request).execute()) { if (response.code() == HttpURLConnection.HTTP_NOT_FOUND) { throw new RuntimeException("File not found: " + path); } @@ -352,8 +338,7 @@ public WriteInfo write(String path, byte[] data, String user) { .build(); request = addSandboxHeaders(request); - try { - Response response = httpClient.newCall(request).execute(); + try (Response response = httpClient.newCall(request).execute()) { if (response.code() != HttpURLConnection.HTTP_OK && response.code() != HttpURLConnection.HTTP_CREATED) { String body = response.body() != null ? response.body().string() : ""; @@ -371,8 +356,8 @@ public WriteInfo write(String path, byte[] data, String user) { obj.has("path") ? obj.get("path").getAsString() : path, obj.has("type") ? obj.get("type").getAsString() : "file"); } - } catch (Exception ignored) { - // Return basic info if parsing fails + } catch (Exception e) { + LOG.log(Level.FINE, "Failed to parse write response for " + path + ", falling back to basic info", e); } } return new WriteInfo(path, "file"); @@ -434,12 +419,14 @@ public WatchHandle watchDir(String path, boolean recursive, Consumer streamReader = @@ -463,7 +450,7 @@ public WatchHandle watchDir(String path, boolean recursive, Consumer protobuf message type */ -public class ConnectStreamReader implements Iterator, Closeable { +public class ConnectStreamReader implements Iterator, MessageStream { private static final int FLAG_TRAILER = 0x02; private static final int HEADER_SIZE = 5; private static final int MAX_FRAME_SIZE = 32 * 1024 * 1024; diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/utils/MessageStream.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/utils/MessageStream.java new file mode 100644 index 0000000..c4bf8a6 --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/utils/MessageStream.java @@ -0,0 +1,26 @@ +package io.openkruise.agents.client.runtime.utils; + +import java.io.Closeable; + +/** + * A stream of typed messages with iterator-style access and lifecycle management. + *

+ * Both {@link ConnectStreamReader} and the ConnectResponse adapter implement this interface, + * allowing {@link CommandHandle} to work with either stream type uniformly. + * + * @param message type + */ +public interface MessageStream extends Closeable { + + /** + * Returns true if there are more messages available in the stream. + */ + boolean hasNext(); + + /** + * Returns the next message from the stream. + * + * @throws java.util.NoSuchElementException if no more messages are available + */ + T next(); +} \ No newline at end of file From 6511b43fc962915d11d02ffb28b9aa641c036de8 Mon Sep 17 00:00:00 2001 From: zhaoqing Date: Fri, 12 Jun 2026 18:35:58 +0800 Subject: [PATCH 3/5] update readme --- .../io/openkruise/agents/client/e2b/README.md | 365 ++++++++++++++++++ .../agents/client/e2b/README_zh-CH.md | 316 +++++++++------ .../openkruise/agents/client/e2b/Sandbox.java | 21 +- .../agents/client/e2b/SandboxApi.java | 4 +- .../agents/client/runtime/README.md | 322 +++++++++++++++ .../agents/client/runtime/README_zh-CH.md | 316 ++++++++++----- 6 files changed, 1109 insertions(+), 235 deletions(-) create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/e2b/README.md create mode 100644 k8s/java/src/main/java/io/openkruise/agents/client/runtime/README.md diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/README.md b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/README.md new file mode 100644 index 0000000..99b5b16 --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/README.md @@ -0,0 +1,365 @@ +# E2B Java SDK (Management Client) + +> **Dependency**: This package is not published to a public Maven repository. Download the project and build the JAR +> manually. + +--- + +## Quick Start + +```java +import io.openkruise.agents.client.e2b.*; + +ConnectionConfig config = new ConnectionConfig.Builder() + .apiKey("your-api-key") + .domain("your.domain.com") + .build(); + +SandboxApi api = new SandboxApi(config); + +// Create → Use → Close connection + Explicitly kill sandbox +Sandbox sandbox = api.create("code-interpreter"); +try (sandbox) { + sandbox.commands.run("echo hello"); + sandbox.files.writeText("/tmp/demo.txt", "Hello!"); +} finally { + api.kill(sandbox.getSandboxID()); // Explicitly kill sandbox +} +``` + +Full +examples: [Lifecycle Management](../examples/e2b/SandboxApiManagerExample.java) | [Commands](../examples/e2b/SandboxCommandsExample.java) | [Files](../examples/e2b/SandboxFilesExample.java) + +--- + +## 1. Sandbox Lifecycle Management (SandboxApi) + +`SandboxApi` provides full lifecycle management for Sandboxes: create, connect, query, pause, resume, and kill. + +### Initialization + +```java +ConnectionConfig config = new ConnectionConfig.Builder() + .apiKey("your-api-key") + .domain("your.domain.com") + .build(); + +SandboxApi api = new SandboxApi(config); +``` + +### API Methods + +| Method | Description | +|------------------------------------------------------------------------------------|-------------------------------------------------------| +| `create(String template)` | Create sandbox from template | +| `create(NewSandbox body)` | Create sandbox (full parameters) | +| `connect(String sandboxID)` | Connect to an existing sandbox | +| `connect(String sandboxID, int timeout)` | Connect to an existing sandbox (with timeout) | +| `list()` | List all running sandboxes | +| `list(String metadata)` | List sandboxes filtered by metadata | +| `list(String metadata, List state, String nextToken, Integer limit)` | Paginated list with state filter | +| `getInfo(String sandboxID)` | Get details; 404 → `SandboxNotFoundException` | +| `kill(String sandboxID)` | Kill sandbox; `true` on success, `false` if not found | +| `pause(String sandboxID)` | Pause sandbox; 409 treated as already paused | +| `setTimeout(String sandboxID, int timeout)` | Update timeout (seconds) | + +### Lifecycle Example + +```java +// ---- Create ---- +Sandbox sandbox = api.create("code-interpreter"); +String id = sandbox.getSandboxID(); + +// Full-parameter creation +Sandbox sandbox2 = api.create(new NewSandbox() + .templateID("code-interpreter") + .timeout(600) + .envVars(Map.of("FOO", "1"))); + +// ---- Query ---- +SandboxInfo info = api.getInfo(id); +List all = api.list(); + +// ---- Connect to existing sandbox ---- +Sandbox reconnected = api.connect(id); + +// ---- Pause / Set timeout ---- +api.pause(id); +api.setTimeout(id, 600); + +// ---- Kill ---- +api.kill(id); +``` + +### Sandbox Instance + +`SandboxApi.create()` / `connect()` returns a `Sandbox` instance, which is the entry point for data-plane operations: + +| Method / Field | Description | +|----------------------|------------------------------------------------| +| `sandboxID` | Sandbox ID | +| `commands` | Command execution module (`Commands`) | +| `files` | Filesystem module (`Filesystem`) | +| `getSandboxURL()` | Sandbox envd URL | +| `getConfig()` | Connection config | +| `getRuntimeClient()` | Underlying `RuntimeClient` | +| `close()` | Close connection (supports try-with-resources) | + +--- + +## 2. Command Execution (Commands) + +Operate on processes inside the container via `sandbox.commands`. Built on OkHttp + Connect Protocol; commands are +executed through `/bin/bash -l -c `. + +### Methods + +| Method | Description | +|-------------------------------------------------|----------------------------------------------------------------------| +| `run(String cmd)` | **Foreground**: start command and wait, returns `CommandResult` | +| `run(String cmd, RunOptions options)` | Foreground with options | +| `runBackground(String cmd, RunOptions options)` | **Background**: returns `CommandHandle`, caller decides when to wait | +| `list()` | List all running processes, returns `List` | +| `kill(int pid)` | Send SIGKILL to the given PID | +| `sendInput(int pid, String data)` | Write data to stdin of the given process | +| `sendSignal(int pid, Signal signal)` | Send a signal to the given process | +| `closeStdin(int pid)` | Close stdin of the given process | +| `connect(int pid)` | Reconnect to a running process, subscribe to its subsequent output | + +### RunOptions + +```java +RunOptions opts = new RunOptions() + .envs(Map.of("LANG", "C")) // Environment variables + .cwd("/tmp") // Working directory + .onStdout(line -> System.out.print(line)) // Streaming stdout callback + .onStderr(line -> System.err.print(line));// Streaming stderr callback +``` + +### CommandResult + +| Field | Type | Description | +|------------|----------|-----------------| +| `stdout` | `String` | Standard output | +| `stderr` | `String` | Standard error | +| `exitCode` | `int` | Exit code | + +### CommandHandle + +Returned by `runBackground()` / `connect()`, implements `AutoCloseable`: + +| Method | Description | +|-----------------------|-------------------------------------------------| +| `getPid()` | Returns process PID | +| `isCompleted()` | Whether the process has completed | +| `waitForCompletion()` | Block until completion, returns `CommandResult` | +| `kill()` | Kill the process | +| `close()` | Close stream and underlying resources | + +### Examples + +```java +// Foreground execution +CommandResult res = sandbox.commands.run("pwd"); +System.out.println(res.getStdout()); + +// With options + streaming output +CommandResult res2 = sandbox.commands.run("ls -la /tmp", + new RunOptions().cwd("/tmp").onStdout(System.out::print)); + +// Background + manual kill +CommandHandle handle = sandbox.commands.runBackground("sleep 60", new RunOptions()); +System.out.println("pid = " + handle.getPid()); +handle.kill(); +handle.close(); + +// List processes +List procs = sandbox.commands.list(); +for (ProcessInfo p : procs) { + System.out.printf("PID: %d, Cmd: %s%n", p.getPid(), p.getCmd()); +} +``` + +--- + +## 3. Filesystem (Filesystem) + +Operate on files inside the container via `sandbox.files`. Metadata operations use the envd Filesystem service; file +read/write uses the HTTP `/files` endpoint. + +### Methods + +**Directory Operations** + +| Method | Description | +|----------------------------------------|-------------------------------------------------| +| `listDir(String path)` | List directory entries (depth=1) | +| `listDir(String path, int depth)` | List directory entries (specified depth) | +| `makeDir(String path)` | Create directory recursively; `false` if exists | +| `move(String oldPath, String newPath)` | Rename/move a file or directory | + +**File Information** + +| Method | Description | +|------------------------|----------------------------------------------| +| `exists(String path)` | Check if path exists | +| `getInfo(String path)` | Get file/directory info, returns `EntryInfo` | + +**File Read / Write** + +| Method | Description | +|-------------------------------------------------------|-----------------------------------------------------| +| `read(String path)` | Read file content (`byte[]`) | +| `read(String path, String user)` | Read file content (as specified user) | +| `readText(String path)` | Read file content (`String`, UTF-8) | +| `readText(String path, String user)` | Read file content (as specified user, UTF-8) | +| `write(String path, byte[] data)` | Write file (binary), returns `WriteInfo` | +| `write(String path, byte[] data, String user)` | Write file (as specified user), returns `WriteInfo` | +| `writeText(String path, String content)` | Write file (text, UTF-8), returns `WriteInfo` | +| `writeText(String path, String content, String user)` | Write file (as specified user), returns `WriteInfo` | + +**Delete** + +| Method | Description | +|-----------------------|----------------------------| +| `remove(String path)` | Delete a file or directory | + +**Directory Watch** + +| Method | Description | +|-------------------------------------------------------------------------------|-------------------------------------| +| `watchDir(String path, Consumer onEvent)` | Watch directory change events | +| `watchDir(String path, boolean recursive, Consumer onEvent)` | Watch directory changes (recursive) | + +### WatchHandle + +| Method | Description | +|---------------|---------------------------------------------------| +| `stop()` | Stop watching and close underlying HTTP resources | +| `isStopped()` | Whether the watch has been stopped | + +### Examples + +```java +// Directory operations +sandbox.files.makeDir("/tmp/work"); +List entries = sandbox.files.listDir("/tmp"); +sandbox.files.move("/tmp/old.txt", "/tmp/new.txt"); +sandbox.files.remove("/tmp/work"); + +// File read/write +sandbox.files.writeText("/tmp/hello.txt", "Hello, World!"); +String content = sandbox.files.readText("/tmp/hello.txt"); + +// Binary read/write +WriteInfo info = sandbox.files.write("/tmp/data.bin", new byte[]{0x01, 0x02}); +byte[] data = sandbox.files.read("/tmp/data.bin"); + +// Directory watch +WatchHandle wh = sandbox.files.watchDir("/tmp", true, event -> + System.out.printf("Event: %s %s%n", event.getType(), event.getName())); +wh.stop(); +``` + +--- + +## 4. SandboxInfo (Immutable) + +`SandboxInfo` is the return type of `list()` / `getInfo()`, an **immutable object** (all fields `final`, no setters, +`metadata` and `volumeMounts` are unmodifiable collections). + +| Field | Type | Description | +|-----------------------|----------------------------|---------------------------------------| +| `sandboxID` | `String` | Sandbox ID | +| `templateID` | `String` | Template ID | +| `alias` | `String` | Alias | +| `clientID` | `String` | Client ID | +| `startedAt` | `OffsetDateTime` | Start time | +| `endAt` | `OffsetDateTime` | End time | +| `cpuCount` | `Integer` | CPU count | +| `memoryMB` | `Integer` | Memory (MB) | +| `diskSizeMB` | `Integer` | Disk (MB) | +| `envdVersion` | `String` | envd version | +| `metadata` | `Map` | Metadata (unmodifiable) | +| `state` | `String` | State | +| `volumeMounts` | `List` | Volume mounts (unmodifiable) | +| `envdAccessToken` | `String` | envd access token (detail only) | +| `domain` | `String` | Domain (detail only) | +| `allowInternetAccess` | `Boolean` | Internet access allowed (detail only) | +| `network` | `SandboxNetworkConfig` | Network config (detail only) | +| `lifecycle` | `SandboxLifecycle` | Lifecycle (detail only) | + +> `list()` returns `SandboxInfo` with only basic fields; detail-exclusive fields are `null`. + +--- + +## 5. Connection Configuration (ConnectionConfig) + +### Scheme & Protocol + +Connection behavior is determined by two orthogonal dimensions: **Scheme** and **Protocol**, which shape the URL format. + +#### Protocol (Routing Protocol) + +| Value | API URL | Sandbox URL | +|----------------------|----------------------------------|-------------------------------------------------| +| **Native (default)** | `https://api.` | `https://-.` | +| **Private** | `:///kruise/api` | `:///kruise//` | + +- **Native**: Subdomain-based routing, for native public deployments +- **Private**: Path-prefix-based routing through a unified gateway, for private deployments or port-forwarding scenarios + +### Builder Methods + +| Method | Description | +|---------------------------------|----------------------------------------------------------------| +| `.apiKey(String)` | API Key, written to `X-API-Key` header | +| `.accessToken(String)` | Access Token, written to `X-Access-Token` header | +| `.domain(String)` | Domain, default `your.domain.com` | +| `.scheme(String)` | URL scheme, default `https` | +| `.protocol(Protocol)` | Routing protocol, default `Protocol.NATIVE` | +| `.apiURL(String)` | **Highest priority**: directly overrides API base URL | +| `.sandboxBaseURL(String)` | **Highest priority**: directly overrides sandbox envd base URL | +| `.requestTimeoutMs(long)` | HTTP request timeout (ms), default 60000 | +| `.port(int)` | envd port, default 49983 | +| `.debug(boolean)` | Debug mode; kill/setTimeout skip actual calls | +| `.headers(Map)` | Custom request headers | +| `.addHeader(String, String)` | Add a single custom header | + +### Priority + +`apiURL` / `sandboxBaseURL` (explicit override) > `protocol` + `domain` assembly > Environment variables (`X_API_KEY`, +`SCHEME`, `PROTOCOL`) > Defaults + +### Environment Variables + +| Variable | Description | +|-------------|-------------------------------------------------| +| `X_API_KEY` | Default API Key | +| `SCHEME` | Default URL scheme | +| `PROTOCOL` | Default routing protocol (`NATIVE` / `PRIVATE`) | + +--- + +## 6. K8s Direct Connect Mode + +Connect directly to a sandbox in a K8s cluster, bypassing the E2B control plane: + +```java +import io.openkruise.agents.client.runtime.*; + +RuntimeConfig config = new RuntimeConfig.Builder() + .runtimeUrl("http://localhost:49983") + .runtimeToken("your-token") + .build(); + +RuntimeClient client = RuntimeClient.create("sandbox-id", config); + +// Commands and file operations +CommandResult res = client.commands.run("echo hello"); +client.files.writeText("/tmp/test.txt", "Hello!"); + +client.close(); // Close connection + release thread pool +``` + +See Runtime layer docs: [README](../runtime/README.md) | [Chinese Docs](../runtime/README_zh-CH.md) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/README_zh-CH.md b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/README_zh-CH.md index 2e98513..41014b6 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/README_zh-CH.md +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/README_zh-CH.md @@ -1,7 +1,6 @@ -# E2B Java SDK(e2b 管理客户端) +# E2B Java SDK(管理客户端) -## 依赖导入 -Maven 仓库:该包未发布到官方 Maven 仓库,你需要手动下载项目并打包成 JAR 文件使用。 +> **依赖导入**:该包未发布到官方 Maven 仓库,需手动下载项目并打包成 JAR 文件使用。 --- @@ -17,20 +16,23 @@ ConnectionConfig config = new ConnectionConfig.Builder() SandboxApi api = new SandboxApi(config); -// 创建 → 使用 → 自动销毁 -try (Sandbox sandbox = api.create("code-interpreter")) { - sandbox.Commands.run("echo hello"); - sandbox.Files.writeText("/tmp/demo.txt", "Hello!"); +// 创建 → 使用 → 关闭连接 + 显式终止 sandbox +Sandbox sandbox = api.create("code-interpreter"); +try (sandbox) { + sandbox.commands.run("echo hello"); + sandbox.files.writeText("/tmp/demo.txt", "Hello!"); +} finally { + api.kill(sandbox.getSandboxID()); // 显式终止 sandbox } ``` -完整演示:[生命周期管理完整示例](../examples/e2b/SandboxApiManagerExample.java) | [命令操作完整示例](../examples/e2b/SandboxCommandsExample.java) | [文件操作完整示例](../examples/e2b/SandboxFilesExample.java) +完整示例:[生命周期管理](../examples/e2b/SandboxApiManagerExample.java) | [命令操作](../examples/e2b/SandboxCommandsExample.java) | [文件操作](../examples/e2b/SandboxFilesExample.java) --- ## 一、Sandbox 生命周期管理(SandboxApi) -`SandboxApi` 提供 Sandbox 的完整生命周期管理能力,包括创建、连接、查询、暂停、恢复和终止。 +`SandboxApi` 提供 Sandbox 的完整生命周期管理:创建、连接、查询、暂停、恢复和终止。 ### 初始化 @@ -45,30 +47,28 @@ SandboxApi api = new SandboxApi(config); ### API 方法一览 -| 方法 | 说明 | -|------------------------------------------------------------------------------------|-------------------------------------------------| -| `create(String template)` | 从模板创建 sandbox | -| `create(NewSandbox body)` | 创建 sandbox(全部参数) | -| `connect(String sandboxID)` | 连接已有 sandbox | -| `connect(String sandboxID, int timeout)` | 连接已有 sandbox(指定超时) | -| `list()` | 列出所有运行中的 sandbox | -| `list(String metadata)` | 按 metadata 过滤列出 | -| `list(String metadata, List state, String nextToken, Integer limit)` | 列出 sandbox(支持分页和状态过滤) | -| `getInfo(String sandboxID)` | 获取 sandbox 详情,404 抛出 `SandboxNotFoundException` | -| `kill(String sandboxID)` | 终止 sandbox;返回 `true` 成功,`false` 未找到 | -| `pause(String sandboxID)` | 暂停 sandbox | -| `setTimeout(String sandboxID, int timeout)` | 修改超时时间(秒) | +| 方法 | 说明 | +|------------------------------------------------------------------------------------|---------------------------------------| +| `create(String template)` | 从模板创建 sandbox | +| `create(NewSandbox body)` | 创建 sandbox(全部参数) | +| `connect(String sandboxID)` | 连接已有 sandbox | +| `connect(String sandboxID, int timeout)` | 连接已有 sandbox(指定超时) | +| `list()` | 列出所有运行中的 sandbox | +| `list(String metadata)` | 按 metadata 过滤列出 | +| `list(String metadata, List state, String nextToken, Integer limit)` | 分页 + 状态过滤 | +| `getInfo(String sandboxID)` | 获取详情,404 → `SandboxNotFoundException` | +| `kill(String sandboxID)` | 终止 sandbox;`true` 成功,`false` 未找到 | +| `pause(String sandboxID)` | 暂停 sandbox,409 视为已暂停 | +| `setTimeout(String sandboxID, int timeout)` | 修改超时时间(秒) | ### 生命周期示例 ```java -SandboxApi api = new SandboxApi(config); - // ---- 创建 ---- Sandbox sandbox = api.create("code-interpreter"); String id = sandbox.getSandboxID(); -// 也可传入完整参数 +// 全参数创建 Sandbox sandbox2 = api.create(new NewSandbox() .templateID("code-interpreter") .timeout(600) @@ -93,45 +93,44 @@ api.kill(id); `SandboxApi.create()` / `connect()` 返回 `Sandbox` 实例,它是数据面操作的入口: -| 方法 | 说明 | -|----------------------|----------------------------------------| -| `getSandboxID()` | 返回 sandbox ID | -| `getSandboxURL()` | 返回 sandbox envd URL | -| `getConfig()` | 返回连接配置 | -| `getRuntimeClient()` | 返回底层 `RuntimeClient` | -| `close()` | 关闭连接并终止 sandbox(支持 try-with-resources) | - -`Sandbox` 暴露两个操作模块: - -- **`sandbox.Commands`** — 命令执行 -- **`sandbox.Files`** — 文件系统 +| 方法/字段 | 说明 | +|----------------------|-----------------------------| +| `sandboxID` | Sandbox ID | +| `commands` | 命令执行模块(`Commands`) | +| `files` | 文件系统模块(`Filesystem`) | +| `getSandboxURL()` | Sandbox envd URL | +| `getConfig()` | 连接配置 | +| `getRuntimeClient()` | 底层 `RuntimeClient` | +| `close()` | 关闭连接(支持 try-with-resources) | --- ## 二、命令执行(Commands) -通过 `sandbox.Commands` 操作容器内进程。底层走 envd 的 `Process` gRPC 服务,命令统一通过 `/bin/bash -l -c ` 执行。 +通过 `sandbox.commands` 操作容器内进程。底层基于 OkHttp + Connect Protocol,命令统一通过 `/bin/bash -l -c ` 执行。 -### 方法 +### 方法一览 -| 方法 | 说明 | -|-----------------------------------------|---------------------------------------| -| `run(String cmd)` | **前台执行**:启动命令并等待完成,返回 `CommandResult` | -| `run(String cmd, RunOptions options)` | 前台执行(带选项) | -| `start(String cmd, RunOptions options)` | **后台启动**:返回 `CommandHandle`,调用方决定何时等待 | -| `list()` | 列出所有运行中的进程,返回 `List` | -| `kill(int pid)` | 向指定 PID 发送 SIGKILL | -| `sendStdin(int pid, String data)` | 向指定进程的 stdin 写入数据 | -| `connectToProcess(int pid)` | 重新连接到已运行的进程,订阅其后续输出 | +| 方法 | 说明 | +|-------------------------------------------------|---------------------------------------| +| `run(String cmd)` | **前台执行**:启动命令并等待完成,返回 `CommandResult` | +| `run(String cmd, RunOptions options)` | 前台执行(带选项) | +| `runBackground(String cmd, RunOptions options)` | **后台启动**:返回 `CommandHandle`,调用方决定何时等待 | +| `list()` | 列出所有运行中的进程,返回 `List` | +| `kill(int pid)` | 向指定 PID 发送 SIGKILL | +| `sendInput(int pid, String data)` | 向指定进程的 stdin 写入数据 | +| `sendSignal(int pid, Signal signal)` | 向指定进程发送信号 | +| `closeStdin(int pid)` | 关闭指定进程的 stdin | +| `connect(int pid)` | 重新连接到已运行的进程,订阅其后续输出 | ### RunOptions ```java RunOptions opts = new RunOptions() - .envs(Map.of("LANG", "C")) // 环境变量 - .cwd("/tmp") // 工作目录 - .onStdout(line -> System.out.print(line)) // 流式 stdout 回调 - .onStderr(line -> System.err.print(line)); // 流式 stderr 回调 + .envs(Map.of("LANG", "C")) // 环境变量 + .cwd("/tmp") // 工作目录 + .onStdout(line -> System.out.print(line)) // 流式 stdout 回调 + .onStderr(line -> System.err.print(line));// 流式 stderr 回调 ``` ### CommandResult @@ -144,7 +143,7 @@ RunOptions opts = new RunOptions() ### CommandHandle -由 `start` / `connectToProcess` 返回: +由 `runBackground()` / `connect()` 返回,实现 `AutoCloseable`: | 方法 | 说明 | |-----------------------|---------------------------| @@ -152,27 +151,27 @@ RunOptions opts = new RunOptions() | `isCompleted()` | 是否已完成 | | `waitForCompletion()` | 阻塞等待结束,返回 `CommandResult` | | `kill()` | 终止进程 | -| `close()` | 关闭(实现 `AutoCloseable`) | +| `close()` | 关闭流和底层资源 | ### 示例 ```java // 前台执行 -CommandResult res = sandbox.Commands.run("pwd"); +CommandResult res = sandbox.commands.run("pwd"); System.out.println(res.getStdout()); // 带选项执行 + 流式输出 -CommandResult res2 = sandbox.Commands.run("ls -la /tmp", +CommandResult res2 = sandbox.commands.run("ls -la /tmp", new RunOptions().cwd("/tmp").onStdout(System.out::print)); // 后台启动 + 主动 Kill -CommandHandle handle = sandbox.Commands.start("sleep 60", new RunOptions()); +CommandHandle handle = sandbox.commands.runBackground("sleep 60", new RunOptions()); System.out.println("pid = " + handle.getPid()); handle.kill(); handle.close(); // 列出进程 -List procs = sandbox.Commands.list(); +List procs = sandbox.commands.list(); for (ProcessInfo p : procs) { System.out.printf("PID: %d, Cmd: %s%n", p.getPid(), p.getCmd()); } @@ -182,51 +181,115 @@ for (ProcessInfo p : procs) { ## 三、文件系统(Filesystem) -通过 `sandbox.Files` 操作容器内文件。元数据操作走 envd Filesystem gRPC,文件内容读写走 HTTP `/files` 端点。 - -### 方法 - -| 方法 | 说明 | -|-------------------------------------------------------------------------------|--------------------------| -| `listDir(String path)` | 列出目录条目(depth=1) | -| `listDir(String path, int depth)` | 列出目录条目(指定深度) | -| `exists(String path)` | 路径是否存在 | -| `getInfo(String path)` | 获取文件/目录信息,返回 `EntryInfo` | -| `makeDir(String path)` | 递归创建目录;已存在返回 `false` | -| `remove(String path)` | 删除文件或目录 | -| `read(String path)` | 读取文件内容(`byte[]`) | -| `read(String path, String user)` | 读取文件内容(指定用户) | -| `readText(String path)` | 读取文件内容(`String`,UTF-8) | -| `writeText(String path, String content)` | 写入文件(文本,UTF-8) | -| `write(String path, byte[] data)` | 写入文件(二进制),自动创建父目录 | -| `watchDir(String path, Consumer onEvent)` | 监听目录变更事件 | -| `watchDir(String path, boolean recursive, Consumer onEvent)` | 监听目录变更事件(支持递归) | +通过 `sandbox.files` 操作容器内文件。元数据操作走 envd Filesystem 服务,文件读写走 HTTP `/files` 端点。 + +### 方法一览 + +**目录操作** + +| 方法 | 说明 | +|----------------------------------------|----------------------| +| `listDir(String path)` | 列出目录条目(depth=1) | +| `listDir(String path, int depth)` | 列出目录条目(指定深度) | +| `makeDir(String path)` | 递归创建目录;已存在返回 `false` | +| `move(String oldPath, String newPath)` | 重命名/移动文件或目录 | + +**文件信息** + +| 方法 | 说明 | +|------------------------|--------------------------| +| `exists(String path)` | 路径是否存在 | +| `getInfo(String path)` | 获取文件/目录信息,返回 `EntryInfo` | + +**文件读写** + +| 方法 | 说明 | +|-------------------------------------------------------|-------------------------------| +| `read(String path)` | 读取文件内容(`byte[]`) | +| `read(String path, String user)` | 读取文件内容(指定用户) | +| `readText(String path)` | 读取文件内容(`String`,UTF-8) | +| `readText(String path, String user)` | 读取文件内容(指定用户,UTF-8) | +| `write(String path, byte[] data)` | 写入文件(二进制),返回 `WriteInfo` | +| `write(String path, byte[] data, String user)` | 写入文件(指定用户),返回 `WriteInfo` | +| `writeText(String path, String content)` | 写入文件(文本,UTF-8),返回 `WriteInfo` | +| `writeText(String path, String content, String user)` | 写入文件(指定用户),返回 `WriteInfo` | + +**删除** + +| 方法 | 说明 | +|-----------------------|---------| +| `remove(String path)` | 删除文件或目录 | + +**目录监听** + +| 方法 | 说明 | +|-------------------------------------------------------------------------------|--------------| +| `watchDir(String path, Consumer onEvent)` | 监听目录变更事件 | +| `watchDir(String path, boolean recursive, Consumer onEvent)` | 监听目录变更(支持递归) | + +### WatchHandle + +| 方法 | 说明 | +|---------------|-------------------| +| `stop()` | 停止监听并关闭底层 HTTP 资源 | +| `isStopped()` | 是否已停止 | ### 示例 ```java // 目录操作 -sandbox.Files.makeDir("/tmp/work"); -List entries = sandbox.Files.listDir("/tmp"); -sandbox.Files.remove("/tmp/work"); +sandbox.files.makeDir("/tmp/work"); +List entries = sandbox.files.listDir("/tmp"); +sandbox.files.move("/tmp/old.txt", "/tmp/new.txt"); +sandbox.files.remove("/tmp/work"); // 文件读写 -sandbox.Files.writeText("/tmp/hello.txt", "Hello, World!"); -String content = sandbox.Files.readText("/tmp/hello.txt"); +sandbox.files.writeText("/tmp/hello.txt", "Hello, World!"); +String content = sandbox.files.readText("/tmp/hello.txt"); // 二进制读写 -sandbox.Files.write("/tmp/data.bin", new byte[]{0x01, 0x02}); -byte[] data = sandbox.Files.read("/tmp/data.bin"); +WriteInfo info = sandbox.files.write("/tmp/data.bin", new byte[]{0x01, 0x02}); +byte[] data = sandbox.files.read("/tmp/data.bin"); // 目录监听 -WatchHandle wh = sandbox.Files.watchDir("/tmp", true, event -> - System.out.printf("Event: %s %s%n", event.getType(), event.getPath())); -wh.close(); +WatchHandle wh = sandbox.files.watchDir("/tmp", true, event -> + System.out.printf("Event: %s %s%n", event.getType(), event.getName())); +wh.stop(); ``` --- -## 四、连接配置(ConnectionConfig) +## 四、SandboxInfo(不可变) + +`SandboxInfo` 是 `list()` / `getInfo()` 的返回类型,**不可变对象**(所有字段 `final`,无 setters,`metadata` 和 +`volumeMounts` 为 unmodifiable 集合)。 + +| 字段 | 类型 | 说明 | +|-----------------------|----------------------------|---------------------| +| `sandboxID` | `String` | Sandbox ID | +| `templateID` | `String` | 模板 ID | +| `alias` | `String` | 别名 | +| `clientID` | `String` | 客户端 ID | +| `startedAt` | `OffsetDateTime` | 启动时间 | +| `endAt` | `OffsetDateTime` | 结束时间 | +| `cpuCount` | `Integer` | CPU 数量 | +| `memoryMB` | `Integer` | 内存(MB) | +| `diskSizeMB` | `Integer` | 磁盘(MB) | +| `envdVersion` | `String` | envd 版本 | +| `metadata` | `Map` | 元数据(unmodifiable) | +| `state` | `String` | 状态 | +| `volumeMounts` | `List` | 卷挂载(unmodifiable) | +| `envdAccessToken` | `String` | envd 访问令牌(仅 detail) | +| `domain` | `String` | 域名(仅 detail) | +| `allowInternetAccess` | `Boolean` | 是否允许互联网(仅 detail) | +| `network` | `SandboxNetworkConfig` | 网络配置(仅 detail) | +| `lifecycle` | `SandboxLifecycle` | 生命周期(仅 detail) | + +> `list()` 返回的 `SandboxInfo` 仅包含基础字段,detail 专属字段为 `null`。 + +--- + +## 五、连接配置(ConnectionConfig) ### Scheme 与 Protocol @@ -234,31 +297,64 @@ wh.close(); #### Protocol(路由协议) -| 值 | 枚举值 | API URL | Sandbox URL | -|----------------|--------------------|----------------------------------|-------------------------------------------------| -| **Native(默认)** | `Protocol.NATIVE` | `https://api.` | `https://-.` | -| **Private** | `Protocol.PRIVATE` | `:///kruise/api` | `:///kruise//` | +| 值 | API URL | Sandbox URL | +|----------------|----------------------------------|-------------------------------------------------| +| **Native(默认)** | `https://api.` | `https://-.` | +| **Private** | `:///kruise/api` | `:///kruise//` | - **Native**:基于子域名路由,对应原生公网部署 - **Private**:基于路径前缀通过统一网关路由,适用于私有化或端口转发场景 -#### Builder 方法 - -| 方法 | 说明 | -|----------------------------------------|--------------------------------------| -| `.apiKey(String)` | API Key,写入请求头 `X-API-Key` | -| `.accessToken(String)` | Access Token,写入请求头 `X-Access-Token` | -| `.domain(String)` | 域名,默认 `your.domain.com` | -| `.scheme(String)` | URL scheme,默认 `https` | -| `.protocol(Protocol)` | 路由协议,默认 `Protocol.NATIVE` | -| `.apiURL(String)` | **最高优先级**:直接覆盖 API base URL | -| `.sandboxBaseURL(String)` | **最高优先级**:直接覆盖 sandbox envd base URL | -| `.requestTimeoutMs(long)` | HTTP 请求超时(毫秒),默认 60000 | -| `.port(int)` | envd 端口,默认 49983 | -| `.debug(boolean)` | 调试模式,kill/setTimeout 跳过实际调用 | -| `.headers(Map)` | 自定义请求头(同时应用于管理面和 runtime) | -| `.addHeader(String key, String value)` | 添加单个自定义请求头 | - -#### 优先级 +### Builder 方法 + +| 方法 | 说明 | +|---------------------------------|--------------------------------------| +| `.apiKey(String)` | API Key,写入请求头 `X-API-Key` | +| `.accessToken(String)` | Access Token,写入请求头 `X-Access-Token` | +| `.domain(String)` | 域名,默认 `your.domain.com` | +| `.scheme(String)` | URL scheme,默认 `https` | +| `.protocol(Protocol)` | 路由协议,默认 `Protocol.NATIVE` | +| `.apiURL(String)` | **最高优先级**:直接覆盖 API base URL | +| `.sandboxBaseURL(String)` | **最高优先级**:直接覆盖 sandbox envd base URL | +| `.requestTimeoutMs(long)` | HTTP 请求超时(毫秒),默认 60000 | +| `.port(int)` | envd 端口,默认 49983 | +| `.debug(boolean)` | 调试模式,kill/setTimeout 跳过实际调用 | +| `.headers(Map)` | 自定义请求头 | +| `.addHeader(String, String)` | 添加单个自定义请求头 | + +### 优先级 `apiURL` / `sandboxBaseURL`(显式覆盖) > `protocol` + `domain` 拼装 > 环境变量(`X_API_KEY`、`SCHEME`、`PROTOCOL`) > 默认值 + +### 环境变量 + +| 变量 | 说明 | +|-------------|------------------------------| +| `X_API_KEY` | 默认 API Key | +| `SCHEME` | 默认 URL scheme | +| `PROTOCOL` | 默认路由协议(`NATIVE` / `PRIVATE`) | + +--- + +## 六、K8s 直连模式 + +不通过 E2B 控制面,直接连接 K8s 集群中的 sandbox: + +```java +import io.openkruise.agents.client.runtime.*; + +RuntimeConfig config = new RuntimeConfig.Builder() + .runtimeUrl("http://localhost:49983") + .runtimeToken("your-token") + .build(); + +RuntimeClient client = RuntimeClient.create("sandbox-id", config); + +// 命令和文件操作 +CommandResult res = client.commands.run("echo hello"); +client.files.writeText("/tmp/test.txt", "Hello!"); + +client.close(); // 关闭连接 + 释放线程池 +``` + +详见 Runtime 层文档:[README](../runtime/README.md) | [中文文档](../runtime/README_zh-CH.md) \ No newline at end of file diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/Sandbox.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/Sandbox.java index 50888e3..8c1aea5 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/Sandbox.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/Sandbox.java @@ -1,20 +1,16 @@ package io.openkruise.agents.client.e2b; -import io.openkruise.agents.client.e2b.api.invoker.ApiException; import io.openkruise.agents.client.runtime.RuntimeClient; import io.openkruise.agents.client.runtime.commands.Commands; import io.openkruise.agents.client.runtime.filesystem.Filesystem; -import java.util.logging.Level; -import java.util.logging.Logger; - /** - * Represents a created/connected E2B sandbox instance (data plane) with try-with-resources support for automatic termination. + * Represents a created/connected E2B sandbox instance (data plane). + * Supports try-with-resources for automatic resource cleanup (HTTP connection + thread pools). + * Does NOT terminate the sandbox on close — use {@code sandboxApi.kill(sandboxID)} to terminate. */ public class Sandbox implements AutoCloseable { - private static final Logger LOG = Logger.getLogger(Sandbox.class.getName()); - /** Command execution within the sandbox */ public final Commands commands; /** File operations within the sandbox */ @@ -22,13 +18,11 @@ public class Sandbox implements AutoCloseable { private final String sandboxID; private final ConnectionConfig config; - private final SandboxApi sandboxApi; private final RuntimeClient runtimeClient; - Sandbox(String sandboxID, String envdAccessToken, ConnectionConfig config, SandboxApi sandboxApi) { + Sandbox(String sandboxID, String envdAccessToken, ConnectionConfig config) { this.sandboxID = sandboxID; this.config = config; - this.sandboxApi = sandboxApi; E2bRuntimeConfig runtimeConfig = E2bRuntimeConfig.fromConnectionConfig(config, envdAccessToken); this.runtimeClient = RuntimeClient.create(sandboxID, runtimeConfig); @@ -52,17 +46,12 @@ public RuntimeClient getRuntimeClient() { return runtimeClient; } - /** Closes and terminates the sandbox. Termination failures are logged but not thrown. */ + /** Closes the HTTP connection and releases thread pools. Does NOT terminate the sandbox. */ @Override public void close() { if (runtimeClient != null) { runtimeClient.close(); } - try { - sandboxApi.kill(sandboxID); - } catch (Exception e) { - LOG.log(Level.WARNING, "Failed to kill sandbox " + sandboxID + " on close()", e); - } } @Override diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/SandboxApi.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/SandboxApi.java index 4bb65cc..5547090 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/SandboxApi.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/SandboxApi.java @@ -34,7 +34,7 @@ public Sandbox create(NewSandbox body) throws ApiException { SandboxResponse resp = lowLevelApi.sandboxesPost(body); - return new Sandbox(resp.getSandboxID(), resp.getEnvdAccessToken(), config, this); + return new Sandbox(resp.getSandboxID(), resp.getEnvdAccessToken(), config); } public Sandbox create(String template) throws ApiException { @@ -50,7 +50,7 @@ public Sandbox connect(String sandboxID, int timeout) throws ApiException { body.setTimeout(timeout); SandboxResponse resp = lowLevelApi.sandboxesSandboxIDConnectPost(sandboxID, body); - return new Sandbox(resp.getSandboxID(), resp.getEnvdAccessToken(), config, this); + return new Sandbox(resp.getSandboxID(), resp.getEnvdAccessToken(), config); } catch (ApiException e) { if (e.getCode() == 404) { throw new SandboxNotFoundException(sandboxID, e); diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/README.md b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/README.md new file mode 100644 index 0000000..4df337f --- /dev/null +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/README.md @@ -0,0 +1,322 @@ +# Runtime Java SDK (Runtime Client) + +> **Dependency**: This package is not published to a public Maven repository. Download the project and build the JAR +> manually. + +--- + +## Package Structure + +``` +runtime/ +├── RuntimeClient.java # Unified entry: create / newFromK8s +├── RuntimeConfig.java # Builder-pattern config: domain / scheme / runtimeToken / ... +├── K8sHelper.java # Extract runtimeToken from Sandbox CR annotation +├── EnvdMethods.java # envd service and method name constants +├── commands/ # Command execution +│ ├── Commands.java # run / runBackground / kill / sendInput / list / connect +│ ├── CommandHandle.java # Background process handle: waitForCompletion / kill / close +│ └── CommandResult.java # Command result: stdout / stderr / exitCode +├── filesystem/ # Filesystem +│ ├── Filesystem.java # listDir / read / write / makeDir / remove / watchDir / move +│ └── WatchHandle.java # Directory watch handle: stop +├── utils/ # Utilities +│ ├── ConnectStreamReader.java # Connect Protocol streaming response parser +│ └── MessageStream.java # Streaming message interface (hasNext / next / close) +├── exceptions/ # Exceptions +│ ├── SandboxException.java # Sandbox runtime exception +│ └── K8sOperationException.java # K8s operation exception +└── envd/ # Protobuf generated code + ├── process/ # envd Process service + └── filesystem/ # envd Filesystem service +``` + +--- + +## Quick Start + +### Option 1: Direct Connection + +Use when you know the sandbox URL and token: + +```java +import io.openkruise.agents.client.runtime.*; +import io.openkruise.agents.client.runtime.commands.CommandResult; + +RuntimeConfig config = new RuntimeConfig.Builder() + .runtimeUrl("http://localhost:49983") + .runtimeToken("your-token") + .build(); + +try (RuntimeClient client = RuntimeClient.create("sandbox-id", config)) { + CommandResult res = client.commands.run("uname -a"); + System.out.println(res.getStdout()); +} +``` + +### Option 2: K8s Auto-Discovery + +When running in-cluster or with kubeconfig access, use `newFromK8s` to automatically resolve `sandboxID` and +`runtimeToken` from the Sandbox CR: + +```java +RuntimeConfig config = new RuntimeConfig.Builder() + .domain("sandbox-gateway.sandbox-system.svc:7788") + .scheme("http") + .build(); + +try (RuntimeClient client = RuntimeClient.newFromK8s("default", "your-sandbox-name", config)) { + System.out.println("Runtime URL: " + client.getRuntimeURL()); + CommandResult res = client.commands.run("uname -a"); + System.out.println(res.getStdout()); +} +``` + +**K8s Mode Notes:** + +- `newFromK8s` queries the Sandbox CR and extracts `runtimeToken` from annotation + `agents.kruise.io/runtime-access-token` +- `sandboxID` format is `namespace--name` (double-hyphen joined) +- Kubeconfig resolution order: `KUBECONFIG` env → `~/.kube/config` → in-cluster config + +Full example: [K8sDirectConnectExample.java](../examples/runtime/K8sDirectConnectExample.java) + +--- + +## 1. RuntimeClient + +`RuntimeClient` is the unified entry point for the Runtime layer, providing command execution and filesystem operations. + +### Creation + +| Method | Description | +|----------------------------------------------------------------------------------------|---------------------------| +| `RuntimeClient.create(String sandboxID, RuntimeConfig config)` | Direct creation | +| `RuntimeClient.newFromK8s(String namespace, String sandboxName, RuntimeConfig config)` | Auto-discover from K8s CR | + +### Fields + +| Field | Type | Description | +|------------|--------------|--------------------------| +| `commands` | `Commands` | Command execution module | +| `files` | `Filesystem` | Filesystem module | + +### Methods + +| Method | Description | +|-------------------|--------------------------------------------------------------------------------| +| `getSandboxID()` | Returns sandbox ID | +| `getRuntimeURL()` | Returns runtime URL | +| `getConfig()` | Returns RuntimeConfig | +| `close()` | Close HTTP connection pool + release thread pool (supports try-with-resources) | + +> `close()` only releases local HTTP resources; it does **not** terminate the remote sandbox. + +--- + +## 2. Connection Configuration (RuntimeConfig) + +The runtime client only needs `scheme` + `domain` to determine the envd address (`://`); no Protocol +routing is involved. + +### Builder Methods + +| Method | Description | +|---------------------------------|------------------------------------------------------------------------------------| +| `.domain(String)` | envd domain, default `domain.app` | +| `.scheme(String)` | URL scheme, default `http` | +| `.runtimeToken(String)` | Runtime Token, written to `X-Access-Token` header | +| `.runtimeUrl(String)` | **Highest priority**: directly overrides URL; `getSandboxURL()` returns this value | +| `.apiKey(String)` | API Key, written to `X-API-Key` header | +| `.authHeader(String)` | Override default Authorization header | +| `.headers(Map)` | Merge multiple custom headers | +| `.addHeader(String, String)` | Add a single custom header | +| `.requestTimeoutMs(long)` | HTTP timeout (ms), default 60000 | + +### Priority + +`runtimeUrl` (explicit override) > `scheme` + `domain` assembly > Defaults + +--- + +## 3. Command Execution (Commands) + +Operate on processes inside the container via `client.commands`. Built on OkHttp + Connect Protocol; commands are +executed through `/bin/bash -l -c `. + +### Methods + +| Method | Description | +|-------------------------------------------------|----------------------------------------------------------------------| +| `run(String cmd)` | **Foreground**: start command and wait, returns `CommandResult` | +| `run(String cmd, RunOptions options)` | Foreground with options | +| `runBackground(String cmd, RunOptions options)` | **Background**: returns `CommandHandle`, caller decides when to wait | +| `list()` | List all running processes, returns `List` | +| `kill(int pid)` | Send SIGKILL to the given PID | +| `sendInput(int pid, String data)` | Write data to stdin of the given process | +| `sendSignal(int pid, Signal signal)` | Send a signal to the given process | +| `closeStdin(int pid)` | Close stdin of the given process | +| `connect(int pid)` | Reconnect to a running process, subscribe to its subsequent output | + +### RunOptions + +```java +RunOptions opts = new RunOptions() + .envs(Map.of("LANG", "C")) // Environment variables + .cwd("/tmp") // Working directory + .onStdout(line -> System.out.print(line)) // Streaming stdout callback + .onStderr(line -> System.err.print(line));// Streaming stderr callback +``` + +### CommandResult + +| Field | Type | Description | +|------------|----------|-----------------| +| `stdout` | `String` | Standard output | +| `stderr` | `String` | Standard error | +| `exitCode` | `int` | Exit code | + +### CommandHandle + +Returned by `runBackground()` / `connect()`, implements `AutoCloseable`: + +| Method | Description | +|-----------------------|-------------------------------------------------| +| `getPid()` | Returns process PID | +| `isCompleted()` | Whether the process has completed | +| `waitForCompletion()` | Block until completion, returns `CommandResult` | +| `kill()` | Kill the process | +| `close()` | Close stream and underlying HTTP resources | + +### Examples + +```java +// Foreground execution +CommandResult res = client.commands.run("pwd"); +System.out.println(res.getStdout()); + +// With options + streaming output +CommandResult res2 = client.commands.run("ls -la /tmp", + new RunOptions().cwd("/tmp").onStdout(System.out::print)); + +// Background + manual kill +CommandHandle handle = client.commands.runBackground("sleep 60", new RunOptions()); +System.out.println("pid = " + handle.getPid()); +handle.kill(); +handle.close(); + +// List processes +List procs = client.commands.list(); +for (ProcessInfo p : procs) { + System.out.printf("PID: %d, Cmd: %s%n", p.getPid(), p.getCmd()); +} +``` + +--- + +## 4. Filesystem (Filesystem) + +Operate on files inside the container via `client.files`. Metadata operations use the envd Filesystem service; file +read/write uses the HTTP `/files` endpoint. + +### Methods + +**Directory Operations** + +| Method | Description | +|----------------------------------------|-------------------------------------------------| +| `listDir(String path)` | List directory entries (depth=1) | +| `listDir(String path, int depth)` | List directory entries (specified depth) | +| `makeDir(String path)` | Create directory recursively; `false` if exists | +| `move(String oldPath, String newPath)` | Rename/move a file or directory | + +**File Information** + +| Method | Description | +|------------------------|----------------------------------------------| +| `exists(String path)` | Check if path exists | +| `getInfo(String path)` | Get file/directory info, returns `EntryInfo` | + +**File Read / Write** + +| Method | Description | +|-------------------------------------------------------|-----------------------------------------------------| +| `read(String path)` | Read file content (`byte[]`) | +| `read(String path, String user)` | Read file content (as specified user) | +| `readText(String path)` | Read file content (`String`, UTF-8) | +| `readText(String path, String user)` | Read file content (as specified user, UTF-8) | +| `write(String path, byte[] data)` | Write file (binary), returns `WriteInfo` | +| `write(String path, byte[] data, String user)` | Write file (as specified user), returns `WriteInfo` | +| `writeText(String path, String content)` | Write file (text, UTF-8), returns `WriteInfo` | +| `writeText(String path, String content, String user)` | Write file (as specified user), returns `WriteInfo` | + +**Delete** + +| Method | Description | +|-----------------------|----------------------------| +| `remove(String path)` | Delete a file or directory | + +**Directory Watch** + +| Method | Description | +|-------------------------------------------------------------------------------|-------------------------------------| +| `watchDir(String path, Consumer onEvent)` | Watch directory change events | +| `watchDir(String path, boolean recursive, Consumer onEvent)` | Watch directory changes (recursive) | + +### WatchHandle + +| Method | Description | +|---------------|---------------------------------------------------| +| `stop()` | Stop watching and close underlying HTTP resources | +| `isStopped()` | Whether the watch has been stopped | + +### Examples + +```java +// Directory operations +client.files.makeDir("/tmp/work"); +List entries = client.files.listDir("/tmp"); +client.files.move("/tmp/old.txt", "/tmp/new.txt"); +client.files.remove("/tmp/work"); + +// File read/write +client.files.writeText("/tmp/hello.txt", "Hello, World!"); +String content = client.files.readText("/tmp/hello.txt"); + +// Binary read/write +WriteInfo info = client.files.write("/tmp/data.bin", new byte[]{0x01, 0x02}); +byte[] data = client.files.read("/tmp/data.bin"); + +// Directory watch +WatchHandle wh = client.files.watchDir("/tmp", true, event -> + System.out.printf("Event: %s %s%n", event.getType(), event.getName())); +wh.stop(); +``` + +--- + +## 5. Exception Hierarchy + +| Exception Class | Description | +|-------------------------|--------------------------------------------------------------------------------| +| `SandboxException` | Sandbox runtime exception (command execution failure, stream read error, etc.) | +| `K8sOperationException` | K8s operation exception (CR query failure, token extraction failure, etc.) | + +--- + +## 6. Resource Management + +`RuntimeClient` implements `AutoCloseable`; `close()` releases: + +- OkHttpClient **Dispatcher** thread pool +- OkHttpClient **ConnectionPool** connection pool + +Recommended: use try-with-resources: + +```java +try (RuntimeClient client = RuntimeClient.create(sandboxID, config)) { + // operations... +} // HTTP resources released automatically +``` + +> `close()` only releases local HTTP resources; it does **not** terminate the remote sandbox. diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/README_zh-CH.md b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/README_zh-CH.md index 93ddb32..e1f8688 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/README_zh-CH.md +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/README_zh-CH.md @@ -1,8 +1,6 @@ # Runtime Java SDK(运行时客户端) -## 依赖导入 - -Maven 仓库:该包未发布到官方 Maven 仓库,你需要手动下载项目并打包成 JAR 文件使用。 +> **依赖导入**:该包未发布到官方 Maven 仓库,需手动下载项目并打包成 JAR 文件使用。 --- @@ -11,85 +9,125 @@ Maven 仓库:该包未发布到官方 Maven 仓库,你需要手动下载项 ``` runtime/ ├── RuntimeClient.java # 统一入口:create / newFromK8s -├── RuntimeConfig.java # Builder 模式配置:Domain / Scheme / RuntimeToken / ... +├── RuntimeConfig.java # Builder 模式配置:domain / scheme / runtimeToken / ... ├── K8sHelper.java # 从 Sandbox CR annotation 提取 runtimeToken -├── EnvdMethods.java # envd gRPC 服务名和方法名常量 +├── EnvdMethods.java # envd 服务名和方法名常量 ├── commands/ # 命令执行 -│ ├── Commands.java # Run / Start / Kill / SendStdin / List / ConnectToProcess -│ ├── CommandHandle.java # 后台进程句柄:waitForCompletion / kill +│ ├── Commands.java # run / runBackground / kill / sendInput / list / connect +│ ├── CommandHandle.java # 后台进程句柄:waitForCompletion / kill / close │ └── CommandResult.java # 命令执行结果:stdout / stderr / exitCode ├── filesystem/ # 文件系统 -│ ├── Filesystem.java # ListDir / Read / Write / MakeDir / Remove / Watch -│ ├── WatchHandle.java # 目录监听句柄 -│ └── WatchDirResponseObserver.java +│ ├── Filesystem.java # listDir / read / write / makeDir / remove / watchDir / move +│ └── WatchHandle.java # 目录监听句柄:stop ├── utils/ # 工具类 -│ └── ConnectStreamReader.java # Connect Protocol 流式响应解析 +│ ├── ConnectStreamReader.java # Connect Protocol 流式响应解析 +│ └── MessageStream.java # 流式消息接口(hasNext / next / close) ├── exceptions/ # 异常 -│ └── SandboxException.java +│ ├── SandboxException.java # 沙箱运行时异常 +│ └── K8sOperationException.java # K8s 操作异常 └── envd/ # protobuf 生成代码 - ├── process/ # envd Process gRPC - └── filesystem/ # envd Filesystem gRPC + ├── process/ # envd Process 服务 + └── filesystem/ # envd Filesystem 服务 ``` --- ## 快速开始 -在集群内或有 kubeconfig 权限时,使用 `newFromK8s` 自动从 Sandbox CR 解析 `sandboxID` 和 `runtimeToken`: +### 方式一:直接连接 + +已知 sandbox URL 和 token 时使用: ```java import io.openkruise.agents.client.runtime.*; import io.openkruise.agents.client.runtime.commands.CommandResult; -public class QuickStart { - public static void main(String[] args) throws Exception { - // domain 是 sandbox gateway 的地址 - // 集群内访问:K8s Service DNS,如 "sandbox-gateway.sandbox-system.svc:7788" - // 本地开发:port-forward 地址,如 "127.0.0.1:7788" - RuntimeConfig config = new RuntimeConfig.Builder() - .domain("sandbox-gateway.sandbox-system.svc:7788") - .scheme("http") - .build(); - - try (RuntimeClient client = RuntimeClient.newFromK8s("default", "your-sandbox-name", config)) { - System.out.println("Runtime URL: " + client.getRuntimeURL()); - - CommandResult res = client.Commands.run("uname -a"); - System.out.println(res.getStdout()); - } - } +RuntimeConfig config = new RuntimeConfig.Builder() + .runtimeUrl("http://localhost:49983") + .runtimeToken("your-token") + .build(); + +try (RuntimeClient client = RuntimeClient.create("sandbox-id", config)) { + CommandResult res = client.commands.run("uname -a"); + System.out.println(res.getStdout()); } ``` -**关键说明:** +### 方式二:K8s 自动发现 + +在集群内或有 kubeconfig 权限时,使用 `newFromK8s` 自动从 Sandbox CR 解析 `sandboxID` 和 `runtimeToken`: + +```java +RuntimeConfig config = new RuntimeConfig.Builder() + .domain("sandbox-gateway.sandbox-system.svc:7788") + .scheme("http") + .build(); + +try (RuntimeClient client = RuntimeClient.newFromK8s("default", "your-sandbox-name", config)) { + System.out.println("Runtime URL: " + client.getRuntimeURL()); + CommandResult res = client.commands.run("uname -a"); + System.out.println(res.getStdout()); +} +``` + +**K8s 模式说明:** - `newFromK8s` 查询 Sandbox CR 并从 annotation `agents.kruise.io/runtime-access-token` 提取 `runtimeToken` - `sandboxID` 格式为 `namespace--name`(双横线连接) - kubeconfig 解析顺序:`KUBECONFIG` 环境变量 → `~/.kube/config` → in-cluster config -完整演示:[K8sDirectConnectExample.java](../examples/runtime/K8sDirectConnectExample.java) +完整示例:[K8sDirectConnectExample.java](../examples/runtime/K8sDirectConnectExample.java) --- -## 连接配置(RuntimeConfig) +## 一、RuntimeClient -运行时客户端**不涉及 Protocol**,只需 `Scheme` + `Domain` 即可确定 envd 地址(`://`)。 +`RuntimeClient` 是 Runtime 层的统一入口,提供命令执行和文件操作能力。 -### Builder 方法 +### 创建方式 + +| 方法 | 说明 | +|----------------------------------------------------------------------------------------|---------------| +| `RuntimeClient.create(String sandboxID, RuntimeConfig config)` | 直接创建 | +| `RuntimeClient.newFromK8s(String namespace, String sandboxName, RuntimeConfig config)` | 从 K8s CR 自动发现 | + +### 字段 + +| 字段 | 类型 | 说明 | +|------------|--------------|--------| +| `commands` | `Commands` | 命令执行模块 | +| `files` | `Filesystem` | 文件系统模块 | + +### 方法 -通过 `new RuntimeConfig.Builder().xxx().build()` 构建: +| 方法 | 说明 | +|-------------------|--------------------------------------------| +| `getSandboxID()` | 返回 sandbox ID | +| `getRuntimeURL()` | 返回 runtime URL | +| `getConfig()` | 返回 RuntimeConfig | +| `close()` | 关闭 HTTP 连接池 + 释放线程池(支持 try-with-resources) | -| 方法 | 说明 | -|----------------------------------------|------------------------------------------------| -| `.domain(String)` | envd 域名,默认 `domain.app` | -| `.scheme(String)` | URL scheme,默认 `http` | -| `.runtimeToken(String)` | 运行时 Token,写入请求头 `X-Access-Token` | -| `.runtimeUrl(String)` | **最高优先级**:直接覆盖 URL 拼装,`getSandboxURL()` 直接返回此值 | -| `.apiKey(String)` | API Key,写入请求头 `X-API-Key` | -| `.authHeader(String)` | 覆盖默认的 Authorization 头 | -| `.headers(Map)` | 合并多个自定义 headers | -| `.addHeader(String key, String value)` | 添加单个自定义 header | -| `.requestTimeoutMs(long)` | HTTP 超时(毫秒),默认 60000 | +> `close()` 只释放本地 HTTP 资源,不会终止远程 sandbox。 + +--- + +## 二、连接配置(RuntimeConfig) + +运行时客户端只需 `scheme` + `domain` 即可确定 envd 地址(`://`),不涉及 Protocol 路由。 + +### Builder 方法 + +| 方法 | 说明 | +|---------------------------------|---------------------------------------------| +| `.domain(String)` | envd 域名,默认 `domain.app` | +| `.scheme(String)` | URL scheme,默认 `http` | +| `.runtimeToken(String)` | 运行时 Token,写入请求头 `X-Access-Token` | +| `.runtimeUrl(String)` | **最高优先级**:直接覆盖 URL,`getSandboxURL()` 直接返回此值 | +| `.apiKey(String)` | API Key,写入请求头 `X-API-Key` | +| `.authHeader(String)` | 覆盖默认的 Authorization 头 | +| `.headers(Map)` | 合并多个自定义 headers | +| `.addHeader(String, String)` | 添加单个自定义 header | +| `.requestTimeoutMs(long)` | HTTP 超时(毫秒),默认 60000 | ### 优先级 @@ -97,35 +135,45 @@ public class QuickStart { --- -## 命令执行(Commands) +## 三、命令执行(Commands) -通过 `client.Commands` 操作容器内进程。底层走 envd 的 `Process` gRPC 服务,命令统一通过 `/bin/bash -l -c ` 执行。 +通过 `client.commands` 操作容器内进程。底层基于 OkHttp + Connect Protocol,命令统一通过 `/bin/bash -l -c ` 执行。 -### 方法 +### 方法一览 -| 方法 | 说明 | -|-----------------------------------------|---------------------------------------| -| `run(String cmd)` | **前台执行**:启动命令并等待完成,返回 `CommandResult` | -| `run(String cmd, RunOptions options)` | 前台执行(带选项) | -| `start(String cmd, RunOptions options)` | **后台启动**:返回 `CommandHandle`,调用方决定何时等待 | -| `list()` | 列出所有运行中的进程,返回 `List` | -| `kill(int pid)` | 向指定 PID 发送 SIGKILL | -| `sendStdin(int pid, String data)` | 向指定进程的 stdin 写入数据 | -| `connectToProcess(int pid)` | 重新连接到已运行的进程,订阅其后续输出 | +| 方法 | 说明 | +|-------------------------------------------------|---------------------------------------| +| `run(String cmd)` | **前台执行**:启动命令并等待完成,返回 `CommandResult` | +| `run(String cmd, RunOptions options)` | 前台执行(带选项) | +| `runBackground(String cmd, RunOptions options)` | **后台启动**:返回 `CommandHandle`,调用方决定何时等待 | +| `list()` | 列出所有运行中的进程,返回 `List` | +| `kill(int pid)` | 向指定 PID 发送 SIGKILL | +| `sendInput(int pid, String data)` | 向指定进程的 stdin 写入数据 | +| `sendSignal(int pid, Signal signal)` | 向指定进程发送信号 | +| `closeStdin(int pid)` | 关闭指定进程的 stdin | +| `connect(int pid)` | 重新连接到已运行的进程,订阅其后续输出 | ### RunOptions ```java RunOptions opts = new RunOptions() - .envs(Map.of("LANG", "C")) // 环境变量 - .cwd("/tmp") // 工作目录 - .onStdout(line -> System.out.print(line)) // 流式 stdout 回调 - .onStderr(line -> System.err.print(line)); // 流式 stderr 回调 + .envs(Map.of("LANG", "C")) // 环境变量 + .cwd("/tmp") // 工作目录 + .onStdout(line -> System.out.print(line)) // 流式 stdout 回调 + .onStderr(line -> System.err.print(line));// 流式 stderr 回调 ``` +### CommandResult + +| 字段 | 类型 | 说明 | +|------------|----------|------| +| `stdout` | `String` | 标准输出 | +| `stderr` | `String` | 标准错误 | +| `exitCode` | `int` | 退出码 | + ### CommandHandle -由 `start` / `connectToProcess` 返回,用于交互或等待: +由 `runBackground()` / `connect()` 返回,实现 `AutoCloseable`: | 方法 | 说明 | |-----------------------|---------------------------| @@ -133,35 +181,27 @@ RunOptions opts = new RunOptions() | `isCompleted()` | 是否已完成 | | `waitForCompletion()` | 阻塞等待结束,返回 `CommandResult` | | `kill()` | 终止进程 | -| `close()` | 关闭(实现 `AutoCloseable`) | - -### CommandResult - -| 字段 | 类型 | 说明 | -|------------|----------|------| -| `stdout` | `String` | 标准输出 | -| `stderr` | `String` | 标准错误 | -| `exitCode` | `int` | 退出码 | +| `close()` | 关闭流和底层 HTTP 资源 | ### 示例 ```java // 前台执行 -CommandResult res = client.Commands.run("pwd"); +CommandResult res = client.commands.run("pwd"); System.out.println(res.getStdout()); // 带选项执行 + 流式输出 -CommandResult res2 = client.Commands.run("ls -la /tmp", +CommandResult res2 = client.commands.run("ls -la /tmp", new RunOptions().cwd("/tmp").onStdout(System.out::print)); // 后台启动 + 主动 Kill -CommandHandle handle = client.Commands.start("sleep 60", new RunOptions()); +CommandHandle handle = client.commands.runBackground("sleep 60", new RunOptions()); System.out.println("pid = " + handle.getPid()); handle.kill(); handle.close(); // 列出进程 -List procs = client.Commands.list(); +List procs = client.commands.list(); for (ProcessInfo p : procs) { System.out.printf("PID: %d, Cmd: %s%n", p.getPid(), p.getCmd()); } @@ -169,46 +209,108 @@ for (ProcessInfo p : procs) { --- -## 文件系统(Filesystem) +## 四、文件系统(Filesystem) -通过 `client.Files` 操作容器内文件。元数据操作走 envd Filesystem gRPC,文件内容读写走 HTTP `/files` 端点。 +通过 `client.files` 操作容器内文件。元数据操作走 envd Filesystem 服务,文件读写走 HTTP `/files` 端点。 -### 方法 +### 方法一览 + +**目录操作** + +| 方法 | 说明 | +|----------------------------------------|----------------------| +| `listDir(String path)` | 列出目录条目(depth=1) | +| `listDir(String path, int depth)` | 列出目录条目(指定深度) | +| `makeDir(String path)` | 递归创建目录;已存在返回 `false` | +| `move(String oldPath, String newPath)` | 重命名/移动文件或目录 | + +**文件信息** + +| 方法 | 说明 | +|------------------------|--------------------------| +| `exists(String path)` | 路径是否存在 | +| `getInfo(String path)` | 获取文件/目录信息,返回 `EntryInfo` | + +**文件读写** + +| 方法 | 说明 | +|-------------------------------------------------------|-------------------------------| +| `read(String path)` | 读取文件内容(`byte[]`) | +| `read(String path, String user)` | 读取文件内容(指定用户) | +| `readText(String path)` | 读取文件内容(`String`,UTF-8) | +| `readText(String path, String user)` | 读取文件内容(指定用户,UTF-8) | +| `write(String path, byte[] data)` | 写入文件(二进制),返回 `WriteInfo` | +| `write(String path, byte[] data, String user)` | 写入文件(指定用户),返回 `WriteInfo` | +| `writeText(String path, String content)` | 写入文件(文本,UTF-8),返回 `WriteInfo` | +| `writeText(String path, String content, String user)` | 写入文件(指定用户),返回 `WriteInfo` | + +**删除** + +| 方法 | 说明 | +|-----------------------|---------| +| `remove(String path)` | 删除文件或目录 | + +**目录监听** -| 方法 | 说明 | -|-------------------------------------------------------------------------------|--------------------------| -| `listDir(String path)` | 列出目录条目(depth=1) | -| `listDir(String path, int depth)` | 列出目录条目(指定深度) | -| `exists(String path)` | 路径是否存在 | -| `getInfo(String path)` | 获取文件/目录信息,返回 `EntryInfo` | -| `makeDir(String path)` | 递归创建目录;已存在返回 `false` | -| `remove(String path)` | 删除文件或目录 | -| `read(String path)` | 读取文件内容(`byte[]`) | -| `readText(String path)` | 读取文件内容(`String`,UTF-8) | -| `write(String path, byte[] data)` | 写入文件(二进制),自动创建父目录 | -| `writeText(String path, String content)` | 写入文件(文本,UTF-8) | -| `watchDir(String path, Consumer onEvent)` | 监听目录变更事件 | -| `watchDir(String path, boolean recursive, Consumer onEvent)` | 监听目录变更事件(支持递归) | +| 方法 | 说明 | +|-------------------------------------------------------------------------------|--------------| +| `watchDir(String path, Consumer onEvent)` | 监听目录变更事件 | +| `watchDir(String path, boolean recursive, Consumer onEvent)` | 监听目录变更(支持递归) | + +### WatchHandle + +| 方法 | 说明 | +|---------------|-------------------| +| `stop()` | 停止监听并关闭底层 HTTP 资源 | +| `isStopped()` | 是否已停止 | ### 示例 ```java // 目录操作 -client.Files.makeDir("/tmp/work"); -List entries = client.Files.listDir("/tmp"); -client.Files.remove("/tmp/work"); +client.files.makeDir("/tmp/work"); +List entries = client.files.listDir("/tmp"); +client.files.move("/tmp/old.txt", "/tmp/new.txt"); +client.files.remove("/tmp/work"); // 文件读写 -client.Files.writeText("/tmp/hello.txt", "Hello, World!"); -String content = client.Files.readText("/tmp/hello.txt"); -System.out.println(content); // Hello, World! +client.files.writeText("/tmp/hello.txt", "Hello, World!"); +String content = client.files.readText("/tmp/hello.txt"); // 二进制读写 -client.Files.write("/tmp/data.bin", new byte[]{0x01, 0x02, 0x03}); -byte[] data = client.Files.read("/tmp/data.bin"); +WriteInfo info = client.files.write("/tmp/data.bin", new byte[]{0x01, 0x02}); +byte[] data = client.files.read("/tmp/data.bin"); // 目录监听 -WatchHandle wh = client.Files.watchDir("/tmp", true, event -> - System.out.printf("Event: %s %s%n", event.getType(), event.getPath())); -wh.close(); +WatchHandle wh = client.files.watchDir("/tmp", true, event -> + System.out.printf("Event: %s %s%n", event.getType(), event.getName())); +wh.stop(); +``` + +--- + +## 五、异常体系 + +| 异常类 | 说明 | +|-------------------------|-------------------------------| +| `SandboxException` | 沙箱运行时异常(命令执行失败、流读取错误等) | +| `K8sOperationException` | K8s 操作异常(CR 查询失败、token 提取失败等) | + +--- + +## 六、资源管理 + +`RuntimeClient` 实现 `AutoCloseable`,`close()` 会释放: + +- OkHttpClient **Dispatcher** 线程池 +- OkHttpClient **ConnectionPool** 连接池 + +推荐使用 try-with-resources: + +```java +try (RuntimeClient client = RuntimeClient.create(sandboxID, config)) { + // 操作... +} // 自动释放 HTTP 资源 ``` + +> `close()` 只释放本地 HTTP 资源,**不会终止远程 sandbox**。 \ No newline at end of file From 44fbcc2d0c47e7861b1fcb53c6235035103ff060 Mon Sep 17 00:00:00 2001 From: zhaoqing Date: Mon, 15 Jun 2026 11:00:00 +0800 Subject: [PATCH 4/5] update Environment Variables --- .../agents/client/e2b/ConnectionConfig.java | 12 ++++-------- .../io/openkruise/agents/client/e2b/README.md | 16 +++++++++------- .../openkruise/agents/client/e2b/README_zh-CH.md | 13 +++++++------ 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/ConnectionConfig.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/ConnectionConfig.java index a1a3e2e..6ad750b 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/ConnectionConfig.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/ConnectionConfig.java @@ -163,17 +163,13 @@ public static class Builder { public Builder() { // Environment variables as defaults - String envApiKey = System.getenv("X_API_KEY"); + String envApiKey = System.getenv("E2B_API_KEY"); if (envApiKey != null && !envApiKey.isEmpty()) { config.apiKey = envApiKey; } - String envScheme = System.getenv("SCHEME"); - if (envScheme != null && !envScheme.isEmpty()) { - config.scheme = envScheme; - } - String envProtocol = System.getenv("PROTOCOL"); - if (envProtocol != null && !envProtocol.isEmpty()) { - config.protocol = Protocol.valueOf(envProtocol.toUpperCase()); + String domain = System.getenv("E2B_DOMAIN"); + if (domain != null && !domain.isEmpty()) { + config.domain = domain; } } diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/README.md b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/README.md index 99b5b16..2d9f1e7 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/README.md +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/README.md @@ -328,16 +328,18 @@ Connection behavior is determined by two orthogonal dimensions: **Scheme** and * ### Priority -`apiURL` / `sandboxBaseURL` (explicit override) > `protocol` + `domain` assembly > Environment variables (`X_API_KEY`, -`SCHEME`, `PROTOCOL`) > Defaults +`apiURL` / `sandboxBaseURL` (explicit override) > `protocol` + `domain` assembly > Environment variables (`E2B_API_KEY`, +`E2B_DOMAIN`) > Defaults ### Environment Variables -| Variable | Description | -|-------------|-------------------------------------------------| -| `X_API_KEY` | Default API Key | -| `SCHEME` | Default URL scheme | -| `PROTOCOL` | Default routing protocol (`NATIVE` / `PRIVATE`) | +The Builder constructor automatically reads these environment variables as defaults, which can then be overridden by +Builder methods: + +| Variable | Description | +|---------------|-----------------| +| `E2B_API_KEY` | Default API Key | +| `E2B_DOMAIN` | Default domain | --- diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/README_zh-CH.md b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/README_zh-CH.md index 41014b6..bcb9bfa 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/README_zh-CH.md +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/README_zh-CH.md @@ -324,15 +324,16 @@ wh.stop(); ### 优先级 -`apiURL` / `sandboxBaseURL`(显式覆盖) > `protocol` + `domain` 拼装 > 环境变量(`X_API_KEY`、`SCHEME`、`PROTOCOL`) > 默认值 +`apiURL` / `sandboxBaseURL`(显式覆盖) > `protocol` + `domain` 拼装 > 环境变量(`E2B_API_KEY`、`E2B_DOMAIN`) > 默认值 ### 环境变量 -| 变量 | 说明 | -|-------------|------------------------------| -| `X_API_KEY` | 默认 API Key | -| `SCHEME` | 默认 URL scheme | -| `PROTOCOL` | 默认路由协议(`NATIVE` / `PRIVATE`) | +Builder 构造时自动读取以下环境变量作为默认值,之后可通过 Builder 方法显式覆盖: + +| 变量 | 说明 | +|---------------|------------| +| `E2B_API_KEY` | 默认 API Key | +| `E2B_DOMAIN` | 默认域名 | --- From 1ecd584decbc16bb4fd67d29579e390341857e34 Mon Sep 17 00:00:00 2001 From: zhaoqing Date: Mon, 15 Jun 2026 17:12:44 +0800 Subject: [PATCH 5/5] fix: address review comments --- .../agents/client/e2b/ConnectionConfig.java | 2 +- .../agents/client/runtime/RuntimeClient.java | 1 + .../agents/client/runtime/RuntimeConfig.java | 12 ++++----- .../runtime/commands/CommandHandle.java | 6 ++++- .../client/runtime/commands/Commands.java | 8 ++++-- .../client/runtime/filesystem/Filesystem.java | 26 +++++++++++++++++-- .../filesystem/WatchDirResponseObserver.java | 6 +++-- .../runtime/filesystem/WatchHandle.java | 5 +++- .../client/runtime/utils/MessageStream.java | 3 --- 9 files changed, 51 insertions(+), 18 deletions(-) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/ConnectionConfig.java b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/ConnectionConfig.java index 6ad750b..2f8c30d 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/e2b/ConnectionConfig.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/e2b/ConnectionConfig.java @@ -90,7 +90,7 @@ public String getAPIURL() { /** Envd URL for a specific sandbox, automatically selects NATIVE/PRIVATE format based on protocol. */ public String getSandboxURL(String sandboxID) { if (sandboxBaseURL != null && !sandboxBaseURL.isEmpty()) { - return String.format("%s/%s", sandboxBaseURL, sandboxID); + return sandboxBaseURL; } String s = getSchemeOrDefault(); if (protocol == Protocol.PRIVATE) { diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/RuntimeClient.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/RuntimeClient.java index b8d8a14..1b818ec 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/RuntimeClient.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/RuntimeClient.java @@ -75,6 +75,7 @@ public RuntimeConfig getConfig() { @Override public void close() { + files.closeAllWatchHandles(); config.shutdown(); } diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/RuntimeConfig.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/RuntimeConfig.java index f6dda20..641b4eb 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/RuntimeConfig.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/RuntimeConfig.java @@ -92,11 +92,11 @@ public Map getSandboxHeaders(String sandboxID) { * Shared OkHttpClient with double-checked locking lazy initialization, reused by all RuntimeClients. */ public OkHttpClient getOrCreateHttpClient() { - if (shutdown) { - throw new IllegalStateException("RuntimeConfig has been shut down"); - } if (sharedHttpClient == null) { synchronized (httpClientLock) { + if (shutdown) { + throw new IllegalStateException("RuntimeConfig has been shut down"); + } if (sharedHttpClient == null) { sharedHttpClient = new OkHttpClient.Builder() .connectTimeout(requestTimeoutMs, TimeUnit.MILLISECONDS) @@ -113,11 +113,11 @@ public OkHttpClient getOrCreateHttpClient() { * Shared streaming OkHttpClient (no read timeout), reused by all RuntimeClients. */ public OkHttpClient getOrCreateStreamingHttpClient() { - if (shutdown) { - throw new IllegalStateException("RuntimeConfig has been shut down"); - } if (sharedStreamingClient == null) { synchronized (httpClientLock) { + if (shutdown) { + throw new IllegalStateException("RuntimeConfig has been shut down"); + } if (sharedStreamingClient == null) { sharedStreamingClient = new OkHttpClient.Builder() .connectTimeout(requestTimeoutMs, TimeUnit.MILLISECONDS) diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/commands/CommandHandle.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/commands/CommandHandle.java index 2221764..d0bf3f5 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/commands/CommandHandle.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/commands/CommandHandle.java @@ -158,7 +158,11 @@ public void close() { } } if (streamingResponse != null) { - streamingResponse.close(); + try { + streamingResponse.close(); + } catch (Exception ignored) { + // Already closed by streamReader (ConnectResponseAdapter), ignore double-close + } } } } diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/commands/Commands.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/commands/Commands.java index 405f2ff..532750c 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/commands/Commands.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/commands/Commands.java @@ -227,7 +227,7 @@ public boolean sendSignal(int pid, Signal signal) { return response.isSuccessful(); } } catch (Exception e) { - throw new RuntimeException("Failed to send kill", e); + throw new RuntimeException("Failed to send signal", e); } } @@ -351,7 +351,11 @@ public StartResponse next() { public void close() { delegate.close(); if (response != null) { - response.close(); + try { + response.close(); + } catch (Exception ignored) { + // Ignore close exceptions to satisfy Closeable contract + } } } } diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/filesystem/Filesystem.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/filesystem/Filesystem.java index 2c1a2d1..24d1e9f 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/filesystem/Filesystem.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/filesystem/Filesystem.java @@ -19,6 +19,8 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.function.Consumer; import java.util.logging.Level; import java.util.logging.Logger; @@ -35,6 +37,9 @@ public class Filesystem { private final RuntimeConfig config; private final OkHttpClient httpClient; private final OkHttpClient streamingClient; + /** Tracks active WatchHandles so they can be closed when the client shuts down (M5). */ + private final Set activeWatchHandles = + ConcurrentHashMap.newKeySet(); public Filesystem(String sandboxID, RuntimeConfig config, OkHttpClient httpClient, OkHttpClient streamingClient) { this.sandboxID = Objects.requireNonNull(sandboxID, "sandboxID cannot be null"); @@ -458,7 +463,24 @@ public WatchHandle watchDir(String path, boolean recursive, Consumer { + private static final Logger LOG = Logger.getLogger(WatchDirResponseObserver.class.getName()); private final Consumer onEvent; public WatchDirResponseObserver(Consumer onEvent) { @@ -39,8 +42,7 @@ public void onNext(WatchDirResponse response) { @Override public void onError(Throwable t) { - System.err.println("Error in WatchDirResponseObserver: " + t.getMessage()); - t.printStackTrace(); + LOG.log(Level.WARNING, "Error in WatchDirResponseObserver", t); } @Override diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/filesystem/WatchHandle.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/filesystem/WatchHandle.java index 50e2ba4..7c058c8 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/filesystem/WatchHandle.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/filesystem/WatchHandle.java @@ -4,6 +4,8 @@ import okhttp3.Response; import java.io.Closeable; +import java.util.logging.Level; +import java.util.logging.Logger; /** * WatchHandle represents a handle to a directory event stream being watched. @@ -11,6 +13,7 @@ * Stops watching and closes the underlying HTTP stream via {@link #stop()}. */ public class WatchHandle { + private static final Logger LOG = Logger.getLogger(WatchHandle.class.getName()); private final Closeable streamReader; private final Response streamingResponse; private volatile boolean stopped = false; @@ -28,7 +31,7 @@ public void stop() { try { streamReader.close(); } catch (Exception e) { - System.err.println("Error closing stream reader: " + e.getMessage()); + LOG.log(Level.WARNING, "Error closing watch stream reader", e); } finally { if (streamingResponse != null) { try { diff --git a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/utils/MessageStream.java b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/utils/MessageStream.java index c4bf8a6..ba67269 100644 --- a/k8s/java/src/main/java/io/openkruise/agents/client/runtime/utils/MessageStream.java +++ b/k8s/java/src/main/java/io/openkruise/agents/client/runtime/utils/MessageStream.java @@ -4,9 +4,6 @@ /** * A stream of typed messages with iterator-style access and lifecycle management. - *

- * Both {@link ConnectStreamReader} and the ConnectResponse adapter implement this interface, - * allowing {@link CommandHandle} to work with either stream type uniformly. * * @param message type */