diff --git a/e2b/README.md b/e2b/README.md new file mode 100644 index 0000000..9198aa0 --- /dev/null +++ b/e2b/README.md @@ -0,0 +1,548 @@ +# E2B Sandbox Go SDK + +This package provides two ways to operate within an E2B Sandbox environment: + +| Package | Import Path | Purpose | +|-----------------|----------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **sandbox** | `github.com/openkruise/agents-api/e2b/sandbox` | **Management Client**: Sandbox lifecycle management (Create / Connect / Pause / Kill) + in-container operations (Commands / Files), with Protocol-based routing | +| **envd/client** | `github.com/openkruise/agents-api/e2b/envd/client` | **Runtime Client**: Directly operates on a running sandbox's envd service for command execution and file operations, without any lifecycle management | + +> Both share the same underlying Commands / Filesystem implementation. The only difference is **whether requests go +through Protocol routing and the management API**. + +--- + +## Package Structure + +``` +e2b/ +├── sandbox/ # Management Client (package sandbox) +│ ├── sandbox.go # Sandbox struct: Create / Connect / Pause / Kill +│ ├── sandbox_api.go # Low-level REST client (SandboxApi): List / GetInfo / Kill / ... +│ └── config.go # ConnectionConfig: Protocol / Scheme / Domain / API URL +│ +├── envd/ # envd runtime layer +│ ├── client/ # Runtime Client (package client) +│ │ ├── client.go # Client struct: New / NewWithConfig +│ │ ├── config.go # Config & Options: Domain / Scheme / RuntimeToken / ... +│ │ ├── commands.go # Commands: Run / Start / Kill / SendStdin / List / ConnectToProcess +│ │ ├── command_handle.go # CommandHandle: Wait / Disconnect / Kill +│ │ └── filesystem.go # Filesystem: List / Exists / GetInfo / MakeDir / Rename / Remove +│ ├── process/ # protobuf generated code (envd Process gRPC) +│ │ ├── process.pb.go +│ │ └── processconnect/ +│ └── filesystem/ # protobuf generated code (envd Filesystem gRPC) +│ ├── filesystem.pb.go +│ └── filesystemconnect/ +│ +├── client/ # Auto-generated E2B REST API client (OpenAPI) +│ +├── example/ +│ ├── sandbox/main.go # Management Client example +│ └── envd_client/main.go # Runtime Client example +│ +├── README.md +└── README_zh-CH.md +``` + +### Key Relationships + +``` +┌──────────────────────────────────────────────────────┐ +│ sandbox.Sandbox │ +│ (Create / Connect / Pause / Kill + Protocol routing)│ +│ │ +│ embeds ──► envd/client.Client │ +│ (Commands + Files + Config) │ +│ │ +│ uses ────► client.* (E2B REST API) │ +└──────────────────────────────────────────────────────┘ + │ + ▼ +┌──────────────────────────────────────────────────────┐ +│ envd/client.Client │ +│ (Runtime Client, no lifecycle mgmt) │ +│ │ +│ Commands.Rpc ──► processconnect.ProcessClient │ +│ Files.Rpc ──► filesystemconnect.FilesystemClient │ +└──────────────────────────────────────────────────────┘ +``` + +- **`sandbox`** (Management Client) embeds `envd/client.Client`, adding lifecycle management and Protocol-based URL + routing on top +- **`envd/client`** (Runtime Client) can be used standalone — just provide a sandbox ID and Token + domain to operate a + running + sandbox directly +- **`Commands.Rpc`** / **`Files.Rpc`** allowing users to call native gRPC methods not covered by the + high-level API + +--- + +## Quick Start: sandbox (Management Client) + +```go +package main + +import ( + "context" + "fmt" + "log" + + "github.com/openkruise/agents-api/e2b/sandbox" +) + +func main() { + ctx := context.Background() + + sb, err := sandbox.Create(ctx, "code-interpreter", + sandbox.WithConfig( + sandbox.WithAPIKey("your-api-key"), + sandbox.WithDomain("your.domain.com"), + ), + ) + if err != nil { + log.Fatal(err) + } + defer sb.Close(ctx) + + res, _ := sb.Commands.Run(ctx, "echo hello") + fmt.Println(res.Stdout) + + sb.Files.MakeDir(ctx, "/tmp/demo") +} +``` + +[Full example](https://github.com/openkruise/agents-api/blob/master/e2b/example/sandbox/main.go) + +--- + +## Quick Start: envd/client (Runtime Client) + +When you already know a sandbox is running and don't need the management API to create/destroy it — just operate the +in-container environment directly: + +```go +package main + +import ( + "context" + "fmt" + + envdclient "github.com/openkruise/agents-api/e2b/envd/client" +) + +func main() { + ctx := context.Background() + + c := envdclient.New("your-sandbox-id", + envdclient.WithDomain("your.domain.com"), + envdclient.WithScheme("http"), + envdclient.WithRuntimeToken("your-runtime-token"), + ) + + res, _ := c.Commands.Run(ctx, "uname -a") + fmt.Println(res.Stdout) + + c.Files.MakeDir(ctx, "/tmp/demo") +} +``` + +[Full example](https://github.com/openkruise/agents-api/blob/master/e2b/example/envd_client/main.go) + +--- + +## Connection Configuration + +### sandbox Package: Scheme & Protocol + +Connection behavior in the sandbox package is controlled via `ConnectionConfig`, determined by two **orthogonal** +dimensions: **Scheme** and **Protocol**. + +#### Protocol (Routing Mode) + +| Value | Constant | API URL | Sandbox URL | +|----------------------|---------------------------|----------------------------------|-------------------------------------------------| +| **Native (default)** | `sandbox.ProtocolNative` | `https://api.` | `https://-.` | +| **Private** | `sandbox.ProtocolPrivate` | `:///kruise/api` | `:///kruise//` | + +- **Native**: Subdomain-based routing, for standard E2B public cloud deployments +- **Private**: Path-prefix-based routing (`/kruise/...`) through a unified gateway, for private deployments or local + port forwarding + +#### Scheme + +| Value | Use Case | +|-------------------------|----------------------------------------------------| +| **`"https"` (default)** | Production / public network | +| **`"http"`** | Local port forwarding, TLS-free intranet debugging | + +#### 4 Typical Combinations + +| Protocol | Scheme | Configuration | Use Case | +|----------|--------|--------------------------------------------------------|-----------------------------------------| +| Native | https | (all defaults) | Public SaaS / standard deployment | +| Private | https | `WithProtocol(ProtocolPrivate)` | Private gateway proxy | +| Private | http | `WithProtocol(ProtocolPrivate)` + `WithScheme("http")` | Local port-forward debugging | +| Native | http | `WithScheme("http")` | Subdomain deployment without TLS (rare) | + +#### ConnectionConfigOption List + +Applied via `sandbox.NewConnectionConfig(opts...)` or embedded in `Create/Connect` calls via `WithConfig(...)`: + +| Option | Description | +|---------------------------------------|---------------------------------------------------------------------------------| +| `WithAPIKey(key string)` | API Key, sent as `X-API-Key` header | +| `WithAccessToken(token string)` | OAuth2 Access Token (alternative to APIKey) | +| `WithDomain(domain string)` | Domain, default `e2b.app` | +| `WithScheme(scheme string)` | URL scheme, default `https` | +| `WithProtocol(p Protocol)` | Routing protocol, default `ProtocolNative` | +| `WithAPIURL(url string)` | **Highest priority**: overrides API base URL directly, bypasses Protocol/Domain | +| `WithSandboxBaseURL(url string)` | **Highest priority**: overrides sandbox envd base URL directly | +| `WithRequestTimeout(d time.Duration)` | HTTP request timeout, default 60s | +| `WithDebug(debug bool)` | Debug mode: skips certain API calls | + +#### Environment Variable Fallback + +| Variable | Field | +|--------------------|---------------------------------| +| `E2B_API_KEY` | APIKey | +| `E2B_ACCESS_TOKEN` | AccessToken | +| `E2B_DOMAIN` | Domain | +| `E2B_SCHEME` | Scheme | +| `E2B_PROTOCOL` | Protocol (`native` / `private`) | +| `E2B_API_URL` | APIURL | + +#### Priority + +`WithAPIURL` / `WithSandboxBaseURL` (explicit override) > `WithProtocol` + `WithDomain` composition > environment +variables > defaults + +--- + +### envd/client Package: Runtime Client Config + +The Runtime Client **does not involve Protocol** — only `Scheme` + `Domain` are needed to determine the envd +address (`://`). + +#### Option List + +| Option | Description | +|---------------------------------------|------------------------------------------------| +| `WithDomain(domain string)` | envd domain, default `e2b.app` | +| `WithScheme(scheme string)` | URL scheme, default `https` | +| `WithRuntimeToken(token string)` | Runtime token, sent as `X-Access-Token` header | +| `WithEnvdPort(port int)` | envd port, default `49983` | +| `WithAPIKey(apiKey string)` | Optional API Key (when ingress validates it) | +| `WithAuthHeader(header string)` | Override default Authorization header | +| `WithSandboxBaseURL(url string)` | Fully override URL composition | +| `WithHeader(key, value string)` | Add a single custom header | +| `WithHeaders(headers map)` | Merge multiple custom headers | +| `WithRequestTimeout(d time.Duration)` | HTTP timeout, default 60s | + +--- + +## Create / Connect Sandbox + +### `Create(ctx, template, opts...) (*Sandbox, error)` + +Creates a new sandbox from a template. Defaults to `"code-interpreter"` when template is empty. + +```go +sb, err := sandbox.Create(ctx, "code-interpreter", +sandbox.WithConfig( +sandbox.WithAPIKey("xxx"), +sandbox.WithDomain("example.com"), +sandbox.WithProtocol(sandbox.ProtocolPrivate), +), +sandbox.WithTimeout(600), +sandbox.WithMetadata(map[string]string{"k": "v"}), +sandbox.WithEnvVars(map[string]string{"FOO": "1"}), +sandbox.WithAutoPause(true), +sandbox.WithSecure(true), +) +``` + +### `Connect(ctx, sandboxID, opts...) (*Sandbox, error)` + +Connects to an existing (including paused) sandbox. Automatically resumes if paused. + +```go +sb, err := sandbox.Connect(ctx, "default--xxx-xxx", +sandbox.WithConfig(sandbox.WithAPIKey("xxx"), sandbox.WithDomain("example.com")), +) +``` + +### SandboxOption List + +| Option | Description | +|------------------------------|-------------------------------------------------| +| `WithConfig(opts...)` | Embed a set of `ConnectionConfigOption` | +| `WithTimeout(seconds int32)` | Sandbox lifetime timeout, default 300 seconds | +| `WithMetadata(map)` | Sandbox metadata | +| `WithEnvVars(map)` | Environment variables injected into the sandbox | +| `WithAutoPause(bool)` | Whether to enable auto-pause | +| `WithSecure(bool)` | Enable secure mode | + +### Sandbox Instance Methods + +| Method | Description | +|----------------------------------------|------------------------------------------| +| `SandboxID() string` | Returns the sandbox ID | +| `TemplateID() string` | Returns the template ID | +| `GetInfo(ctx) (*SandboxInfo, error)` | Gets sandbox details | +| `SetTimeout(ctx, timeout int32) error` | Updates the timeout | +| `Pause(ctx) (string, error)` | Pauses the sandbox | +| `Kill(ctx) (bool, error)` | Destroys the sandbox | +| `Close(ctx) error` | Alias for `Kill`, convenient for `defer` | + +`Sandbox` exposes two sub-modules: + +- `sb.Commands` — command execution (`*Commands`) +- `sb.Files` — filesystem operations (`*Filesystem`) + +--- + +## Sandbox Management API (SandboxApi) + +`SandboxApi` is the low-level REST client that can be used independently without creating a `Sandbox` instance (e.g., to +list all sandboxes). + +```go +api := sandbox.NewSandboxApi(sandbox.NewConnectionConfig( +sandbox.WithAPIKey("xxx"), +sandbox.WithDomain("example.com"), +)) +``` + +| Method | Description | +|------------------------------------------------------------------------------|-------------------------------------------------------------| +| `List(ctx) ([]SandboxInfo, error)` | Lists all running sandboxes | +| `GetInfo(ctx, sandboxID) (*SandboxInfo, error)` | Gets sandbox details; returns `not found` error on 404 | +| `Kill(ctx, sandboxID) (bool, error)` | Destroys a sandbox; returns `true` directly in `Debug` mode | +| `SetTimeout(ctx, sandboxID, timeout int32) error` | Updates the timeout | +| `CreateSandbox(ctx, opts CreateSandboxOpts) (*SandboxCreateResponse, error)` | Low-level create API | +| `ConnectSandbox(ctx, sandboxID, timeout int32) (*client.Sandbox, error)` | Low-level connect API (auto-resumes paused sandboxes) | +| `Pause(ctx, sandboxID) (string, error)` | Pauses a sandbox | + +### `SandboxInfo` Fields + +```go +type SandboxInfo struct { +SandboxID string +TemplateID string +Alias string +ClientID string +StartedAt time.Time +EndAt time.Time +CpuCount int32 +MemoryMB int32 +DiskSizeMB int32 +EnvdVersion string +Metadata map[string]string +State string +} +``` + +--- + +## Command Execution (Commands) + +Operate in-container processes via `sb.Commands` (sandbox mode) or `c.Commands` (direct mode). Backed by +envd's `Process` gRPC service. + +### Methods + +| Method | Description | +|-------------------------------------------------------------|-----------------------------------------------------------------------------------------------------| +| `Run(ctx, cmd, opts...) (*CommandResult, error)` | **Foreground execution**: starts a command and waits for completion, returns stdout/stderr/exitCode | +| `Start(ctx, cmd, opts...) (*CommandHandle, error)` | **Background start**: returns a handle, caller decides when to `Wait` | +| `List(ctx) ([]ProcessInfo, error)` | Lists all running processes | +| `Kill(ctx, pid uint32) (bool, error)` | Sends SIGKILL to the given PID; returns `false, nil` if process doesn't exist | +| `SendStdin(ctx, pid uint32, data string) error` | Writes data to a process's stdin | +| `ConnectToProcess(ctx, pid uint32) (*CommandHandle, error)` | Reconnects to a running process, subscribing to its subsequent output | + +### `RunOpts` Fields + +```go +type RunOpts struct { +Envs map[string]string // Process environment variables +Cwd string // Working directory +Stdin bool // Whether to allow SendStdin +Background bool // Background execution (reserved) +OnStdout func (string) // Streaming stdout callback (foreground only) +OnStderr func (string) // Streaming stderr callback (foreground only) +} +``` + +> Commands are executed via `/bin/bash -l -c `, preserving the login environment. + +### `CommandHandle` + +Returned by `Start` / `ConnectToProcess` for interaction or waiting: + +| Method | Description | +|----------------------------------------------------|--------------------------------------------------------------------------| +| `Pid() uint32` | Returns the process PID | +| `Wait(onStdout, onStderr) (*CommandResult, error)` | Blocks until completion; non-zero exit code includes `*CommandExitError` | +| `Disconnect()` | Disconnects from the stream **without killing** the process | +| `Kill() bool` | Kills the process | + +### `CommandResult` / `CommandExitError` + +```go +type CommandResult struct { +Stdout string +Stderr string +ExitCode int32 +Error string +} + +// Returned when exit code is non-zero (alongside *CommandResult) +type CommandExitError struct { +Stdout, Stderr string +ExitCode int32 +ErrorMessage string +} +``` + +### Example + +```go +// Foreground execution with streaming output +res, err := sb.Commands.Run(ctx, "ls -la /tmp", envdclient.RunOpts{ +Cwd: "/tmp", +Envs: map[string]string{"LANG": "C"}, +OnStdout: func (line string) { fmt.Print(line) }, +}) + +// Background start + manual Kill +h, _ := sb.Commands.Start(ctx, "sleep 60") +fmt.Println("pid =", h.Pid()) +h.Kill() +``` + +--- + +## Filesystem + +Operate in-container files via `sb.Files` (sandbox mode) or `c.Files` (direct mode). Wraps the official envd Filesystem +gRPC service. + +### Methods + +| Method | Description | +|-----------------------------------------------------|-------------------------------------------------------------------------| +| `List(ctx, path, depth...) ([]EntryInfo, error)` | Lists directory entries; `depth` defaults to 1 | +| `Exists(ctx, path) (bool, error)` | Checks if a path exists (via `Stat`, returns false on 404) | +| `GetInfo(ctx, path) (*EntryInfo, error)` | Gets file/directory info | +| `MakeDir(ctx, path) (bool, error)` | Creates a directory recursively; returns `false, nil` if already exists | +| `Rename(ctx, oldPath, newPath) (*EntryInfo, error)` | Renames/moves a file or directory | +| `Remove(ctx, path) error` | Removes a file or directory | + +### `EntryInfo` Fields + +```go +type EntryInfo struct { +Name string +Type EntryType // "file" / "directory" / "symlink" +Path string +Size int64 +Mode uint32 +Permissions string +Owner string +Group string +ModifiedTime time.Time +SymlinkTarget *string +} +``` + +### Example + +```go +c.Files.MakeDir(ctx, "/tmp/work") + +entries, _ := c.Files.List(ctx, "/tmp") +for _, e := range entries { +fmt.Printf("%s %s (%d bytes)\n", e.Type, e.Name, e.Size) +} + +c.Files.Rename(ctx, "/tmp/work", "/tmp/done") +c.Files.Remove(ctx, "/tmp/done") +``` + +--- + +## Full Examples + +### sandbox Mode (Management Client) + +```go +package main + +import ( + "context" + "fmt" + "log" + + "github.com/openkruise/agents-api/e2b/sandbox" +) + +func main() { + ctx := context.Background() + + sb, err := sandbox.Create(ctx, "code-interpreter", + sandbox.WithConfig( + sandbox.WithAPIKey("your-api-key"), + sandbox.WithDomain("your.domain.com"), + sandbox.WithProtocol(sandbox.ProtocolPrivate), + ), + sandbox.WithTimeout(600), + ) + if err != nil { + log.Fatal(err) + } + defer sb.Close(ctx) + + fmt.Println("sandbox:", sb.SandboxID()) + + if res, err := sb.Commands.Run(ctx, "uname -a"); err == nil { + fmt.Println(res.Stdout) + } + + sb.Files.MakeDir(ctx, "/tmp/demo") +} +``` + +### envd/client Mode (Runtime Client) + +```go +package main + +import ( + "context" + "fmt" + + envdclient "github.com/openkruise/agents-api/e2b/envd/client" +) + +func main() { + ctx := context.Background() + + c := envdclient.New("your-sandbox-id", + envdclient.WithDomain("your.domain.com"), + envdclient.WithScheme("http"), + envdclient.WithRuntimeToken("your-runtime-token"), + ) + + if res, err := c.Commands.Run(ctx, "uname -a"); err == nil { + fmt.Println(res.Stdout) + } + + c.Files.MakeDir(ctx, "/tmp/demo") +} +``` + +For more complete demos, see: + +- [Management Client example](https://github.com/openkruise/agents-api/blob/master/e2b/example/sandbox/main.go) +- [Runtime Client example](https://github.com/openkruise/agents-api/blob/master/e2b/example/envd_client/main.go) diff --git a/e2b/README_zh-CH.md b/e2b/README_zh-CH.md new file mode 100644 index 0000000..ba01820 --- /dev/null +++ b/e2b/README_zh-CH.md @@ -0,0 +1,535 @@ +# E2B Sandbox Go SDK + +本包提供两种使用方式操作 E2B Sandbox 内的环境: + +| 包 | 导入路径 | 定位 | +|-----------------|----------------------------------------------------|---------------------------------------------------------------------------------------------------------------------| +| **sandbox** | `github.com/openkruise/agents-api/e2b/sandbox` | **管理客户端(Management Client)**:Sandbox 生命周期管理(Create / Connect / Pause / Kill)+ 容器内操作(Commands / Files),走 Protocol 路由 | +| **envd/client** | `github.com/openkruise/agents-api/e2b/envd/client` | **运行时客户端(Runtime Client)**:直接操作运行中的沙箱容器内的 envd 服务,进行命令执行和文件操作,不涉及生命周期管理 | + +> 两者共享同一套 Commands / Filesystem 底层实现,区别仅在**是否经过 Protocol 路由和管理 API**。 + +--- + +## 包结构 + +``` +e2b/ +├── sandbox/ # 管理客户端(package sandbox) +│ ├── sandbox.go # Sandbox 结构体:Create / Connect / Pause / Kill +│ ├── sandbox_api.go # 底层 REST 客户端(SandboxApi):List / GetInfo / Kill / ... +│ └── config.go # ConnectionConfig:Protocol / Scheme / Domain / API URL +│ +├── envd/ # envd 运行时层 +│ ├── client/ # 运行时客户端(package client) +│ │ ├── client.go # Client 结构体:New / NewWithConfig +│ │ ├── config.go # Config 与 Options:Domain / Scheme / RuntimeToken / ... +│ │ ├── commands.go # Commands:Run / Start / Kill / SendStdin / List / ConnectToProcess +│ │ ├── command_handle.go # CommandHandle:Wait / Disconnect / Kill +│ │ └── filesystem.go # Filesystem:List / Exists / GetInfo / MakeDir / Rename / Remove +│ ├── process/ # protobuf 生成代码(envd Process gRPC) +│ │ ├── process.pb.go +│ │ └── processconnect/ +│ └── filesystem/ # protobuf 生成代码(envd Filesystem gRPC) +│ ├── filesystem.pb.go +│ └── filesystemconnect/ +│ +├── client/ # 自动生成的 E2B REST API 客户端(OpenAPI) +│ +├── example/ +│ ├── sandbox/main.go # 管理客户端示例 +│ └── envd_client/main.go # 运行时客户端示例 +│ +├── README.md +└── README_zh-CH.md +``` + +### 核心关系 + +``` +┌──────────────────────────────────────────────────────┐ +│ sandbox.Sandbox │ +│ (Create / Connect / Pause / Kill + Protocol 路由) │ +│ │ +│ 嵌入 ──► envd/client.Client │ +│ (Commands + Files + Config) │ +│ │ +│ 使用 ──► client.*(E2B REST API) │ +└──────────────────────────────────────────────────────┘ + │ + ▼ +┌──────────────────────────────────────────────────────┐ +│ envd/client.Client │ +│ (运行时客户端,不涉及生命周期管理) │ +│ │ +│ Commands.Rpc ──► processconnect.ProcessClient │ +│ Files.Rpc ──► filesystemconnect.FilesystemClient │ +└──────────────────────────────────────────────────────┘ +``` + +- **`sandbox`**(管理客户端)嵌入了 `envd/client.Client`,在其基础上增加了生命周期管理和 Protocol 路由 +- **`envd/client`**(运行时客户端)可独立使用 —— 只需提供 sandbox ID 和 token + 域名即可直接操作运行中的沙箱 +- **`Commands.Rpc`** / **`Files.Rpc`** 已导出,用户可直接调用高层 API 未覆盖的原生 gRPC 方法 + +--- + +## 快速开始:sandbox(管理客户端) + +```go +package main + +import ( + "context" + "fmt" + "log" + + "github.com/openkruise/agents-api/e2b/sandbox" +) + +func main() { + ctx := context.Background() + + sb, err := sandbox.Create(ctx, "code-interpreter", + sandbox.WithConfig( + sandbox.WithAPIKey("your-api-key"), + sandbox.WithDomain("your.domain.com"), + ), + ) + if err != nil { + log.Fatal(err) + } + defer sb.Close(ctx) + + res, _ := sb.Commands.Run(ctx, "echo hello") + fmt.Println(res.Stdout) + + sb.Files.MakeDir(ctx, "/tmp/demo") +} +``` + +[完整示例](https://github.com/openkruise/agents-api/blob/master/e2b/example/sandbox/main.go) + +--- + +## 快速开始:envd/client(运行时客户端) + +当你已经知道 sandbox 正在运行,不需要通过管理 API 创建/销毁,只想直接操作容器内环境时: + +```go +package main + +import ( + "context" + "fmt" + + "github.com/openkruise/agents-api/e2b/envd/client" +) + +func main() { + ctx := context.Background() + + c := client.New("your-sandbox-id", + client.WithDomain("your.domain.com"), + client.WithScheme("http"), + client.WithRuntimeToken("your-runtime-token"), + ) + + res, _ := c.Commands.Run(ctx, "uname -a") + fmt.Println(res.Stdout) + + c.Files.MakeDir(ctx, "/tmp/demo") +} +``` + +[完整示例](https://github.com/openkruise/agents-api/blob/master/e2b/example/envd_client/main.go) + +--- + +## 连接配置 + +### sandbox 包:Scheme 与 Protocol + +sandbox 包的连接行为通过 `ConnectionConfig` 控制,由 **Scheme** 和 **Protocol** 两个正交维度决定 URL 形态。 + +#### Protocol(路由协议) + +| 值 | 常量 | API URL | Sandbox URL | +|----------------|---------------------------|----------------------------------|-------------------------------------------------| +| **Native(默认)** | `sandbox.ProtocolNative` | `https://api.` | `https://-.` | +| **Private** | `sandbox.ProtocolPrivate` | `:///kruise/api` | `:///kruise//` | + +- **Native**:基于子域名路由,对应 E2B 原生公网部署 +- **Private**:基于路径前缀(`/kruise/...`)通过统一网关路由,适用于私有化或本地端口转发场景 + +#### Scheme(协议头) + +| 值 | 适用场景 | +|-------------------|-------------------| +| **`"https"`(默认)** | 生产环境 / 公网 | +| **`"http"`** | 本地端口转发、内网无 TLS 调试 | + +#### 4 种典型组合 + +| Protocol | Scheme | 配置示例 | 用途 | +|----------|--------|--------------------------------------------------------|-------------------| +| Native | https | (全部使用默认) | 公网 SaaS / 标准部署 | +| Private | https | `WithProtocol(ProtocolPrivate)` | 私有化网关代理 | +| Private | http | `WithProtocol(ProtocolPrivate)` + `WithScheme("http")` | 本地端口转发调试 | +| Native | http | `WithScheme("http")` | 不带 TLS 的子域名部署(少见) | + +#### ConnectionConfigOption 列表 + +通过 `sandbox.NewConnectionConfig(opts...)` 或在 `Create/Connect` 中嵌入 `WithConfig(...)` 应用: + +| 选项 | 说明 | +|---------------------------------------|---------------------------------------------------| +| `WithAPIKey(key string)` | API Key,写入请求头 `X-API-Key` | +| `WithAccessToken(token string)` | OAuth2 Access Token(与 APIKey 二选一) | +| `WithDomain(domain string)` | 域名,默认 `e2b.app` | +| `WithScheme(scheme string)` | URL scheme,默认 `https` | +| `WithProtocol(p Protocol)` | 路由协议,默认 `ProtocolNative` | +| `WithAPIURL(url string)` | **最高优先级**:直接覆盖 API base URL,绕过 Protocol/Domain 拼装 | +| `WithSandboxBaseURL(url string)` | **最高优先级**:直接覆盖 sandbox envd base URL | +| `WithRequestTimeout(d time.Duration)` | HTTP 请求超时,默认 60s | +| `WithDebug(debug bool)` | 调试模式:跳过部分 API 调用 | + +#### 环境变量回退 + +| 环境变量 | 对应字段 | +|--------------------|--------------------------------| +| `E2B_API_KEY` | APIKey | +| `E2B_ACCESS_TOKEN` | AccessToken | +| `E2B_DOMAIN` | Domain | +| `E2B_SCHEME` | Scheme | +| `E2B_PROTOCOL` | Protocol(`native` / `private`) | +| `E2B_API_URL` | APIURL | + +#### 优先级 + +`WithAPIURL` / `WithSandboxBaseURL`(显式覆盖) > `WithProtocol` + `WithDomain` 拼装 > 环境变量 > 默认值 + +--- + +### envd/client 包:运行时客户端配置 + +运行时客户端**不涉及 Protocol**,只需 `Scheme` + `Domain` 即可确定 envd 地址(`://`)。 + +#### Option 列表 + +| 选项 | 说明 | +|---------------------------------------|----------------------------------| +| `WithDomain(domain string)` | envd 域名,默认 `e2b.app` | +| `WithScheme(scheme string)` | URL scheme,默认 `https` | +| `WithRuntimeToken(token string)` | 运行时 Token,写入请求头 `X-Access-Token` | +| `WithEnvdPort(port int)` | envd 端口,默认 `49983` | +| `WithAPIKey(apiKey string)` | 可选 API Key(当 ingress 校验时使用) | +| `WithAuthHeader(header string)` | 覆盖默认的 Authorization 头 | +| `WithSandboxBaseURL(url string)` | 完全覆盖 URL 拼装 | +| `WithHeader(key, value string)` | 添加单个自定义 header | +| `WithHeaders(headers map)` | 合并多个自定义 headers | +| `WithRequestTimeout(d time.Duration)` | HTTP 超时,默认 60s | + +--- + +## 创建 / 连接 Sandbox + +### `Create(ctx, template, opts...) (*Sandbox, error)` + +从一个模板创建新 sandbox。`template` 为空时默认 `"code-interpreter"`。 + +```go +sb, err := sandbox.Create(ctx, "code-interpreter", +sandbox.WithConfig( +sandbox.WithAPIKey("xxx"), +sandbox.WithDomain("example.com"), +sandbox.WithProtocol(sandbox.ProtocolPrivate), +), +sandbox.WithTimeout(600), +sandbox.WithMetadata(map[string]string{"k": "v"}), +sandbox.WithEnvVars(map[string]string{"FOO": "1"}), +sandbox.WithAutoPause(true), +sandbox.WithSecure(true), +) +``` + +### `Connect(ctx, sandboxID, opts...) (*Sandbox, error)` + +连接到已存在(含暂停状态)的 sandbox,会自动唤醒。 + +```go +sb, err := sandbox.Connect(ctx, "default--xxx-xxx", +sandbox.WithConfig(sandbox.WithAPIKey("xxx"), sandbox.WithDomain("example.com")), +) +``` + +### SandboxOption 列表 + +| 选项 | 说明 | +|------------------------------|-------------------------------| +| `WithConfig(opts...)` | 内嵌一组 `ConnectionConfigOption` | +| `WithTimeout(seconds int32)` | sandbox 存活超时,默认 300 秒 | +| `WithMetadata(map)` | sandbox 元数据 | +| `WithEnvVars(map)` | 注入 sandbox 的环境变量 | +| `WithAutoPause(bool)` | 是否启用自动暂停 | +| `WithSecure(bool)` | 启用安全模式 | + +### Sandbox 实例方法 + +| 方法 | 说明 | +|----------------------------------------|--------------------------| +| `SandboxID() string` | 返回 sandbox ID | +| `TemplateID() string` | 返回模板 ID | +| `GetInfo(ctx) (*SandboxInfo, error)` | 获取 sandbox 详情 | +| `SetTimeout(ctx, timeout int32) error` | 修改超时时间 | +| `Pause(ctx) (string, error)` | 暂停 | +| `Kill(ctx) (bool, error)` | 销毁 | +| `Close(ctx) error` | `Kill` 的别名,方便 `defer` 使用 | + +`Sandbox` 暴露两个子模块: + +- `sb.Commands` — 命令执行(`*Commands`) +- `sb.Files` — 文件系统(`*Filesystem`) + +--- + +## Sandbox 管理 API(SandboxApi) + +`SandboxApi` 是底层 REST 客户端,可在不创建具体 Sandbox 实例时单独使用(例如列出所有 sandbox)。 + +```go +api := sandbox.NewSandboxApi(sandbox.NewConnectionConfig( +sandbox.WithAPIKey("xxx"), +sandbox.WithDomain("example.com"), +)) +``` + +| 方法 | 说明 | +|------------------------------------------------------------------------------|-------------------------------------| +| `List(ctx) ([]SandboxInfo, error)` | 列出所有运行中的 sandbox | +| `GetInfo(ctx, sandboxID) (*SandboxInfo, error)` | 获取 sandbox 详情,404 返回 `not found` 错误 | +| `Kill(ctx, sandboxID) (bool, error)` | 销毁 sandbox;`Debug` 模式下直接返回 `true` | +| `SetTimeout(ctx, sandboxID, timeout int32) error` | 修改超时时间 | +| `CreateSandbox(ctx, opts CreateSandboxOpts) (*SandboxCreateResponse, error)` | 底层创建接口 | +| `ConnectSandbox(ctx, sandboxID, timeout int32) (*client.Sandbox, error)` | 底层连接接口(自动唤醒暂停态) | +| `Pause(ctx, sandboxID) (string, error)` | 暂停 sandbox | + +### `SandboxInfo` 字段 + +```go +type SandboxInfo struct { +SandboxID string +TemplateID string +Alias string +ClientID string +StartedAt time.Time +EndAt time.Time +CpuCount int32 +MemoryMB int32 +DiskSizeMB int32 +EnvdVersion string +Metadata map[string]string +State string +} +``` + +--- + +## 命令执行(Commands) + +通过 `sb.Commands`(sandbox 模式)或 `c.Commands`(直连模式)操作容器内进程。底层走 envd 的 `Process` gRPC 服务。 + +### 方法 + +| 方法 | 说明 | +|-------------------------------------------------------------|----------------------------------------------| +| `Run(ctx, cmd, opts...) (*CommandResult, error)` | **前台执行**:启动命令并等待完成,返回 stdout/stderr/exitCode | +| `Start(ctx, cmd, opts...) (*CommandHandle, error)` | **后台启动**:返回 handle,调用方决定何时 `Wait` | +| `List(ctx) ([]ProcessInfo, error)` | 列出所有运行中的进程 | +| `Kill(ctx, pid uint32) (bool, error)` | 向指定 PID 发送 SIGKILL;进程已不存在返回 `false, nil` | +| `SendStdin(ctx, pid uint32, data string) error` | 向指定进程的 stdin 写入数据 | +| `ConnectToProcess(ctx, pid uint32) (*CommandHandle, error)` | 重新连接到一个已运行的进程,订阅其后续输出 | + +### `RunOpts` 字段 + +```go +type RunOpts struct { +Envs map[string]string // 进程环境变量 +Cwd string // 工作目录 +Stdin bool // 是否允许通过 SendStdin 写入 +Background bool // 后台执行(保留字段) +OnStdout func (string) // 流式 stdout 回调(前台执行) +OnStderr func (string) // 流式 stderr 回调(前台执行) +} +``` + +> 命令统一通过 `/bin/bash -l -c ` 执行,保留登录环境。 + +### `CommandHandle` + +由 `Start` / `ConnectToProcess` 返回,用于交互或等待: + +| 方法 | 说明 | +|----------------------------------------------------|---------------------------------------| +| `Pid() uint32` | 返回进程 PID | +| `Wait(onStdout, onStderr) (*CommandResult, error)` | 阻塞等待结束;非 0 退出码会附带 `*CommandExitError` | +| `Disconnect()` | 断开订阅但**不杀进程** | +| `Kill() bool` | 杀掉进程 | + +### `CommandResult` / `CommandExitError` + +```go +type CommandResult struct { +Stdout string +Stderr string +ExitCode int32 +Error string +} + +// 退出码非 0 时返回此错误(同时返回 *CommandResult) +type CommandExitError struct { +Stdout, Stderr string +ExitCode int32 +ErrorMessage string +} +``` + +### 示例 + +```go +// 前台执行 + 流式输出 +res, err := sb.Commands.Run(ctx, "ls -la /tmp", client.RunOpts{ +Cwd: "/tmp", +Envs: map[string]string{"LANG": "C"}, +OnStdout: func (line string) { fmt.Print(line) }, +}) + +// 后台启动 + 主动 Kill +h, _ := sb.Commands.Start(ctx, "sleep 60") +fmt.Println("pid =", h.Pid()) +h.Kill() +``` + +--- + +## 文件系统(Filesystem) + +通过 `sb.Files`(sandbox 模式)或 `c.Files`(直连模式)操作容器内文件。仅封装官方 envd Filesystem gRPC 提供的能力。 + +### 方法 + +| 方法 | 说明 | +|-----------------------------------------------------|--------------------------------| +| `List(ctx, path, depth...) ([]EntryInfo, error)` | 列出目录条目;`depth` 默认 1 | +| `Exists(ctx, path) (bool, error)` | 路径是否存在(基于 `Stat`,404 返回 false) | +| `GetInfo(ctx, path) (*EntryInfo, error)` | 获取文件 / 目录信息 | +| `MakeDir(ctx, path) (bool, error)` | 递归创建目录;已存在返回 `false, nil` | +| `Rename(ctx, oldPath, newPath) (*EntryInfo, error)` | 重命名 / 移动 | +| `Remove(ctx, path) error` | 删除文件或目录 | + +### `EntryInfo` 字段 + +```go +type EntryInfo struct { +Name string +Type EntryType // "file" / "directory" / "symlink" +Path string +Size int64 +Mode uint32 +Permissions string +Owner string +Group string +ModifiedTime time.Time +SymlinkTarget *string +} +``` + +### 示例 + +```go +c.Files.MakeDir(ctx, "/tmp/work") + +entries, _ := c.Files.List(ctx, "/tmp") +for _, e := range entries { +fmt.Printf("%s %s (%d bytes)\n", e.Type, e.Name, e.Size) +} + +c.Files.Rename(ctx, "/tmp/work", "/tmp/done") +c.Files.Remove(ctx, "/tmp/done") +``` + +--- + +## 完整示例 + +### sandbox 模式(管理客户端) + +```go +package main + +import ( + "context" + "fmt" + "log" + + "github.com/openkruise/agents-api/e2b/sandbox" +) + +func main() { + ctx := context.Background() + + sb, err := sandbox.Create(ctx, "code-interpreter", + sandbox.WithConfig( + sandbox.WithAPIKey("your-api-key"), + sandbox.WithDomain("your.domain.com"), + sandbox.WithProtocol(sandbox.ProtocolPrivate), + ), + sandbox.WithTimeout(600), + ) + if err != nil { + log.Fatal(err) + } + defer sb.Close(ctx) + + fmt.Println("sandbox:", sb.SandboxID()) + + if res, err := sb.Commands.Run(ctx, "uname -a"); err == nil { + fmt.Println(res.Stdout) + } + + sb.Files.MakeDir(ctx, "/tmp/demo") +} +``` + +### envd/client 模式(运行时客户端) + +```go +package main + +import ( + "context" + "fmt" + + "github.com/openkruise/agents-api/e2b/envd/client" +) + +func main() { + ctx := context.Background() + + c := client.New("your-sandbox-id", + client.WithDomain("your.domain.com"), + client.WithScheme("http"), + client.WithRuntimeToken("your-runtime-token"), + ) + + if res, err := c.Commands.Run(ctx, "uname -a"); err == nil { + fmt.Println(res.Stdout) + } + + c.Files.MakeDir(ctx, "/tmp/demo") +} +``` + +更完整的演示可参考: + +- [管理客户端示例](https://github.com/openkruise/agents-api/blob/master/e2b/example/sandbox/main.go) +- [运行时客户端示例](https://github.com/openkruise/agents-api/blob/master/e2b/example/envd_client/main.go) diff --git a/e2b/client/api_access_tokens.go b/e2b/client/api_access_tokens.go new file mode 100644 index 0000000..1ed3db9 --- /dev/null +++ b/e2b/client/api_access_tokens.go @@ -0,0 +1,338 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +type AccessTokensApi interface { + + /* + AccessTokensAccessTokenIDDelete Method for AccessTokensAccessTokenIDDelete + + Delete an access token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param accessTokenID + @return ApiAccessTokensAccessTokenIDDeleteRequest + */ + AccessTokensAccessTokenIDDelete(ctx context.Context, accessTokenID string) ApiAccessTokensAccessTokenIDDeleteRequest + + // AccessTokensAccessTokenIDDeleteExecute executes the request + AccessTokensAccessTokenIDDeleteExecute(r ApiAccessTokensAccessTokenIDDeleteRequest) (*http.Response, error) + + /* + AccessTokensPost Method for AccessTokensPost + + Create a new access token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiAccessTokensPostRequest + */ + AccessTokensPost(ctx context.Context) ApiAccessTokensPostRequest + + // AccessTokensPostExecute executes the request + // @return CreatedAccessToken + AccessTokensPostExecute(r ApiAccessTokensPostRequest) (*CreatedAccessToken, *http.Response, error) +} + +// AccessTokensApiService AccessTokensApi service +type AccessTokensApiService service + +type ApiAccessTokensAccessTokenIDDeleteRequest struct { + ctx context.Context + ApiService AccessTokensApi + accessTokenID string +} + +func (r ApiAccessTokensAccessTokenIDDeleteRequest) Execute() (*http.Response, error) { + return r.ApiService.AccessTokensAccessTokenIDDeleteExecute(r) +} + +/* +AccessTokensAccessTokenIDDelete Method for AccessTokensAccessTokenIDDelete + +Delete an access token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param accessTokenID + @return ApiAccessTokensAccessTokenIDDeleteRequest +*/ +func (a *AccessTokensApiService) AccessTokensAccessTokenIDDelete(ctx context.Context, accessTokenID string) ApiAccessTokensAccessTokenIDDeleteRequest { + return ApiAccessTokensAccessTokenIDDeleteRequest{ + ApiService: a, + ctx: ctx, + accessTokenID: accessTokenID, + } +} + +// Execute executes the request +func (a *AccessTokensApiService) AccessTokensAccessTokenIDDeleteExecute(r ApiAccessTokensAccessTokenIDDeleteRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AccessTokensApiService.AccessTokensAccessTokenIDDelete") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/access-tokens/{accessTokenID}" + localVarPath = strings.Replace(localVarPath, "{"+"accessTokenID"+"}", url.PathEscape(parameterValueToString(r.accessTokenID, "accessTokenID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiAccessTokensPostRequest struct { + ctx context.Context + ApiService AccessTokensApi + newAccessToken *NewAccessToken +} + +func (r ApiAccessTokensPostRequest) NewAccessToken(newAccessToken NewAccessToken) ApiAccessTokensPostRequest { + r.newAccessToken = &newAccessToken + return r +} + +func (r ApiAccessTokensPostRequest) Execute() (*CreatedAccessToken, *http.Response, error) { + return r.ApiService.AccessTokensPostExecute(r) +} + +/* +AccessTokensPost Method for AccessTokensPost + +Create a new access token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiAccessTokensPostRequest +*/ +func (a *AccessTokensApiService) AccessTokensPost(ctx context.Context) ApiAccessTokensPostRequest { + return ApiAccessTokensPostRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return CreatedAccessToken +func (a *AccessTokensApiService) AccessTokensPostExecute(r ApiAccessTokensPostRequest) (*CreatedAccessToken, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreatedAccessToken + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AccessTokensApiService.AccessTokensPost") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/access-tokens" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.newAccessToken == nil { + return localVarReturnValue, nil, reportError("newAccessToken is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.newAccessToken + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/e2b/client/api_admin.go b/e2b/client/api_admin.go new file mode 100644 index 0000000..3328e7a --- /dev/null +++ b/e2b/client/api_admin.go @@ -0,0 +1,675 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +type AdminApi interface { + + /* + AdminTeamsTeamIDSandboxesKillPost Kill all sandboxes for a team + + Kills all sandboxes for the specified team + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param teamID Team ID + @return ApiAdminTeamsTeamIDSandboxesKillPostRequest + */ + AdminTeamsTeamIDSandboxesKillPost(ctx context.Context, teamID string) ApiAdminTeamsTeamIDSandboxesKillPostRequest + + // AdminTeamsTeamIDSandboxesKillPostExecute executes the request + // @return AdminSandboxKillResult + AdminTeamsTeamIDSandboxesKillPostExecute(r ApiAdminTeamsTeamIDSandboxesKillPostRequest) (*AdminSandboxKillResult, *http.Response, error) + + /* + NodesGet Method for NodesGet + + List all nodes + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiNodesGetRequest + */ + NodesGet(ctx context.Context) ApiNodesGetRequest + + // NodesGetExecute executes the request + // @return []NodesGet200ResponseInner + NodesGetExecute(r ApiNodesGetRequest) ([]NodesGet200ResponseInner, *http.Response, error) + + /* + NodesNodeIDGet Method for NodesNodeIDGet + + Get node info + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param nodeID + @return ApiNodesNodeIDGetRequest + */ + NodesNodeIDGet(ctx context.Context, nodeID string) ApiNodesNodeIDGetRequest + + // NodesNodeIDGetExecute executes the request + // @return NodeDetail + NodesNodeIDGetExecute(r ApiNodesNodeIDGetRequest) (*NodeDetail, *http.Response, error) + + /* + NodesNodeIDPost Method for NodesNodeIDPost + + Change status of a node + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param nodeID + @return ApiNodesNodeIDPostRequest + */ + NodesNodeIDPost(ctx context.Context, nodeID string) ApiNodesNodeIDPostRequest + + // NodesNodeIDPostExecute executes the request + NodesNodeIDPostExecute(r ApiNodesNodeIDPostRequest) (*http.Response, error) +} + +// AdminApiService AdminApi service +type AdminApiService service + +type ApiAdminTeamsTeamIDSandboxesKillPostRequest struct { + ctx context.Context + ApiService AdminApi + teamID string +} + +func (r ApiAdminTeamsTeamIDSandboxesKillPostRequest) Execute() (*AdminSandboxKillResult, *http.Response, error) { + return r.ApiService.AdminTeamsTeamIDSandboxesKillPostExecute(r) +} + +/* +AdminTeamsTeamIDSandboxesKillPost Kill all sandboxes for a team + +Kills all sandboxes for the specified team + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param teamID Team ID + @return ApiAdminTeamsTeamIDSandboxesKillPostRequest +*/ +func (a *AdminApiService) AdminTeamsTeamIDSandboxesKillPost(ctx context.Context, teamID string) ApiAdminTeamsTeamIDSandboxesKillPostRequest { + return ApiAdminTeamsTeamIDSandboxesKillPostRequest{ + ApiService: a, + ctx: ctx, + teamID: teamID, + } +} + +// Execute executes the request +// +// @return AdminSandboxKillResult +func (a *AdminApiService) AdminTeamsTeamIDSandboxesKillPostExecute(r ApiAdminTeamsTeamIDSandboxesKillPostRequest) (*AdminSandboxKillResult, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AdminSandboxKillResult + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AdminApiService.AdminTeamsTeamIDSandboxesKillPost") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admin/teams/{teamID}/sandboxes/kill" + localVarPath = strings.Replace(localVarPath, "{"+"teamID"+"}", url.PathEscape(parameterValueToString(r.teamID, "teamID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["AdminTokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Admin-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiNodesGetRequest struct { + ctx context.Context + ApiService AdminApi +} + +func (r ApiNodesGetRequest) Execute() ([]NodesGet200ResponseInner, *http.Response, error) { + return r.ApiService.NodesGetExecute(r) +} + +/* +NodesGet Method for NodesGet + +List all nodes + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiNodesGetRequest +*/ +func (a *AdminApiService) NodesGet(ctx context.Context) ApiNodesGetRequest { + return ApiNodesGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return []NodesGet200ResponseInner +func (a *AdminApiService) NodesGetExecute(r ApiNodesGetRequest) ([]NodesGet200ResponseInner, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []NodesGet200ResponseInner + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AdminApiService.NodesGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/nodes" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["AdminTokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Admin-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiNodesNodeIDGetRequest struct { + ctx context.Context + ApiService AdminApi + nodeID string + clusterID *string +} + +// Identifier of the cluster +func (r ApiNodesNodeIDGetRequest) ClusterID(clusterID string) ApiNodesNodeIDGetRequest { + r.clusterID = &clusterID + return r +} + +func (r ApiNodesNodeIDGetRequest) Execute() (*NodeDetail, *http.Response, error) { + return r.ApiService.NodesNodeIDGetExecute(r) +} + +/* +NodesNodeIDGet Method for NodesNodeIDGet + +Get node info + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param nodeID + @return ApiNodesNodeIDGetRequest +*/ +func (a *AdminApiService) NodesNodeIDGet(ctx context.Context, nodeID string) ApiNodesNodeIDGetRequest { + return ApiNodesNodeIDGetRequest{ + ApiService: a, + ctx: ctx, + nodeID: nodeID, + } +} + +// Execute executes the request +// +// @return NodeDetail +func (a *AdminApiService) NodesNodeIDGetExecute(r ApiNodesNodeIDGetRequest) (*NodeDetail, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NodeDetail + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AdminApiService.NodesNodeIDGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/nodes/{nodeID}" + localVarPath = strings.Replace(localVarPath, "{"+"nodeID"+"}", url.PathEscape(parameterValueToString(r.nodeID, "nodeID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.clusterID != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "clusterID", r.clusterID, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["AdminTokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Admin-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiNodesNodeIDPostRequest struct { + ctx context.Context + ApiService AdminApi + nodeID string + nodeStatusChange *NodeStatusChange +} + +func (r ApiNodesNodeIDPostRequest) NodeStatusChange(nodeStatusChange NodeStatusChange) ApiNodesNodeIDPostRequest { + r.nodeStatusChange = &nodeStatusChange + return r +} + +func (r ApiNodesNodeIDPostRequest) Execute() (*http.Response, error) { + return r.ApiService.NodesNodeIDPostExecute(r) +} + +/* +NodesNodeIDPost Method for NodesNodeIDPost + +Change status of a node + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param nodeID + @return ApiNodesNodeIDPostRequest +*/ +func (a *AdminApiService) NodesNodeIDPost(ctx context.Context, nodeID string) ApiNodesNodeIDPostRequest { + return ApiNodesNodeIDPostRequest{ + ApiService: a, + ctx: ctx, + nodeID: nodeID, + } +} + +// Execute executes the request +func (a *AdminApiService) NodesNodeIDPostExecute(r ApiNodesNodeIDPostRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AdminApiService.NodesNodeIDPost") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/nodes/{nodeID}" + localVarPath = strings.Replace(localVarPath, "{"+"nodeID"+"}", url.PathEscape(parameterValueToString(r.nodeID, "nodeID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.nodeStatusChange + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["AdminTokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Admin-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} diff --git a/e2b/client/api_api_keys.go b/e2b/client/api_api_keys.go new file mode 100644 index 0000000..cd43a41 --- /dev/null +++ b/e2b/client/api_api_keys.go @@ -0,0 +1,706 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +type ApiKeysApi interface { + + /* + ApiKeysApiKeyIDDelete Method for ApiKeysApiKeyIDDelete + + Delete a team API key + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param apiKeyID + @return ApiApiKeysApiKeyIDDeleteRequest + */ + ApiKeysApiKeyIDDelete(ctx context.Context, apiKeyID string) ApiApiKeysApiKeyIDDeleteRequest + + // ApiKeysApiKeyIDDeleteExecute executes the request + ApiKeysApiKeyIDDeleteExecute(r ApiApiKeysApiKeyIDDeleteRequest) (*http.Response, error) + + /* + ApiKeysApiKeyIDPatch Method for ApiKeysApiKeyIDPatch + + Update a team API key + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param apiKeyID + @return ApiApiKeysApiKeyIDPatchRequest + */ + ApiKeysApiKeyIDPatch(ctx context.Context, apiKeyID string) ApiApiKeysApiKeyIDPatchRequest + + // ApiKeysApiKeyIDPatchExecute executes the request + ApiKeysApiKeyIDPatchExecute(r ApiApiKeysApiKeyIDPatchRequest) (*http.Response, error) + + /* + ApiKeysGet Method for ApiKeysGet + + List all team API keys + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiApiKeysGetRequest + */ + ApiKeysGet(ctx context.Context) ApiApiKeysGetRequest + + // ApiKeysGetExecute executes the request + // @return []TeamAPIKey + ApiKeysGetExecute(r ApiApiKeysGetRequest) ([]TeamAPIKey, *http.Response, error) + + /* + ApiKeysPost Method for ApiKeysPost + + Create a new team API key + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiApiKeysPostRequest + */ + ApiKeysPost(ctx context.Context) ApiApiKeysPostRequest + + // ApiKeysPostExecute executes the request + // @return CreatedTeamAPIKey + ApiKeysPostExecute(r ApiApiKeysPostRequest) (*CreatedTeamAPIKey, *http.Response, error) +} + +// ApiKeysApiService ApiKeysApi service +type ApiKeysApiService service + +type ApiApiKeysApiKeyIDDeleteRequest struct { + ctx context.Context + ApiService ApiKeysApi + apiKeyID string +} + +func (r ApiApiKeysApiKeyIDDeleteRequest) Execute() (*http.Response, error) { + return r.ApiService.ApiKeysApiKeyIDDeleteExecute(r) +} + +/* +ApiKeysApiKeyIDDelete Method for ApiKeysApiKeyIDDelete + +Delete a team API key + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param apiKeyID + @return ApiApiKeysApiKeyIDDeleteRequest +*/ +func (a *ApiKeysApiService) ApiKeysApiKeyIDDelete(ctx context.Context, apiKeyID string) ApiApiKeysApiKeyIDDeleteRequest { + return ApiApiKeysApiKeyIDDeleteRequest{ + ApiService: a, + ctx: ctx, + apiKeyID: apiKeyID, + } +} + +// Execute executes the request +func (a *ApiKeysApiService) ApiKeysApiKeyIDDeleteExecute(r ApiApiKeysApiKeyIDDeleteRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiKeysApiService.ApiKeysApiKeyIDDelete") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api-keys/{apiKeyID}" + localVarPath = strings.Replace(localVarPath, "{"+"apiKeyID"+"}", url.PathEscape(parameterValueToString(r.apiKeyID, "apiKeyID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiApiKeysApiKeyIDPatchRequest struct { + ctx context.Context + ApiService ApiKeysApi + apiKeyID string + updateTeamAPIKey *UpdateTeamAPIKey +} + +func (r ApiApiKeysApiKeyIDPatchRequest) UpdateTeamAPIKey(updateTeamAPIKey UpdateTeamAPIKey) ApiApiKeysApiKeyIDPatchRequest { + r.updateTeamAPIKey = &updateTeamAPIKey + return r +} + +func (r ApiApiKeysApiKeyIDPatchRequest) Execute() (*http.Response, error) { + return r.ApiService.ApiKeysApiKeyIDPatchExecute(r) +} + +/* +ApiKeysApiKeyIDPatch Method for ApiKeysApiKeyIDPatch + +Update a team API key + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param apiKeyID + @return ApiApiKeysApiKeyIDPatchRequest +*/ +func (a *ApiKeysApiService) ApiKeysApiKeyIDPatch(ctx context.Context, apiKeyID string) ApiApiKeysApiKeyIDPatchRequest { + return ApiApiKeysApiKeyIDPatchRequest{ + ApiService: a, + ctx: ctx, + apiKeyID: apiKeyID, + } +} + +// Execute executes the request +func (a *ApiKeysApiService) ApiKeysApiKeyIDPatchExecute(r ApiApiKeysApiKeyIDPatchRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiKeysApiService.ApiKeysApiKeyIDPatch") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api-keys/{apiKeyID}" + localVarPath = strings.Replace(localVarPath, "{"+"apiKeyID"+"}", url.PathEscape(parameterValueToString(r.apiKeyID, "apiKeyID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateTeamAPIKey == nil { + return nil, reportError("updateTeamAPIKey is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateTeamAPIKey + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiApiKeysGetRequest struct { + ctx context.Context + ApiService ApiKeysApi +} + +func (r ApiApiKeysGetRequest) Execute() ([]TeamAPIKey, *http.Response, error) { + return r.ApiService.ApiKeysGetExecute(r) +} + +/* +ApiKeysGet Method for ApiKeysGet + +List all team API keys + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiApiKeysGetRequest +*/ +func (a *ApiKeysApiService) ApiKeysGet(ctx context.Context) ApiApiKeysGetRequest { + return ApiApiKeysGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return []TeamAPIKey +func (a *ApiKeysApiService) ApiKeysGetExecute(r ApiApiKeysGetRequest) ([]TeamAPIKey, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []TeamAPIKey + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiKeysApiService.ApiKeysGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api-keys" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiApiKeysPostRequest struct { + ctx context.Context + ApiService ApiKeysApi + createTeamAPIKeyRequest *CreateTeamAPIKeyRequest +} + +func (r ApiApiKeysPostRequest) CreateTeamAPIKeyRequest(createTeamAPIKeyRequest CreateTeamAPIKeyRequest) ApiApiKeysPostRequest { + r.createTeamAPIKeyRequest = &createTeamAPIKeyRequest + return r +} + +func (r ApiApiKeysPostRequest) Execute() (*CreatedTeamAPIKey, *http.Response, error) { + return r.ApiService.ApiKeysPostExecute(r) +} + +/* +ApiKeysPost Method for ApiKeysPost + +Create a new team API key + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiApiKeysPostRequest +*/ +func (a *ApiKeysApiService) ApiKeysPost(ctx context.Context) ApiApiKeysPostRequest { + return ApiApiKeysPostRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return CreatedTeamAPIKey +func (a *ApiKeysApiService) ApiKeysPostExecute(r ApiApiKeysPostRequest) (*CreatedTeamAPIKey, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreatedTeamAPIKey + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApiKeysApiService.ApiKeysPost") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api-keys" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createTeamAPIKeyRequest == nil { + return localVarReturnValue, nil, reportError("createTeamAPIKeyRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createTeamAPIKeyRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/e2b/client/api_auth.go b/e2b/client/api_auth.go new file mode 100644 index 0000000..cd7e431 --- /dev/null +++ b/e2b/client/api_auth.go @@ -0,0 +1,632 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +type AuthApi interface { + + /* + TeamsGet Method for TeamsGet + + List all teams + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTeamsGetRequest + */ + TeamsGet(ctx context.Context) ApiTeamsGetRequest + + // TeamsGetExecute executes the request + // @return []TeamsGet200ResponseInner + TeamsGetExecute(r ApiTeamsGetRequest) ([]TeamsGet200ResponseInner, *http.Response, error) + + /* + TeamsTeamIDMetricsGet Method for TeamsTeamIDMetricsGet + + Get metrics for the team + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param teamID + @return ApiTeamsTeamIDMetricsGetRequest + */ + TeamsTeamIDMetricsGet(ctx context.Context, teamID string) ApiTeamsTeamIDMetricsGetRequest + + // TeamsTeamIDMetricsGetExecute executes the request + // @return []TeamMetric + TeamsTeamIDMetricsGetExecute(r ApiTeamsTeamIDMetricsGetRequest) ([]TeamMetric, *http.Response, error) + + /* + TeamsTeamIDMetricsMaxGet Method for TeamsTeamIDMetricsMaxGet + + Get the maximum metrics for the team in the given interval + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param teamID + @return ApiTeamsTeamIDMetricsMaxGetRequest + */ + TeamsTeamIDMetricsMaxGet(ctx context.Context, teamID string) ApiTeamsTeamIDMetricsMaxGetRequest + + // TeamsTeamIDMetricsMaxGetExecute executes the request + // @return MaxTeamMetric + TeamsTeamIDMetricsMaxGetExecute(r ApiTeamsTeamIDMetricsMaxGetRequest) (*MaxTeamMetric, *http.Response, error) +} + +// AuthApiService AuthApi service +type AuthApiService service + +type ApiTeamsGetRequest struct { + ctx context.Context + ApiService AuthApi +} + +func (r ApiTeamsGetRequest) Execute() ([]TeamsGet200ResponseInner, *http.Response, error) { + return r.ApiService.TeamsGetExecute(r) +} + +/* +TeamsGet Method for TeamsGet + +List all teams + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTeamsGetRequest +*/ +func (a *AuthApiService) TeamsGet(ctx context.Context) ApiTeamsGetRequest { + return ApiTeamsGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return []TeamsGet200ResponseInner +func (a *AuthApiService) TeamsGetExecute(r ApiTeamsGetRequest) ([]TeamsGet200ResponseInner, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []TeamsGet200ResponseInner + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthApiService.TeamsGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/teams" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTeamsTeamIDMetricsGetRequest struct { + ctx context.Context + ApiService AuthApi + teamID string + start *int64 + end *int64 +} + +// Unix timestamp for the start of the interval, in seconds, for which the metrics +func (r ApiTeamsTeamIDMetricsGetRequest) Start(start int64) ApiTeamsTeamIDMetricsGetRequest { + r.start = &start + return r +} + +func (r ApiTeamsTeamIDMetricsGetRequest) End(end int64) ApiTeamsTeamIDMetricsGetRequest { + r.end = &end + return r +} + +func (r ApiTeamsTeamIDMetricsGetRequest) Execute() ([]TeamMetric, *http.Response, error) { + return r.ApiService.TeamsTeamIDMetricsGetExecute(r) +} + +/* +TeamsTeamIDMetricsGet Method for TeamsTeamIDMetricsGet + +Get metrics for the team + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param teamID + @return ApiTeamsTeamIDMetricsGetRequest +*/ +func (a *AuthApiService) TeamsTeamIDMetricsGet(ctx context.Context, teamID string) ApiTeamsTeamIDMetricsGetRequest { + return ApiTeamsTeamIDMetricsGetRequest{ + ApiService: a, + ctx: ctx, + teamID: teamID, + } +} + +// Execute executes the request +// +// @return []TeamMetric +func (a *AuthApiService) TeamsTeamIDMetricsGetExecute(r ApiTeamsTeamIDMetricsGetRequest) ([]TeamMetric, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []TeamMetric + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthApiService.TeamsTeamIDMetricsGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/teams/{teamID}/metrics" + localVarPath = strings.Replace(localVarPath, "{"+"teamID"+"}", url.PathEscape(parameterValueToString(r.teamID, "teamID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.start != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "start", r.start, "") + } + if r.end != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "end", r.end, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTeamsTeamIDMetricsMaxGetRequest struct { + ctx context.Context + ApiService AuthApi + teamID string + metric *string + start *int64 + end *int64 +} + +// Metric to retrieve the maximum value for +func (r ApiTeamsTeamIDMetricsMaxGetRequest) Metric(metric string) ApiTeamsTeamIDMetricsMaxGetRequest { + r.metric = &metric + return r +} + +// Unix timestamp for the start of the interval, in seconds, for which the metrics +func (r ApiTeamsTeamIDMetricsMaxGetRequest) Start(start int64) ApiTeamsTeamIDMetricsMaxGetRequest { + r.start = &start + return r +} + +func (r ApiTeamsTeamIDMetricsMaxGetRequest) End(end int64) ApiTeamsTeamIDMetricsMaxGetRequest { + r.end = &end + return r +} + +func (r ApiTeamsTeamIDMetricsMaxGetRequest) Execute() (*MaxTeamMetric, *http.Response, error) { + return r.ApiService.TeamsTeamIDMetricsMaxGetExecute(r) +} + +/* +TeamsTeamIDMetricsMaxGet Method for TeamsTeamIDMetricsMaxGet + +Get the maximum metrics for the team in the given interval + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param teamID + @return ApiTeamsTeamIDMetricsMaxGetRequest +*/ +func (a *AuthApiService) TeamsTeamIDMetricsMaxGet(ctx context.Context, teamID string) ApiTeamsTeamIDMetricsMaxGetRequest { + return ApiTeamsTeamIDMetricsMaxGetRequest{ + ApiService: a, + ctx: ctx, + teamID: teamID, + } +} + +// Execute executes the request +// +// @return MaxTeamMetric +func (a *AuthApiService) TeamsTeamIDMetricsMaxGetExecute(r ApiTeamsTeamIDMetricsMaxGetRequest) (*MaxTeamMetric, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *MaxTeamMetric + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthApiService.TeamsTeamIDMetricsMaxGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/teams/{teamID}/metrics/max" + localVarPath = strings.Replace(localVarPath, "{"+"teamID"+"}", url.PathEscape(parameterValueToString(r.teamID, "teamID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.metric == nil { + return localVarReturnValue, nil, reportError("metric is required and must be specified") + } + + if r.start != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "start", r.start, "") + } + if r.end != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "end", r.end, "") + } + parameterAddToHeaderOrQuery(localVarQueryParams, "metric", r.metric, "") + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/e2b/client/api_default.go b/e2b/client/api_default.go new file mode 100644 index 0000000..8c203fb --- /dev/null +++ b/e2b/client/api_default.go @@ -0,0 +1,136 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" +) + +type DefaultApi interface { + + /* + HealthGet Method for HealthGet + + Health check + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiHealthGetRequest + */ + HealthGet(ctx context.Context) ApiHealthGetRequest + + // HealthGetExecute executes the request + HealthGetExecute(r ApiHealthGetRequest) (*http.Response, error) +} + +// DefaultApiService DefaultApi service +type DefaultApiService service + +type ApiHealthGetRequest struct { + ctx context.Context + ApiService DefaultApi +} + +func (r ApiHealthGetRequest) Execute() (*http.Response, error) { + return r.ApiService.HealthGetExecute(r) +} + +/* +HealthGet Method for HealthGet + +Health check + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiHealthGetRequest +*/ +func (a *DefaultApiService) HealthGet(ctx context.Context) ApiHealthGetRequest { + return ApiHealthGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +func (a *DefaultApiService) HealthGetExecute(r ApiHealthGetRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.HealthGet") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/health" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} diff --git a/e2b/client/api_sandboxes.go b/e2b/client/api_sandboxes.go new file mode 100644 index 0000000..981dbca --- /dev/null +++ b/e2b/client/api_sandboxes.go @@ -0,0 +1,3100 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +type SandboxesApi interface { + + /* + SandboxesGet Method for SandboxesGet + + List all running sandboxes + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiSandboxesGetRequest + */ + SandboxesGet(ctx context.Context) ApiSandboxesGetRequest + + // SandboxesGetExecute executes the request + // @return []SandboxesGet200ResponseInner + SandboxesGetExecute(r ApiSandboxesGetRequest) ([]SandboxesGet200ResponseInner, *http.Response, error) + + /* + SandboxesMetricsGet Method for SandboxesMetricsGet + + List metrics for given sandboxes + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiSandboxesMetricsGetRequest + */ + SandboxesMetricsGet(ctx context.Context) ApiSandboxesMetricsGetRequest + + // SandboxesMetricsGetExecute executes the request + // @return SandboxesWithMetrics + SandboxesMetricsGetExecute(r ApiSandboxesMetricsGetRequest) (*SandboxesWithMetrics, *http.Response, error) + + /* + SandboxesPost Method for SandboxesPost + + Create a sandbox from the template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiSandboxesPostRequest + */ + SandboxesPost(ctx context.Context) ApiSandboxesPostRequest + + // SandboxesPostExecute executes the request + // @return Sandbox + SandboxesPostExecute(r ApiSandboxesPostRequest) (*Sandbox, *http.Response, error) + + /* + SandboxesSandboxIDConnectPost Method for SandboxesSandboxIDConnectPost + + Returns sandbox details. If the sandbox is paused, it will be resumed. TTL is only extended. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param sandboxID + @return ApiSandboxesSandboxIDConnectPostRequest + */ + SandboxesSandboxIDConnectPost(ctx context.Context, sandboxID string) ApiSandboxesSandboxIDConnectPostRequest + + // SandboxesSandboxIDConnectPostExecute executes the request + // @return Sandbox + SandboxesSandboxIDConnectPostExecute(r ApiSandboxesSandboxIDConnectPostRequest) (*Sandbox, *http.Response, error) + + /* + SandboxesSandboxIDDelete Method for SandboxesSandboxIDDelete + + Kill a sandbox + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param sandboxID + @return ApiSandboxesSandboxIDDeleteRequest + */ + SandboxesSandboxIDDelete(ctx context.Context, sandboxID string) ApiSandboxesSandboxIDDeleteRequest + + // SandboxesSandboxIDDeleteExecute executes the request + SandboxesSandboxIDDeleteExecute(r ApiSandboxesSandboxIDDeleteRequest) (*http.Response, error) + + /* + SandboxesSandboxIDGet Method for SandboxesSandboxIDGet + + Get a sandbox by id + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param sandboxID + @return ApiSandboxesSandboxIDGetRequest + */ + SandboxesSandboxIDGet(ctx context.Context, sandboxID string) ApiSandboxesSandboxIDGetRequest + + // SandboxesSandboxIDGetExecute executes the request + // @return SandboxDetail + SandboxesSandboxIDGetExecute(r ApiSandboxesSandboxIDGetRequest) (*SandboxDetail, *http.Response, error) + + /* + SandboxesSandboxIDLogsGet Method for SandboxesSandboxIDLogsGet + + Get sandbox logs. Use /v2/sandboxes/{sandboxID}/logs instead. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param sandboxID + @return ApiSandboxesSandboxIDLogsGetRequest + + Deprecated + */ + SandboxesSandboxIDLogsGet(ctx context.Context, sandboxID string) ApiSandboxesSandboxIDLogsGetRequest + + // SandboxesSandboxIDLogsGetExecute executes the request + // @return SandboxLogs + // Deprecated + SandboxesSandboxIDLogsGetExecute(r ApiSandboxesSandboxIDLogsGetRequest) (*SandboxLogs, *http.Response, error) + + /* + SandboxesSandboxIDMetricsGet Method for SandboxesSandboxIDMetricsGet + + Get sandbox metrics + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param sandboxID + @return ApiSandboxesSandboxIDMetricsGetRequest + */ + SandboxesSandboxIDMetricsGet(ctx context.Context, sandboxID string) ApiSandboxesSandboxIDMetricsGetRequest + + // SandboxesSandboxIDMetricsGetExecute executes the request + // @return []SandboxMetric + SandboxesSandboxIDMetricsGetExecute(r ApiSandboxesSandboxIDMetricsGetRequest) ([]SandboxMetric, *http.Response, error) + + /* + SandboxesSandboxIDPausePost Method for SandboxesSandboxIDPausePost + + Pause the sandbox + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param sandboxID + @return ApiSandboxesSandboxIDPausePostRequest + */ + SandboxesSandboxIDPausePost(ctx context.Context, sandboxID string) ApiSandboxesSandboxIDPausePostRequest + + // SandboxesSandboxIDPausePostExecute executes the request + SandboxesSandboxIDPausePostExecute(r ApiSandboxesSandboxIDPausePostRequest) (*http.Response, error) + + /* + SandboxesSandboxIDRefreshesPost Method for SandboxesSandboxIDRefreshesPost + + Refresh the sandbox extending its time to live + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param sandboxID + @return ApiSandboxesSandboxIDRefreshesPostRequest + */ + SandboxesSandboxIDRefreshesPost(ctx context.Context, sandboxID string) ApiSandboxesSandboxIDRefreshesPostRequest + + // SandboxesSandboxIDRefreshesPostExecute executes the request + SandboxesSandboxIDRefreshesPostExecute(r ApiSandboxesSandboxIDRefreshesPostRequest) (*http.Response, error) + + /* + SandboxesSandboxIDResumePost Method for SandboxesSandboxIDResumePost + + Resume the sandbox + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param sandboxID + @return ApiSandboxesSandboxIDResumePostRequest + + Deprecated + */ + SandboxesSandboxIDResumePost(ctx context.Context, sandboxID string) ApiSandboxesSandboxIDResumePostRequest + + // SandboxesSandboxIDResumePostExecute executes the request + // @return Sandbox + // Deprecated + SandboxesSandboxIDResumePostExecute(r ApiSandboxesSandboxIDResumePostRequest) (*Sandbox, *http.Response, error) + + /* + SandboxesSandboxIDSnapshotsPost Method for SandboxesSandboxIDSnapshotsPost + + Create a persistent snapshot from the sandbox's current state. Snapshots can be used to create new sandboxes and persist beyond the original sandbox's lifetime. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param sandboxID + @return ApiSandboxesSandboxIDSnapshotsPostRequest + */ + SandboxesSandboxIDSnapshotsPost(ctx context.Context, sandboxID string) ApiSandboxesSandboxIDSnapshotsPostRequest + + // SandboxesSandboxIDSnapshotsPostExecute executes the request + // @return SnapshotInfo + SandboxesSandboxIDSnapshotsPostExecute(r ApiSandboxesSandboxIDSnapshotsPostRequest) (*SnapshotInfo, *http.Response, error) + + /* + SandboxesSandboxIDTimeoutPost Method for SandboxesSandboxIDTimeoutPost + + Set the timeout for the sandbox. The sandbox will expire x seconds from the time of the request. Calling this method multiple times overwrites the TTL, each time using the current timestamp as the starting point to measure the timeout duration. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param sandboxID + @return ApiSandboxesSandboxIDTimeoutPostRequest + */ + SandboxesSandboxIDTimeoutPost(ctx context.Context, sandboxID string) ApiSandboxesSandboxIDTimeoutPostRequest + + // SandboxesSandboxIDTimeoutPostExecute executes the request + SandboxesSandboxIDTimeoutPostExecute(r ApiSandboxesSandboxIDTimeoutPostRequest) (*http.Response, error) + + /* + V2SandboxesGet Method for V2SandboxesGet + + List all sandboxes + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiV2SandboxesGetRequest + */ + V2SandboxesGet(ctx context.Context) ApiV2SandboxesGetRequest + + // V2SandboxesGetExecute executes the request + // @return []SandboxesGet200ResponseInner + V2SandboxesGetExecute(r ApiV2SandboxesGetRequest) ([]SandboxesGet200ResponseInner, *http.Response, error) + + /* + V2SandboxesSandboxIDLogsGet Method for V2SandboxesSandboxIDLogsGet + + Get sandbox logs + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param sandboxID + @return ApiV2SandboxesSandboxIDLogsGetRequest + */ + V2SandboxesSandboxIDLogsGet(ctx context.Context, sandboxID string) ApiV2SandboxesSandboxIDLogsGetRequest + + // V2SandboxesSandboxIDLogsGetExecute executes the request + // @return SandboxLogsV2Response + V2SandboxesSandboxIDLogsGetExecute(r ApiV2SandboxesSandboxIDLogsGetRequest) (*SandboxLogsV2Response, *http.Response, error) +} + +// SandboxesApiService SandboxesApi service +type SandboxesApiService service + +type ApiSandboxesGetRequest struct { + ctx context.Context + ApiService SandboxesApi + metadata *string +} + +// Metadata query used to filter the sandboxes (e.g. \"user=abc&app=prod\"). Each key and values must be URL encoded. +func (r ApiSandboxesGetRequest) Metadata(metadata string) ApiSandboxesGetRequest { + r.metadata = &metadata + return r +} + +func (r ApiSandboxesGetRequest) Execute() ([]SandboxesGet200ResponseInner, *http.Response, error) { + return r.ApiService.SandboxesGetExecute(r) +} + +/* +SandboxesGet Method for SandboxesGet + +List all running sandboxes + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiSandboxesGetRequest +*/ +func (a *SandboxesApiService) SandboxesGet(ctx context.Context) ApiSandboxesGetRequest { + return ApiSandboxesGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return []SandboxesGet200ResponseInner +func (a *SandboxesApiService) SandboxesGetExecute(r ApiSandboxesGetRequest) ([]SandboxesGet200ResponseInner, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []SandboxesGet200ResponseInner + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SandboxesApiService.SandboxesGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/sandboxes" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.metadata != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "metadata", r.metadata, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiSandboxesMetricsGetRequest struct { + ctx context.Context + ApiService SandboxesApi + sandboxIds *[]string +} + +// Comma-separated list of sandbox IDs to get metrics for +func (r ApiSandboxesMetricsGetRequest) SandboxIds(sandboxIds []string) ApiSandboxesMetricsGetRequest { + r.sandboxIds = &sandboxIds + return r +} + +func (r ApiSandboxesMetricsGetRequest) Execute() (*SandboxesWithMetrics, *http.Response, error) { + return r.ApiService.SandboxesMetricsGetExecute(r) +} + +/* +SandboxesMetricsGet Method for SandboxesMetricsGet + +List metrics for given sandboxes + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiSandboxesMetricsGetRequest +*/ +func (a *SandboxesApiService) SandboxesMetricsGet(ctx context.Context) ApiSandboxesMetricsGetRequest { + return ApiSandboxesMetricsGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return SandboxesWithMetrics +func (a *SandboxesApiService) SandboxesMetricsGetExecute(r ApiSandboxesMetricsGetRequest) (*SandboxesWithMetrics, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SandboxesWithMetrics + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SandboxesApiService.SandboxesMetricsGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/sandboxes/metrics" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.sandboxIds == nil { + return localVarReturnValue, nil, reportError("sandboxIds is required and must be specified") + } + if len(*r.sandboxIds) > 100 { + return localVarReturnValue, nil, reportError("sandboxIds must have less than 100 elements") + } + + parameterAddToHeaderOrQuery(localVarQueryParams, "sandbox_ids", r.sandboxIds, "csv") + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiSandboxesPostRequest struct { + ctx context.Context + ApiService SandboxesApi + createSandboxRequest *CreateSandboxRequest +} + +func (r ApiSandboxesPostRequest) CreateSandboxRequest(createSandboxRequest CreateSandboxRequest) ApiSandboxesPostRequest { + r.createSandboxRequest = &createSandboxRequest + return r +} + +func (r ApiSandboxesPostRequest) Execute() (*Sandbox, *http.Response, error) { + return r.ApiService.SandboxesPostExecute(r) +} + +/* +SandboxesPost Method for SandboxesPost + +Create a sandbox from the template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiSandboxesPostRequest +*/ +func (a *SandboxesApiService) SandboxesPost(ctx context.Context) ApiSandboxesPostRequest { + return ApiSandboxesPostRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return Sandbox +func (a *SandboxesApiService) SandboxesPostExecute(r ApiSandboxesPostRequest) (*Sandbox, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Sandbox + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SandboxesApiService.SandboxesPost") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/sandboxes" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createSandboxRequest == nil { + return localVarReturnValue, nil, reportError("createSandboxRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createSandboxRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiSandboxesSandboxIDConnectPostRequest struct { + ctx context.Context + ApiService SandboxesApi + sandboxID string + connectSandbox *ConnectSandbox +} + +func (r ApiSandboxesSandboxIDConnectPostRequest) ConnectSandbox(connectSandbox ConnectSandbox) ApiSandboxesSandboxIDConnectPostRequest { + r.connectSandbox = &connectSandbox + return r +} + +func (r ApiSandboxesSandboxIDConnectPostRequest) Execute() (*Sandbox, *http.Response, error) { + return r.ApiService.SandboxesSandboxIDConnectPostExecute(r) +} + +/* +SandboxesSandboxIDConnectPost Method for SandboxesSandboxIDConnectPost + +Returns sandbox details. If the sandbox is paused, it will be resumed. TTL is only extended. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param sandboxID + @return ApiSandboxesSandboxIDConnectPostRequest +*/ +func (a *SandboxesApiService) SandboxesSandboxIDConnectPost(ctx context.Context, sandboxID string) ApiSandboxesSandboxIDConnectPostRequest { + return ApiSandboxesSandboxIDConnectPostRequest{ + ApiService: a, + ctx: ctx, + sandboxID: sandboxID, + } +} + +// Execute executes the request +// +// @return Sandbox +func (a *SandboxesApiService) SandboxesSandboxIDConnectPostExecute(r ApiSandboxesSandboxIDConnectPostRequest) (*Sandbox, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Sandbox + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SandboxesApiService.SandboxesSandboxIDConnectPost") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/sandboxes/{sandboxID}/connect" + localVarPath = strings.Replace(localVarPath, "{"+"sandboxID"+"}", url.PathEscape(parameterValueToString(r.sandboxID, "sandboxID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.connectSandbox == nil { + return localVarReturnValue, nil, reportError("connectSandbox is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.connectSandbox + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiSandboxesSandboxIDDeleteRequest struct { + ctx context.Context + ApiService SandboxesApi + sandboxID string +} + +func (r ApiSandboxesSandboxIDDeleteRequest) Execute() (*http.Response, error) { + return r.ApiService.SandboxesSandboxIDDeleteExecute(r) +} + +/* +SandboxesSandboxIDDelete Method for SandboxesSandboxIDDelete + +Kill a sandbox + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param sandboxID + @return ApiSandboxesSandboxIDDeleteRequest +*/ +func (a *SandboxesApiService) SandboxesSandboxIDDelete(ctx context.Context, sandboxID string) ApiSandboxesSandboxIDDeleteRequest { + return ApiSandboxesSandboxIDDeleteRequest{ + ApiService: a, + ctx: ctx, + sandboxID: sandboxID, + } +} + +// Execute executes the request +func (a *SandboxesApiService) SandboxesSandboxIDDeleteExecute(r ApiSandboxesSandboxIDDeleteRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SandboxesApiService.SandboxesSandboxIDDelete") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/sandboxes/{sandboxID}" + localVarPath = strings.Replace(localVarPath, "{"+"sandboxID"+"}", url.PathEscape(parameterValueToString(r.sandboxID, "sandboxID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiSandboxesSandboxIDGetRequest struct { + ctx context.Context + ApiService SandboxesApi + sandboxID string +} + +func (r ApiSandboxesSandboxIDGetRequest) Execute() (*SandboxDetail, *http.Response, error) { + return r.ApiService.SandboxesSandboxIDGetExecute(r) +} + +/* +SandboxesSandboxIDGet Method for SandboxesSandboxIDGet + +Get a sandbox by id + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param sandboxID + @return ApiSandboxesSandboxIDGetRequest +*/ +func (a *SandboxesApiService) SandboxesSandboxIDGet(ctx context.Context, sandboxID string) ApiSandboxesSandboxIDGetRequest { + return ApiSandboxesSandboxIDGetRequest{ + ApiService: a, + ctx: ctx, + sandboxID: sandboxID, + } +} + +// Execute executes the request +// +// @return SandboxDetail +func (a *SandboxesApiService) SandboxesSandboxIDGetExecute(r ApiSandboxesSandboxIDGetRequest) (*SandboxDetail, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SandboxDetail + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SandboxesApiService.SandboxesSandboxIDGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/sandboxes/{sandboxID}" + localVarPath = strings.Replace(localVarPath, "{"+"sandboxID"+"}", url.PathEscape(parameterValueToString(r.sandboxID, "sandboxID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiSandboxesSandboxIDLogsGetRequest struct { + ctx context.Context + ApiService SandboxesApi + sandboxID string + start *int64 + limit *int32 +} + +// Starting timestamp of the logs that should be returned in milliseconds +func (r ApiSandboxesSandboxIDLogsGetRequest) Start(start int64) ApiSandboxesSandboxIDLogsGetRequest { + r.start = &start + return r +} + +// Maximum number of logs that should be returned +func (r ApiSandboxesSandboxIDLogsGetRequest) Limit(limit int32) ApiSandboxesSandboxIDLogsGetRequest { + r.limit = &limit + return r +} + +func (r ApiSandboxesSandboxIDLogsGetRequest) Execute() (*SandboxLogs, *http.Response, error) { + return r.ApiService.SandboxesSandboxIDLogsGetExecute(r) +} + +/* +SandboxesSandboxIDLogsGet Method for SandboxesSandboxIDLogsGet + +Get sandbox logs. Use /v2/sandboxes/{sandboxID}/logs instead. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param sandboxID + @return ApiSandboxesSandboxIDLogsGetRequest + +Deprecated +*/ +func (a *SandboxesApiService) SandboxesSandboxIDLogsGet(ctx context.Context, sandboxID string) ApiSandboxesSandboxIDLogsGetRequest { + return ApiSandboxesSandboxIDLogsGetRequest{ + ApiService: a, + ctx: ctx, + sandboxID: sandboxID, + } +} + +// Execute executes the request +// +// @return SandboxLogs +// +// Deprecated +func (a *SandboxesApiService) SandboxesSandboxIDLogsGetExecute(r ApiSandboxesSandboxIDLogsGetRequest) (*SandboxLogs, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SandboxLogs + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SandboxesApiService.SandboxesSandboxIDLogsGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/sandboxes/{sandboxID}/logs" + localVarPath = strings.Replace(localVarPath, "{"+"sandboxID"+"}", url.PathEscape(parameterValueToString(r.sandboxID, "sandboxID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.start != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "start", r.start, "") + } + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiSandboxesSandboxIDMetricsGetRequest struct { + ctx context.Context + ApiService SandboxesApi + sandboxID string + start *int64 + end *int64 +} + +// Unix timestamp for the start of the interval, in seconds, for which the metrics +func (r ApiSandboxesSandboxIDMetricsGetRequest) Start(start int64) ApiSandboxesSandboxIDMetricsGetRequest { + r.start = &start + return r +} + +func (r ApiSandboxesSandboxIDMetricsGetRequest) End(end int64) ApiSandboxesSandboxIDMetricsGetRequest { + r.end = &end + return r +} + +func (r ApiSandboxesSandboxIDMetricsGetRequest) Execute() ([]SandboxMetric, *http.Response, error) { + return r.ApiService.SandboxesSandboxIDMetricsGetExecute(r) +} + +/* +SandboxesSandboxIDMetricsGet Method for SandboxesSandboxIDMetricsGet + +Get sandbox metrics + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param sandboxID + @return ApiSandboxesSandboxIDMetricsGetRequest +*/ +func (a *SandboxesApiService) SandboxesSandboxIDMetricsGet(ctx context.Context, sandboxID string) ApiSandboxesSandboxIDMetricsGetRequest { + return ApiSandboxesSandboxIDMetricsGetRequest{ + ApiService: a, + ctx: ctx, + sandboxID: sandboxID, + } +} + +// Execute executes the request +// +// @return []SandboxMetric +func (a *SandboxesApiService) SandboxesSandboxIDMetricsGetExecute(r ApiSandboxesSandboxIDMetricsGetRequest) ([]SandboxMetric, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []SandboxMetric + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SandboxesApiService.SandboxesSandboxIDMetricsGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/sandboxes/{sandboxID}/metrics" + localVarPath = strings.Replace(localVarPath, "{"+"sandboxID"+"}", url.PathEscape(parameterValueToString(r.sandboxID, "sandboxID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.start != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "start", r.start, "") + } + if r.end != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "end", r.end, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiSandboxesSandboxIDPausePostRequest struct { + ctx context.Context + ApiService SandboxesApi + sandboxID string +} + +func (r ApiSandboxesSandboxIDPausePostRequest) Execute() (*http.Response, error) { + return r.ApiService.SandboxesSandboxIDPausePostExecute(r) +} + +/* +SandboxesSandboxIDPausePost Method for SandboxesSandboxIDPausePost + +Pause the sandbox + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param sandboxID + @return ApiSandboxesSandboxIDPausePostRequest +*/ +func (a *SandboxesApiService) SandboxesSandboxIDPausePost(ctx context.Context, sandboxID string) ApiSandboxesSandboxIDPausePostRequest { + return ApiSandboxesSandboxIDPausePostRequest{ + ApiService: a, + ctx: ctx, + sandboxID: sandboxID, + } +} + +// Execute executes the request +func (a *SandboxesApiService) SandboxesSandboxIDPausePostExecute(r ApiSandboxesSandboxIDPausePostRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SandboxesApiService.SandboxesSandboxIDPausePost") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/sandboxes/{sandboxID}/pause" + localVarPath = strings.Replace(localVarPath, "{"+"sandboxID"+"}", url.PathEscape(parameterValueToString(r.sandboxID, "sandboxID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiSandboxesSandboxIDRefreshesPostRequest struct { + ctx context.Context + ApiService SandboxesApi + sandboxID string + sandboxesSandboxIDRefreshesPostRequest *SandboxesSandboxIDRefreshesPostRequest +} + +func (r ApiSandboxesSandboxIDRefreshesPostRequest) SandboxesSandboxIDRefreshesPostRequest(sandboxesSandboxIDRefreshesPostRequest SandboxesSandboxIDRefreshesPostRequest) ApiSandboxesSandboxIDRefreshesPostRequest { + r.sandboxesSandboxIDRefreshesPostRequest = &sandboxesSandboxIDRefreshesPostRequest + return r +} + +func (r ApiSandboxesSandboxIDRefreshesPostRequest) Execute() (*http.Response, error) { + return r.ApiService.SandboxesSandboxIDRefreshesPostExecute(r) +} + +/* +SandboxesSandboxIDRefreshesPost Method for SandboxesSandboxIDRefreshesPost + +Refresh the sandbox extending its time to live + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param sandboxID + @return ApiSandboxesSandboxIDRefreshesPostRequest +*/ +func (a *SandboxesApiService) SandboxesSandboxIDRefreshesPost(ctx context.Context, sandboxID string) ApiSandboxesSandboxIDRefreshesPostRequest { + return ApiSandboxesSandboxIDRefreshesPostRequest{ + ApiService: a, + ctx: ctx, + sandboxID: sandboxID, + } +} + +// Execute executes the request +func (a *SandboxesApiService) SandboxesSandboxIDRefreshesPostExecute(r ApiSandboxesSandboxIDRefreshesPostRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SandboxesApiService.SandboxesSandboxIDRefreshesPost") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/sandboxes/{sandboxID}/refreshes" + localVarPath = strings.Replace(localVarPath, "{"+"sandboxID"+"}", url.PathEscape(parameterValueToString(r.sandboxID, "sandboxID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.sandboxesSandboxIDRefreshesPostRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiSandboxesSandboxIDResumePostRequest struct { + ctx context.Context + ApiService SandboxesApi + sandboxID string + resumedSandbox *ResumedSandbox +} + +func (r ApiSandboxesSandboxIDResumePostRequest) ResumedSandbox(resumedSandbox ResumedSandbox) ApiSandboxesSandboxIDResumePostRequest { + r.resumedSandbox = &resumedSandbox + return r +} + +func (r ApiSandboxesSandboxIDResumePostRequest) Execute() (*Sandbox, *http.Response, error) { + return r.ApiService.SandboxesSandboxIDResumePostExecute(r) +} + +/* +SandboxesSandboxIDResumePost Method for SandboxesSandboxIDResumePost + +Resume the sandbox + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param sandboxID + @return ApiSandboxesSandboxIDResumePostRequest + +Deprecated +*/ +func (a *SandboxesApiService) SandboxesSandboxIDResumePost(ctx context.Context, sandboxID string) ApiSandboxesSandboxIDResumePostRequest { + return ApiSandboxesSandboxIDResumePostRequest{ + ApiService: a, + ctx: ctx, + sandboxID: sandboxID, + } +} + +// Execute executes the request +// +// @return Sandbox +// +// Deprecated +func (a *SandboxesApiService) SandboxesSandboxIDResumePostExecute(r ApiSandboxesSandboxIDResumePostRequest) (*Sandbox, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Sandbox + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SandboxesApiService.SandboxesSandboxIDResumePost") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/sandboxes/{sandboxID}/resume" + localVarPath = strings.Replace(localVarPath, "{"+"sandboxID"+"}", url.PathEscape(parameterValueToString(r.sandboxID, "sandboxID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.resumedSandbox == nil { + return localVarReturnValue, nil, reportError("resumedSandbox is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.resumedSandbox + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiSandboxesSandboxIDSnapshotsPostRequest struct { + ctx context.Context + ApiService SandboxesApi + sandboxID string + sandboxesSandboxIDSnapshotsPostRequest *SandboxesSandboxIDSnapshotsPostRequest +} + +func (r ApiSandboxesSandboxIDSnapshotsPostRequest) SandboxesSandboxIDSnapshotsPostRequest(sandboxesSandboxIDSnapshotsPostRequest SandboxesSandboxIDSnapshotsPostRequest) ApiSandboxesSandboxIDSnapshotsPostRequest { + r.sandboxesSandboxIDSnapshotsPostRequest = &sandboxesSandboxIDSnapshotsPostRequest + return r +} + +func (r ApiSandboxesSandboxIDSnapshotsPostRequest) Execute() (*SnapshotInfo, *http.Response, error) { + return r.ApiService.SandboxesSandboxIDSnapshotsPostExecute(r) +} + +/* +SandboxesSandboxIDSnapshotsPost Method for SandboxesSandboxIDSnapshotsPost + +Create a persistent snapshot from the sandbox's current state. Snapshots can be used to create new sandboxes and persist beyond the original sandbox's lifetime. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param sandboxID + @return ApiSandboxesSandboxIDSnapshotsPostRequest +*/ +func (a *SandboxesApiService) SandboxesSandboxIDSnapshotsPost(ctx context.Context, sandboxID string) ApiSandboxesSandboxIDSnapshotsPostRequest { + return ApiSandboxesSandboxIDSnapshotsPostRequest{ + ApiService: a, + ctx: ctx, + sandboxID: sandboxID, + } +} + +// Execute executes the request +// +// @return SnapshotInfo +func (a *SandboxesApiService) SandboxesSandboxIDSnapshotsPostExecute(r ApiSandboxesSandboxIDSnapshotsPostRequest) (*SnapshotInfo, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SnapshotInfo + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SandboxesApiService.SandboxesSandboxIDSnapshotsPost") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/sandboxes/{sandboxID}/snapshots" + localVarPath = strings.Replace(localVarPath, "{"+"sandboxID"+"}", url.PathEscape(parameterValueToString(r.sandboxID, "sandboxID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.sandboxesSandboxIDSnapshotsPostRequest == nil { + return localVarReturnValue, nil, reportError("sandboxesSandboxIDSnapshotsPostRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.sandboxesSandboxIDSnapshotsPostRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiSandboxesSandboxIDTimeoutPostRequest struct { + ctx context.Context + ApiService SandboxesApi + sandboxID string + sandboxesSandboxIDTimeoutPostRequest *SandboxesSandboxIDTimeoutPostRequest +} + +func (r ApiSandboxesSandboxIDTimeoutPostRequest) SandboxesSandboxIDTimeoutPostRequest(sandboxesSandboxIDTimeoutPostRequest SandboxesSandboxIDTimeoutPostRequest) ApiSandboxesSandboxIDTimeoutPostRequest { + r.sandboxesSandboxIDTimeoutPostRequest = &sandboxesSandboxIDTimeoutPostRequest + return r +} + +func (r ApiSandboxesSandboxIDTimeoutPostRequest) Execute() (*http.Response, error) { + return r.ApiService.SandboxesSandboxIDTimeoutPostExecute(r) +} + +/* +SandboxesSandboxIDTimeoutPost Method for SandboxesSandboxIDTimeoutPost + +Set the timeout for the sandbox. The sandbox will expire x seconds from the time of the request. Calling this method multiple times overwrites the TTL, each time using the current timestamp as the starting point to measure the timeout duration. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param sandboxID + @return ApiSandboxesSandboxIDTimeoutPostRequest +*/ +func (a *SandboxesApiService) SandboxesSandboxIDTimeoutPost(ctx context.Context, sandboxID string) ApiSandboxesSandboxIDTimeoutPostRequest { + return ApiSandboxesSandboxIDTimeoutPostRequest{ + ApiService: a, + ctx: ctx, + sandboxID: sandboxID, + } +} + +// Execute executes the request +func (a *SandboxesApiService) SandboxesSandboxIDTimeoutPostExecute(r ApiSandboxesSandboxIDTimeoutPostRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SandboxesApiService.SandboxesSandboxIDTimeoutPost") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/sandboxes/{sandboxID}/timeout" + localVarPath = strings.Replace(localVarPath, "{"+"sandboxID"+"}", url.PathEscape(parameterValueToString(r.sandboxID, "sandboxID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.sandboxesSandboxIDTimeoutPostRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiV2SandboxesGetRequest struct { + ctx context.Context + ApiService SandboxesApi + metadata *string + state *[]SandboxState + nextToken *string + limit *int32 +} + +// Metadata query used to filter the sandboxes (e.g. \"user=abc&app=prod\"). Each key and values must be URL encoded. +func (r ApiV2SandboxesGetRequest) Metadata(metadata string) ApiV2SandboxesGetRequest { + r.metadata = &metadata + return r +} + +// Filter sandboxes by one or more states +func (r ApiV2SandboxesGetRequest) State(state []SandboxState) ApiV2SandboxesGetRequest { + r.state = &state + return r +} + +// Cursor to start the list from +func (r ApiV2SandboxesGetRequest) NextToken(nextToken string) ApiV2SandboxesGetRequest { + r.nextToken = &nextToken + return r +} + +// Maximum number of items to return per page +func (r ApiV2SandboxesGetRequest) Limit(limit int32) ApiV2SandboxesGetRequest { + r.limit = &limit + return r +} + +func (r ApiV2SandboxesGetRequest) Execute() ([]SandboxesGet200ResponseInner, *http.Response, error) { + return r.ApiService.V2SandboxesGetExecute(r) +} + +/* +V2SandboxesGet Method for V2SandboxesGet + +List all sandboxes + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiV2SandboxesGetRequest +*/ +func (a *SandboxesApiService) V2SandboxesGet(ctx context.Context) ApiV2SandboxesGetRequest { + return ApiV2SandboxesGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return []SandboxesGet200ResponseInner +func (a *SandboxesApiService) V2SandboxesGetExecute(r ApiV2SandboxesGetRequest) ([]SandboxesGet200ResponseInner, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []SandboxesGet200ResponseInner + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SandboxesApiService.V2SandboxesGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v2/sandboxes" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.metadata != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "metadata", r.metadata, "") + } + if r.state != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "state", r.state, "csv") + } + if r.nextToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "nextToken", r.nextToken, "") + } + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiV2SandboxesSandboxIDLogsGetRequest struct { + ctx context.Context + ApiService SandboxesApi + sandboxID string + cursor *int64 + limit *int32 + direction *LogsDirection +} + +// Starting timestamp of the logs that should be returned in milliseconds +func (r ApiV2SandboxesSandboxIDLogsGetRequest) Cursor(cursor int64) ApiV2SandboxesSandboxIDLogsGetRequest { + r.cursor = &cursor + return r +} + +// Maximum number of logs that should be returned +func (r ApiV2SandboxesSandboxIDLogsGetRequest) Limit(limit int32) ApiV2SandboxesSandboxIDLogsGetRequest { + r.limit = &limit + return r +} + +// Direction of the logs that should be returned +func (r ApiV2SandboxesSandboxIDLogsGetRequest) Direction(direction LogsDirection) ApiV2SandboxesSandboxIDLogsGetRequest { + r.direction = &direction + return r +} + +func (r ApiV2SandboxesSandboxIDLogsGetRequest) Execute() (*SandboxLogsV2Response, *http.Response, error) { + return r.ApiService.V2SandboxesSandboxIDLogsGetExecute(r) +} + +/* +V2SandboxesSandboxIDLogsGet Method for V2SandboxesSandboxIDLogsGet + +Get sandbox logs + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param sandboxID + @return ApiV2SandboxesSandboxIDLogsGetRequest +*/ +func (a *SandboxesApiService) V2SandboxesSandboxIDLogsGet(ctx context.Context, sandboxID string) ApiV2SandboxesSandboxIDLogsGetRequest { + return ApiV2SandboxesSandboxIDLogsGetRequest{ + ApiService: a, + ctx: ctx, + sandboxID: sandboxID, + } +} + +// Execute executes the request +// +// @return SandboxLogsV2Response +func (a *SandboxesApiService) V2SandboxesSandboxIDLogsGetExecute(r ApiV2SandboxesSandboxIDLogsGetRequest) (*SandboxLogsV2Response, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SandboxLogsV2Response + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SandboxesApiService.V2SandboxesSandboxIDLogsGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v2/sandboxes/{sandboxID}/logs" + localVarPath = strings.Replace(localVarPath, "{"+"sandboxID"+"}", url.PathEscape(parameterValueToString(r.sandboxID, "sandboxID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.cursor != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "cursor", r.cursor, "") + } + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") + } + if r.direction != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "direction", r.direction, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/e2b/client/api_snapshots.go b/e2b/client/api_snapshots.go new file mode 100644 index 0000000..4c176ee --- /dev/null +++ b/e2b/client/api_snapshots.go @@ -0,0 +1,231 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" +) + +type SnapshotsApi interface { + + /* + SnapshotsGet Method for SnapshotsGet + + List all snapshots for the team + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiSnapshotsGetRequest + */ + SnapshotsGet(ctx context.Context) ApiSnapshotsGetRequest + + // SnapshotsGetExecute executes the request + // @return []SnapshotInfo + SnapshotsGetExecute(r ApiSnapshotsGetRequest) ([]SnapshotInfo, *http.Response, error) +} + +// SnapshotsApiService SnapshotsApi service +type SnapshotsApiService service + +type ApiSnapshotsGetRequest struct { + ctx context.Context + ApiService SnapshotsApi + sandboxID *string + limit *int32 + nextToken *string +} + +func (r ApiSnapshotsGetRequest) SandboxID(sandboxID string) ApiSnapshotsGetRequest { + r.sandboxID = &sandboxID + return r +} + +// Maximum number of items to return per page +func (r ApiSnapshotsGetRequest) Limit(limit int32) ApiSnapshotsGetRequest { + r.limit = &limit + return r +} + +// Cursor to start the list from +func (r ApiSnapshotsGetRequest) NextToken(nextToken string) ApiSnapshotsGetRequest { + r.nextToken = &nextToken + return r +} + +func (r ApiSnapshotsGetRequest) Execute() ([]SnapshotInfo, *http.Response, error) { + return r.ApiService.SnapshotsGetExecute(r) +} + +/* +SnapshotsGet Method for SnapshotsGet + +List all snapshots for the team + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiSnapshotsGetRequest +*/ +func (a *SnapshotsApiService) SnapshotsGet(ctx context.Context) ApiSnapshotsGetRequest { + return ApiSnapshotsGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return []SnapshotInfo +func (a *SnapshotsApiService) SnapshotsGetExecute(r ApiSnapshotsGetRequest) ([]SnapshotInfo, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []SnapshotInfo + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SnapshotsApiService.SnapshotsGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/snapshots" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.sandboxID != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "sandboxID", r.sandboxID, "") + } + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") + } + if r.nextToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "nextToken", r.nextToken, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/e2b/client/api_tags.go b/e2b/client/api_tags.go new file mode 100644 index 0000000..200bf0c --- /dev/null +++ b/e2b/client/api_tags.go @@ -0,0 +1,637 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +type TagsApi interface { + + /* + TemplatesTagsDelete Method for TemplatesTagsDelete + + Delete multiple tags from templates + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTemplatesTagsDeleteRequest + */ + TemplatesTagsDelete(ctx context.Context) ApiTemplatesTagsDeleteRequest + + // TemplatesTagsDeleteExecute executes the request + TemplatesTagsDeleteExecute(r ApiTemplatesTagsDeleteRequest) (*http.Response, error) + + /* + TemplatesTagsPost Method for TemplatesTagsPost + + Assign tag(s) to a template build + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTemplatesTagsPostRequest + */ + TemplatesTagsPost(ctx context.Context) ApiTemplatesTagsPostRequest + + // TemplatesTagsPostExecute executes the request + // @return AssignedTemplateTags + TemplatesTagsPostExecute(r ApiTemplatesTagsPostRequest) (*AssignedTemplateTags, *http.Response, error) + + /* + TemplatesTemplateIDTagsGet Method for TemplatesTemplateIDTagsGet + + List all tags for a template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param templateID + @return ApiTemplatesTemplateIDTagsGetRequest + */ + TemplatesTemplateIDTagsGet(ctx context.Context, templateID string) ApiTemplatesTemplateIDTagsGetRequest + + // TemplatesTemplateIDTagsGetExecute executes the request + // @return []TemplateTag + TemplatesTemplateIDTagsGetExecute(r ApiTemplatesTemplateIDTagsGetRequest) ([]TemplateTag, *http.Response, error) +} + +// TagsApiService TagsApi service +type TagsApiService service + +type ApiTemplatesTagsDeleteRequest struct { + ctx context.Context + ApiService TagsApi + deleteTemplateTagsRequest *DeleteTemplateTagsRequest +} + +func (r ApiTemplatesTagsDeleteRequest) DeleteTemplateTagsRequest(deleteTemplateTagsRequest DeleteTemplateTagsRequest) ApiTemplatesTagsDeleteRequest { + r.deleteTemplateTagsRequest = &deleteTemplateTagsRequest + return r +} + +func (r ApiTemplatesTagsDeleteRequest) Execute() (*http.Response, error) { + return r.ApiService.TemplatesTagsDeleteExecute(r) +} + +/* +TemplatesTagsDelete Method for TemplatesTagsDelete + +Delete multiple tags from templates + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTemplatesTagsDeleteRequest +*/ +func (a *TagsApiService) TemplatesTagsDelete(ctx context.Context) ApiTemplatesTagsDeleteRequest { + return ApiTemplatesTagsDeleteRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +func (a *TagsApiService) TemplatesTagsDeleteExecute(r ApiTemplatesTagsDeleteRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TagsApiService.TemplatesTagsDelete") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/templates/tags" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.deleteTemplateTagsRequest == nil { + return nil, reportError("deleteTemplateTagsRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.deleteTemplateTagsRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiTemplatesTagsPostRequest struct { + ctx context.Context + ApiService TagsApi + assignTemplateTagsRequest *AssignTemplateTagsRequest +} + +func (r ApiTemplatesTagsPostRequest) AssignTemplateTagsRequest(assignTemplateTagsRequest AssignTemplateTagsRequest) ApiTemplatesTagsPostRequest { + r.assignTemplateTagsRequest = &assignTemplateTagsRequest + return r +} + +func (r ApiTemplatesTagsPostRequest) Execute() (*AssignedTemplateTags, *http.Response, error) { + return r.ApiService.TemplatesTagsPostExecute(r) +} + +/* +TemplatesTagsPost Method for TemplatesTagsPost + +Assign tag(s) to a template build + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTemplatesTagsPostRequest +*/ +func (a *TagsApiService) TemplatesTagsPost(ctx context.Context) ApiTemplatesTagsPostRequest { + return ApiTemplatesTagsPostRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return AssignedTemplateTags +func (a *TagsApiService) TemplatesTagsPostExecute(r ApiTemplatesTagsPostRequest) (*AssignedTemplateTags, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AssignedTemplateTags + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TagsApiService.TemplatesTagsPost") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/templates/tags" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.assignTemplateTagsRequest == nil { + return localVarReturnValue, nil, reportError("assignTemplateTagsRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.assignTemplateTagsRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTemplatesTemplateIDTagsGetRequest struct { + ctx context.Context + ApiService TagsApi + templateID string +} + +func (r ApiTemplatesTemplateIDTagsGetRequest) Execute() ([]TemplateTag, *http.Response, error) { + return r.ApiService.TemplatesTemplateIDTagsGetExecute(r) +} + +/* +TemplatesTemplateIDTagsGet Method for TemplatesTemplateIDTagsGet + +List all tags for a template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param templateID + @return ApiTemplatesTemplateIDTagsGetRequest +*/ +func (a *TagsApiService) TemplatesTemplateIDTagsGet(ctx context.Context, templateID string) ApiTemplatesTemplateIDTagsGetRequest { + return ApiTemplatesTemplateIDTagsGetRequest{ + ApiService: a, + ctx: ctx, + templateID: templateID, + } +} + +// Execute executes the request +// +// @return []TemplateTag +func (a *TagsApiService) TemplatesTemplateIDTagsGetExecute(r ApiTemplatesTemplateIDTagsGetRequest) ([]TemplateTag, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []TemplateTag + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TagsApiService.TemplatesTemplateIDTagsGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/templates/{templateID}/tags" + localVarPath = strings.Replace(localVarPath, "{"+"templateID"+"}", url.PathEscape(parameterValueToString(r.templateID, "templateID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/e2b/client/api_templates.go b/e2b/client/api_templates.go new file mode 100644 index 0000000..c24bc33 --- /dev/null +++ b/e2b/client/api_templates.go @@ -0,0 +1,3004 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +type TemplatesApi interface { + + /* + TemplatesAliasesAliasGet Method for TemplatesAliasesAliasGet + + Check if template with given alias exists + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param alias + @return ApiTemplatesAliasesAliasGetRequest + */ + TemplatesAliasesAliasGet(ctx context.Context, alias string) ApiTemplatesAliasesAliasGetRequest + + // TemplatesAliasesAliasGetExecute executes the request + // @return TemplateAliasResponse + TemplatesAliasesAliasGetExecute(r ApiTemplatesAliasesAliasGetRequest) (*TemplateAliasResponse, *http.Response, error) + + /* + TemplatesGet Method for TemplatesGet + + List all templates + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTemplatesGetRequest + */ + TemplatesGet(ctx context.Context) ApiTemplatesGetRequest + + // TemplatesGetExecute executes the request + // @return []TemplatesGet200ResponseInner + TemplatesGetExecute(r ApiTemplatesGetRequest) ([]TemplatesGet200ResponseInner, *http.Response, error) + + /* + TemplatesPost Method for TemplatesPost + + Create a new template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTemplatesPostRequest + + Deprecated + */ + TemplatesPost(ctx context.Context) ApiTemplatesPostRequest + + // TemplatesPostExecute executes the request + // @return TemplateLegacy + // Deprecated + TemplatesPostExecute(r ApiTemplatesPostRequest) (*TemplateLegacy, *http.Response, error) + + /* + TemplatesTemplateIDBuildsBuildIDLogsGet Method for TemplatesTemplateIDBuildsBuildIDLogsGet + + Get template build logs + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param templateID + @param buildID + @return ApiTemplatesTemplateIDBuildsBuildIDLogsGetRequest + */ + TemplatesTemplateIDBuildsBuildIDLogsGet(ctx context.Context, templateID string, buildID string) ApiTemplatesTemplateIDBuildsBuildIDLogsGetRequest + + // TemplatesTemplateIDBuildsBuildIDLogsGetExecute executes the request + // @return TemplateBuildLogsResponse + TemplatesTemplateIDBuildsBuildIDLogsGetExecute(r ApiTemplatesTemplateIDBuildsBuildIDLogsGetRequest) (*TemplateBuildLogsResponse, *http.Response, error) + + /* + TemplatesTemplateIDBuildsBuildIDPost Method for TemplatesTemplateIDBuildsBuildIDPost + + Start the build + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param templateID + @param buildID + @return ApiTemplatesTemplateIDBuildsBuildIDPostRequest + + Deprecated + */ + TemplatesTemplateIDBuildsBuildIDPost(ctx context.Context, templateID string, buildID string) ApiTemplatesTemplateIDBuildsBuildIDPostRequest + + // TemplatesTemplateIDBuildsBuildIDPostExecute executes the request + // Deprecated + TemplatesTemplateIDBuildsBuildIDPostExecute(r ApiTemplatesTemplateIDBuildsBuildIDPostRequest) (*http.Response, error) + + /* + TemplatesTemplateIDBuildsBuildIDStatusGet Method for TemplatesTemplateIDBuildsBuildIDStatusGet + + Get template build info + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param templateID + @param buildID + @return ApiTemplatesTemplateIDBuildsBuildIDStatusGetRequest + */ + TemplatesTemplateIDBuildsBuildIDStatusGet(ctx context.Context, templateID string, buildID string) ApiTemplatesTemplateIDBuildsBuildIDStatusGetRequest + + // TemplatesTemplateIDBuildsBuildIDStatusGetExecute executes the request + // @return TemplateBuildInfo + TemplatesTemplateIDBuildsBuildIDStatusGetExecute(r ApiTemplatesTemplateIDBuildsBuildIDStatusGetRequest) (*TemplateBuildInfo, *http.Response, error) + + /* + TemplatesTemplateIDDelete Method for TemplatesTemplateIDDelete + + Delete a template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param templateID + @return ApiTemplatesTemplateIDDeleteRequest + */ + TemplatesTemplateIDDelete(ctx context.Context, templateID string) ApiTemplatesTemplateIDDeleteRequest + + // TemplatesTemplateIDDeleteExecute executes the request + TemplatesTemplateIDDeleteExecute(r ApiTemplatesTemplateIDDeleteRequest) (*http.Response, error) + + /* + TemplatesTemplateIDFilesHashGet Method for TemplatesTemplateIDFilesHashGet + + Get an upload link for a tar file containing build layer files + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param templateID + @param hash + @return ApiTemplatesTemplateIDFilesHashGetRequest + */ + TemplatesTemplateIDFilesHashGet(ctx context.Context, templateID string, hash string) ApiTemplatesTemplateIDFilesHashGetRequest + + // TemplatesTemplateIDFilesHashGetExecute executes the request + // @return TemplateBuildFileUpload + TemplatesTemplateIDFilesHashGetExecute(r ApiTemplatesTemplateIDFilesHashGetRequest) (*TemplateBuildFileUpload, *http.Response, error) + + /* + TemplatesTemplateIDGet Method for TemplatesTemplateIDGet + + List all builds for a template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param templateID + @return ApiTemplatesTemplateIDGetRequest + */ + TemplatesTemplateIDGet(ctx context.Context, templateID string) ApiTemplatesTemplateIDGetRequest + + // TemplatesTemplateIDGetExecute executes the request + // @return TemplateWithBuilds + TemplatesTemplateIDGetExecute(r ApiTemplatesTemplateIDGetRequest) (*TemplateWithBuilds, *http.Response, error) + + /* + TemplatesTemplateIDPatch Method for TemplatesTemplateIDPatch + + Update template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param templateID + @return ApiTemplatesTemplateIDPatchRequest + + Deprecated + */ + TemplatesTemplateIDPatch(ctx context.Context, templateID string) ApiTemplatesTemplateIDPatchRequest + + // TemplatesTemplateIDPatchExecute executes the request + // Deprecated + TemplatesTemplateIDPatchExecute(r ApiTemplatesTemplateIDPatchRequest) (*http.Response, error) + + /* + TemplatesTemplateIDPost Method for TemplatesTemplateIDPost + + Rebuild an template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param templateID + @return ApiTemplatesTemplateIDPostRequest + + Deprecated + */ + TemplatesTemplateIDPost(ctx context.Context, templateID string) ApiTemplatesTemplateIDPostRequest + + // TemplatesTemplateIDPostExecute executes the request + // @return TemplateLegacy + // Deprecated + TemplatesTemplateIDPostExecute(r ApiTemplatesTemplateIDPostRequest) (*TemplateLegacy, *http.Response, error) + + /* + V2TemplatesPost Method for V2TemplatesPost + + Create a new template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiV2TemplatesPostRequest + + Deprecated + */ + V2TemplatesPost(ctx context.Context) ApiV2TemplatesPostRequest + + // V2TemplatesPostExecute executes the request + // @return TemplateLegacy + // Deprecated + V2TemplatesPostExecute(r ApiV2TemplatesPostRequest) (*TemplateLegacy, *http.Response, error) + + /* + V2TemplatesTemplateIDBuildsBuildIDPost Method for V2TemplatesTemplateIDBuildsBuildIDPost + + Start the build + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param templateID + @param buildID + @return ApiV2TemplatesTemplateIDBuildsBuildIDPostRequest + */ + V2TemplatesTemplateIDBuildsBuildIDPost(ctx context.Context, templateID string, buildID string) ApiV2TemplatesTemplateIDBuildsBuildIDPostRequest + + // V2TemplatesTemplateIDBuildsBuildIDPostExecute executes the request + V2TemplatesTemplateIDBuildsBuildIDPostExecute(r ApiV2TemplatesTemplateIDBuildsBuildIDPostRequest) (*http.Response, error) + + /* + V2TemplatesTemplateIDPatch Method for V2TemplatesTemplateIDPatch + + Update template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param templateID + @return ApiV2TemplatesTemplateIDPatchRequest + */ + V2TemplatesTemplateIDPatch(ctx context.Context, templateID string) ApiV2TemplatesTemplateIDPatchRequest + + // V2TemplatesTemplateIDPatchExecute executes the request + // @return TemplateUpdateResponse + V2TemplatesTemplateIDPatchExecute(r ApiV2TemplatesTemplateIDPatchRequest) (*TemplateUpdateResponse, *http.Response, error) + + /* + V3TemplatesPost Method for V3TemplatesPost + + Create a new template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiV3TemplatesPostRequest + */ + V3TemplatesPost(ctx context.Context) ApiV3TemplatesPostRequest + + // V3TemplatesPostExecute executes the request + // @return TemplateRequestResponseV3 + V3TemplatesPostExecute(r ApiV3TemplatesPostRequest) (*TemplateRequestResponseV3, *http.Response, error) +} + +// TemplatesApiService TemplatesApi service +type TemplatesApiService service + +type ApiTemplatesAliasesAliasGetRequest struct { + ctx context.Context + ApiService TemplatesApi + alias string +} + +func (r ApiTemplatesAliasesAliasGetRequest) Execute() (*TemplateAliasResponse, *http.Response, error) { + return r.ApiService.TemplatesAliasesAliasGetExecute(r) +} + +/* +TemplatesAliasesAliasGet Method for TemplatesAliasesAliasGet + +Check if template with given alias exists + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param alias + @return ApiTemplatesAliasesAliasGetRequest +*/ +func (a *TemplatesApiService) TemplatesAliasesAliasGet(ctx context.Context, alias string) ApiTemplatesAliasesAliasGetRequest { + return ApiTemplatesAliasesAliasGetRequest{ + ApiService: a, + ctx: ctx, + alias: alias, + } +} + +// Execute executes the request +// +// @return TemplateAliasResponse +func (a *TemplatesApiService) TemplatesAliasesAliasGetExecute(r ApiTemplatesAliasesAliasGetRequest) (*TemplateAliasResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TemplateAliasResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TemplatesApiService.TemplatesAliasesAliasGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/templates/aliases/{alias}" + localVarPath = strings.Replace(localVarPath, "{"+"alias"+"}", url.PathEscape(parameterValueToString(r.alias, "alias")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTemplatesGetRequest struct { + ctx context.Context + ApiService TemplatesApi + teamID *string +} + +func (r ApiTemplatesGetRequest) TeamID(teamID string) ApiTemplatesGetRequest { + r.teamID = &teamID + return r +} + +func (r ApiTemplatesGetRequest) Execute() ([]TemplatesGet200ResponseInner, *http.Response, error) { + return r.ApiService.TemplatesGetExecute(r) +} + +/* +TemplatesGet Method for TemplatesGet + +List all templates + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTemplatesGetRequest +*/ +func (a *TemplatesApiService) TemplatesGet(ctx context.Context) ApiTemplatesGetRequest { + return ApiTemplatesGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return []TemplatesGet200ResponseInner +func (a *TemplatesApiService) TemplatesGetExecute(r ApiTemplatesGetRequest) ([]TemplatesGet200ResponseInner, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []TemplatesGet200ResponseInner + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TemplatesApiService.TemplatesGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/templates" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.teamID != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "teamID", r.teamID, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTemplatesPostRequest struct { + ctx context.Context + ApiService TemplatesApi + templateBuildRequest *TemplateBuildRequest +} + +func (r ApiTemplatesPostRequest) TemplateBuildRequest(templateBuildRequest TemplateBuildRequest) ApiTemplatesPostRequest { + r.templateBuildRequest = &templateBuildRequest + return r +} + +func (r ApiTemplatesPostRequest) Execute() (*TemplateLegacy, *http.Response, error) { + return r.ApiService.TemplatesPostExecute(r) +} + +/* +TemplatesPost Method for TemplatesPost + +Create a new template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTemplatesPostRequest + +Deprecated +*/ +func (a *TemplatesApiService) TemplatesPost(ctx context.Context) ApiTemplatesPostRequest { + return ApiTemplatesPostRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return TemplateLegacy +// +// Deprecated +func (a *TemplatesApiService) TemplatesPostExecute(r ApiTemplatesPostRequest) (*TemplateLegacy, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TemplateLegacy + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TemplatesApiService.TemplatesPost") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/templates" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.templateBuildRequest == nil { + return localVarReturnValue, nil, reportError("templateBuildRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.templateBuildRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTemplatesTemplateIDBuildsBuildIDLogsGetRequest struct { + ctx context.Context + ApiService TemplatesApi + templateID string + buildID string + cursor *int64 + limit *int32 + direction *LogsDirection + level *LogLevel + source *LogsSource +} + +// Starting timestamp of the logs that should be returned in milliseconds +func (r ApiTemplatesTemplateIDBuildsBuildIDLogsGetRequest) Cursor(cursor int64) ApiTemplatesTemplateIDBuildsBuildIDLogsGetRequest { + r.cursor = &cursor + return r +} + +// Maximum number of logs that should be returned +func (r ApiTemplatesTemplateIDBuildsBuildIDLogsGetRequest) Limit(limit int32) ApiTemplatesTemplateIDBuildsBuildIDLogsGetRequest { + r.limit = &limit + return r +} + +func (r ApiTemplatesTemplateIDBuildsBuildIDLogsGetRequest) Direction(direction LogsDirection) ApiTemplatesTemplateIDBuildsBuildIDLogsGetRequest { + r.direction = &direction + return r +} + +func (r ApiTemplatesTemplateIDBuildsBuildIDLogsGetRequest) Level(level LogLevel) ApiTemplatesTemplateIDBuildsBuildIDLogsGetRequest { + r.level = &level + return r +} + +// Source of the logs that should be returned from +func (r ApiTemplatesTemplateIDBuildsBuildIDLogsGetRequest) Source(source LogsSource) ApiTemplatesTemplateIDBuildsBuildIDLogsGetRequest { + r.source = &source + return r +} + +func (r ApiTemplatesTemplateIDBuildsBuildIDLogsGetRequest) Execute() (*TemplateBuildLogsResponse, *http.Response, error) { + return r.ApiService.TemplatesTemplateIDBuildsBuildIDLogsGetExecute(r) +} + +/* +TemplatesTemplateIDBuildsBuildIDLogsGet Method for TemplatesTemplateIDBuildsBuildIDLogsGet + +Get template build logs + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param templateID + @param buildID + @return ApiTemplatesTemplateIDBuildsBuildIDLogsGetRequest +*/ +func (a *TemplatesApiService) TemplatesTemplateIDBuildsBuildIDLogsGet(ctx context.Context, templateID string, buildID string) ApiTemplatesTemplateIDBuildsBuildIDLogsGetRequest { + return ApiTemplatesTemplateIDBuildsBuildIDLogsGetRequest{ + ApiService: a, + ctx: ctx, + templateID: templateID, + buildID: buildID, + } +} + +// Execute executes the request +// +// @return TemplateBuildLogsResponse +func (a *TemplatesApiService) TemplatesTemplateIDBuildsBuildIDLogsGetExecute(r ApiTemplatesTemplateIDBuildsBuildIDLogsGetRequest) (*TemplateBuildLogsResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TemplateBuildLogsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TemplatesApiService.TemplatesTemplateIDBuildsBuildIDLogsGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/templates/{templateID}/builds/{buildID}/logs" + localVarPath = strings.Replace(localVarPath, "{"+"templateID"+"}", url.PathEscape(parameterValueToString(r.templateID, "templateID")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"buildID"+"}", url.PathEscape(parameterValueToString(r.buildID, "buildID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.cursor != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "cursor", r.cursor, "") + } + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") + } + if r.direction != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "direction", r.direction, "") + } + if r.level != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "level", r.level, "") + } + if r.source != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "source", r.source, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTemplatesTemplateIDBuildsBuildIDPostRequest struct { + ctx context.Context + ApiService TemplatesApi + templateID string + buildID string +} + +func (r ApiTemplatesTemplateIDBuildsBuildIDPostRequest) Execute() (*http.Response, error) { + return r.ApiService.TemplatesTemplateIDBuildsBuildIDPostExecute(r) +} + +/* +TemplatesTemplateIDBuildsBuildIDPost Method for TemplatesTemplateIDBuildsBuildIDPost + +Start the build + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param templateID + @param buildID + @return ApiTemplatesTemplateIDBuildsBuildIDPostRequest + +Deprecated +*/ +func (a *TemplatesApiService) TemplatesTemplateIDBuildsBuildIDPost(ctx context.Context, templateID string, buildID string) ApiTemplatesTemplateIDBuildsBuildIDPostRequest { + return ApiTemplatesTemplateIDBuildsBuildIDPostRequest{ + ApiService: a, + ctx: ctx, + templateID: templateID, + buildID: buildID, + } +} + +// Execute executes the request +// Deprecated +func (a *TemplatesApiService) TemplatesTemplateIDBuildsBuildIDPostExecute(r ApiTemplatesTemplateIDBuildsBuildIDPostRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TemplatesApiService.TemplatesTemplateIDBuildsBuildIDPost") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/templates/{templateID}/builds/{buildID}" + localVarPath = strings.Replace(localVarPath, "{"+"templateID"+"}", url.PathEscape(parameterValueToString(r.templateID, "templateID")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"buildID"+"}", url.PathEscape(parameterValueToString(r.buildID, "buildID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiTemplatesTemplateIDBuildsBuildIDStatusGetRequest struct { + ctx context.Context + ApiService TemplatesApi + templateID string + buildID string + logsOffset *int32 + limit *int32 + level *LogLevel +} + +// Index of the starting build log that should be returned with the template +func (r ApiTemplatesTemplateIDBuildsBuildIDStatusGetRequest) LogsOffset(logsOffset int32) ApiTemplatesTemplateIDBuildsBuildIDStatusGetRequest { + r.logsOffset = &logsOffset + return r +} + +// Maximum number of logs that should be returned +func (r ApiTemplatesTemplateIDBuildsBuildIDStatusGetRequest) Limit(limit int32) ApiTemplatesTemplateIDBuildsBuildIDStatusGetRequest { + r.limit = &limit + return r +} + +func (r ApiTemplatesTemplateIDBuildsBuildIDStatusGetRequest) Level(level LogLevel) ApiTemplatesTemplateIDBuildsBuildIDStatusGetRequest { + r.level = &level + return r +} + +func (r ApiTemplatesTemplateIDBuildsBuildIDStatusGetRequest) Execute() (*TemplateBuildInfo, *http.Response, error) { + return r.ApiService.TemplatesTemplateIDBuildsBuildIDStatusGetExecute(r) +} + +/* +TemplatesTemplateIDBuildsBuildIDStatusGet Method for TemplatesTemplateIDBuildsBuildIDStatusGet + +Get template build info + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param templateID + @param buildID + @return ApiTemplatesTemplateIDBuildsBuildIDStatusGetRequest +*/ +func (a *TemplatesApiService) TemplatesTemplateIDBuildsBuildIDStatusGet(ctx context.Context, templateID string, buildID string) ApiTemplatesTemplateIDBuildsBuildIDStatusGetRequest { + return ApiTemplatesTemplateIDBuildsBuildIDStatusGetRequest{ + ApiService: a, + ctx: ctx, + templateID: templateID, + buildID: buildID, + } +} + +// Execute executes the request +// +// @return TemplateBuildInfo +func (a *TemplatesApiService) TemplatesTemplateIDBuildsBuildIDStatusGetExecute(r ApiTemplatesTemplateIDBuildsBuildIDStatusGetRequest) (*TemplateBuildInfo, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TemplateBuildInfo + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TemplatesApiService.TemplatesTemplateIDBuildsBuildIDStatusGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/templates/{templateID}/builds/{buildID}/status" + localVarPath = strings.Replace(localVarPath, "{"+"templateID"+"}", url.PathEscape(parameterValueToString(r.templateID, "templateID")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"buildID"+"}", url.PathEscape(parameterValueToString(r.buildID, "buildID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.logsOffset != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "logsOffset", r.logsOffset, "") + } + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") + } + if r.level != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "level", r.level, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTemplatesTemplateIDDeleteRequest struct { + ctx context.Context + ApiService TemplatesApi + templateID string +} + +func (r ApiTemplatesTemplateIDDeleteRequest) Execute() (*http.Response, error) { + return r.ApiService.TemplatesTemplateIDDeleteExecute(r) +} + +/* +TemplatesTemplateIDDelete Method for TemplatesTemplateIDDelete + +Delete a template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param templateID + @return ApiTemplatesTemplateIDDeleteRequest +*/ +func (a *TemplatesApiService) TemplatesTemplateIDDelete(ctx context.Context, templateID string) ApiTemplatesTemplateIDDeleteRequest { + return ApiTemplatesTemplateIDDeleteRequest{ + ApiService: a, + ctx: ctx, + templateID: templateID, + } +} + +// Execute executes the request +func (a *TemplatesApiService) TemplatesTemplateIDDeleteExecute(r ApiTemplatesTemplateIDDeleteRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TemplatesApiService.TemplatesTemplateIDDelete") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/templates/{templateID}" + localVarPath = strings.Replace(localVarPath, "{"+"templateID"+"}", url.PathEscape(parameterValueToString(r.templateID, "templateID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiTemplatesTemplateIDFilesHashGetRequest struct { + ctx context.Context + ApiService TemplatesApi + templateID string + hash string +} + +func (r ApiTemplatesTemplateIDFilesHashGetRequest) Execute() (*TemplateBuildFileUpload, *http.Response, error) { + return r.ApiService.TemplatesTemplateIDFilesHashGetExecute(r) +} + +/* +TemplatesTemplateIDFilesHashGet Method for TemplatesTemplateIDFilesHashGet + +Get an upload link for a tar file containing build layer files + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param templateID + @param hash + @return ApiTemplatesTemplateIDFilesHashGetRequest +*/ +func (a *TemplatesApiService) TemplatesTemplateIDFilesHashGet(ctx context.Context, templateID string, hash string) ApiTemplatesTemplateIDFilesHashGetRequest { + return ApiTemplatesTemplateIDFilesHashGetRequest{ + ApiService: a, + ctx: ctx, + templateID: templateID, + hash: hash, + } +} + +// Execute executes the request +// +// @return TemplateBuildFileUpload +func (a *TemplatesApiService) TemplatesTemplateIDFilesHashGetExecute(r ApiTemplatesTemplateIDFilesHashGetRequest) (*TemplateBuildFileUpload, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TemplateBuildFileUpload + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TemplatesApiService.TemplatesTemplateIDFilesHashGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/templates/{templateID}/files/{hash}" + localVarPath = strings.Replace(localVarPath, "{"+"templateID"+"}", url.PathEscape(parameterValueToString(r.templateID, "templateID")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"hash"+"}", url.PathEscape(parameterValueToString(r.hash, "hash")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTemplatesTemplateIDGetRequest struct { + ctx context.Context + ApiService TemplatesApi + templateID string + nextToken *string + limit *int32 +} + +// Cursor to start the list from +func (r ApiTemplatesTemplateIDGetRequest) NextToken(nextToken string) ApiTemplatesTemplateIDGetRequest { + r.nextToken = &nextToken + return r +} + +// Maximum number of items to return per page +func (r ApiTemplatesTemplateIDGetRequest) Limit(limit int32) ApiTemplatesTemplateIDGetRequest { + r.limit = &limit + return r +} + +func (r ApiTemplatesTemplateIDGetRequest) Execute() (*TemplateWithBuilds, *http.Response, error) { + return r.ApiService.TemplatesTemplateIDGetExecute(r) +} + +/* +TemplatesTemplateIDGet Method for TemplatesTemplateIDGet + +List all builds for a template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param templateID + @return ApiTemplatesTemplateIDGetRequest +*/ +func (a *TemplatesApiService) TemplatesTemplateIDGet(ctx context.Context, templateID string) ApiTemplatesTemplateIDGetRequest { + return ApiTemplatesTemplateIDGetRequest{ + ApiService: a, + ctx: ctx, + templateID: templateID, + } +} + +// Execute executes the request +// +// @return TemplateWithBuilds +func (a *TemplatesApiService) TemplatesTemplateIDGetExecute(r ApiTemplatesTemplateIDGetRequest) (*TemplateWithBuilds, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TemplateWithBuilds + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TemplatesApiService.TemplatesTemplateIDGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/templates/{templateID}" + localVarPath = strings.Replace(localVarPath, "{"+"templateID"+"}", url.PathEscape(parameterValueToString(r.templateID, "templateID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.nextToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "nextToken", r.nextToken, "") + } + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTemplatesTemplateIDPatchRequest struct { + ctx context.Context + ApiService TemplatesApi + templateID string + templateUpdateRequest *TemplateUpdateRequest +} + +func (r ApiTemplatesTemplateIDPatchRequest) TemplateUpdateRequest(templateUpdateRequest TemplateUpdateRequest) ApiTemplatesTemplateIDPatchRequest { + r.templateUpdateRequest = &templateUpdateRequest + return r +} + +func (r ApiTemplatesTemplateIDPatchRequest) Execute() (*http.Response, error) { + return r.ApiService.TemplatesTemplateIDPatchExecute(r) +} + +/* +TemplatesTemplateIDPatch Method for TemplatesTemplateIDPatch + +Update template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param templateID + @return ApiTemplatesTemplateIDPatchRequest + +Deprecated +*/ +func (a *TemplatesApiService) TemplatesTemplateIDPatch(ctx context.Context, templateID string) ApiTemplatesTemplateIDPatchRequest { + return ApiTemplatesTemplateIDPatchRequest{ + ApiService: a, + ctx: ctx, + templateID: templateID, + } +} + +// Execute executes the request +// Deprecated +func (a *TemplatesApiService) TemplatesTemplateIDPatchExecute(r ApiTemplatesTemplateIDPatchRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TemplatesApiService.TemplatesTemplateIDPatch") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/templates/{templateID}" + localVarPath = strings.Replace(localVarPath, "{"+"templateID"+"}", url.PathEscape(parameterValueToString(r.templateID, "templateID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.templateUpdateRequest == nil { + return nil, reportError("templateUpdateRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.templateUpdateRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiTemplatesTemplateIDPostRequest struct { + ctx context.Context + ApiService TemplatesApi + templateID string + templateBuildRequest *TemplateBuildRequest +} + +func (r ApiTemplatesTemplateIDPostRequest) TemplateBuildRequest(templateBuildRequest TemplateBuildRequest) ApiTemplatesTemplateIDPostRequest { + r.templateBuildRequest = &templateBuildRequest + return r +} + +func (r ApiTemplatesTemplateIDPostRequest) Execute() (*TemplateLegacy, *http.Response, error) { + return r.ApiService.TemplatesTemplateIDPostExecute(r) +} + +/* +TemplatesTemplateIDPost Method for TemplatesTemplateIDPost + +Rebuild an template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param templateID + @return ApiTemplatesTemplateIDPostRequest + +Deprecated +*/ +func (a *TemplatesApiService) TemplatesTemplateIDPost(ctx context.Context, templateID string) ApiTemplatesTemplateIDPostRequest { + return ApiTemplatesTemplateIDPostRequest{ + ApiService: a, + ctx: ctx, + templateID: templateID, + } +} + +// Execute executes the request +// +// @return TemplateLegacy +// +// Deprecated +func (a *TemplatesApiService) TemplatesTemplateIDPostExecute(r ApiTemplatesTemplateIDPostRequest) (*TemplateLegacy, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TemplateLegacy + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TemplatesApiService.TemplatesTemplateIDPost") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/templates/{templateID}" + localVarPath = strings.Replace(localVarPath, "{"+"templateID"+"}", url.PathEscape(parameterValueToString(r.templateID, "templateID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.templateBuildRequest == nil { + return localVarReturnValue, nil, reportError("templateBuildRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.templateBuildRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiV2TemplatesPostRequest struct { + ctx context.Context + ApiService TemplatesApi + templateBuildRequestV2 *TemplateBuildRequestV2 +} + +func (r ApiV2TemplatesPostRequest) TemplateBuildRequestV2(templateBuildRequestV2 TemplateBuildRequestV2) ApiV2TemplatesPostRequest { + r.templateBuildRequestV2 = &templateBuildRequestV2 + return r +} + +func (r ApiV2TemplatesPostRequest) Execute() (*TemplateLegacy, *http.Response, error) { + return r.ApiService.V2TemplatesPostExecute(r) +} + +/* +V2TemplatesPost Method for V2TemplatesPost + +Create a new template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiV2TemplatesPostRequest + +Deprecated +*/ +func (a *TemplatesApiService) V2TemplatesPost(ctx context.Context) ApiV2TemplatesPostRequest { + return ApiV2TemplatesPostRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return TemplateLegacy +// +// Deprecated +func (a *TemplatesApiService) V2TemplatesPostExecute(r ApiV2TemplatesPostRequest) (*TemplateLegacy, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TemplateLegacy + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TemplatesApiService.V2TemplatesPost") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v2/templates" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.templateBuildRequestV2 == nil { + return localVarReturnValue, nil, reportError("templateBuildRequestV2 is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.templateBuildRequestV2 + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiV2TemplatesTemplateIDBuildsBuildIDPostRequest struct { + ctx context.Context + ApiService TemplatesApi + templateID string + buildID string + templateBuildStartV2 *TemplateBuildStartV2 +} + +func (r ApiV2TemplatesTemplateIDBuildsBuildIDPostRequest) TemplateBuildStartV2(templateBuildStartV2 TemplateBuildStartV2) ApiV2TemplatesTemplateIDBuildsBuildIDPostRequest { + r.templateBuildStartV2 = &templateBuildStartV2 + return r +} + +func (r ApiV2TemplatesTemplateIDBuildsBuildIDPostRequest) Execute() (*http.Response, error) { + return r.ApiService.V2TemplatesTemplateIDBuildsBuildIDPostExecute(r) +} + +/* +V2TemplatesTemplateIDBuildsBuildIDPost Method for V2TemplatesTemplateIDBuildsBuildIDPost + +Start the build + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param templateID + @param buildID + @return ApiV2TemplatesTemplateIDBuildsBuildIDPostRequest +*/ +func (a *TemplatesApiService) V2TemplatesTemplateIDBuildsBuildIDPost(ctx context.Context, templateID string, buildID string) ApiV2TemplatesTemplateIDBuildsBuildIDPostRequest { + return ApiV2TemplatesTemplateIDBuildsBuildIDPostRequest{ + ApiService: a, + ctx: ctx, + templateID: templateID, + buildID: buildID, + } +} + +// Execute executes the request +func (a *TemplatesApiService) V2TemplatesTemplateIDBuildsBuildIDPostExecute(r ApiV2TemplatesTemplateIDBuildsBuildIDPostRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TemplatesApiService.V2TemplatesTemplateIDBuildsBuildIDPost") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v2/templates/{templateID}/builds/{buildID}" + localVarPath = strings.Replace(localVarPath, "{"+"templateID"+"}", url.PathEscape(parameterValueToString(r.templateID, "templateID")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"buildID"+"}", url.PathEscape(parameterValueToString(r.buildID, "buildID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.templateBuildStartV2 == nil { + return nil, reportError("templateBuildStartV2 is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.templateBuildStartV2 + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiV2TemplatesTemplateIDPatchRequest struct { + ctx context.Context + ApiService TemplatesApi + templateID string + templateUpdateRequest *TemplateUpdateRequest +} + +func (r ApiV2TemplatesTemplateIDPatchRequest) TemplateUpdateRequest(templateUpdateRequest TemplateUpdateRequest) ApiV2TemplatesTemplateIDPatchRequest { + r.templateUpdateRequest = &templateUpdateRequest + return r +} + +func (r ApiV2TemplatesTemplateIDPatchRequest) Execute() (*TemplateUpdateResponse, *http.Response, error) { + return r.ApiService.V2TemplatesTemplateIDPatchExecute(r) +} + +/* +V2TemplatesTemplateIDPatch Method for V2TemplatesTemplateIDPatch + +Update template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param templateID + @return ApiV2TemplatesTemplateIDPatchRequest +*/ +func (a *TemplatesApiService) V2TemplatesTemplateIDPatch(ctx context.Context, templateID string) ApiV2TemplatesTemplateIDPatchRequest { + return ApiV2TemplatesTemplateIDPatchRequest{ + ApiService: a, + ctx: ctx, + templateID: templateID, + } +} + +// Execute executes the request +// +// @return TemplateUpdateResponse +func (a *TemplatesApiService) V2TemplatesTemplateIDPatchExecute(r ApiV2TemplatesTemplateIDPatchRequest) (*TemplateUpdateResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TemplateUpdateResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TemplatesApiService.V2TemplatesTemplateIDPatch") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v2/templates/{templateID}" + localVarPath = strings.Replace(localVarPath, "{"+"templateID"+"}", url.PathEscape(parameterValueToString(r.templateID, "templateID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.templateUpdateRequest == nil { + return localVarReturnValue, nil, reportError("templateUpdateRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.templateUpdateRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiV3TemplatesPostRequest struct { + ctx context.Context + ApiService TemplatesApi + templateBuildRequestV3 *TemplateBuildRequestV3 +} + +func (r ApiV3TemplatesPostRequest) TemplateBuildRequestV3(templateBuildRequestV3 TemplateBuildRequestV3) ApiV3TemplatesPostRequest { + r.templateBuildRequestV3 = &templateBuildRequestV3 + return r +} + +func (r ApiV3TemplatesPostRequest) Execute() (*TemplateRequestResponseV3, *http.Response, error) { + return r.ApiService.V3TemplatesPostExecute(r) +} + +/* +V3TemplatesPost Method for V3TemplatesPost + +Create a new template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiV3TemplatesPostRequest +*/ +func (a *TemplatesApiService) V3TemplatesPost(ctx context.Context) ApiV3TemplatesPostRequest { + return ApiV3TemplatesPostRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return TemplateRequestResponseV3 +func (a *TemplatesApiService) V3TemplatesPostExecute(r ApiV3TemplatesPostRequest) (*TemplateRequestResponseV3, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TemplateRequestResponseV3 + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TemplatesApiService.V3TemplatesPost") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v3/templates" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.templateBuildRequestV3 == nil { + return localVarReturnValue, nil, reportError("templateBuildRequestV3 is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.templateBuildRequestV3 + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/e2b/client/api_volumes.go b/e2b/client/api_volumes.go new file mode 100644 index 0000000..a184b82 --- /dev/null +++ b/e2b/client/api_volumes.go @@ -0,0 +1,775 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +type VolumesApi interface { + + /* + VolumesGet Method for VolumesGet + + List all team volumes + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVolumesGetRequest + */ + VolumesGet(ctx context.Context) ApiVolumesGetRequest + + // VolumesGetExecute executes the request + // @return []Volume + VolumesGetExecute(r ApiVolumesGetRequest) ([]Volume, *http.Response, error) + + /* + VolumesPost Method for VolumesPost + + Create a new team volume + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVolumesPostRequest + */ + VolumesPost(ctx context.Context) ApiVolumesPostRequest + + // VolumesPostExecute executes the request + // @return Volume + VolumesPostExecute(r ApiVolumesPostRequest) (*Volume, *http.Response, error) + + /* + VolumesVolumeIDDelete Method for VolumesVolumeIDDelete + + Delete a team volume + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param volumeID + @return ApiVolumesVolumeIDDeleteRequest + */ + VolumesVolumeIDDelete(ctx context.Context, volumeID string) ApiVolumesVolumeIDDeleteRequest + + // VolumesVolumeIDDeleteExecute executes the request + VolumesVolumeIDDeleteExecute(r ApiVolumesVolumeIDDeleteRequest) (*http.Response, error) + + /* + VolumesVolumeIDGet Method for VolumesVolumeIDGet + + Get team volume info + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param volumeID + @return ApiVolumesVolumeIDGetRequest + */ + VolumesVolumeIDGet(ctx context.Context, volumeID string) ApiVolumesVolumeIDGetRequest + + // VolumesVolumeIDGetExecute executes the request + // @return Volume + VolumesVolumeIDGetExecute(r ApiVolumesVolumeIDGetRequest) (*Volume, *http.Response, error) +} + +// VolumesApiService VolumesApi service +type VolumesApiService service + +type ApiVolumesGetRequest struct { + ctx context.Context + ApiService VolumesApi +} + +func (r ApiVolumesGetRequest) Execute() ([]Volume, *http.Response, error) { + return r.ApiService.VolumesGetExecute(r) +} + +/* +VolumesGet Method for VolumesGet + +List all team volumes + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVolumesGetRequest +*/ +func (a *VolumesApiService) VolumesGet(ctx context.Context) ApiVolumesGetRequest { + return ApiVolumesGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return []Volume +func (a *VolumesApiService) VolumesGetExecute(r ApiVolumesGetRequest) ([]Volume, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []Volume + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VolumesApiService.VolumesGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/volumes" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiVolumesPostRequest struct { + ctx context.Context + ApiService VolumesApi + createVolumeRequest *CreateVolumeRequest +} + +func (r ApiVolumesPostRequest) CreateVolumeRequest(createVolumeRequest CreateVolumeRequest) ApiVolumesPostRequest { + r.createVolumeRequest = &createVolumeRequest + return r +} + +func (r ApiVolumesPostRequest) Execute() (*Volume, *http.Response, error) { + return r.ApiService.VolumesPostExecute(r) +} + +/* +VolumesPost Method for VolumesPost + +Create a new team volume + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiVolumesPostRequest +*/ +func (a *VolumesApiService) VolumesPost(ctx context.Context) ApiVolumesPostRequest { + return ApiVolumesPostRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return Volume +func (a *VolumesApiService) VolumesPostExecute(r ApiVolumesPostRequest) (*Volume, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Volume + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VolumesApiService.VolumesPost") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/volumes" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createVolumeRequest == nil { + return localVarReturnValue, nil, reportError("createVolumeRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createVolumeRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiVolumesVolumeIDDeleteRequest struct { + ctx context.Context + ApiService VolumesApi + volumeID string +} + +func (r ApiVolumesVolumeIDDeleteRequest) Execute() (*http.Response, error) { + return r.ApiService.VolumesVolumeIDDeleteExecute(r) +} + +/* +VolumesVolumeIDDelete Method for VolumesVolumeIDDelete + +Delete a team volume + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param volumeID + @return ApiVolumesVolumeIDDeleteRequest +*/ +func (a *VolumesApiService) VolumesVolumeIDDelete(ctx context.Context, volumeID string) ApiVolumesVolumeIDDeleteRequest { + return ApiVolumesVolumeIDDeleteRequest{ + ApiService: a, + ctx: ctx, + volumeID: volumeID, + } +} + +// Execute executes the request +func (a *VolumesApiService) VolumesVolumeIDDeleteExecute(r ApiVolumesVolumeIDDeleteRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VolumesApiService.VolumesVolumeIDDelete") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/volumes/{volumeID}" + localVarPath = strings.Replace(localVarPath, "{"+"volumeID"+"}", url.PathEscape(parameterValueToString(r.volumeID, "volumeID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiVolumesVolumeIDGetRequest struct { + ctx context.Context + ApiService VolumesApi + volumeID string +} + +func (r ApiVolumesVolumeIDGetRequest) Execute() (*Volume, *http.Response, error) { + return r.ApiService.VolumesVolumeIDGetExecute(r) +} + +/* +VolumesVolumeIDGet Method for VolumesVolumeIDGet + +Get team volume info + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param volumeID + @return ApiVolumesVolumeIDGetRequest +*/ +func (a *VolumesApiService) VolumesVolumeIDGet(ctx context.Context, volumeID string) ApiVolumesVolumeIDGetRequest { + return ApiVolumesVolumeIDGetRequest{ + ApiService: a, + ctx: ctx, + volumeID: volumeID, + } +} + +// Execute executes the request +// +// @return Volume +func (a *VolumesApiService) VolumesVolumeIDGetExecute(r ApiVolumesVolumeIDGetRequest) (*Volume, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Volume + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VolumesApiService.VolumesVolumeIDGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/volumes/{volumeID}" + localVarPath = strings.Replace(localVarPath, "{"+"volumeID"+"}", url.PathEscape(parameterValueToString(r.volumeID, "volumeID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase1TokenAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Token"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["ApiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-API-Key"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Supabase2TeamAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["X-Supabase-Team"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/e2b/client/client.go b/e2b/client/client.go new file mode 100644 index 0000000..53ce6b2 --- /dev/null +++ b/e2b/client/client.go @@ -0,0 +1,687 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the E2B API API v0.1.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + AccessTokensApi AccessTokensApi + + AdminApi AdminApi + + ApiKeysApi ApiKeysApi + + AuthApi AuthApi + + DefaultApi DefaultApi + + SandboxesApi SandboxesApi + + SnapshotsApi SnapshotsApi + + TagsApi TagsApi + + TemplatesApi TemplatesApi + + VolumesApi VolumesApi +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.AccessTokensApi = (*AccessTokensApiService)(&c.common) + c.AdminApi = (*AdminApiService)(&c.common) + c.ApiKeysApi = (*ApiKeysApiService)(&c.common) + c.AuthApi = (*AuthApiService)(&c.common) + c.DefaultApi = (*DefaultApiService)(&c.common) + c.SandboxesApi = (*SandboxesApiService)(&c.common) + c.SnapshotsApi = (*SnapshotsApiService)(&c.common) + c.TagsApi = (*TagsApiService)(&c.common) + c.TemplatesApi = (*TemplatesApiService)(&c.common) + c.VolumesApi = (*VolumesApiService)(&c.common) + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func parameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + // AccessToken Authentication + if auth, ok := ctx.Value(ContextAccessToken).(string); ok { + localVarRequest.Header.Add("Authorization", "Bearer "+auth) + } + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + err = file.Close() + if err != nil { + return err + } + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericOpenAPIError Provides access to the body, error and model on returned errors. +type GenericOpenAPIError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericOpenAPIError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericOpenAPIError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericOpenAPIError) Model() interface{} { + return e.model +} + +// format error message using title and detail when model implements rfc7807 +func formatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + + if metaValue.Kind() == reflect.Struct { + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + } + + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) +} diff --git a/e2b/client/configuration.go b/e2b/client/configuration.go new file mode 100644 index 0000000..f4e73a5 --- /dev/null +++ b/e2b/client/configuration.go @@ -0,0 +1,220 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "context" + "fmt" + "net/http" + "strings" +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // ContextAPIKeys takes a string apikey as authentication for the request + ContextAPIKeys = contextKey("apiKeys") + + // ContextServerIndex uses a server configuration from the index. + ContextServerIndex = contextKey("serverIndex") + + // ContextOperationServerIndices uses a server configuration from the index mapping. + ContextOperationServerIndices = contextKey("serverOperationIndices") + + // ContextServerVariables overrides a server configuration variables. + ContextServerVariables = contextKey("serverVariables") + + // ContextOperationServerVariables overrides a server configuration variables using operation specific values. + ContextOperationServerVariables = contextKey("serverOperationVariables") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} + +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + URL string + Description string + Variables map[string]ServerVariable +} + +// ServerConfigurations stores multiple ServerConfiguration items +type ServerConfigurations []ServerConfiguration + +// Configuration stores the configuration of the API client +type Configuration struct { + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers ServerConfigurations + OperationServers map[string]ServerConfigurations + HTTPClient *http.Client +} + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *Configuration { + cfg := &Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Servers: ServerConfigurations{ + { + URL: "https://api.e2b.app", + Description: "No description provided", + }, + }, + OperationServers: map[string]ServerConfigurations{}, + } + return cfg +} + +// AddDefaultHeader adds a new HTTP header to the default header in the request +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} + +// URL formats template on a index using given variables +func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { + if index < 0 || len(sc) <= index { + return "", fmt.Errorf("index %v out of range %v", index, len(sc)-1) + } + server := sc[index] + url := server.URL + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("the variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} + +// ServerURL returns URL based on server settings +func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) { + return c.Servers.URL(index, variables) +} + +func getServerIndex(ctx context.Context) (int, error) { + si := ctx.Value(ContextServerIndex) + if si != nil { + if index, ok := si.(int); ok { + return index, nil + } + return 0, reportError("Invalid type %T should be int", si) + } + return 0, nil +} + +func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) { + osi := ctx.Value(ContextOperationServerIndices) + if osi != nil { + if operationIndices, ok := osi.(map[string]int); !ok { + return 0, reportError("Invalid type %T should be map[string]int", osi) + } else { + index, ok := operationIndices[endpoint] + if ok { + return index, nil + } + } + } + return getServerIndex(ctx) +} + +func getServerVariables(ctx context.Context) (map[string]string, error) { + sv := ctx.Value(ContextServerVariables) + if sv != nil { + if variables, ok := sv.(map[string]string); ok { + return variables, nil + } + return nil, reportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv) + } + return nil, nil +} + +func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) { + osv := ctx.Value(ContextOperationServerVariables) + if osv != nil { + if operationVariables, ok := osv.(map[string]map[string]string); !ok { + return nil, reportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv) + } else { + variables, ok := operationVariables[endpoint] + if ok { + return variables, nil + } + } + } + return getServerVariables(ctx) +} + +// ServerURLWithContext returns a new server URL given an endpoint +func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) { + sc, ok := c.OperationServers[endpoint] + if !ok { + sc = c.Servers + } + + if ctx == nil { + return sc.URL(0, nil) + } + + index, err := getServerOperationIndex(ctx, endpoint) + if err != nil { + return "", err + } + + variables, err := getServerOperationVariables(ctx, endpoint) + if err != nil { + return "", err + } + + return sc.URL(index, variables) +} diff --git a/e2b/client/model__nodes_get_200_response_inner.go b/e2b/client/model__nodes_get_200_response_inner.go new file mode 100644 index 0000000..ddeb7f9 --- /dev/null +++ b/e2b/client/model__nodes_get_200_response_inner.go @@ -0,0 +1,453 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the NodesGet200ResponseInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NodesGet200ResponseInner{} + +// NodesGet200ResponseInner struct for NodesGet200ResponseInner +type NodesGet200ResponseInner struct { + // Version of the orchestrator + Version string `json:"version"` + // Commit of the orchestrator + Commit string `json:"commit"` + // Identifier of the nomad node + // Deprecated + NodeID string `json:"nodeID"` + // Identifier of the node + Id string `json:"id"` + // Service instance identifier of the node + ServiceInstanceID string `json:"serviceInstanceID"` + // Identifier of the cluster + ClusterID string `json:"clusterID"` + MachineInfo MachineInfo `json:"machineInfo"` + Status NodeStatus `json:"status"` + // Number of sandboxes running on the node + SandboxCount int32 `json:"sandboxCount"` + Metrics NodeMetrics `json:"metrics"` + // Number of sandbox create successes + CreateSuccesses int32 `json:"createSuccesses"` + // Number of sandbox create fails + CreateFails int32 `json:"createFails"` + // Number of starting Sandboxes + SandboxStartingCount int32 `json:"sandboxStartingCount"` +} + +// NewNodesGet200ResponseInner instantiates a new NodesGet200ResponseInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNodesGet200ResponseInner(version string, commit string, nodeID string, id string, serviceInstanceID string, clusterID string, machineInfo MachineInfo, status NodeStatus, sandboxCount int32, metrics NodeMetrics, createSuccesses int32, createFails int32, sandboxStartingCount int32) *NodesGet200ResponseInner { + this := NodesGet200ResponseInner{} + this.Version = version + this.Commit = commit + this.NodeID = nodeID + this.Id = id + this.ServiceInstanceID = serviceInstanceID + this.ClusterID = clusterID + this.MachineInfo = machineInfo + this.Status = status + this.SandboxCount = sandboxCount + this.Metrics = metrics + this.CreateSuccesses = createSuccesses + this.CreateFails = createFails + this.SandboxStartingCount = sandboxStartingCount + return &this +} + +// NewNodesGet200ResponseInnerWithDefaults instantiates a new NodesGet200ResponseInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNodesGet200ResponseInnerWithDefaults() *NodesGet200ResponseInner { + this := NodesGet200ResponseInner{} + return &this +} + +// GetVersion returns the Version field value +func (o *NodesGet200ResponseInner) GetVersion() string { + if o == nil { + var ret string + return ret + } + + return o.Version +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +func (o *NodesGet200ResponseInner) GetVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Version, true +} + +// SetVersion sets field value +func (o *NodesGet200ResponseInner) SetVersion(v string) { + o.Version = v +} + +// GetCommit returns the Commit field value +func (o *NodesGet200ResponseInner) GetCommit() string { + if o == nil { + var ret string + return ret + } + + return o.Commit +} + +// GetCommitOk returns a tuple with the Commit field value +// and a boolean to check if the value has been set. +func (o *NodesGet200ResponseInner) GetCommitOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Commit, true +} + +// SetCommit sets field value +func (o *NodesGet200ResponseInner) SetCommit(v string) { + o.Commit = v +} + +// GetNodeID returns the NodeID field value +// Deprecated +func (o *NodesGet200ResponseInner) GetNodeID() string { + if o == nil { + var ret string + return ret + } + + return o.NodeID +} + +// GetNodeIDOk returns a tuple with the NodeID field value +// and a boolean to check if the value has been set. +// Deprecated +func (o *NodesGet200ResponseInner) GetNodeIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NodeID, true +} + +// SetNodeID sets field value +// Deprecated +func (o *NodesGet200ResponseInner) SetNodeID(v string) { + o.NodeID = v +} + +// GetId returns the Id field value +func (o *NodesGet200ResponseInner) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *NodesGet200ResponseInner) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *NodesGet200ResponseInner) SetId(v string) { + o.Id = v +} + +// GetServiceInstanceID returns the ServiceInstanceID field value +func (o *NodesGet200ResponseInner) GetServiceInstanceID() string { + if o == nil { + var ret string + return ret + } + + return o.ServiceInstanceID +} + +// GetServiceInstanceIDOk returns a tuple with the ServiceInstanceID field value +// and a boolean to check if the value has been set. +func (o *NodesGet200ResponseInner) GetServiceInstanceIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ServiceInstanceID, true +} + +// SetServiceInstanceID sets field value +func (o *NodesGet200ResponseInner) SetServiceInstanceID(v string) { + o.ServiceInstanceID = v +} + +// GetClusterID returns the ClusterID field value +func (o *NodesGet200ResponseInner) GetClusterID() string { + if o == nil { + var ret string + return ret + } + + return o.ClusterID +} + +// GetClusterIDOk returns a tuple with the ClusterID field value +// and a boolean to check if the value has been set. +func (o *NodesGet200ResponseInner) GetClusterIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ClusterID, true +} + +// SetClusterID sets field value +func (o *NodesGet200ResponseInner) SetClusterID(v string) { + o.ClusterID = v +} + +// GetMachineInfo returns the MachineInfo field value +func (o *NodesGet200ResponseInner) GetMachineInfo() MachineInfo { + if o == nil { + var ret MachineInfo + return ret + } + + return o.MachineInfo +} + +// GetMachineInfoOk returns a tuple with the MachineInfo field value +// and a boolean to check if the value has been set. +func (o *NodesGet200ResponseInner) GetMachineInfoOk() (*MachineInfo, bool) { + if o == nil { + return nil, false + } + return &o.MachineInfo, true +} + +// SetMachineInfo sets field value +func (o *NodesGet200ResponseInner) SetMachineInfo(v MachineInfo) { + o.MachineInfo = v +} + +// GetStatus returns the Status field value +func (o *NodesGet200ResponseInner) GetStatus() NodeStatus { + if o == nil { + var ret NodeStatus + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *NodesGet200ResponseInner) GetStatusOk() (*NodeStatus, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *NodesGet200ResponseInner) SetStatus(v NodeStatus) { + o.Status = v +} + +// GetSandboxCount returns the SandboxCount field value +func (o *NodesGet200ResponseInner) GetSandboxCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.SandboxCount +} + +// GetSandboxCountOk returns a tuple with the SandboxCount field value +// and a boolean to check if the value has been set. +func (o *NodesGet200ResponseInner) GetSandboxCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.SandboxCount, true +} + +// SetSandboxCount sets field value +func (o *NodesGet200ResponseInner) SetSandboxCount(v int32) { + o.SandboxCount = v +} + +// GetMetrics returns the Metrics field value +func (o *NodesGet200ResponseInner) GetMetrics() NodeMetrics { + if o == nil { + var ret NodeMetrics + return ret + } + + return o.Metrics +} + +// GetMetricsOk returns a tuple with the Metrics field value +// and a boolean to check if the value has been set. +func (o *NodesGet200ResponseInner) GetMetricsOk() (*NodeMetrics, bool) { + if o == nil { + return nil, false + } + return &o.Metrics, true +} + +// SetMetrics sets field value +func (o *NodesGet200ResponseInner) SetMetrics(v NodeMetrics) { + o.Metrics = v +} + +// GetCreateSuccesses returns the CreateSuccesses field value +func (o *NodesGet200ResponseInner) GetCreateSuccesses() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.CreateSuccesses +} + +// GetCreateSuccessesOk returns a tuple with the CreateSuccesses field value +// and a boolean to check if the value has been set. +func (o *NodesGet200ResponseInner) GetCreateSuccessesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.CreateSuccesses, true +} + +// SetCreateSuccesses sets field value +func (o *NodesGet200ResponseInner) SetCreateSuccesses(v int32) { + o.CreateSuccesses = v +} + +// GetCreateFails returns the CreateFails field value +func (o *NodesGet200ResponseInner) GetCreateFails() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.CreateFails +} + +// GetCreateFailsOk returns a tuple with the CreateFails field value +// and a boolean to check if the value has been set. +func (o *NodesGet200ResponseInner) GetCreateFailsOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.CreateFails, true +} + +// SetCreateFails sets field value +func (o *NodesGet200ResponseInner) SetCreateFails(v int32) { + o.CreateFails = v +} + +// GetSandboxStartingCount returns the SandboxStartingCount field value +func (o *NodesGet200ResponseInner) GetSandboxStartingCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.SandboxStartingCount +} + +// GetSandboxStartingCountOk returns a tuple with the SandboxStartingCount field value +// and a boolean to check if the value has been set. +func (o *NodesGet200ResponseInner) GetSandboxStartingCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.SandboxStartingCount, true +} + +// SetSandboxStartingCount sets field value +func (o *NodesGet200ResponseInner) SetSandboxStartingCount(v int32) { + o.SandboxStartingCount = v +} + +func (o NodesGet200ResponseInner) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NodesGet200ResponseInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["version"] = o.Version + toSerialize["commit"] = o.Commit + toSerialize["nodeID"] = o.NodeID + toSerialize["id"] = o.Id + toSerialize["serviceInstanceID"] = o.ServiceInstanceID + toSerialize["clusterID"] = o.ClusterID + toSerialize["machineInfo"] = o.MachineInfo + toSerialize["status"] = o.Status + toSerialize["sandboxCount"] = o.SandboxCount + toSerialize["metrics"] = o.Metrics + toSerialize["createSuccesses"] = o.CreateSuccesses + toSerialize["createFails"] = o.CreateFails + toSerialize["sandboxStartingCount"] = o.SandboxStartingCount + return toSerialize, nil +} + +type NullableNodesGet200ResponseInner struct { + value *NodesGet200ResponseInner + isSet bool +} + +func (v NullableNodesGet200ResponseInner) Get() *NodesGet200ResponseInner { + return v.value +} + +func (v *NullableNodesGet200ResponseInner) Set(val *NodesGet200ResponseInner) { + v.value = val + v.isSet = true +} + +func (v NullableNodesGet200ResponseInner) IsSet() bool { + return v.isSet +} + +func (v *NullableNodesGet200ResponseInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNodesGet200ResponseInner(val *NodesGet200ResponseInner) *NullableNodesGet200ResponseInner { + return &NullableNodesGet200ResponseInner{value: val, isSet: true} +} + +func (v NullableNodesGet200ResponseInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNodesGet200ResponseInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model__sandboxes__sandbox_id__refreshes_post_request.go b/e2b/client/model__sandboxes__sandbox_id__refreshes_post_request.go new file mode 100644 index 0000000..acbddde --- /dev/null +++ b/e2b/client/model__sandboxes__sandbox_id__refreshes_post_request.go @@ -0,0 +1,125 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the SandboxesSandboxIDRefreshesPostRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SandboxesSandboxIDRefreshesPostRequest{} + +// SandboxesSandboxIDRefreshesPostRequest struct for SandboxesSandboxIDRefreshesPostRequest +type SandboxesSandboxIDRefreshesPostRequest struct { + // Duration for which the sandbox should be kept alive in seconds + Duration *int32 `json:"duration,omitempty"` +} + +// NewSandboxesSandboxIDRefreshesPostRequest instantiates a new SandboxesSandboxIDRefreshesPostRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSandboxesSandboxIDRefreshesPostRequest() *SandboxesSandboxIDRefreshesPostRequest { + this := SandboxesSandboxIDRefreshesPostRequest{} + return &this +} + +// NewSandboxesSandboxIDRefreshesPostRequestWithDefaults instantiates a new SandboxesSandboxIDRefreshesPostRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSandboxesSandboxIDRefreshesPostRequestWithDefaults() *SandboxesSandboxIDRefreshesPostRequest { + this := SandboxesSandboxIDRefreshesPostRequest{} + return &this +} + +// GetDuration returns the Duration field value if set, zero value otherwise. +func (o *SandboxesSandboxIDRefreshesPostRequest) GetDuration() int32 { + if o == nil || IsNil(o.Duration) { + var ret int32 + return ret + } + return *o.Duration +} + +// GetDurationOk returns a tuple with the Duration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SandboxesSandboxIDRefreshesPostRequest) GetDurationOk() (*int32, bool) { + if o == nil || IsNil(o.Duration) { + return nil, false + } + return o.Duration, true +} + +// HasDuration returns a boolean if a field has been set. +func (o *SandboxesSandboxIDRefreshesPostRequest) HasDuration() bool { + if o != nil && !IsNil(o.Duration) { + return true + } + + return false +} + +// SetDuration gets a reference to the given int32 and assigns it to the Duration field. +func (o *SandboxesSandboxIDRefreshesPostRequest) SetDuration(v int32) { + o.Duration = &v +} + +func (o SandboxesSandboxIDRefreshesPostRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SandboxesSandboxIDRefreshesPostRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Duration) { + toSerialize["duration"] = o.Duration + } + return toSerialize, nil +} + +type NullableSandboxesSandboxIDRefreshesPostRequest struct { + value *SandboxesSandboxIDRefreshesPostRequest + isSet bool +} + +func (v NullableSandboxesSandboxIDRefreshesPostRequest) Get() *SandboxesSandboxIDRefreshesPostRequest { + return v.value +} + +func (v *NullableSandboxesSandboxIDRefreshesPostRequest) Set(val *SandboxesSandboxIDRefreshesPostRequest) { + v.value = val + v.isSet = true +} + +func (v NullableSandboxesSandboxIDRefreshesPostRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableSandboxesSandboxIDRefreshesPostRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSandboxesSandboxIDRefreshesPostRequest(val *SandboxesSandboxIDRefreshesPostRequest) *NullableSandboxesSandboxIDRefreshesPostRequest { + return &NullableSandboxesSandboxIDRefreshesPostRequest{value: val, isSet: true} +} + +func (v NullableSandboxesSandboxIDRefreshesPostRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSandboxesSandboxIDRefreshesPostRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model__sandboxes__sandbox_id__snapshots_post_request.go b/e2b/client/model__sandboxes__sandbox_id__snapshots_post_request.go new file mode 100644 index 0000000..cab945b --- /dev/null +++ b/e2b/client/model__sandboxes__sandbox_id__snapshots_post_request.go @@ -0,0 +1,125 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the SandboxesSandboxIDSnapshotsPostRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SandboxesSandboxIDSnapshotsPostRequest{} + +// SandboxesSandboxIDSnapshotsPostRequest struct for SandboxesSandboxIDSnapshotsPostRequest +type SandboxesSandboxIDSnapshotsPostRequest struct { + // Optional name for the snapshot template. If a snapshot template with this name already exists, a new build will be assigned to the existing template instead of creating a new one. + Name *string `json:"name,omitempty"` +} + +// NewSandboxesSandboxIDSnapshotsPostRequest instantiates a new SandboxesSandboxIDSnapshotsPostRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSandboxesSandboxIDSnapshotsPostRequest() *SandboxesSandboxIDSnapshotsPostRequest { + this := SandboxesSandboxIDSnapshotsPostRequest{} + return &this +} + +// NewSandboxesSandboxIDSnapshotsPostRequestWithDefaults instantiates a new SandboxesSandboxIDSnapshotsPostRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSandboxesSandboxIDSnapshotsPostRequestWithDefaults() *SandboxesSandboxIDSnapshotsPostRequest { + this := SandboxesSandboxIDSnapshotsPostRequest{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SandboxesSandboxIDSnapshotsPostRequest) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SandboxesSandboxIDSnapshotsPostRequest) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SandboxesSandboxIDSnapshotsPostRequest) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SandboxesSandboxIDSnapshotsPostRequest) SetName(v string) { + o.Name = &v +} + +func (o SandboxesSandboxIDSnapshotsPostRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SandboxesSandboxIDSnapshotsPostRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + return toSerialize, nil +} + +type NullableSandboxesSandboxIDSnapshotsPostRequest struct { + value *SandboxesSandboxIDSnapshotsPostRequest + isSet bool +} + +func (v NullableSandboxesSandboxIDSnapshotsPostRequest) Get() *SandboxesSandboxIDSnapshotsPostRequest { + return v.value +} + +func (v *NullableSandboxesSandboxIDSnapshotsPostRequest) Set(val *SandboxesSandboxIDSnapshotsPostRequest) { + v.value = val + v.isSet = true +} + +func (v NullableSandboxesSandboxIDSnapshotsPostRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableSandboxesSandboxIDSnapshotsPostRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSandboxesSandboxIDSnapshotsPostRequest(val *SandboxesSandboxIDSnapshotsPostRequest) *NullableSandboxesSandboxIDSnapshotsPostRequest { + return &NullableSandboxesSandboxIDSnapshotsPostRequest{value: val, isSet: true} +} + +func (v NullableSandboxesSandboxIDSnapshotsPostRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSandboxesSandboxIDSnapshotsPostRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model__sandboxes__sandbox_id__timeout_post_request.go b/e2b/client/model__sandboxes__sandbox_id__timeout_post_request.go new file mode 100644 index 0000000..3d0eef2 --- /dev/null +++ b/e2b/client/model__sandboxes__sandbox_id__timeout_post_request.go @@ -0,0 +1,116 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the SandboxesSandboxIDTimeoutPostRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SandboxesSandboxIDTimeoutPostRequest{} + +// SandboxesSandboxIDTimeoutPostRequest struct for SandboxesSandboxIDTimeoutPostRequest +type SandboxesSandboxIDTimeoutPostRequest struct { + // Timeout in seconds from the current time after which the sandbox should expire + Timeout int32 `json:"timeout"` +} + +// NewSandboxesSandboxIDTimeoutPostRequest instantiates a new SandboxesSandboxIDTimeoutPostRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSandboxesSandboxIDTimeoutPostRequest(timeout int32) *SandboxesSandboxIDTimeoutPostRequest { + this := SandboxesSandboxIDTimeoutPostRequest{} + this.Timeout = timeout + return &this +} + +// NewSandboxesSandboxIDTimeoutPostRequestWithDefaults instantiates a new SandboxesSandboxIDTimeoutPostRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSandboxesSandboxIDTimeoutPostRequestWithDefaults() *SandboxesSandboxIDTimeoutPostRequest { + this := SandboxesSandboxIDTimeoutPostRequest{} + return &this +} + +// GetTimeout returns the Timeout field value +func (o *SandboxesSandboxIDTimeoutPostRequest) GetTimeout() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Timeout +} + +// GetTimeoutOk returns a tuple with the Timeout field value +// and a boolean to check if the value has been set. +func (o *SandboxesSandboxIDTimeoutPostRequest) GetTimeoutOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Timeout, true +} + +// SetTimeout sets field value +func (o *SandboxesSandboxIDTimeoutPostRequest) SetTimeout(v int32) { + o.Timeout = v +} + +func (o SandboxesSandboxIDTimeoutPostRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SandboxesSandboxIDTimeoutPostRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["timeout"] = o.Timeout + return toSerialize, nil +} + +type NullableSandboxesSandboxIDTimeoutPostRequest struct { + value *SandboxesSandboxIDTimeoutPostRequest + isSet bool +} + +func (v NullableSandboxesSandboxIDTimeoutPostRequest) Get() *SandboxesSandboxIDTimeoutPostRequest { + return v.value +} + +func (v *NullableSandboxesSandboxIDTimeoutPostRequest) Set(val *SandboxesSandboxIDTimeoutPostRequest) { + v.value = val + v.isSet = true +} + +func (v NullableSandboxesSandboxIDTimeoutPostRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableSandboxesSandboxIDTimeoutPostRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSandboxesSandboxIDTimeoutPostRequest(val *SandboxesSandboxIDTimeoutPostRequest) *NullableSandboxesSandboxIDTimeoutPostRequest { + return &NullableSandboxesSandboxIDTimeoutPostRequest{value: val, isSet: true} +} + +func (v NullableSandboxesSandboxIDTimeoutPostRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSandboxesSandboxIDTimeoutPostRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model__sandboxes_get_200_response_inner.go b/e2b/client/model__sandboxes_get_200_response_inner.go new file mode 100644 index 0000000..d3850ee --- /dev/null +++ b/e2b/client/model__sandboxes_get_200_response_inner.go @@ -0,0 +1,481 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" +) + +// checks if the SandboxesGet200ResponseInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SandboxesGet200ResponseInner{} + +// SandboxesGet200ResponseInner struct for SandboxesGet200ResponseInner +type SandboxesGet200ResponseInner struct { + // Identifier of the template from which is the sandbox created + TemplateID string `json:"templateID"` + // Alias of the template + Alias *string `json:"alias,omitempty"` + // Identifier of the sandbox + SandboxID string `json:"sandboxID"` + // Identifier of the client + // Deprecated + ClientID string `json:"clientID"` + // Time when the sandbox was started + StartedAt time.Time `json:"startedAt"` + // Time when the sandbox will expire + EndAt time.Time `json:"endAt"` + // CPU cores for the sandbox + CpuCount int32 `json:"cpuCount"` + // Memory for the sandbox in MiB + MemoryMB int32 `json:"memoryMB"` + // Disk size for the sandbox in MiB + DiskSizeMB int32 `json:"diskSizeMB"` + Metadata *map[string]string `json:"metadata,omitempty"` + State SandboxState `json:"state"` + // Version of the envd running in the sandbox + EnvdVersion string `json:"envdVersion"` + VolumeMounts []SandboxVolumeMount `json:"volumeMounts,omitempty"` +} + +// NewSandboxesGet200ResponseInner instantiates a new SandboxesGet200ResponseInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSandboxesGet200ResponseInner(templateID string, sandboxID string, clientID string, startedAt time.Time, endAt time.Time, cpuCount int32, memoryMB int32, diskSizeMB int32, state SandboxState, envdVersion string) *SandboxesGet200ResponseInner { + this := SandboxesGet200ResponseInner{} + this.TemplateID = templateID + this.SandboxID = sandboxID + this.ClientID = clientID + this.StartedAt = startedAt + this.EndAt = endAt + this.CpuCount = cpuCount + this.MemoryMB = memoryMB + this.DiskSizeMB = diskSizeMB + this.State = state + this.EnvdVersion = envdVersion + return &this +} + +// NewSandboxesGet200ResponseInnerWithDefaults instantiates a new SandboxesGet200ResponseInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSandboxesGet200ResponseInnerWithDefaults() *SandboxesGet200ResponseInner { + this := SandboxesGet200ResponseInner{} + return &this +} + +// GetTemplateID returns the TemplateID field value +func (o *SandboxesGet200ResponseInner) GetTemplateID() string { + if o == nil { + var ret string + return ret + } + + return o.TemplateID +} + +// GetTemplateIDOk returns a tuple with the TemplateID field value +// and a boolean to check if the value has been set. +func (o *SandboxesGet200ResponseInner) GetTemplateIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TemplateID, true +} + +// SetTemplateID sets field value +func (o *SandboxesGet200ResponseInner) SetTemplateID(v string) { + o.TemplateID = v +} + +// GetAlias returns the Alias field value if set, zero value otherwise. +func (o *SandboxesGet200ResponseInner) GetAlias() string { + if o == nil || IsNil(o.Alias) { + var ret string + return ret + } + return *o.Alias +} + +// GetAliasOk returns a tuple with the Alias field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SandboxesGet200ResponseInner) GetAliasOk() (*string, bool) { + if o == nil || IsNil(o.Alias) { + return nil, false + } + return o.Alias, true +} + +// HasAlias returns a boolean if a field has been set. +func (o *SandboxesGet200ResponseInner) HasAlias() bool { + if o != nil && !IsNil(o.Alias) { + return true + } + + return false +} + +// SetAlias gets a reference to the given string and assigns it to the Alias field. +func (o *SandboxesGet200ResponseInner) SetAlias(v string) { + o.Alias = &v +} + +// GetSandboxID returns the SandboxID field value +func (o *SandboxesGet200ResponseInner) GetSandboxID() string { + if o == nil { + var ret string + return ret + } + + return o.SandboxID +} + +// GetSandboxIDOk returns a tuple with the SandboxID field value +// and a boolean to check if the value has been set. +func (o *SandboxesGet200ResponseInner) GetSandboxIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SandboxID, true +} + +// SetSandboxID sets field value +func (o *SandboxesGet200ResponseInner) SetSandboxID(v string) { + o.SandboxID = v +} + +// GetClientID returns the ClientID field value +// Deprecated +func (o *SandboxesGet200ResponseInner) GetClientID() string { + if o == nil { + var ret string + return ret + } + + return o.ClientID +} + +// GetClientIDOk returns a tuple with the ClientID field value +// and a boolean to check if the value has been set. +// Deprecated +func (o *SandboxesGet200ResponseInner) GetClientIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ClientID, true +} + +// SetClientID sets field value +// Deprecated +func (o *SandboxesGet200ResponseInner) SetClientID(v string) { + o.ClientID = v +} + +// GetStartedAt returns the StartedAt field value +func (o *SandboxesGet200ResponseInner) GetStartedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.StartedAt +} + +// GetStartedAtOk returns a tuple with the StartedAt field value +// and a boolean to check if the value has been set. +func (o *SandboxesGet200ResponseInner) GetStartedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.StartedAt, true +} + +// SetStartedAt sets field value +func (o *SandboxesGet200ResponseInner) SetStartedAt(v time.Time) { + o.StartedAt = v +} + +// GetEndAt returns the EndAt field value +func (o *SandboxesGet200ResponseInner) GetEndAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.EndAt +} + +// GetEndAtOk returns a tuple with the EndAt field value +// and a boolean to check if the value has been set. +func (o *SandboxesGet200ResponseInner) GetEndAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.EndAt, true +} + +// SetEndAt sets field value +func (o *SandboxesGet200ResponseInner) SetEndAt(v time.Time) { + o.EndAt = v +} + +// GetCpuCount returns the CpuCount field value +func (o *SandboxesGet200ResponseInner) GetCpuCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.CpuCount +} + +// GetCpuCountOk returns a tuple with the CpuCount field value +// and a boolean to check if the value has been set. +func (o *SandboxesGet200ResponseInner) GetCpuCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.CpuCount, true +} + +// SetCpuCount sets field value +func (o *SandboxesGet200ResponseInner) SetCpuCount(v int32) { + o.CpuCount = v +} + +// GetMemoryMB returns the MemoryMB field value +func (o *SandboxesGet200ResponseInner) GetMemoryMB() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.MemoryMB +} + +// GetMemoryMBOk returns a tuple with the MemoryMB field value +// and a boolean to check if the value has been set. +func (o *SandboxesGet200ResponseInner) GetMemoryMBOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.MemoryMB, true +} + +// SetMemoryMB sets field value +func (o *SandboxesGet200ResponseInner) SetMemoryMB(v int32) { + o.MemoryMB = v +} + +// GetDiskSizeMB returns the DiskSizeMB field value +func (o *SandboxesGet200ResponseInner) GetDiskSizeMB() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.DiskSizeMB +} + +// GetDiskSizeMBOk returns a tuple with the DiskSizeMB field value +// and a boolean to check if the value has been set. +func (o *SandboxesGet200ResponseInner) GetDiskSizeMBOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.DiskSizeMB, true +} + +// SetDiskSizeMB sets field value +func (o *SandboxesGet200ResponseInner) SetDiskSizeMB(v int32) { + o.DiskSizeMB = v +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *SandboxesGet200ResponseInner) GetMetadata() map[string]string { + if o == nil || IsNil(o.Metadata) { + var ret map[string]string + return ret + } + return *o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SandboxesGet200ResponseInner) GetMetadataOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Metadata) { + return nil, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *SandboxesGet200ResponseInner) HasMetadata() bool { + if o != nil && !IsNil(o.Metadata) { + return true + } + + return false +} + +// SetMetadata gets a reference to the given map[string]string and assigns it to the Metadata field. +func (o *SandboxesGet200ResponseInner) SetMetadata(v map[string]string) { + o.Metadata = &v +} + +// GetState returns the State field value +func (o *SandboxesGet200ResponseInner) GetState() SandboxState { + if o == nil { + var ret SandboxState + return ret + } + + return o.State +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *SandboxesGet200ResponseInner) GetStateOk() (*SandboxState, bool) { + if o == nil { + return nil, false + } + return &o.State, true +} + +// SetState sets field value +func (o *SandboxesGet200ResponseInner) SetState(v SandboxState) { + o.State = v +} + +// GetEnvdVersion returns the EnvdVersion field value +func (o *SandboxesGet200ResponseInner) GetEnvdVersion() string { + if o == nil { + var ret string + return ret + } + + return o.EnvdVersion +} + +// GetEnvdVersionOk returns a tuple with the EnvdVersion field value +// and a boolean to check if the value has been set. +func (o *SandboxesGet200ResponseInner) GetEnvdVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.EnvdVersion, true +} + +// SetEnvdVersion sets field value +func (o *SandboxesGet200ResponseInner) SetEnvdVersion(v string) { + o.EnvdVersion = v +} + +// GetVolumeMounts returns the VolumeMounts field value if set, zero value otherwise. +func (o *SandboxesGet200ResponseInner) GetVolumeMounts() []SandboxVolumeMount { + if o == nil || IsNil(o.VolumeMounts) { + var ret []SandboxVolumeMount + return ret + } + return o.VolumeMounts +} + +// GetVolumeMountsOk returns a tuple with the VolumeMounts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SandboxesGet200ResponseInner) GetVolumeMountsOk() ([]SandboxVolumeMount, bool) { + if o == nil || IsNil(o.VolumeMounts) { + return nil, false + } + return o.VolumeMounts, true +} + +// HasVolumeMounts returns a boolean if a field has been set. +func (o *SandboxesGet200ResponseInner) HasVolumeMounts() bool { + if o != nil && !IsNil(o.VolumeMounts) { + return true + } + + return false +} + +// SetVolumeMounts gets a reference to the given []SandboxVolumeMount and assigns it to the VolumeMounts field. +func (o *SandboxesGet200ResponseInner) SetVolumeMounts(v []SandboxVolumeMount) { + o.VolumeMounts = v +} + +func (o SandboxesGet200ResponseInner) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SandboxesGet200ResponseInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["templateID"] = o.TemplateID + if !IsNil(o.Alias) { + toSerialize["alias"] = o.Alias + } + toSerialize["sandboxID"] = o.SandboxID + toSerialize["clientID"] = o.ClientID + toSerialize["startedAt"] = o.StartedAt + toSerialize["endAt"] = o.EndAt + toSerialize["cpuCount"] = o.CpuCount + toSerialize["memoryMB"] = o.MemoryMB + toSerialize["diskSizeMB"] = o.DiskSizeMB + if !IsNil(o.Metadata) { + toSerialize["metadata"] = o.Metadata + } + toSerialize["state"] = o.State + toSerialize["envdVersion"] = o.EnvdVersion + if !IsNil(o.VolumeMounts) { + toSerialize["volumeMounts"] = o.VolumeMounts + } + return toSerialize, nil +} + +type NullableSandboxesGet200ResponseInner struct { + value *SandboxesGet200ResponseInner + isSet bool +} + +func (v NullableSandboxesGet200ResponseInner) Get() *SandboxesGet200ResponseInner { + return v.value +} + +func (v *NullableSandboxesGet200ResponseInner) Set(val *SandboxesGet200ResponseInner) { + v.value = val + v.isSet = true +} + +func (v NullableSandboxesGet200ResponseInner) IsSet() bool { + return v.isSet +} + +func (v *NullableSandboxesGet200ResponseInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSandboxesGet200ResponseInner(val *SandboxesGet200ResponseInner) *NullableSandboxesGet200ResponseInner { + return &NullableSandboxesGet200ResponseInner{value: val, isSet: true} +} + +func (v NullableSandboxesGet200ResponseInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSandboxesGet200ResponseInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model__teams_get_200_response_inner.go b/e2b/client/model__teams_get_200_response_inner.go new file mode 100644 index 0000000..24bfef1 --- /dev/null +++ b/e2b/client/model__teams_get_200_response_inner.go @@ -0,0 +1,200 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the TeamsGet200ResponseInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TeamsGet200ResponseInner{} + +// TeamsGet200ResponseInner struct for TeamsGet200ResponseInner +type TeamsGet200ResponseInner struct { + // Identifier of the team + TeamID string `json:"teamID"` + // Name of the team + Name string `json:"name"` + // API key for the team + ApiKey string `json:"apiKey"` + // Whether the team is the default team + IsDefault bool `json:"isDefault"` +} + +// NewTeamsGet200ResponseInner instantiates a new TeamsGet200ResponseInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTeamsGet200ResponseInner(teamID string, name string, apiKey string, isDefault bool) *TeamsGet200ResponseInner { + this := TeamsGet200ResponseInner{} + this.TeamID = teamID + this.Name = name + this.ApiKey = apiKey + this.IsDefault = isDefault + return &this +} + +// NewTeamsGet200ResponseInnerWithDefaults instantiates a new TeamsGet200ResponseInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTeamsGet200ResponseInnerWithDefaults() *TeamsGet200ResponseInner { + this := TeamsGet200ResponseInner{} + return &this +} + +// GetTeamID returns the TeamID field value +func (o *TeamsGet200ResponseInner) GetTeamID() string { + if o == nil { + var ret string + return ret + } + + return o.TeamID +} + +// GetTeamIDOk returns a tuple with the TeamID field value +// and a boolean to check if the value has been set. +func (o *TeamsGet200ResponseInner) GetTeamIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TeamID, true +} + +// SetTeamID sets field value +func (o *TeamsGet200ResponseInner) SetTeamID(v string) { + o.TeamID = v +} + +// GetName returns the Name field value +func (o *TeamsGet200ResponseInner) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *TeamsGet200ResponseInner) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *TeamsGet200ResponseInner) SetName(v string) { + o.Name = v +} + +// GetApiKey returns the ApiKey field value +func (o *TeamsGet200ResponseInner) GetApiKey() string { + if o == nil { + var ret string + return ret + } + + return o.ApiKey +} + +// GetApiKeyOk returns a tuple with the ApiKey field value +// and a boolean to check if the value has been set. +func (o *TeamsGet200ResponseInner) GetApiKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ApiKey, true +} + +// SetApiKey sets field value +func (o *TeamsGet200ResponseInner) SetApiKey(v string) { + o.ApiKey = v +} + +// GetIsDefault returns the IsDefault field value +func (o *TeamsGet200ResponseInner) GetIsDefault() bool { + if o == nil { + var ret bool + return ret + } + + return o.IsDefault +} + +// GetIsDefaultOk returns a tuple with the IsDefault field value +// and a boolean to check if the value has been set. +func (o *TeamsGet200ResponseInner) GetIsDefaultOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IsDefault, true +} + +// SetIsDefault sets field value +func (o *TeamsGet200ResponseInner) SetIsDefault(v bool) { + o.IsDefault = v +} + +func (o TeamsGet200ResponseInner) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TeamsGet200ResponseInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["teamID"] = o.TeamID + toSerialize["name"] = o.Name + toSerialize["apiKey"] = o.ApiKey + toSerialize["isDefault"] = o.IsDefault + return toSerialize, nil +} + +type NullableTeamsGet200ResponseInner struct { + value *TeamsGet200ResponseInner + isSet bool +} + +func (v NullableTeamsGet200ResponseInner) Get() *TeamsGet200ResponseInner { + return v.value +} + +func (v *NullableTeamsGet200ResponseInner) Set(val *TeamsGet200ResponseInner) { + v.value = val + v.isSet = true +} + +func (v NullableTeamsGet200ResponseInner) IsSet() bool { + return v.isSet +} + +func (v *NullableTeamsGet200ResponseInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTeamsGet200ResponseInner(val *TeamsGet200ResponseInner) *NullableTeamsGet200ResponseInner { + return &NullableTeamsGet200ResponseInner{value: val, isSet: true} +} + +func (v NullableTeamsGet200ResponseInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTeamsGet200ResponseInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model__templates_get_200_response_inner.go b/e2b/client/model__templates_get_200_response_inner.go new file mode 100644 index 0000000..cc01cc2 --- /dev/null +++ b/e2b/client/model__templates_get_200_response_inner.go @@ -0,0 +1,543 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" +) + +// checks if the TemplatesGet200ResponseInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TemplatesGet200ResponseInner{} + +// TemplatesGet200ResponseInner struct for TemplatesGet200ResponseInner +type TemplatesGet200ResponseInner struct { + // Identifier of the template + TemplateID string `json:"templateID"` + // Identifier of the last successful build for given template + BuildID string `json:"buildID"` + // CPU cores for the sandbox + CpuCount int32 `json:"cpuCount"` + // Memory for the sandbox in MiB + MemoryMB int32 `json:"memoryMB"` + // Disk size for the sandbox in MiB + DiskSizeMB int32 `json:"diskSizeMB"` + // Whether the template is public or only accessible by the team + Public bool `json:"public"` + // Aliases of the template + // Deprecated + Aliases []string `json:"aliases"` + // Names of the template (namespace/alias format when namespaced) + Names []string `json:"names"` + // Time when the template was created + CreatedAt time.Time `json:"createdAt"` + // Time when the template was last updated + UpdatedAt time.Time `json:"updatedAt"` + CreatedBy NullableTeamUser `json:"createdBy"` + // Time when the template was last used + LastSpawnedAt NullableTime `json:"lastSpawnedAt"` + // Number of times the template was used + SpawnCount int64 `json:"spawnCount"` + // Number of times the template was built + BuildCount int32 `json:"buildCount"` + // Version of the envd running in the sandbox + EnvdVersion string `json:"envdVersion"` + BuildStatus TemplateBuildStatus `json:"buildStatus"` +} + +// NewTemplatesGet200ResponseInner instantiates a new TemplatesGet200ResponseInner object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTemplatesGet200ResponseInner(templateID string, buildID string, cpuCount int32, memoryMB int32, diskSizeMB int32, public bool, aliases []string, names []string, createdAt time.Time, updatedAt time.Time, createdBy NullableTeamUser, lastSpawnedAt NullableTime, spawnCount int64, buildCount int32, envdVersion string, buildStatus TemplateBuildStatus) *TemplatesGet200ResponseInner { + this := TemplatesGet200ResponseInner{} + this.TemplateID = templateID + this.BuildID = buildID + this.CpuCount = cpuCount + this.MemoryMB = memoryMB + this.DiskSizeMB = diskSizeMB + this.Public = public + this.Aliases = aliases + this.Names = names + this.CreatedAt = createdAt + this.UpdatedAt = updatedAt + this.CreatedBy = createdBy + this.LastSpawnedAt = lastSpawnedAt + this.SpawnCount = spawnCount + this.BuildCount = buildCount + this.EnvdVersion = envdVersion + this.BuildStatus = buildStatus + return &this +} + +// NewTemplatesGet200ResponseInnerWithDefaults instantiates a new TemplatesGet200ResponseInner object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTemplatesGet200ResponseInnerWithDefaults() *TemplatesGet200ResponseInner { + this := TemplatesGet200ResponseInner{} + return &this +} + +// GetTemplateID returns the TemplateID field value +func (o *TemplatesGet200ResponseInner) GetTemplateID() string { + if o == nil { + var ret string + return ret + } + + return o.TemplateID +} + +// GetTemplateIDOk returns a tuple with the TemplateID field value +// and a boolean to check if the value has been set. +func (o *TemplatesGet200ResponseInner) GetTemplateIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TemplateID, true +} + +// SetTemplateID sets field value +func (o *TemplatesGet200ResponseInner) SetTemplateID(v string) { + o.TemplateID = v +} + +// GetBuildID returns the BuildID field value +func (o *TemplatesGet200ResponseInner) GetBuildID() string { + if o == nil { + var ret string + return ret + } + + return o.BuildID +} + +// GetBuildIDOk returns a tuple with the BuildID field value +// and a boolean to check if the value has been set. +func (o *TemplatesGet200ResponseInner) GetBuildIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BuildID, true +} + +// SetBuildID sets field value +func (o *TemplatesGet200ResponseInner) SetBuildID(v string) { + o.BuildID = v +} + +// GetCpuCount returns the CpuCount field value +func (o *TemplatesGet200ResponseInner) GetCpuCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.CpuCount +} + +// GetCpuCountOk returns a tuple with the CpuCount field value +// and a boolean to check if the value has been set. +func (o *TemplatesGet200ResponseInner) GetCpuCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.CpuCount, true +} + +// SetCpuCount sets field value +func (o *TemplatesGet200ResponseInner) SetCpuCount(v int32) { + o.CpuCount = v +} + +// GetMemoryMB returns the MemoryMB field value +func (o *TemplatesGet200ResponseInner) GetMemoryMB() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.MemoryMB +} + +// GetMemoryMBOk returns a tuple with the MemoryMB field value +// and a boolean to check if the value has been set. +func (o *TemplatesGet200ResponseInner) GetMemoryMBOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.MemoryMB, true +} + +// SetMemoryMB sets field value +func (o *TemplatesGet200ResponseInner) SetMemoryMB(v int32) { + o.MemoryMB = v +} + +// GetDiskSizeMB returns the DiskSizeMB field value +func (o *TemplatesGet200ResponseInner) GetDiskSizeMB() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.DiskSizeMB +} + +// GetDiskSizeMBOk returns a tuple with the DiskSizeMB field value +// and a boolean to check if the value has been set. +func (o *TemplatesGet200ResponseInner) GetDiskSizeMBOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.DiskSizeMB, true +} + +// SetDiskSizeMB sets field value +func (o *TemplatesGet200ResponseInner) SetDiskSizeMB(v int32) { + o.DiskSizeMB = v +} + +// GetPublic returns the Public field value +func (o *TemplatesGet200ResponseInner) GetPublic() bool { + if o == nil { + var ret bool + return ret + } + + return o.Public +} + +// GetPublicOk returns a tuple with the Public field value +// and a boolean to check if the value has been set. +func (o *TemplatesGet200ResponseInner) GetPublicOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Public, true +} + +// SetPublic sets field value +func (o *TemplatesGet200ResponseInner) SetPublic(v bool) { + o.Public = v +} + +// GetAliases returns the Aliases field value +// Deprecated +func (o *TemplatesGet200ResponseInner) GetAliases() []string { + if o == nil { + var ret []string + return ret + } + + return o.Aliases +} + +// GetAliasesOk returns a tuple with the Aliases field value +// and a boolean to check if the value has been set. +// Deprecated +func (o *TemplatesGet200ResponseInner) GetAliasesOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Aliases, true +} + +// SetAliases sets field value +// Deprecated +func (o *TemplatesGet200ResponseInner) SetAliases(v []string) { + o.Aliases = v +} + +// GetNames returns the Names field value +func (o *TemplatesGet200ResponseInner) GetNames() []string { + if o == nil { + var ret []string + return ret + } + + return o.Names +} + +// GetNamesOk returns a tuple with the Names field value +// and a boolean to check if the value has been set. +func (o *TemplatesGet200ResponseInner) GetNamesOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Names, true +} + +// SetNames sets field value +func (o *TemplatesGet200ResponseInner) SetNames(v []string) { + o.Names = v +} + +// GetCreatedAt returns the CreatedAt field value +func (o *TemplatesGet200ResponseInner) GetCreatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *TemplatesGet200ResponseInner) GetCreatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value +func (o *TemplatesGet200ResponseInner) SetCreatedAt(v time.Time) { + o.CreatedAt = v +} + +// GetUpdatedAt returns the UpdatedAt field value +func (o *TemplatesGet200ResponseInner) GetUpdatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value +// and a boolean to check if the value has been set. +func (o *TemplatesGet200ResponseInner) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.UpdatedAt, true +} + +// SetUpdatedAt sets field value +func (o *TemplatesGet200ResponseInner) SetUpdatedAt(v time.Time) { + o.UpdatedAt = v +} + +// GetCreatedBy returns the CreatedBy field value +// If the value is explicit nil, the zero value for TeamUser will be returned +func (o *TemplatesGet200ResponseInner) GetCreatedBy() TeamUser { + if o == nil || o.CreatedBy.Get() == nil { + var ret TeamUser + return ret + } + + return *o.CreatedBy.Get() +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TemplatesGet200ResponseInner) GetCreatedByOk() (*TeamUser, bool) { + if o == nil { + return nil, false + } + return o.CreatedBy.Get(), o.CreatedBy.IsSet() +} + +// SetCreatedBy sets field value +func (o *TemplatesGet200ResponseInner) SetCreatedBy(v TeamUser) { + o.CreatedBy.Set(&v) +} + +// GetLastSpawnedAt returns the LastSpawnedAt field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *TemplatesGet200ResponseInner) GetLastSpawnedAt() time.Time { + if o == nil || o.LastSpawnedAt.Get() == nil { + var ret time.Time + return ret + } + + return *o.LastSpawnedAt.Get() +} + +// GetLastSpawnedAtOk returns a tuple with the LastSpawnedAt field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TemplatesGet200ResponseInner) GetLastSpawnedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.LastSpawnedAt.Get(), o.LastSpawnedAt.IsSet() +} + +// SetLastSpawnedAt sets field value +func (o *TemplatesGet200ResponseInner) SetLastSpawnedAt(v time.Time) { + o.LastSpawnedAt.Set(&v) +} + +// GetSpawnCount returns the SpawnCount field value +func (o *TemplatesGet200ResponseInner) GetSpawnCount() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.SpawnCount +} + +// GetSpawnCountOk returns a tuple with the SpawnCount field value +// and a boolean to check if the value has been set. +func (o *TemplatesGet200ResponseInner) GetSpawnCountOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.SpawnCount, true +} + +// SetSpawnCount sets field value +func (o *TemplatesGet200ResponseInner) SetSpawnCount(v int64) { + o.SpawnCount = v +} + +// GetBuildCount returns the BuildCount field value +func (o *TemplatesGet200ResponseInner) GetBuildCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.BuildCount +} + +// GetBuildCountOk returns a tuple with the BuildCount field value +// and a boolean to check if the value has been set. +func (o *TemplatesGet200ResponseInner) GetBuildCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.BuildCount, true +} + +// SetBuildCount sets field value +func (o *TemplatesGet200ResponseInner) SetBuildCount(v int32) { + o.BuildCount = v +} + +// GetEnvdVersion returns the EnvdVersion field value +func (o *TemplatesGet200ResponseInner) GetEnvdVersion() string { + if o == nil { + var ret string + return ret + } + + return o.EnvdVersion +} + +// GetEnvdVersionOk returns a tuple with the EnvdVersion field value +// and a boolean to check if the value has been set. +func (o *TemplatesGet200ResponseInner) GetEnvdVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.EnvdVersion, true +} + +// SetEnvdVersion sets field value +func (o *TemplatesGet200ResponseInner) SetEnvdVersion(v string) { + o.EnvdVersion = v +} + +// GetBuildStatus returns the BuildStatus field value +func (o *TemplatesGet200ResponseInner) GetBuildStatus() TemplateBuildStatus { + if o == nil { + var ret TemplateBuildStatus + return ret + } + + return o.BuildStatus +} + +// GetBuildStatusOk returns a tuple with the BuildStatus field value +// and a boolean to check if the value has been set. +func (o *TemplatesGet200ResponseInner) GetBuildStatusOk() (*TemplateBuildStatus, bool) { + if o == nil { + return nil, false + } + return &o.BuildStatus, true +} + +// SetBuildStatus sets field value +func (o *TemplatesGet200ResponseInner) SetBuildStatus(v TemplateBuildStatus) { + o.BuildStatus = v +} + +func (o TemplatesGet200ResponseInner) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TemplatesGet200ResponseInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["templateID"] = o.TemplateID + toSerialize["buildID"] = o.BuildID + toSerialize["cpuCount"] = o.CpuCount + toSerialize["memoryMB"] = o.MemoryMB + toSerialize["diskSizeMB"] = o.DiskSizeMB + toSerialize["public"] = o.Public + toSerialize["aliases"] = o.Aliases + toSerialize["names"] = o.Names + toSerialize["createdAt"] = o.CreatedAt + toSerialize["updatedAt"] = o.UpdatedAt + toSerialize["createdBy"] = o.CreatedBy.Get() + toSerialize["lastSpawnedAt"] = o.LastSpawnedAt.Get() + toSerialize["spawnCount"] = o.SpawnCount + toSerialize["buildCount"] = o.BuildCount + toSerialize["envdVersion"] = o.EnvdVersion + toSerialize["buildStatus"] = o.BuildStatus + return toSerialize, nil +} + +type NullableTemplatesGet200ResponseInner struct { + value *TemplatesGet200ResponseInner + isSet bool +} + +func (v NullableTemplatesGet200ResponseInner) Get() *TemplatesGet200ResponseInner { + return v.value +} + +func (v *NullableTemplatesGet200ResponseInner) Set(val *TemplatesGet200ResponseInner) { + v.value = val + v.isSet = true +} + +func (v NullableTemplatesGet200ResponseInner) IsSet() bool { + return v.isSet +} + +func (v *NullableTemplatesGet200ResponseInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTemplatesGet200ResponseInner(val *TemplatesGet200ResponseInner) *NullableTemplatesGet200ResponseInner { + return &NullableTemplatesGet200ResponseInner{value: val, isSet: true} +} + +func (v NullableTemplatesGet200ResponseInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTemplatesGet200ResponseInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_admin_sandbox_kill_result.go b/e2b/client/model_admin_sandbox_kill_result.go new file mode 100644 index 0000000..be64d1b --- /dev/null +++ b/e2b/client/model_admin_sandbox_kill_result.go @@ -0,0 +1,144 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the AdminSandboxKillResult type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AdminSandboxKillResult{} + +// AdminSandboxKillResult struct for AdminSandboxKillResult +type AdminSandboxKillResult struct { + // Number of sandboxes successfully killed + KilledCount int32 `json:"killedCount"` + // Number of sandboxes that failed to kill + FailedCount int32 `json:"failedCount"` +} + +// NewAdminSandboxKillResult instantiates a new AdminSandboxKillResult object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAdminSandboxKillResult(killedCount int32, failedCount int32) *AdminSandboxKillResult { + this := AdminSandboxKillResult{} + this.KilledCount = killedCount + this.FailedCount = failedCount + return &this +} + +// NewAdminSandboxKillResultWithDefaults instantiates a new AdminSandboxKillResult object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAdminSandboxKillResultWithDefaults() *AdminSandboxKillResult { + this := AdminSandboxKillResult{} + return &this +} + +// GetKilledCount returns the KilledCount field value +func (o *AdminSandboxKillResult) GetKilledCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.KilledCount +} + +// GetKilledCountOk returns a tuple with the KilledCount field value +// and a boolean to check if the value has been set. +func (o *AdminSandboxKillResult) GetKilledCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.KilledCount, true +} + +// SetKilledCount sets field value +func (o *AdminSandboxKillResult) SetKilledCount(v int32) { + o.KilledCount = v +} + +// GetFailedCount returns the FailedCount field value +func (o *AdminSandboxKillResult) GetFailedCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.FailedCount +} + +// GetFailedCountOk returns a tuple with the FailedCount field value +// and a boolean to check if the value has been set. +func (o *AdminSandboxKillResult) GetFailedCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.FailedCount, true +} + +// SetFailedCount sets field value +func (o *AdminSandboxKillResult) SetFailedCount(v int32) { + o.FailedCount = v +} + +func (o AdminSandboxKillResult) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AdminSandboxKillResult) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["killedCount"] = o.KilledCount + toSerialize["failedCount"] = o.FailedCount + return toSerialize, nil +} + +type NullableAdminSandboxKillResult struct { + value *AdminSandboxKillResult + isSet bool +} + +func (v NullableAdminSandboxKillResult) Get() *AdminSandboxKillResult { + return v.value +} + +func (v *NullableAdminSandboxKillResult) Set(val *AdminSandboxKillResult) { + v.value = val + v.isSet = true +} + +func (v NullableAdminSandboxKillResult) IsSet() bool { + return v.isSet +} + +func (v *NullableAdminSandboxKillResult) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAdminSandboxKillResult(val *AdminSandboxKillResult) *NullableAdminSandboxKillResult { + return &NullableAdminSandboxKillResult{value: val, isSet: true} +} + +func (v NullableAdminSandboxKillResult) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAdminSandboxKillResult) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_assign_template_tags_request.go b/e2b/client/model_assign_template_tags_request.go new file mode 100644 index 0000000..55533b3 --- /dev/null +++ b/e2b/client/model_assign_template_tags_request.go @@ -0,0 +1,144 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the AssignTemplateTagsRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AssignTemplateTagsRequest{} + +// AssignTemplateTagsRequest struct for AssignTemplateTagsRequest +type AssignTemplateTagsRequest struct { + // Target template in \"name:tag\" format + Target string `json:"target"` + // Tags to assign to the template + Tags []string `json:"tags"` +} + +// NewAssignTemplateTagsRequest instantiates a new AssignTemplateTagsRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAssignTemplateTagsRequest(target string, tags []string) *AssignTemplateTagsRequest { + this := AssignTemplateTagsRequest{} + this.Target = target + this.Tags = tags + return &this +} + +// NewAssignTemplateTagsRequestWithDefaults instantiates a new AssignTemplateTagsRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAssignTemplateTagsRequestWithDefaults() *AssignTemplateTagsRequest { + this := AssignTemplateTagsRequest{} + return &this +} + +// GetTarget returns the Target field value +func (o *AssignTemplateTagsRequest) GetTarget() string { + if o == nil { + var ret string + return ret + } + + return o.Target +} + +// GetTargetOk returns a tuple with the Target field value +// and a boolean to check if the value has been set. +func (o *AssignTemplateTagsRequest) GetTargetOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Target, true +} + +// SetTarget sets field value +func (o *AssignTemplateTagsRequest) SetTarget(v string) { + o.Target = v +} + +// GetTags returns the Tags field value +func (o *AssignTemplateTagsRequest) GetTags() []string { + if o == nil { + var ret []string + return ret + } + + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value +// and a boolean to check if the value has been set. +func (o *AssignTemplateTagsRequest) GetTagsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Tags, true +} + +// SetTags sets field value +func (o *AssignTemplateTagsRequest) SetTags(v []string) { + o.Tags = v +} + +func (o AssignTemplateTagsRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AssignTemplateTagsRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["target"] = o.Target + toSerialize["tags"] = o.Tags + return toSerialize, nil +} + +type NullableAssignTemplateTagsRequest struct { + value *AssignTemplateTagsRequest + isSet bool +} + +func (v NullableAssignTemplateTagsRequest) Get() *AssignTemplateTagsRequest { + return v.value +} + +func (v *NullableAssignTemplateTagsRequest) Set(val *AssignTemplateTagsRequest) { + v.value = val + v.isSet = true +} + +func (v NullableAssignTemplateTagsRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableAssignTemplateTagsRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAssignTemplateTagsRequest(val *AssignTemplateTagsRequest) *NullableAssignTemplateTagsRequest { + return &NullableAssignTemplateTagsRequest{value: val, isSet: true} +} + +func (v NullableAssignTemplateTagsRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAssignTemplateTagsRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_assigned_template_tags.go b/e2b/client/model_assigned_template_tags.go new file mode 100644 index 0000000..bea17fe --- /dev/null +++ b/e2b/client/model_assigned_template_tags.go @@ -0,0 +1,144 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the AssignedTemplateTags type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AssignedTemplateTags{} + +// AssignedTemplateTags struct for AssignedTemplateTags +type AssignedTemplateTags struct { + // Assigned tags of the template + Tags []string `json:"tags"` + // Identifier of the build associated with these tags + BuildID string `json:"buildID"` +} + +// NewAssignedTemplateTags instantiates a new AssignedTemplateTags object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAssignedTemplateTags(tags []string, buildID string) *AssignedTemplateTags { + this := AssignedTemplateTags{} + this.Tags = tags + this.BuildID = buildID + return &this +} + +// NewAssignedTemplateTagsWithDefaults instantiates a new AssignedTemplateTags object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAssignedTemplateTagsWithDefaults() *AssignedTemplateTags { + this := AssignedTemplateTags{} + return &this +} + +// GetTags returns the Tags field value +func (o *AssignedTemplateTags) GetTags() []string { + if o == nil { + var ret []string + return ret + } + + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value +// and a boolean to check if the value has been set. +func (o *AssignedTemplateTags) GetTagsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Tags, true +} + +// SetTags sets field value +func (o *AssignedTemplateTags) SetTags(v []string) { + o.Tags = v +} + +// GetBuildID returns the BuildID field value +func (o *AssignedTemplateTags) GetBuildID() string { + if o == nil { + var ret string + return ret + } + + return o.BuildID +} + +// GetBuildIDOk returns a tuple with the BuildID field value +// and a boolean to check if the value has been set. +func (o *AssignedTemplateTags) GetBuildIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BuildID, true +} + +// SetBuildID sets field value +func (o *AssignedTemplateTags) SetBuildID(v string) { + o.BuildID = v +} + +func (o AssignedTemplateTags) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AssignedTemplateTags) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["tags"] = o.Tags + toSerialize["buildID"] = o.BuildID + return toSerialize, nil +} + +type NullableAssignedTemplateTags struct { + value *AssignedTemplateTags + isSet bool +} + +func (v NullableAssignedTemplateTags) Get() *AssignedTemplateTags { + return v.value +} + +func (v *NullableAssignedTemplateTags) Set(val *AssignedTemplateTags) { + v.value = val + v.isSet = true +} + +func (v NullableAssignedTemplateTags) IsSet() bool { + return v.isSet +} + +func (v *NullableAssignedTemplateTags) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAssignedTemplateTags(val *AssignedTemplateTags) *NullableAssignedTemplateTags { + return &NullableAssignedTemplateTags{value: val, isSet: true} +} + +func (v NullableAssignedTemplateTags) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAssignedTemplateTags) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_aws_registry.go b/e2b/client/model_aws_registry.go new file mode 100644 index 0000000..0d669f7 --- /dev/null +++ b/e2b/client/model_aws_registry.go @@ -0,0 +1,200 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the AWSRegistry type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AWSRegistry{} + +// AWSRegistry struct for AWSRegistry +type AWSRegistry struct { + // Type of registry authentication + Type string `json:"type"` + // AWS Access Key ID for ECR authentication + AwsAccessKeyId string `json:"awsAccessKeyId"` + // AWS Secret Access Key for ECR authentication + AwsSecretAccessKey string `json:"awsSecretAccessKey"` + // AWS Region where the ECR registry is located + AwsRegion string `json:"awsRegion"` +} + +// NewAWSRegistry instantiates a new AWSRegistry object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAWSRegistry(type_ string, awsAccessKeyId string, awsSecretAccessKey string, awsRegion string) *AWSRegistry { + this := AWSRegistry{} + this.Type = type_ + this.AwsAccessKeyId = awsAccessKeyId + this.AwsSecretAccessKey = awsSecretAccessKey + this.AwsRegion = awsRegion + return &this +} + +// NewAWSRegistryWithDefaults instantiates a new AWSRegistry object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAWSRegistryWithDefaults() *AWSRegistry { + this := AWSRegistry{} + return &this +} + +// GetType returns the Type field value +func (o *AWSRegistry) GetType() string { + if o == nil { + var ret string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *AWSRegistry) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *AWSRegistry) SetType(v string) { + o.Type = v +} + +// GetAwsAccessKeyId returns the AwsAccessKeyId field value +func (o *AWSRegistry) GetAwsAccessKeyId() string { + if o == nil { + var ret string + return ret + } + + return o.AwsAccessKeyId +} + +// GetAwsAccessKeyIdOk returns a tuple with the AwsAccessKeyId field value +// and a boolean to check if the value has been set. +func (o *AWSRegistry) GetAwsAccessKeyIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AwsAccessKeyId, true +} + +// SetAwsAccessKeyId sets field value +func (o *AWSRegistry) SetAwsAccessKeyId(v string) { + o.AwsAccessKeyId = v +} + +// GetAwsSecretAccessKey returns the AwsSecretAccessKey field value +func (o *AWSRegistry) GetAwsSecretAccessKey() string { + if o == nil { + var ret string + return ret + } + + return o.AwsSecretAccessKey +} + +// GetAwsSecretAccessKeyOk returns a tuple with the AwsSecretAccessKey field value +// and a boolean to check if the value has been set. +func (o *AWSRegistry) GetAwsSecretAccessKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AwsSecretAccessKey, true +} + +// SetAwsSecretAccessKey sets field value +func (o *AWSRegistry) SetAwsSecretAccessKey(v string) { + o.AwsSecretAccessKey = v +} + +// GetAwsRegion returns the AwsRegion field value +func (o *AWSRegistry) GetAwsRegion() string { + if o == nil { + var ret string + return ret + } + + return o.AwsRegion +} + +// GetAwsRegionOk returns a tuple with the AwsRegion field value +// and a boolean to check if the value has been set. +func (o *AWSRegistry) GetAwsRegionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AwsRegion, true +} + +// SetAwsRegion sets field value +func (o *AWSRegistry) SetAwsRegion(v string) { + o.AwsRegion = v +} + +func (o AWSRegistry) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AWSRegistry) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["type"] = o.Type + toSerialize["awsAccessKeyId"] = o.AwsAccessKeyId + toSerialize["awsSecretAccessKey"] = o.AwsSecretAccessKey + toSerialize["awsRegion"] = o.AwsRegion + return toSerialize, nil +} + +type NullableAWSRegistry struct { + value *AWSRegistry + isSet bool +} + +func (v NullableAWSRegistry) Get() *AWSRegistry { + return v.value +} + +func (v *NullableAWSRegistry) Set(val *AWSRegistry) { + v.value = val + v.isSet = true +} + +func (v NullableAWSRegistry) IsSet() bool { + return v.isSet +} + +func (v *NullableAWSRegistry) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAWSRegistry(val *AWSRegistry) *NullableAWSRegistry { + return &NullableAWSRegistry{value: val, isSet: true} +} + +func (v NullableAWSRegistry) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAWSRegistry) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_build_log_entry.go b/e2b/client/model_build_log_entry.go new file mode 100644 index 0000000..168f5d0 --- /dev/null +++ b/e2b/client/model_build_log_entry.go @@ -0,0 +1,209 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" +) + +// checks if the BuildLogEntry type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BuildLogEntry{} + +// BuildLogEntry struct for BuildLogEntry +type BuildLogEntry struct { + // Timestamp of the log entry + Timestamp time.Time `json:"timestamp"` + // Log message content + Message string `json:"message"` + Level LogLevel `json:"level"` + // Step in the build process related to the log entry + Step *string `json:"step,omitempty"` +} + +// NewBuildLogEntry instantiates a new BuildLogEntry object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBuildLogEntry(timestamp time.Time, message string, level LogLevel) *BuildLogEntry { + this := BuildLogEntry{} + this.Timestamp = timestamp + this.Message = message + this.Level = level + return &this +} + +// NewBuildLogEntryWithDefaults instantiates a new BuildLogEntry object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBuildLogEntryWithDefaults() *BuildLogEntry { + this := BuildLogEntry{} + return &this +} + +// GetTimestamp returns the Timestamp field value +func (o *BuildLogEntry) GetTimestamp() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value +// and a boolean to check if the value has been set. +func (o *BuildLogEntry) GetTimestampOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Timestamp, true +} + +// SetTimestamp sets field value +func (o *BuildLogEntry) SetTimestamp(v time.Time) { + o.Timestamp = v +} + +// GetMessage returns the Message field value +func (o *BuildLogEntry) GetMessage() string { + if o == nil { + var ret string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *BuildLogEntry) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *BuildLogEntry) SetMessage(v string) { + o.Message = v +} + +// GetLevel returns the Level field value +func (o *BuildLogEntry) GetLevel() LogLevel { + if o == nil { + var ret LogLevel + return ret + } + + return o.Level +} + +// GetLevelOk returns a tuple with the Level field value +// and a boolean to check if the value has been set. +func (o *BuildLogEntry) GetLevelOk() (*LogLevel, bool) { + if o == nil { + return nil, false + } + return &o.Level, true +} + +// SetLevel sets field value +func (o *BuildLogEntry) SetLevel(v LogLevel) { + o.Level = v +} + +// GetStep returns the Step field value if set, zero value otherwise. +func (o *BuildLogEntry) GetStep() string { + if o == nil || IsNil(o.Step) { + var ret string + return ret + } + return *o.Step +} + +// GetStepOk returns a tuple with the Step field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BuildLogEntry) GetStepOk() (*string, bool) { + if o == nil || IsNil(o.Step) { + return nil, false + } + return o.Step, true +} + +// HasStep returns a boolean if a field has been set. +func (o *BuildLogEntry) HasStep() bool { + if o != nil && !IsNil(o.Step) { + return true + } + + return false +} + +// SetStep gets a reference to the given string and assigns it to the Step field. +func (o *BuildLogEntry) SetStep(v string) { + o.Step = &v +} + +func (o BuildLogEntry) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BuildLogEntry) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["timestamp"] = o.Timestamp + toSerialize["message"] = o.Message + toSerialize["level"] = o.Level + if !IsNil(o.Step) { + toSerialize["step"] = o.Step + } + return toSerialize, nil +} + +type NullableBuildLogEntry struct { + value *BuildLogEntry + isSet bool +} + +func (v NullableBuildLogEntry) Get() *BuildLogEntry { + return v.value +} + +func (v *NullableBuildLogEntry) Set(val *BuildLogEntry) { + v.value = val + v.isSet = true +} + +func (v NullableBuildLogEntry) IsSet() bool { + return v.isSet +} + +func (v *NullableBuildLogEntry) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBuildLogEntry(val *BuildLogEntry) *NullableBuildLogEntry { + return &NullableBuildLogEntry{value: val, isSet: true} +} + +func (v NullableBuildLogEntry) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBuildLogEntry) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_build_status_reason.go b/e2b/client/model_build_status_reason.go new file mode 100644 index 0000000..bb3fec7 --- /dev/null +++ b/e2b/client/model_build_status_reason.go @@ -0,0 +1,190 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the BuildStatusReason type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BuildStatusReason{} + +// BuildStatusReason struct for BuildStatusReason +type BuildStatusReason struct { + // Message with the status reason, currently reporting only for error status + Message string `json:"message"` + // Step that failed + Step *string `json:"step,omitempty"` + // Log entries related to the status reason + LogEntries []BuildLogEntry `json:"logEntries,omitempty"` +} + +// NewBuildStatusReason instantiates a new BuildStatusReason object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBuildStatusReason(message string) *BuildStatusReason { + this := BuildStatusReason{} + this.Message = message + return &this +} + +// NewBuildStatusReasonWithDefaults instantiates a new BuildStatusReason object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBuildStatusReasonWithDefaults() *BuildStatusReason { + this := BuildStatusReason{} + return &this +} + +// GetMessage returns the Message field value +func (o *BuildStatusReason) GetMessage() string { + if o == nil { + var ret string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *BuildStatusReason) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *BuildStatusReason) SetMessage(v string) { + o.Message = v +} + +// GetStep returns the Step field value if set, zero value otherwise. +func (o *BuildStatusReason) GetStep() string { + if o == nil || IsNil(o.Step) { + var ret string + return ret + } + return *o.Step +} + +// GetStepOk returns a tuple with the Step field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BuildStatusReason) GetStepOk() (*string, bool) { + if o == nil || IsNil(o.Step) { + return nil, false + } + return o.Step, true +} + +// HasStep returns a boolean if a field has been set. +func (o *BuildStatusReason) HasStep() bool { + if o != nil && !IsNil(o.Step) { + return true + } + + return false +} + +// SetStep gets a reference to the given string and assigns it to the Step field. +func (o *BuildStatusReason) SetStep(v string) { + o.Step = &v +} + +// GetLogEntries returns the LogEntries field value if set, zero value otherwise. +func (o *BuildStatusReason) GetLogEntries() []BuildLogEntry { + if o == nil || IsNil(o.LogEntries) { + var ret []BuildLogEntry + return ret + } + return o.LogEntries +} + +// GetLogEntriesOk returns a tuple with the LogEntries field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BuildStatusReason) GetLogEntriesOk() ([]BuildLogEntry, bool) { + if o == nil || IsNil(o.LogEntries) { + return nil, false + } + return o.LogEntries, true +} + +// HasLogEntries returns a boolean if a field has been set. +func (o *BuildStatusReason) HasLogEntries() bool { + if o != nil && !IsNil(o.LogEntries) { + return true + } + + return false +} + +// SetLogEntries gets a reference to the given []BuildLogEntry and assigns it to the LogEntries field. +func (o *BuildStatusReason) SetLogEntries(v []BuildLogEntry) { + o.LogEntries = v +} + +func (o BuildStatusReason) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BuildStatusReason) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["message"] = o.Message + if !IsNil(o.Step) { + toSerialize["step"] = o.Step + } + if !IsNil(o.LogEntries) { + toSerialize["logEntries"] = o.LogEntries + } + return toSerialize, nil +} + +type NullableBuildStatusReason struct { + value *BuildStatusReason + isSet bool +} + +func (v NullableBuildStatusReason) Get() *BuildStatusReason { + return v.value +} + +func (v *NullableBuildStatusReason) Set(val *BuildStatusReason) { + v.value = val + v.isSet = true +} + +func (v NullableBuildStatusReason) IsSet() bool { + return v.isSet +} + +func (v *NullableBuildStatusReason) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBuildStatusReason(val *BuildStatusReason) *NullableBuildStatusReason { + return &NullableBuildStatusReason{value: val, isSet: true} +} + +func (v NullableBuildStatusReason) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBuildStatusReason) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_connect_sandbox.go b/e2b/client/model_connect_sandbox.go new file mode 100644 index 0000000..ecc9a97 --- /dev/null +++ b/e2b/client/model_connect_sandbox.go @@ -0,0 +1,116 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the ConnectSandbox type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ConnectSandbox{} + +// ConnectSandbox struct for ConnectSandbox +type ConnectSandbox struct { + // Timeout in seconds from the current time after which the sandbox should expire + Timeout int32 `json:"timeout"` +} + +// NewConnectSandbox instantiates a new ConnectSandbox object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewConnectSandbox(timeout int32) *ConnectSandbox { + this := ConnectSandbox{} + this.Timeout = timeout + return &this +} + +// NewConnectSandboxWithDefaults instantiates a new ConnectSandbox object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewConnectSandboxWithDefaults() *ConnectSandbox { + this := ConnectSandbox{} + return &this +} + +// GetTimeout returns the Timeout field value +func (o *ConnectSandbox) GetTimeout() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Timeout +} + +// GetTimeoutOk returns a tuple with the Timeout field value +// and a boolean to check if the value has been set. +func (o *ConnectSandbox) GetTimeoutOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Timeout, true +} + +// SetTimeout sets field value +func (o *ConnectSandbox) SetTimeout(v int32) { + o.Timeout = v +} + +func (o ConnectSandbox) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ConnectSandbox) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["timeout"] = o.Timeout + return toSerialize, nil +} + +type NullableConnectSandbox struct { + value *ConnectSandbox + isSet bool +} + +func (v NullableConnectSandbox) Get() *ConnectSandbox { + return v.value +} + +func (v *NullableConnectSandbox) Set(val *ConnectSandbox) { + v.value = val + v.isSet = true +} + +func (v NullableConnectSandbox) IsSet() bool { + return v.isSet +} + +func (v *NullableConnectSandbox) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConnectSandbox(val *ConnectSandbox) *NullableConnectSandbox { + return &NullableConnectSandbox{value: val, isSet: true} +} + +func (v NullableConnectSandbox) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConnectSandbox) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_create_sandbox_request.go b/e2b/client/model_create_sandbox_request.go new file mode 100644 index 0000000..cea0459 --- /dev/null +++ b/e2b/client/model_create_sandbox_request.go @@ -0,0 +1,490 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the CreateSandboxRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateSandboxRequest{} + +// CreateSandboxRequest struct for CreateSandboxRequest +type CreateSandboxRequest struct { + // Identifier of the required template + TemplateID string `json:"templateID"` + // Time to live for the sandbox in seconds. + Timeout *int32 `json:"timeout,omitempty"` + // Automatically pauses the sandbox after the timeout + AutoPause *bool `json:"autoPause,omitempty"` + AutoResume *SandboxAutoResumeConfig `json:"autoResume,omitempty"` + // Secure all system communication with sandbox + Secure *bool `json:"secure,omitempty"` + // 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. + AllowInternetAccess *bool `json:"allow_internet_access,omitempty"` + Network *SandboxNetworkConfig `json:"network,omitempty"` + Metadata *map[string]string `json:"metadata,omitempty"` + EnvVars *map[string]string `json:"envVars,omitempty"` + // MCP configuration for the sandbox + Mcp map[string]interface{} `json:"mcp,omitempty"` + VolumeMounts []SandboxVolumeMount `json:"volumeMounts,omitempty"` +} + +// NewCreateSandboxRequest instantiates a new CreateSandboxRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateSandboxRequest(templateID string) *CreateSandboxRequest { + this := CreateSandboxRequest{} + this.TemplateID = templateID + var timeout int32 = 15 + this.Timeout = &timeout + var autoPause bool = false + this.AutoPause = &autoPause + return &this +} + +// NewCreateSandboxRequestWithDefaults instantiates a new CreateSandboxRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateSandboxRequestWithDefaults() *CreateSandboxRequest { + this := CreateSandboxRequest{} + var timeout int32 = 15 + this.Timeout = &timeout + var autoPause bool = false + this.AutoPause = &autoPause + return &this +} + +// GetTemplateID returns the TemplateID field value +func (o *CreateSandboxRequest) GetTemplateID() string { + if o == nil { + var ret string + return ret + } + + return o.TemplateID +} + +// GetTemplateIDOk returns a tuple with the TemplateID field value +// and a boolean to check if the value has been set. +func (o *CreateSandboxRequest) GetTemplateIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TemplateID, true +} + +// SetTemplateID sets field value +func (o *CreateSandboxRequest) SetTemplateID(v string) { + o.TemplateID = v +} + +// GetTimeout returns the Timeout field value if set, zero value otherwise. +func (o *CreateSandboxRequest) GetTimeout() int32 { + if o == nil || IsNil(o.Timeout) { + var ret int32 + return ret + } + return *o.Timeout +} + +// GetTimeoutOk returns a tuple with the Timeout field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSandboxRequest) GetTimeoutOk() (*int32, bool) { + if o == nil || IsNil(o.Timeout) { + return nil, false + } + return o.Timeout, true +} + +// HasTimeout returns a boolean if a field has been set. +func (o *CreateSandboxRequest) HasTimeout() bool { + if o != nil && !IsNil(o.Timeout) { + return true + } + + return false +} + +// SetTimeout gets a reference to the given int32 and assigns it to the Timeout field. +func (o *CreateSandboxRequest) SetTimeout(v int32) { + o.Timeout = &v +} + +// GetAutoPause returns the AutoPause field value if set, zero value otherwise. +func (o *CreateSandboxRequest) GetAutoPause() bool { + if o == nil || IsNil(o.AutoPause) { + var ret bool + return ret + } + return *o.AutoPause +} + +// GetAutoPauseOk returns a tuple with the AutoPause field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSandboxRequest) GetAutoPauseOk() (*bool, bool) { + if o == nil || IsNil(o.AutoPause) { + return nil, false + } + return o.AutoPause, true +} + +// HasAutoPause returns a boolean if a field has been set. +func (o *CreateSandboxRequest) HasAutoPause() bool { + if o != nil && !IsNil(o.AutoPause) { + return true + } + + return false +} + +// SetAutoPause gets a reference to the given bool and assigns it to the AutoPause field. +func (o *CreateSandboxRequest) SetAutoPause(v bool) { + o.AutoPause = &v +} + +// GetAutoResume returns the AutoResume field value if set, zero value otherwise. +func (o *CreateSandboxRequest) GetAutoResume() SandboxAutoResumeConfig { + if o == nil || IsNil(o.AutoResume) { + var ret SandboxAutoResumeConfig + return ret + } + return *o.AutoResume +} + +// GetAutoResumeOk returns a tuple with the AutoResume field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSandboxRequest) GetAutoResumeOk() (*SandboxAutoResumeConfig, bool) { + if o == nil || IsNil(o.AutoResume) { + return nil, false + } + return o.AutoResume, true +} + +// HasAutoResume returns a boolean if a field has been set. +func (o *CreateSandboxRequest) HasAutoResume() bool { + if o != nil && !IsNil(o.AutoResume) { + return true + } + + return false +} + +// SetAutoResume gets a reference to the given SandboxAutoResumeConfig and assigns it to the AutoResume field. +func (o *CreateSandboxRequest) SetAutoResume(v SandboxAutoResumeConfig) { + o.AutoResume = &v +} + +// GetSecure returns the Secure field value if set, zero value otherwise. +func (o *CreateSandboxRequest) GetSecure() bool { + if o == nil || IsNil(o.Secure) { + var ret bool + return ret + } + return *o.Secure +} + +// GetSecureOk returns a tuple with the Secure field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSandboxRequest) GetSecureOk() (*bool, bool) { + if o == nil || IsNil(o.Secure) { + return nil, false + } + return o.Secure, true +} + +// HasSecure returns a boolean if a field has been set. +func (o *CreateSandboxRequest) HasSecure() bool { + if o != nil && !IsNil(o.Secure) { + return true + } + + return false +} + +// SetSecure gets a reference to the given bool and assigns it to the Secure field. +func (o *CreateSandboxRequest) SetSecure(v bool) { + o.Secure = &v +} + +// GetAllowInternetAccess returns the AllowInternetAccess field value if set, zero value otherwise. +func (o *CreateSandboxRequest) GetAllowInternetAccess() bool { + if o == nil || IsNil(o.AllowInternetAccess) { + var ret bool + return ret + } + return *o.AllowInternetAccess +} + +// GetAllowInternetAccessOk returns a tuple with the AllowInternetAccess field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSandboxRequest) GetAllowInternetAccessOk() (*bool, bool) { + if o == nil || IsNil(o.AllowInternetAccess) { + return nil, false + } + return o.AllowInternetAccess, true +} + +// HasAllowInternetAccess returns a boolean if a field has been set. +func (o *CreateSandboxRequest) HasAllowInternetAccess() bool { + if o != nil && !IsNil(o.AllowInternetAccess) { + return true + } + + return false +} + +// SetAllowInternetAccess gets a reference to the given bool and assigns it to the AllowInternetAccess field. +func (o *CreateSandboxRequest) SetAllowInternetAccess(v bool) { + o.AllowInternetAccess = &v +} + +// GetNetwork returns the Network field value if set, zero value otherwise. +func (o *CreateSandboxRequest) GetNetwork() SandboxNetworkConfig { + if o == nil || IsNil(o.Network) { + var ret SandboxNetworkConfig + return ret + } + return *o.Network +} + +// GetNetworkOk returns a tuple with the Network field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSandboxRequest) GetNetworkOk() (*SandboxNetworkConfig, bool) { + if o == nil || IsNil(o.Network) { + return nil, false + } + return o.Network, true +} + +// HasNetwork returns a boolean if a field has been set. +func (o *CreateSandboxRequest) HasNetwork() bool { + if o != nil && !IsNil(o.Network) { + return true + } + + return false +} + +// SetNetwork gets a reference to the given SandboxNetworkConfig and assigns it to the Network field. +func (o *CreateSandboxRequest) SetNetwork(v SandboxNetworkConfig) { + o.Network = &v +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *CreateSandboxRequest) GetMetadata() map[string]string { + if o == nil || IsNil(o.Metadata) { + var ret map[string]string + return ret + } + return *o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSandboxRequest) GetMetadataOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Metadata) { + return nil, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *CreateSandboxRequest) HasMetadata() bool { + if o != nil && !IsNil(o.Metadata) { + return true + } + + return false +} + +// SetMetadata gets a reference to the given map[string]string and assigns it to the Metadata field. +func (o *CreateSandboxRequest) SetMetadata(v map[string]string) { + o.Metadata = &v +} + +// GetEnvVars returns the EnvVars field value if set, zero value otherwise. +func (o *CreateSandboxRequest) GetEnvVars() map[string]string { + if o == nil || IsNil(o.EnvVars) { + var ret map[string]string + return ret + } + return *o.EnvVars +} + +// GetEnvVarsOk returns a tuple with the EnvVars field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSandboxRequest) GetEnvVarsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.EnvVars) { + return nil, false + } + return o.EnvVars, true +} + +// HasEnvVars returns a boolean if a field has been set. +func (o *CreateSandboxRequest) HasEnvVars() bool { + if o != nil && !IsNil(o.EnvVars) { + return true + } + + return false +} + +// SetEnvVars gets a reference to the given map[string]string and assigns it to the EnvVars field. +func (o *CreateSandboxRequest) SetEnvVars(v map[string]string) { + o.EnvVars = &v +} + +// GetMcp returns the Mcp field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreateSandboxRequest) GetMcp() map[string]interface{} { + if o == nil { + var ret map[string]interface{} + return ret + } + return o.Mcp +} + +// GetMcpOk returns a tuple with the Mcp field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *CreateSandboxRequest) GetMcpOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Mcp) { + return map[string]interface{}{}, false + } + return o.Mcp, true +} + +// HasMcp returns a boolean if a field has been set. +func (o *CreateSandboxRequest) HasMcp() bool { + if o != nil && IsNil(o.Mcp) { + return true + } + + return false +} + +// SetMcp gets a reference to the given map[string]interface{} and assigns it to the Mcp field. +func (o *CreateSandboxRequest) SetMcp(v map[string]interface{}) { + o.Mcp = v +} + +// GetVolumeMounts returns the VolumeMounts field value if set, zero value otherwise. +func (o *CreateSandboxRequest) GetVolumeMounts() []SandboxVolumeMount { + if o == nil || IsNil(o.VolumeMounts) { + var ret []SandboxVolumeMount + return ret + } + return o.VolumeMounts +} + +// GetVolumeMountsOk returns a tuple with the VolumeMounts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSandboxRequest) GetVolumeMountsOk() ([]SandboxVolumeMount, bool) { + if o == nil || IsNil(o.VolumeMounts) { + return nil, false + } + return o.VolumeMounts, true +} + +// HasVolumeMounts returns a boolean if a field has been set. +func (o *CreateSandboxRequest) HasVolumeMounts() bool { + if o != nil && !IsNil(o.VolumeMounts) { + return true + } + + return false +} + +// SetVolumeMounts gets a reference to the given []SandboxVolumeMount and assigns it to the VolumeMounts field. +func (o *CreateSandboxRequest) SetVolumeMounts(v []SandboxVolumeMount) { + o.VolumeMounts = v +} + +func (o CreateSandboxRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateSandboxRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["templateID"] = o.TemplateID + if !IsNil(o.Timeout) { + toSerialize["timeout"] = o.Timeout + } + if !IsNil(o.AutoPause) { + toSerialize["autoPause"] = o.AutoPause + } + if !IsNil(o.AutoResume) { + toSerialize["autoResume"] = o.AutoResume + } + if !IsNil(o.Secure) { + toSerialize["secure"] = o.Secure + } + if !IsNil(o.AllowInternetAccess) { + toSerialize["allow_internet_access"] = o.AllowInternetAccess + } + if !IsNil(o.Network) { + toSerialize["network"] = o.Network + } + if !IsNil(o.Metadata) { + toSerialize["metadata"] = o.Metadata + } + if !IsNil(o.EnvVars) { + toSerialize["envVars"] = o.EnvVars + } + if o.Mcp != nil { + toSerialize["mcp"] = o.Mcp + } + if !IsNil(o.VolumeMounts) { + toSerialize["volumeMounts"] = o.VolumeMounts + } + return toSerialize, nil +} + +type NullableCreateSandboxRequest struct { + value *CreateSandboxRequest + isSet bool +} + +func (v NullableCreateSandboxRequest) Get() *CreateSandboxRequest { + return v.value +} + +func (v *NullableCreateSandboxRequest) Set(val *CreateSandboxRequest) { + v.value = val + v.isSet = true +} + +func (v NullableCreateSandboxRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateSandboxRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateSandboxRequest(val *CreateSandboxRequest) *NullableCreateSandboxRequest { + return &NullableCreateSandboxRequest{value: val, isSet: true} +} + +func (v NullableCreateSandboxRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateSandboxRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_create_team_api_key_request.go b/e2b/client/model_create_team_api_key_request.go new file mode 100644 index 0000000..850f795 --- /dev/null +++ b/e2b/client/model_create_team_api_key_request.go @@ -0,0 +1,116 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the CreateTeamAPIKeyRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateTeamAPIKeyRequest{} + +// CreateTeamAPIKeyRequest struct for CreateTeamAPIKeyRequest +type CreateTeamAPIKeyRequest struct { + // Name of the API key + Name string `json:"name"` +} + +// NewCreateTeamAPIKeyRequest instantiates a new CreateTeamAPIKeyRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateTeamAPIKeyRequest(name string) *CreateTeamAPIKeyRequest { + this := CreateTeamAPIKeyRequest{} + this.Name = name + return &this +} + +// NewCreateTeamAPIKeyRequestWithDefaults instantiates a new CreateTeamAPIKeyRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateTeamAPIKeyRequestWithDefaults() *CreateTeamAPIKeyRequest { + this := CreateTeamAPIKeyRequest{} + return &this +} + +// GetName returns the Name field value +func (o *CreateTeamAPIKeyRequest) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateTeamAPIKeyRequest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *CreateTeamAPIKeyRequest) SetName(v string) { + o.Name = v +} + +func (o CreateTeamAPIKeyRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateTeamAPIKeyRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + return toSerialize, nil +} + +type NullableCreateTeamAPIKeyRequest struct { + value *CreateTeamAPIKeyRequest + isSet bool +} + +func (v NullableCreateTeamAPIKeyRequest) Get() *CreateTeamAPIKeyRequest { + return v.value +} + +func (v *NullableCreateTeamAPIKeyRequest) Set(val *CreateTeamAPIKeyRequest) { + v.value = val + v.isSet = true +} + +func (v NullableCreateTeamAPIKeyRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateTeamAPIKeyRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateTeamAPIKeyRequest(val *CreateTeamAPIKeyRequest) *NullableCreateTeamAPIKeyRequest { + return &NullableCreateTeamAPIKeyRequest{value: val, isSet: true} +} + +func (v NullableCreateTeamAPIKeyRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateTeamAPIKeyRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_create_volume_request.go b/e2b/client/model_create_volume_request.go new file mode 100644 index 0000000..4556c69 --- /dev/null +++ b/e2b/client/model_create_volume_request.go @@ -0,0 +1,116 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the CreateVolumeRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateVolumeRequest{} + +// CreateVolumeRequest struct for CreateVolumeRequest +type CreateVolumeRequest struct { + // Name of the volume + Name string `json:"name"` +} + +// NewCreateVolumeRequest instantiates a new CreateVolumeRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateVolumeRequest(name string) *CreateVolumeRequest { + this := CreateVolumeRequest{} + this.Name = name + return &this +} + +// NewCreateVolumeRequestWithDefaults instantiates a new CreateVolumeRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateVolumeRequestWithDefaults() *CreateVolumeRequest { + this := CreateVolumeRequest{} + return &this +} + +// GetName returns the Name field value +func (o *CreateVolumeRequest) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateVolumeRequest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *CreateVolumeRequest) SetName(v string) { + o.Name = v +} + +func (o CreateVolumeRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateVolumeRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + return toSerialize, nil +} + +type NullableCreateVolumeRequest struct { + value *CreateVolumeRequest + isSet bool +} + +func (v NullableCreateVolumeRequest) Get() *CreateVolumeRequest { + return v.value +} + +func (v *NullableCreateVolumeRequest) Set(val *CreateVolumeRequest) { + v.value = val + v.isSet = true +} + +func (v NullableCreateVolumeRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateVolumeRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateVolumeRequest(val *CreateVolumeRequest) *NullableCreateVolumeRequest { + return &NullableCreateVolumeRequest{value: val, isSet: true} +} + +func (v NullableCreateVolumeRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateVolumeRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_created_access_token.go b/e2b/client/model_created_access_token.go new file mode 100644 index 0000000..35b751f --- /dev/null +++ b/e2b/client/model_created_access_token.go @@ -0,0 +1,228 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" +) + +// checks if the CreatedAccessToken type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreatedAccessToken{} + +// CreatedAccessToken struct for CreatedAccessToken +type CreatedAccessToken struct { + // Identifier of the access token + Id string `json:"id"` + // Name of the access token + Name string `json:"name"` + // The fully created access token + Token string `json:"token"` + Mask IdentifierMaskingDetails `json:"mask"` + // Timestamp of access token creation + CreatedAt time.Time `json:"createdAt"` +} + +// NewCreatedAccessToken instantiates a new CreatedAccessToken object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreatedAccessToken(id string, name string, token string, mask IdentifierMaskingDetails, createdAt time.Time) *CreatedAccessToken { + this := CreatedAccessToken{} + this.Id = id + this.Name = name + this.Token = token + this.Mask = mask + this.CreatedAt = createdAt + return &this +} + +// NewCreatedAccessTokenWithDefaults instantiates a new CreatedAccessToken object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreatedAccessTokenWithDefaults() *CreatedAccessToken { + this := CreatedAccessToken{} + return &this +} + +// GetId returns the Id field value +func (o *CreatedAccessToken) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *CreatedAccessToken) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *CreatedAccessToken) SetId(v string) { + o.Id = v +} + +// GetName returns the Name field value +func (o *CreatedAccessToken) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreatedAccessToken) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *CreatedAccessToken) SetName(v string) { + o.Name = v +} + +// GetToken returns the Token field value +func (o *CreatedAccessToken) GetToken() string { + if o == nil { + var ret string + return ret + } + + return o.Token +} + +// GetTokenOk returns a tuple with the Token field value +// and a boolean to check if the value has been set. +func (o *CreatedAccessToken) GetTokenOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Token, true +} + +// SetToken sets field value +func (o *CreatedAccessToken) SetToken(v string) { + o.Token = v +} + +// GetMask returns the Mask field value +func (o *CreatedAccessToken) GetMask() IdentifierMaskingDetails { + if o == nil { + var ret IdentifierMaskingDetails + return ret + } + + return o.Mask +} + +// GetMaskOk returns a tuple with the Mask field value +// and a boolean to check if the value has been set. +func (o *CreatedAccessToken) GetMaskOk() (*IdentifierMaskingDetails, bool) { + if o == nil { + return nil, false + } + return &o.Mask, true +} + +// SetMask sets field value +func (o *CreatedAccessToken) SetMask(v IdentifierMaskingDetails) { + o.Mask = v +} + +// GetCreatedAt returns the CreatedAt field value +func (o *CreatedAccessToken) GetCreatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *CreatedAccessToken) GetCreatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value +func (o *CreatedAccessToken) SetCreatedAt(v time.Time) { + o.CreatedAt = v +} + +func (o CreatedAccessToken) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreatedAccessToken) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + toSerialize["token"] = o.Token + toSerialize["mask"] = o.Mask + toSerialize["createdAt"] = o.CreatedAt + return toSerialize, nil +} + +type NullableCreatedAccessToken struct { + value *CreatedAccessToken + isSet bool +} + +func (v NullableCreatedAccessToken) Get() *CreatedAccessToken { + return v.value +} + +func (v *NullableCreatedAccessToken) Set(val *CreatedAccessToken) { + v.value = val + v.isSet = true +} + +func (v NullableCreatedAccessToken) IsSet() bool { + return v.isSet +} + +func (v *NullableCreatedAccessToken) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreatedAccessToken(val *CreatedAccessToken) *NullableCreatedAccessToken { + return &NullableCreatedAccessToken{value: val, isSet: true} +} + +func (v NullableCreatedAccessToken) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreatedAccessToken) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_created_team_api_key.go b/e2b/client/model_created_team_api_key.go new file mode 100644 index 0000000..db51387 --- /dev/null +++ b/e2b/client/model_created_team_api_key.go @@ -0,0 +1,323 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" +) + +// checks if the CreatedTeamAPIKey type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreatedTeamAPIKey{} + +// CreatedTeamAPIKey struct for CreatedTeamAPIKey +type CreatedTeamAPIKey struct { + // Identifier of the API key + Id string `json:"id"` + // Raw value of the API key + Key string `json:"key"` + Mask IdentifierMaskingDetails `json:"mask"` + // Name of the API key + Name string `json:"name"` + // Timestamp of API key creation + CreatedAt time.Time `json:"createdAt"` + CreatedBy NullableTeamUser `json:"createdBy,omitempty"` + // Last time this API key was used + LastUsed NullableTime `json:"lastUsed,omitempty"` +} + +// NewCreatedTeamAPIKey instantiates a new CreatedTeamAPIKey object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreatedTeamAPIKey(id string, key string, mask IdentifierMaskingDetails, name string, createdAt time.Time) *CreatedTeamAPIKey { + this := CreatedTeamAPIKey{} + this.Id = id + this.Key = key + this.Mask = mask + this.Name = name + this.CreatedAt = createdAt + return &this +} + +// NewCreatedTeamAPIKeyWithDefaults instantiates a new CreatedTeamAPIKey object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreatedTeamAPIKeyWithDefaults() *CreatedTeamAPIKey { + this := CreatedTeamAPIKey{} + return &this +} + +// GetId returns the Id field value +func (o *CreatedTeamAPIKey) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *CreatedTeamAPIKey) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *CreatedTeamAPIKey) SetId(v string) { + o.Id = v +} + +// GetKey returns the Key field value +func (o *CreatedTeamAPIKey) GetKey() string { + if o == nil { + var ret string + return ret + } + + return o.Key +} + +// GetKeyOk returns a tuple with the Key field value +// and a boolean to check if the value has been set. +func (o *CreatedTeamAPIKey) GetKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Key, true +} + +// SetKey sets field value +func (o *CreatedTeamAPIKey) SetKey(v string) { + o.Key = v +} + +// GetMask returns the Mask field value +func (o *CreatedTeamAPIKey) GetMask() IdentifierMaskingDetails { + if o == nil { + var ret IdentifierMaskingDetails + return ret + } + + return o.Mask +} + +// GetMaskOk returns a tuple with the Mask field value +// and a boolean to check if the value has been set. +func (o *CreatedTeamAPIKey) GetMaskOk() (*IdentifierMaskingDetails, bool) { + if o == nil { + return nil, false + } + return &o.Mask, true +} + +// SetMask sets field value +func (o *CreatedTeamAPIKey) SetMask(v IdentifierMaskingDetails) { + o.Mask = v +} + +// GetName returns the Name field value +func (o *CreatedTeamAPIKey) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreatedTeamAPIKey) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *CreatedTeamAPIKey) SetName(v string) { + o.Name = v +} + +// GetCreatedAt returns the CreatedAt field value +func (o *CreatedTeamAPIKey) GetCreatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *CreatedTeamAPIKey) GetCreatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value +func (o *CreatedTeamAPIKey) SetCreatedAt(v time.Time) { + o.CreatedAt = v +} + +// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreatedTeamAPIKey) GetCreatedBy() TeamUser { + if o == nil || IsNil(o.CreatedBy.Get()) { + var ret TeamUser + return ret + } + return *o.CreatedBy.Get() +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *CreatedTeamAPIKey) GetCreatedByOk() (*TeamUser, bool) { + if o == nil { + return nil, false + } + return o.CreatedBy.Get(), o.CreatedBy.IsSet() +} + +// HasCreatedBy returns a boolean if a field has been set. +func (o *CreatedTeamAPIKey) HasCreatedBy() bool { + if o != nil && o.CreatedBy.IsSet() { + return true + } + + return false +} + +// SetCreatedBy gets a reference to the given NullableTeamUser and assigns it to the CreatedBy field. +func (o *CreatedTeamAPIKey) SetCreatedBy(v TeamUser) { + o.CreatedBy.Set(&v) +} + +// SetCreatedByNil sets the value for CreatedBy to be an explicit nil +func (o *CreatedTeamAPIKey) SetCreatedByNil() { + o.CreatedBy.Set(nil) +} + +// UnsetCreatedBy ensures that no value is present for CreatedBy, not even an explicit nil +func (o *CreatedTeamAPIKey) UnsetCreatedBy() { + o.CreatedBy.Unset() +} + +// GetLastUsed returns the LastUsed field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreatedTeamAPIKey) GetLastUsed() time.Time { + if o == nil || IsNil(o.LastUsed.Get()) { + var ret time.Time + return ret + } + return *o.LastUsed.Get() +} + +// GetLastUsedOk returns a tuple with the LastUsed field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *CreatedTeamAPIKey) GetLastUsedOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.LastUsed.Get(), o.LastUsed.IsSet() +} + +// HasLastUsed returns a boolean if a field has been set. +func (o *CreatedTeamAPIKey) HasLastUsed() bool { + if o != nil && o.LastUsed.IsSet() { + return true + } + + return false +} + +// SetLastUsed gets a reference to the given NullableTime and assigns it to the LastUsed field. +func (o *CreatedTeamAPIKey) SetLastUsed(v time.Time) { + o.LastUsed.Set(&v) +} + +// SetLastUsedNil sets the value for LastUsed to be an explicit nil +func (o *CreatedTeamAPIKey) SetLastUsedNil() { + o.LastUsed.Set(nil) +} + +// UnsetLastUsed ensures that no value is present for LastUsed, not even an explicit nil +func (o *CreatedTeamAPIKey) UnsetLastUsed() { + o.LastUsed.Unset() +} + +func (o CreatedTeamAPIKey) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreatedTeamAPIKey) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["key"] = o.Key + toSerialize["mask"] = o.Mask + toSerialize["name"] = o.Name + toSerialize["createdAt"] = o.CreatedAt + if o.CreatedBy.IsSet() { + toSerialize["createdBy"] = o.CreatedBy.Get() + } + if o.LastUsed.IsSet() { + toSerialize["lastUsed"] = o.LastUsed.Get() + } + return toSerialize, nil +} + +type NullableCreatedTeamAPIKey struct { + value *CreatedTeamAPIKey + isSet bool +} + +func (v NullableCreatedTeamAPIKey) Get() *CreatedTeamAPIKey { + return v.value +} + +func (v *NullableCreatedTeamAPIKey) Set(val *CreatedTeamAPIKey) { + v.value = val + v.isSet = true +} + +func (v NullableCreatedTeamAPIKey) IsSet() bool { + return v.isSet +} + +func (v *NullableCreatedTeamAPIKey) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreatedTeamAPIKey(val *CreatedTeamAPIKey) *NullableCreatedTeamAPIKey { + return &NullableCreatedTeamAPIKey{value: val, isSet: true} +} + +func (v NullableCreatedTeamAPIKey) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreatedTeamAPIKey) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_delete_template_tags_request.go b/e2b/client/model_delete_template_tags_request.go new file mode 100644 index 0000000..54529a1 --- /dev/null +++ b/e2b/client/model_delete_template_tags_request.go @@ -0,0 +1,144 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the DeleteTemplateTagsRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeleteTemplateTagsRequest{} + +// DeleteTemplateTagsRequest struct for DeleteTemplateTagsRequest +type DeleteTemplateTagsRequest struct { + // Name of the template + Name string `json:"name"` + // Tags to delete + Tags []string `json:"tags"` +} + +// NewDeleteTemplateTagsRequest instantiates a new DeleteTemplateTagsRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDeleteTemplateTagsRequest(name string, tags []string) *DeleteTemplateTagsRequest { + this := DeleteTemplateTagsRequest{} + this.Name = name + this.Tags = tags + return &this +} + +// NewDeleteTemplateTagsRequestWithDefaults instantiates a new DeleteTemplateTagsRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDeleteTemplateTagsRequestWithDefaults() *DeleteTemplateTagsRequest { + this := DeleteTemplateTagsRequest{} + return &this +} + +// GetName returns the Name field value +func (o *DeleteTemplateTagsRequest) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *DeleteTemplateTagsRequest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *DeleteTemplateTagsRequest) SetName(v string) { + o.Name = v +} + +// GetTags returns the Tags field value +func (o *DeleteTemplateTagsRequest) GetTags() []string { + if o == nil { + var ret []string + return ret + } + + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value +// and a boolean to check if the value has been set. +func (o *DeleteTemplateTagsRequest) GetTagsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Tags, true +} + +// SetTags sets field value +func (o *DeleteTemplateTagsRequest) SetTags(v []string) { + o.Tags = v +} + +func (o DeleteTemplateTagsRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DeleteTemplateTagsRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["tags"] = o.Tags + return toSerialize, nil +} + +type NullableDeleteTemplateTagsRequest struct { + value *DeleteTemplateTagsRequest + isSet bool +} + +func (v NullableDeleteTemplateTagsRequest) Get() *DeleteTemplateTagsRequest { + return v.value +} + +func (v *NullableDeleteTemplateTagsRequest) Set(val *DeleteTemplateTagsRequest) { + v.value = val + v.isSet = true +} + +func (v NullableDeleteTemplateTagsRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableDeleteTemplateTagsRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeleteTemplateTagsRequest(val *DeleteTemplateTagsRequest) *NullableDeleteTemplateTagsRequest { + return &NullableDeleteTemplateTagsRequest{value: val, isSet: true} +} + +func (v NullableDeleteTemplateTagsRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeleteTemplateTagsRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_disk_metrics.go b/e2b/client/model_disk_metrics.go new file mode 100644 index 0000000..b2ed8c3 --- /dev/null +++ b/e2b/client/model_disk_metrics.go @@ -0,0 +1,228 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the DiskMetrics type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DiskMetrics{} + +// DiskMetrics struct for DiskMetrics +type DiskMetrics struct { + // Mount point of the disk + MountPoint string `json:"mountPoint"` + // Device name + Device string `json:"device"` + // Filesystem type (e.g., ext4, xfs) + FilesystemType string `json:"filesystemType"` + // Used space in bytes + UsedBytes int32 `json:"usedBytes"` + // Total space in bytes + TotalBytes int32 `json:"totalBytes"` +} + +// NewDiskMetrics instantiates a new DiskMetrics object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDiskMetrics(mountPoint string, device string, filesystemType string, usedBytes int32, totalBytes int32) *DiskMetrics { + this := DiskMetrics{} + this.MountPoint = mountPoint + this.Device = device + this.FilesystemType = filesystemType + this.UsedBytes = usedBytes + this.TotalBytes = totalBytes + return &this +} + +// NewDiskMetricsWithDefaults instantiates a new DiskMetrics object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDiskMetricsWithDefaults() *DiskMetrics { + this := DiskMetrics{} + return &this +} + +// GetMountPoint returns the MountPoint field value +func (o *DiskMetrics) GetMountPoint() string { + if o == nil { + var ret string + return ret + } + + return o.MountPoint +} + +// GetMountPointOk returns a tuple with the MountPoint field value +// and a boolean to check if the value has been set. +func (o *DiskMetrics) GetMountPointOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.MountPoint, true +} + +// SetMountPoint sets field value +func (o *DiskMetrics) SetMountPoint(v string) { + o.MountPoint = v +} + +// GetDevice returns the Device field value +func (o *DiskMetrics) GetDevice() string { + if o == nil { + var ret string + return ret + } + + return o.Device +} + +// GetDeviceOk returns a tuple with the Device field value +// and a boolean to check if the value has been set. +func (o *DiskMetrics) GetDeviceOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Device, true +} + +// SetDevice sets field value +func (o *DiskMetrics) SetDevice(v string) { + o.Device = v +} + +// GetFilesystemType returns the FilesystemType field value +func (o *DiskMetrics) GetFilesystemType() string { + if o == nil { + var ret string + return ret + } + + return o.FilesystemType +} + +// GetFilesystemTypeOk returns a tuple with the FilesystemType field value +// and a boolean to check if the value has been set. +func (o *DiskMetrics) GetFilesystemTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.FilesystemType, true +} + +// SetFilesystemType sets field value +func (o *DiskMetrics) SetFilesystemType(v string) { + o.FilesystemType = v +} + +// GetUsedBytes returns the UsedBytes field value +func (o *DiskMetrics) GetUsedBytes() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.UsedBytes +} + +// GetUsedBytesOk returns a tuple with the UsedBytes field value +// and a boolean to check if the value has been set. +func (o *DiskMetrics) GetUsedBytesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.UsedBytes, true +} + +// SetUsedBytes sets field value +func (o *DiskMetrics) SetUsedBytes(v int32) { + o.UsedBytes = v +} + +// GetTotalBytes returns the TotalBytes field value +func (o *DiskMetrics) GetTotalBytes() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.TotalBytes +} + +// GetTotalBytesOk returns a tuple with the TotalBytes field value +// and a boolean to check if the value has been set. +func (o *DiskMetrics) GetTotalBytesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.TotalBytes, true +} + +// SetTotalBytes sets field value +func (o *DiskMetrics) SetTotalBytes(v int32) { + o.TotalBytes = v +} + +func (o DiskMetrics) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DiskMetrics) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["mountPoint"] = o.MountPoint + toSerialize["device"] = o.Device + toSerialize["filesystemType"] = o.FilesystemType + toSerialize["usedBytes"] = o.UsedBytes + toSerialize["totalBytes"] = o.TotalBytes + return toSerialize, nil +} + +type NullableDiskMetrics struct { + value *DiskMetrics + isSet bool +} + +func (v NullableDiskMetrics) Get() *DiskMetrics { + return v.value +} + +func (v *NullableDiskMetrics) Set(val *DiskMetrics) { + v.value = val + v.isSet = true +} + +func (v NullableDiskMetrics) IsSet() bool { + return v.isSet +} + +func (v *NullableDiskMetrics) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDiskMetrics(val *DiskMetrics) *NullableDiskMetrics { + return &NullableDiskMetrics{value: val, isSet: true} +} + +func (v NullableDiskMetrics) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDiskMetrics) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_error.go b/e2b/client/model_error.go new file mode 100644 index 0000000..863f523 --- /dev/null +++ b/e2b/client/model_error.go @@ -0,0 +1,144 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the Error type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Error{} + +// Error struct for Error +type Error struct { + // Error code + Code int32 `json:"code"` + // Error + Message string `json:"message"` +} + +// NewError instantiates a new Error object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewError(code int32, message string) *Error { + this := Error{} + this.Code = code + this.Message = message + return &this +} + +// NewErrorWithDefaults instantiates a new Error object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewErrorWithDefaults() *Error { + this := Error{} + return &this +} + +// GetCode returns the Code field value +func (o *Error) GetCode() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Code +} + +// GetCodeOk returns a tuple with the Code field value +// and a boolean to check if the value has been set. +func (o *Error) GetCodeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Code, true +} + +// SetCode sets field value +func (o *Error) SetCode(v int32) { + o.Code = v +} + +// GetMessage returns the Message field value +func (o *Error) GetMessage() string { + if o == nil { + var ret string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *Error) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *Error) SetMessage(v string) { + o.Message = v +} + +func (o Error) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Error) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["code"] = o.Code + toSerialize["message"] = o.Message + return toSerialize, nil +} + +type NullableError struct { + value *Error + isSet bool +} + +func (v NullableError) Get() *Error { + return v.value +} + +func (v *NullableError) Set(val *Error) { + v.value = val + v.isSet = true +} + +func (v NullableError) IsSet() bool { + return v.isSet +} + +func (v *NullableError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableError(val *Error) *NullableError { + return &NullableError{value: val, isSet: true} +} + +func (v NullableError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_from_image_registry.go b/e2b/client/model_from_image_registry.go new file mode 100644 index 0000000..60d8b65 --- /dev/null +++ b/e2b/client/model_from_image_registry.go @@ -0,0 +1,175 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// FromImageRegistry - struct for FromImageRegistry +type FromImageRegistry struct { + AWSRegistry *AWSRegistry + GCPRegistry *GCPRegistry + GeneralRegistry *GeneralRegistry +} + +// AWSRegistryAsFromImageRegistry is a convenience function that returns AWSRegistry wrapped in FromImageRegistry +func AWSRegistryAsFromImageRegistry(v *AWSRegistry) FromImageRegistry { + return FromImageRegistry{ + AWSRegistry: v, + } +} + +// GCPRegistryAsFromImageRegistry is a convenience function that returns GCPRegistry wrapped in FromImageRegistry +func GCPRegistryAsFromImageRegistry(v *GCPRegistry) FromImageRegistry { + return FromImageRegistry{ + GCPRegistry: v, + } +} + +// GeneralRegistryAsFromImageRegistry is a convenience function that returns GeneralRegistry wrapped in FromImageRegistry +func GeneralRegistryAsFromImageRegistry(v *GeneralRegistry) FromImageRegistry { + return FromImageRegistry{ + GeneralRegistry: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *FromImageRegistry) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into AWSRegistry + err = newStrictDecoder(data).Decode(&dst.AWSRegistry) + if err == nil { + jsonAWSRegistry, _ := json.Marshal(dst.AWSRegistry) + if string(jsonAWSRegistry) == "{}" { // empty struct + dst.AWSRegistry = nil + } else { + match++ + } + } else { + dst.AWSRegistry = nil + } + + // try to unmarshal data into GCPRegistry + err = newStrictDecoder(data).Decode(&dst.GCPRegistry) + if err == nil { + jsonGCPRegistry, _ := json.Marshal(dst.GCPRegistry) + if string(jsonGCPRegistry) == "{}" { // empty struct + dst.GCPRegistry = nil + } else { + match++ + } + } else { + dst.GCPRegistry = nil + } + + // try to unmarshal data into GeneralRegistry + err = newStrictDecoder(data).Decode(&dst.GeneralRegistry) + if err == nil { + jsonGeneralRegistry, _ := json.Marshal(dst.GeneralRegistry) + if string(jsonGeneralRegistry) == "{}" { // empty struct + dst.GeneralRegistry = nil + } else { + match++ + } + } else { + dst.GeneralRegistry = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.AWSRegistry = nil + dst.GCPRegistry = nil + dst.GeneralRegistry = nil + + return fmt.Errorf("data matches more than one schema in oneOf(FromImageRegistry)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(FromImageRegistry)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src FromImageRegistry) MarshalJSON() ([]byte, error) { + if src.AWSRegistry != nil { + return json.Marshal(&src.AWSRegistry) + } + + if src.GCPRegistry != nil { + return json.Marshal(&src.GCPRegistry) + } + + if src.GeneralRegistry != nil { + return json.Marshal(&src.GeneralRegistry) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *FromImageRegistry) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.AWSRegistry != nil { + return obj.AWSRegistry + } + + if obj.GCPRegistry != nil { + return obj.GCPRegistry + } + + if obj.GeneralRegistry != nil { + return obj.GeneralRegistry + } + + // all schemas are nil + return nil +} + +type NullableFromImageRegistry struct { + value *FromImageRegistry + isSet bool +} + +func (v NullableFromImageRegistry) Get() *FromImageRegistry { + return v.value +} + +func (v *NullableFromImageRegistry) Set(val *FromImageRegistry) { + v.value = val + v.isSet = true +} + +func (v NullableFromImageRegistry) IsSet() bool { + return v.isSet +} + +func (v *NullableFromImageRegistry) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFromImageRegistry(val *FromImageRegistry) *NullableFromImageRegistry { + return &NullableFromImageRegistry{value: val, isSet: true} +} + +func (v NullableFromImageRegistry) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFromImageRegistry) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_gcp_registry.go b/e2b/client/model_gcp_registry.go new file mode 100644 index 0000000..e86bcb6 --- /dev/null +++ b/e2b/client/model_gcp_registry.go @@ -0,0 +1,144 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the GCPRegistry type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GCPRegistry{} + +// GCPRegistry struct for GCPRegistry +type GCPRegistry struct { + // Type of registry authentication + Type string `json:"type"` + // Service Account JSON for GCP authentication + ServiceAccountJson string `json:"serviceAccountJson"` +} + +// NewGCPRegistry instantiates a new GCPRegistry object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGCPRegistry(type_ string, serviceAccountJson string) *GCPRegistry { + this := GCPRegistry{} + this.Type = type_ + this.ServiceAccountJson = serviceAccountJson + return &this +} + +// NewGCPRegistryWithDefaults instantiates a new GCPRegistry object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGCPRegistryWithDefaults() *GCPRegistry { + this := GCPRegistry{} + return &this +} + +// GetType returns the Type field value +func (o *GCPRegistry) GetType() string { + if o == nil { + var ret string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *GCPRegistry) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *GCPRegistry) SetType(v string) { + o.Type = v +} + +// GetServiceAccountJson returns the ServiceAccountJson field value +func (o *GCPRegistry) GetServiceAccountJson() string { + if o == nil { + var ret string + return ret + } + + return o.ServiceAccountJson +} + +// GetServiceAccountJsonOk returns a tuple with the ServiceAccountJson field value +// and a boolean to check if the value has been set. +func (o *GCPRegistry) GetServiceAccountJsonOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ServiceAccountJson, true +} + +// SetServiceAccountJson sets field value +func (o *GCPRegistry) SetServiceAccountJson(v string) { + o.ServiceAccountJson = v +} + +func (o GCPRegistry) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GCPRegistry) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["type"] = o.Type + toSerialize["serviceAccountJson"] = o.ServiceAccountJson + return toSerialize, nil +} + +type NullableGCPRegistry struct { + value *GCPRegistry + isSet bool +} + +func (v NullableGCPRegistry) Get() *GCPRegistry { + return v.value +} + +func (v *NullableGCPRegistry) Set(val *GCPRegistry) { + v.value = val + v.isSet = true +} + +func (v NullableGCPRegistry) IsSet() bool { + return v.isSet +} + +func (v *NullableGCPRegistry) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGCPRegistry(val *GCPRegistry) *NullableGCPRegistry { + return &NullableGCPRegistry{value: val, isSet: true} +} + +func (v NullableGCPRegistry) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGCPRegistry) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_general_registry.go b/e2b/client/model_general_registry.go new file mode 100644 index 0000000..269cb24 --- /dev/null +++ b/e2b/client/model_general_registry.go @@ -0,0 +1,172 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the GeneralRegistry type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GeneralRegistry{} + +// GeneralRegistry struct for GeneralRegistry +type GeneralRegistry struct { + // Type of registry authentication + Type string `json:"type"` + // Username to use for the registry + Username string `json:"username"` + // Password to use for the registry + Password string `json:"password"` +} + +// NewGeneralRegistry instantiates a new GeneralRegistry object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGeneralRegistry(type_ string, username string, password string) *GeneralRegistry { + this := GeneralRegistry{} + this.Type = type_ + this.Username = username + this.Password = password + return &this +} + +// NewGeneralRegistryWithDefaults instantiates a new GeneralRegistry object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGeneralRegistryWithDefaults() *GeneralRegistry { + this := GeneralRegistry{} + return &this +} + +// GetType returns the Type field value +func (o *GeneralRegistry) GetType() string { + if o == nil { + var ret string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *GeneralRegistry) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *GeneralRegistry) SetType(v string) { + o.Type = v +} + +// GetUsername returns the Username field value +func (o *GeneralRegistry) GetUsername() string { + if o == nil { + var ret string + return ret + } + + return o.Username +} + +// GetUsernameOk returns a tuple with the Username field value +// and a boolean to check if the value has been set. +func (o *GeneralRegistry) GetUsernameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Username, true +} + +// SetUsername sets field value +func (o *GeneralRegistry) SetUsername(v string) { + o.Username = v +} + +// GetPassword returns the Password field value +func (o *GeneralRegistry) GetPassword() string { + if o == nil { + var ret string + return ret + } + + return o.Password +} + +// GetPasswordOk returns a tuple with the Password field value +// and a boolean to check if the value has been set. +func (o *GeneralRegistry) GetPasswordOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Password, true +} + +// SetPassword sets field value +func (o *GeneralRegistry) SetPassword(v string) { + o.Password = v +} + +func (o GeneralRegistry) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GeneralRegistry) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["type"] = o.Type + toSerialize["username"] = o.Username + toSerialize["password"] = o.Password + return toSerialize, nil +} + +type NullableGeneralRegistry struct { + value *GeneralRegistry + isSet bool +} + +func (v NullableGeneralRegistry) Get() *GeneralRegistry { + return v.value +} + +func (v *NullableGeneralRegistry) Set(val *GeneralRegistry) { + v.value = val + v.isSet = true +} + +func (v NullableGeneralRegistry) IsSet() bool { + return v.isSet +} + +func (v *NullableGeneralRegistry) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGeneralRegistry(val *GeneralRegistry) *NullableGeneralRegistry { + return &NullableGeneralRegistry{value: val, isSet: true} +} + +func (v NullableGeneralRegistry) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGeneralRegistry) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_identifier_masking_details.go b/e2b/client/model_identifier_masking_details.go new file mode 100644 index 0000000..6cc8682 --- /dev/null +++ b/e2b/client/model_identifier_masking_details.go @@ -0,0 +1,200 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the IdentifierMaskingDetails type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IdentifierMaskingDetails{} + +// IdentifierMaskingDetails struct for IdentifierMaskingDetails +type IdentifierMaskingDetails struct { + // Prefix that identifies the token or key type + Prefix string `json:"prefix"` + // Length of the token or key + ValueLength int32 `json:"valueLength"` + // Prefix used in masked version of the token or key + MaskedValuePrefix string `json:"maskedValuePrefix"` + // Suffix used in masked version of the token or key + MaskedValueSuffix string `json:"maskedValueSuffix"` +} + +// NewIdentifierMaskingDetails instantiates a new IdentifierMaskingDetails object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewIdentifierMaskingDetails(prefix string, valueLength int32, maskedValuePrefix string, maskedValueSuffix string) *IdentifierMaskingDetails { + this := IdentifierMaskingDetails{} + this.Prefix = prefix + this.ValueLength = valueLength + this.MaskedValuePrefix = maskedValuePrefix + this.MaskedValueSuffix = maskedValueSuffix + return &this +} + +// NewIdentifierMaskingDetailsWithDefaults instantiates a new IdentifierMaskingDetails object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewIdentifierMaskingDetailsWithDefaults() *IdentifierMaskingDetails { + this := IdentifierMaskingDetails{} + return &this +} + +// GetPrefix returns the Prefix field value +func (o *IdentifierMaskingDetails) GetPrefix() string { + if o == nil { + var ret string + return ret + } + + return o.Prefix +} + +// GetPrefixOk returns a tuple with the Prefix field value +// and a boolean to check if the value has been set. +func (o *IdentifierMaskingDetails) GetPrefixOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Prefix, true +} + +// SetPrefix sets field value +func (o *IdentifierMaskingDetails) SetPrefix(v string) { + o.Prefix = v +} + +// GetValueLength returns the ValueLength field value +func (o *IdentifierMaskingDetails) GetValueLength() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.ValueLength +} + +// GetValueLengthOk returns a tuple with the ValueLength field value +// and a boolean to check if the value has been set. +func (o *IdentifierMaskingDetails) GetValueLengthOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.ValueLength, true +} + +// SetValueLength sets field value +func (o *IdentifierMaskingDetails) SetValueLength(v int32) { + o.ValueLength = v +} + +// GetMaskedValuePrefix returns the MaskedValuePrefix field value +func (o *IdentifierMaskingDetails) GetMaskedValuePrefix() string { + if o == nil { + var ret string + return ret + } + + return o.MaskedValuePrefix +} + +// GetMaskedValuePrefixOk returns a tuple with the MaskedValuePrefix field value +// and a boolean to check if the value has been set. +func (o *IdentifierMaskingDetails) GetMaskedValuePrefixOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.MaskedValuePrefix, true +} + +// SetMaskedValuePrefix sets field value +func (o *IdentifierMaskingDetails) SetMaskedValuePrefix(v string) { + o.MaskedValuePrefix = v +} + +// GetMaskedValueSuffix returns the MaskedValueSuffix field value +func (o *IdentifierMaskingDetails) GetMaskedValueSuffix() string { + if o == nil { + var ret string + return ret + } + + return o.MaskedValueSuffix +} + +// GetMaskedValueSuffixOk returns a tuple with the MaskedValueSuffix field value +// and a boolean to check if the value has been set. +func (o *IdentifierMaskingDetails) GetMaskedValueSuffixOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.MaskedValueSuffix, true +} + +// SetMaskedValueSuffix sets field value +func (o *IdentifierMaskingDetails) SetMaskedValueSuffix(v string) { + o.MaskedValueSuffix = v +} + +func (o IdentifierMaskingDetails) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IdentifierMaskingDetails) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["prefix"] = o.Prefix + toSerialize["valueLength"] = o.ValueLength + toSerialize["maskedValuePrefix"] = o.MaskedValuePrefix + toSerialize["maskedValueSuffix"] = o.MaskedValueSuffix + return toSerialize, nil +} + +type NullableIdentifierMaskingDetails struct { + value *IdentifierMaskingDetails + isSet bool +} + +func (v NullableIdentifierMaskingDetails) Get() *IdentifierMaskingDetails { + return v.value +} + +func (v *NullableIdentifierMaskingDetails) Set(val *IdentifierMaskingDetails) { + v.value = val + v.isSet = true +} + +func (v NullableIdentifierMaskingDetails) IsSet() bool { + return v.isSet +} + +func (v *NullableIdentifierMaskingDetails) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIdentifierMaskingDetails(val *IdentifierMaskingDetails) *NullableIdentifierMaskingDetails { + return &NullableIdentifierMaskingDetails{value: val, isSet: true} +} + +func (v NullableIdentifierMaskingDetails) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIdentifierMaskingDetails) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_listed_sandbox.go b/e2b/client/model_listed_sandbox.go new file mode 100644 index 0000000..78ef8cc --- /dev/null +++ b/e2b/client/model_listed_sandbox.go @@ -0,0 +1,481 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" +) + +// checks if the ListedSandbox type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListedSandbox{} + +// ListedSandbox struct for ListedSandbox +type ListedSandbox struct { + // Identifier of the template from which is the sandbox created + TemplateID string `json:"templateID"` + // Alias of the template + Alias *string `json:"alias,omitempty"` + // Identifier of the sandbox + SandboxID string `json:"sandboxID"` + // Identifier of the client + // Deprecated + ClientID string `json:"clientID"` + // Time when the sandbox was started + StartedAt time.Time `json:"startedAt"` + // Time when the sandbox will expire + EndAt time.Time `json:"endAt"` + // CPU cores for the sandbox + CpuCount int32 `json:"cpuCount"` + // Memory for the sandbox in MiB + MemoryMB int32 `json:"memoryMB"` + // Disk size for the sandbox in MiB + DiskSizeMB int32 `json:"diskSizeMB"` + Metadata *map[string]string `json:"metadata,omitempty"` + State SandboxState `json:"state"` + // Version of the envd running in the sandbox + EnvdVersion string `json:"envdVersion"` + VolumeMounts []SandboxVolumeMount `json:"volumeMounts,omitempty"` +} + +// NewListedSandbox instantiates a new ListedSandbox object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewListedSandbox(templateID string, sandboxID string, clientID string, startedAt time.Time, endAt time.Time, cpuCount int32, memoryMB int32, diskSizeMB int32, state SandboxState, envdVersion string) *ListedSandbox { + this := ListedSandbox{} + this.TemplateID = templateID + this.SandboxID = sandboxID + this.ClientID = clientID + this.StartedAt = startedAt + this.EndAt = endAt + this.CpuCount = cpuCount + this.MemoryMB = memoryMB + this.DiskSizeMB = diskSizeMB + this.State = state + this.EnvdVersion = envdVersion + return &this +} + +// NewListedSandboxWithDefaults instantiates a new ListedSandbox object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewListedSandboxWithDefaults() *ListedSandbox { + this := ListedSandbox{} + return &this +} + +// GetTemplateID returns the TemplateID field value +func (o *ListedSandbox) GetTemplateID() string { + if o == nil { + var ret string + return ret + } + + return o.TemplateID +} + +// GetTemplateIDOk returns a tuple with the TemplateID field value +// and a boolean to check if the value has been set. +func (o *ListedSandbox) GetTemplateIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TemplateID, true +} + +// SetTemplateID sets field value +func (o *ListedSandbox) SetTemplateID(v string) { + o.TemplateID = v +} + +// GetAlias returns the Alias field value if set, zero value otherwise. +func (o *ListedSandbox) GetAlias() string { + if o == nil || IsNil(o.Alias) { + var ret string + return ret + } + return *o.Alias +} + +// GetAliasOk returns a tuple with the Alias field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListedSandbox) GetAliasOk() (*string, bool) { + if o == nil || IsNil(o.Alias) { + return nil, false + } + return o.Alias, true +} + +// HasAlias returns a boolean if a field has been set. +func (o *ListedSandbox) HasAlias() bool { + if o != nil && !IsNil(o.Alias) { + return true + } + + return false +} + +// SetAlias gets a reference to the given string and assigns it to the Alias field. +func (o *ListedSandbox) SetAlias(v string) { + o.Alias = &v +} + +// GetSandboxID returns the SandboxID field value +func (o *ListedSandbox) GetSandboxID() string { + if o == nil { + var ret string + return ret + } + + return o.SandboxID +} + +// GetSandboxIDOk returns a tuple with the SandboxID field value +// and a boolean to check if the value has been set. +func (o *ListedSandbox) GetSandboxIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SandboxID, true +} + +// SetSandboxID sets field value +func (o *ListedSandbox) SetSandboxID(v string) { + o.SandboxID = v +} + +// GetClientID returns the ClientID field value +// Deprecated +func (o *ListedSandbox) GetClientID() string { + if o == nil { + var ret string + return ret + } + + return o.ClientID +} + +// GetClientIDOk returns a tuple with the ClientID field value +// and a boolean to check if the value has been set. +// Deprecated +func (o *ListedSandbox) GetClientIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ClientID, true +} + +// SetClientID sets field value +// Deprecated +func (o *ListedSandbox) SetClientID(v string) { + o.ClientID = v +} + +// GetStartedAt returns the StartedAt field value +func (o *ListedSandbox) GetStartedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.StartedAt +} + +// GetStartedAtOk returns a tuple with the StartedAt field value +// and a boolean to check if the value has been set. +func (o *ListedSandbox) GetStartedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.StartedAt, true +} + +// SetStartedAt sets field value +func (o *ListedSandbox) SetStartedAt(v time.Time) { + o.StartedAt = v +} + +// GetEndAt returns the EndAt field value +func (o *ListedSandbox) GetEndAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.EndAt +} + +// GetEndAtOk returns a tuple with the EndAt field value +// and a boolean to check if the value has been set. +func (o *ListedSandbox) GetEndAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.EndAt, true +} + +// SetEndAt sets field value +func (o *ListedSandbox) SetEndAt(v time.Time) { + o.EndAt = v +} + +// GetCpuCount returns the CpuCount field value +func (o *ListedSandbox) GetCpuCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.CpuCount +} + +// GetCpuCountOk returns a tuple with the CpuCount field value +// and a boolean to check if the value has been set. +func (o *ListedSandbox) GetCpuCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.CpuCount, true +} + +// SetCpuCount sets field value +func (o *ListedSandbox) SetCpuCount(v int32) { + o.CpuCount = v +} + +// GetMemoryMB returns the MemoryMB field value +func (o *ListedSandbox) GetMemoryMB() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.MemoryMB +} + +// GetMemoryMBOk returns a tuple with the MemoryMB field value +// and a boolean to check if the value has been set. +func (o *ListedSandbox) GetMemoryMBOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.MemoryMB, true +} + +// SetMemoryMB sets field value +func (o *ListedSandbox) SetMemoryMB(v int32) { + o.MemoryMB = v +} + +// GetDiskSizeMB returns the DiskSizeMB field value +func (o *ListedSandbox) GetDiskSizeMB() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.DiskSizeMB +} + +// GetDiskSizeMBOk returns a tuple with the DiskSizeMB field value +// and a boolean to check if the value has been set. +func (o *ListedSandbox) GetDiskSizeMBOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.DiskSizeMB, true +} + +// SetDiskSizeMB sets field value +func (o *ListedSandbox) SetDiskSizeMB(v int32) { + o.DiskSizeMB = v +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *ListedSandbox) GetMetadata() map[string]string { + if o == nil || IsNil(o.Metadata) { + var ret map[string]string + return ret + } + return *o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListedSandbox) GetMetadataOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Metadata) { + return nil, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *ListedSandbox) HasMetadata() bool { + if o != nil && !IsNil(o.Metadata) { + return true + } + + return false +} + +// SetMetadata gets a reference to the given map[string]string and assigns it to the Metadata field. +func (o *ListedSandbox) SetMetadata(v map[string]string) { + o.Metadata = &v +} + +// GetState returns the State field value +func (o *ListedSandbox) GetState() SandboxState { + if o == nil { + var ret SandboxState + return ret + } + + return o.State +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *ListedSandbox) GetStateOk() (*SandboxState, bool) { + if o == nil { + return nil, false + } + return &o.State, true +} + +// SetState sets field value +func (o *ListedSandbox) SetState(v SandboxState) { + o.State = v +} + +// GetEnvdVersion returns the EnvdVersion field value +func (o *ListedSandbox) GetEnvdVersion() string { + if o == nil { + var ret string + return ret + } + + return o.EnvdVersion +} + +// GetEnvdVersionOk returns a tuple with the EnvdVersion field value +// and a boolean to check if the value has been set. +func (o *ListedSandbox) GetEnvdVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.EnvdVersion, true +} + +// SetEnvdVersion sets field value +func (o *ListedSandbox) SetEnvdVersion(v string) { + o.EnvdVersion = v +} + +// GetVolumeMounts returns the VolumeMounts field value if set, zero value otherwise. +func (o *ListedSandbox) GetVolumeMounts() []SandboxVolumeMount { + if o == nil || IsNil(o.VolumeMounts) { + var ret []SandboxVolumeMount + return ret + } + return o.VolumeMounts +} + +// GetVolumeMountsOk returns a tuple with the VolumeMounts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListedSandbox) GetVolumeMountsOk() ([]SandboxVolumeMount, bool) { + if o == nil || IsNil(o.VolumeMounts) { + return nil, false + } + return o.VolumeMounts, true +} + +// HasVolumeMounts returns a boolean if a field has been set. +func (o *ListedSandbox) HasVolumeMounts() bool { + if o != nil && !IsNil(o.VolumeMounts) { + return true + } + + return false +} + +// SetVolumeMounts gets a reference to the given []SandboxVolumeMount and assigns it to the VolumeMounts field. +func (o *ListedSandbox) SetVolumeMounts(v []SandboxVolumeMount) { + o.VolumeMounts = v +} + +func (o ListedSandbox) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListedSandbox) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["templateID"] = o.TemplateID + if !IsNil(o.Alias) { + toSerialize["alias"] = o.Alias + } + toSerialize["sandboxID"] = o.SandboxID + toSerialize["clientID"] = o.ClientID + toSerialize["startedAt"] = o.StartedAt + toSerialize["endAt"] = o.EndAt + toSerialize["cpuCount"] = o.CpuCount + toSerialize["memoryMB"] = o.MemoryMB + toSerialize["diskSizeMB"] = o.DiskSizeMB + if !IsNil(o.Metadata) { + toSerialize["metadata"] = o.Metadata + } + toSerialize["state"] = o.State + toSerialize["envdVersion"] = o.EnvdVersion + if !IsNil(o.VolumeMounts) { + toSerialize["volumeMounts"] = o.VolumeMounts + } + return toSerialize, nil +} + +type NullableListedSandbox struct { + value *ListedSandbox + isSet bool +} + +func (v NullableListedSandbox) Get() *ListedSandbox { + return v.value +} + +func (v *NullableListedSandbox) Set(val *ListedSandbox) { + v.value = val + v.isSet = true +} + +func (v NullableListedSandbox) IsSet() bool { + return v.isSet +} + +func (v *NullableListedSandbox) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListedSandbox(val *ListedSandbox) *NullableListedSandbox { + return &NullableListedSandbox{value: val, isSet: true} +} + +func (v NullableListedSandbox) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListedSandbox) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_log_level.go b/e2b/client/model_log_level.go new file mode 100644 index 0000000..10d8b92 --- /dev/null +++ b/e2b/client/model_log_level.go @@ -0,0 +1,114 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// LogLevel State of the sandbox +type LogLevel string + +// List of LogLevel +const ( + LOGLEVEL_DEBUG LogLevel = "debug" + LOGLEVEL_INFO LogLevel = "info" + LOGLEVEL_WARN LogLevel = "warn" + LOGLEVEL_ERROR LogLevel = "error" +) + +// All allowed values of LogLevel enum +var AllowedLogLevelEnumValues = []LogLevel{ + "debug", + "info", + "warn", + "error", +} + +func (v *LogLevel) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := LogLevel(value) + for _, existing := range AllowedLogLevelEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid LogLevel", value) +} + +// NewLogLevelFromValue returns a pointer to a valid LogLevel +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewLogLevelFromValue(v string) (*LogLevel, error) { + ev := LogLevel(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for LogLevel: valid values are %v", v, AllowedLogLevelEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v LogLevel) IsValid() bool { + for _, existing := range AllowedLogLevelEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogLevel value +func (v LogLevel) Ptr() *LogLevel { + return &v +} + +type NullableLogLevel struct { + value *LogLevel + isSet bool +} + +func (v NullableLogLevel) Get() *LogLevel { + return v.value +} + +func (v *NullableLogLevel) Set(val *LogLevel) { + v.value = val + v.isSet = true +} + +func (v NullableLogLevel) IsSet() bool { + return v.isSet +} + +func (v *NullableLogLevel) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLogLevel(val *LogLevel) *NullableLogLevel { + return &NullableLogLevel{value: val, isSet: true} +} + +func (v NullableLogLevel) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLogLevel) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_logs_direction.go b/e2b/client/model_logs_direction.go new file mode 100644 index 0000000..4d1b7ae --- /dev/null +++ b/e2b/client/model_logs_direction.go @@ -0,0 +1,110 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// LogsDirection Direction of the logs that should be returned +type LogsDirection string + +// List of LogsDirection +const ( + LOGSDIRECTION_LogsDirectionForward LogsDirection = "forward" + LOGSDIRECTION_LogsDirectionBackward LogsDirection = "backward" +) + +// All allowed values of LogsDirection enum +var AllowedLogsDirectionEnumValues = []LogsDirection{ + "forward", + "backward", +} + +func (v *LogsDirection) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := LogsDirection(value) + for _, existing := range AllowedLogsDirectionEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid LogsDirection", value) +} + +// NewLogsDirectionFromValue returns a pointer to a valid LogsDirection +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewLogsDirectionFromValue(v string) (*LogsDirection, error) { + ev := LogsDirection(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for LogsDirection: valid values are %v", v, AllowedLogsDirectionEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v LogsDirection) IsValid() bool { + for _, existing := range AllowedLogsDirectionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsDirection value +func (v LogsDirection) Ptr() *LogsDirection { + return &v +} + +type NullableLogsDirection struct { + value *LogsDirection + isSet bool +} + +func (v NullableLogsDirection) Get() *LogsDirection { + return v.value +} + +func (v *NullableLogsDirection) Set(val *LogsDirection) { + v.value = val + v.isSet = true +} + +func (v NullableLogsDirection) IsSet() bool { + return v.isSet +} + +func (v *NullableLogsDirection) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLogsDirection(val *LogsDirection) *NullableLogsDirection { + return &NullableLogsDirection{value: val, isSet: true} +} + +func (v NullableLogsDirection) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLogsDirection) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_logs_source.go b/e2b/client/model_logs_source.go new file mode 100644 index 0000000..f05f630 --- /dev/null +++ b/e2b/client/model_logs_source.go @@ -0,0 +1,110 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// LogsSource Source of the logs that should be returned +type LogsSource string + +// List of LogsSource +const ( + LOGSSOURCE_LogsSourceTemporary LogsSource = "temporary" + LOGSSOURCE_LogsSourcePersistent LogsSource = "persistent" +) + +// All allowed values of LogsSource enum +var AllowedLogsSourceEnumValues = []LogsSource{ + "temporary", + "persistent", +} + +func (v *LogsSource) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := LogsSource(value) + for _, existing := range AllowedLogsSourceEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid LogsSource", value) +} + +// NewLogsSourceFromValue returns a pointer to a valid LogsSource +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewLogsSourceFromValue(v string) (*LogsSource, error) { + ev := LogsSource(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for LogsSource: valid values are %v", v, AllowedLogsSourceEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v LogsSource) IsValid() bool { + for _, existing := range AllowedLogsSourceEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsSource value +func (v LogsSource) Ptr() *LogsSource { + return &v +} + +type NullableLogsSource struct { + value *LogsSource + isSet bool +} + +func (v NullableLogsSource) Get() *LogsSource { + return v.value +} + +func (v *NullableLogsSource) Set(val *LogsSource) { + v.value = val + v.isSet = true +} + +func (v NullableLogsSource) IsSet() bool { + return v.isSet +} + +func (v *NullableLogsSource) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLogsSource(val *LogsSource) *NullableLogsSource { + return &NullableLogsSource{value: val, isSet: true} +} + +func (v NullableLogsSource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLogsSource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_machine_info.go b/e2b/client/model_machine_info.go new file mode 100644 index 0000000..6c1aab9 --- /dev/null +++ b/e2b/client/model_machine_info.go @@ -0,0 +1,200 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the MachineInfo type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MachineInfo{} + +// MachineInfo struct for MachineInfo +type MachineInfo struct { + // CPU family of the node + CpuFamily string `json:"cpuFamily"` + // CPU model of the node + CpuModel string `json:"cpuModel"` + // CPU model name of the node + CpuModelName string `json:"cpuModelName"` + // CPU architecture of the node + CpuArchitecture string `json:"cpuArchitecture"` +} + +// NewMachineInfo instantiates a new MachineInfo object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMachineInfo(cpuFamily string, cpuModel string, cpuModelName string, cpuArchitecture string) *MachineInfo { + this := MachineInfo{} + this.CpuFamily = cpuFamily + this.CpuModel = cpuModel + this.CpuModelName = cpuModelName + this.CpuArchitecture = cpuArchitecture + return &this +} + +// NewMachineInfoWithDefaults instantiates a new MachineInfo object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMachineInfoWithDefaults() *MachineInfo { + this := MachineInfo{} + return &this +} + +// GetCpuFamily returns the CpuFamily field value +func (o *MachineInfo) GetCpuFamily() string { + if o == nil { + var ret string + return ret + } + + return o.CpuFamily +} + +// GetCpuFamilyOk returns a tuple with the CpuFamily field value +// and a boolean to check if the value has been set. +func (o *MachineInfo) GetCpuFamilyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CpuFamily, true +} + +// SetCpuFamily sets field value +func (o *MachineInfo) SetCpuFamily(v string) { + o.CpuFamily = v +} + +// GetCpuModel returns the CpuModel field value +func (o *MachineInfo) GetCpuModel() string { + if o == nil { + var ret string + return ret + } + + return o.CpuModel +} + +// GetCpuModelOk returns a tuple with the CpuModel field value +// and a boolean to check if the value has been set. +func (o *MachineInfo) GetCpuModelOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CpuModel, true +} + +// SetCpuModel sets field value +func (o *MachineInfo) SetCpuModel(v string) { + o.CpuModel = v +} + +// GetCpuModelName returns the CpuModelName field value +func (o *MachineInfo) GetCpuModelName() string { + if o == nil { + var ret string + return ret + } + + return o.CpuModelName +} + +// GetCpuModelNameOk returns a tuple with the CpuModelName field value +// and a boolean to check if the value has been set. +func (o *MachineInfo) GetCpuModelNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CpuModelName, true +} + +// SetCpuModelName sets field value +func (o *MachineInfo) SetCpuModelName(v string) { + o.CpuModelName = v +} + +// GetCpuArchitecture returns the CpuArchitecture field value +func (o *MachineInfo) GetCpuArchitecture() string { + if o == nil { + var ret string + return ret + } + + return o.CpuArchitecture +} + +// GetCpuArchitectureOk returns a tuple with the CpuArchitecture field value +// and a boolean to check if the value has been set. +func (o *MachineInfo) GetCpuArchitectureOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CpuArchitecture, true +} + +// SetCpuArchitecture sets field value +func (o *MachineInfo) SetCpuArchitecture(v string) { + o.CpuArchitecture = v +} + +func (o MachineInfo) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MachineInfo) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["cpuFamily"] = o.CpuFamily + toSerialize["cpuModel"] = o.CpuModel + toSerialize["cpuModelName"] = o.CpuModelName + toSerialize["cpuArchitecture"] = o.CpuArchitecture + return toSerialize, nil +} + +type NullableMachineInfo struct { + value *MachineInfo + isSet bool +} + +func (v NullableMachineInfo) Get() *MachineInfo { + return v.value +} + +func (v *NullableMachineInfo) Set(val *MachineInfo) { + v.value = val + v.isSet = true +} + +func (v NullableMachineInfo) IsSet() bool { + return v.isSet +} + +func (v *NullableMachineInfo) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMachineInfo(val *MachineInfo) *NullableMachineInfo { + return &NullableMachineInfo{value: val, isSet: true} +} + +func (v NullableMachineInfo) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMachineInfo) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_max_team_metric.go b/e2b/client/model_max_team_metric.go new file mode 100644 index 0000000..45e189e --- /dev/null +++ b/e2b/client/model_max_team_metric.go @@ -0,0 +1,177 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" +) + +// checks if the MaxTeamMetric type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MaxTeamMetric{} + +// MaxTeamMetric Team metric with timestamp +type MaxTeamMetric struct { + // Timestamp of the metric entry + // Deprecated + Timestamp time.Time `json:"timestamp"` + // Timestamp of the metric entry in Unix time (seconds since epoch) + TimestampUnix int64 `json:"timestampUnix"` + // The maximum value of the requested metric in the given interval + Value float32 `json:"value"` +} + +// NewMaxTeamMetric instantiates a new MaxTeamMetric object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMaxTeamMetric(timestamp time.Time, timestampUnix int64, value float32) *MaxTeamMetric { + this := MaxTeamMetric{} + this.Timestamp = timestamp + this.TimestampUnix = timestampUnix + this.Value = value + return &this +} + +// NewMaxTeamMetricWithDefaults instantiates a new MaxTeamMetric object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMaxTeamMetricWithDefaults() *MaxTeamMetric { + this := MaxTeamMetric{} + return &this +} + +// GetTimestamp returns the Timestamp field value +// Deprecated +func (o *MaxTeamMetric) GetTimestamp() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value +// and a boolean to check if the value has been set. +// Deprecated +func (o *MaxTeamMetric) GetTimestampOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Timestamp, true +} + +// SetTimestamp sets field value +// Deprecated +func (o *MaxTeamMetric) SetTimestamp(v time.Time) { + o.Timestamp = v +} + +// GetTimestampUnix returns the TimestampUnix field value +func (o *MaxTeamMetric) GetTimestampUnix() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.TimestampUnix +} + +// GetTimestampUnixOk returns a tuple with the TimestampUnix field value +// and a boolean to check if the value has been set. +func (o *MaxTeamMetric) GetTimestampUnixOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.TimestampUnix, true +} + +// SetTimestampUnix sets field value +func (o *MaxTeamMetric) SetTimestampUnix(v int64) { + o.TimestampUnix = v +} + +// GetValue returns the Value field value +func (o *MaxTeamMetric) GetValue() float32 { + if o == nil { + var ret float32 + return ret + } + + return o.Value +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *MaxTeamMetric) GetValueOk() (*float32, bool) { + if o == nil { + return nil, false + } + return &o.Value, true +} + +// SetValue sets field value +func (o *MaxTeamMetric) SetValue(v float32) { + o.Value = v +} + +func (o MaxTeamMetric) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MaxTeamMetric) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["timestamp"] = o.Timestamp + toSerialize["timestampUnix"] = o.TimestampUnix + toSerialize["value"] = o.Value + return toSerialize, nil +} + +type NullableMaxTeamMetric struct { + value *MaxTeamMetric + isSet bool +} + +func (v NullableMaxTeamMetric) Get() *MaxTeamMetric { + return v.value +} + +func (v *NullableMaxTeamMetric) Set(val *MaxTeamMetric) { + v.value = val + v.isSet = true +} + +func (v NullableMaxTeamMetric) IsSet() bool { + return v.isSet +} + +func (v *NullableMaxTeamMetric) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMaxTeamMetric(val *MaxTeamMetric) *NullableMaxTeamMetric { + return &NullableMaxTeamMetric{value: val, isSet: true} +} + +func (v NullableMaxTeamMetric) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMaxTeamMetric) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_new_access_token.go b/e2b/client/model_new_access_token.go new file mode 100644 index 0000000..9826861 --- /dev/null +++ b/e2b/client/model_new_access_token.go @@ -0,0 +1,116 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the NewAccessToken type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NewAccessToken{} + +// NewAccessToken struct for NewAccessToken +type NewAccessToken struct { + // Name of the access token + Name string `json:"name"` +} + +// NewNewAccessToken instantiates a new NewAccessToken object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNewAccessToken(name string) *NewAccessToken { + this := NewAccessToken{} + this.Name = name + return &this +} + +// NewNewAccessTokenWithDefaults instantiates a new NewAccessToken object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNewAccessTokenWithDefaults() *NewAccessToken { + this := NewAccessToken{} + return &this +} + +// GetName returns the Name field value +func (o *NewAccessToken) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *NewAccessToken) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *NewAccessToken) SetName(v string) { + o.Name = v +} + +func (o NewAccessToken) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NewAccessToken) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + return toSerialize, nil +} + +type NullableNewAccessToken struct { + value *NewAccessToken + isSet bool +} + +func (v NullableNewAccessToken) Get() *NewAccessToken { + return v.value +} + +func (v *NullableNewAccessToken) Set(val *NewAccessToken) { + v.value = val + v.isSet = true +} + +func (v NullableNewAccessToken) IsSet() bool { + return v.isSet +} + +func (v *NullableNewAccessToken) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNewAccessToken(val *NewAccessToken) *NullableNewAccessToken { + return &NullableNewAccessToken{value: val, isSet: true} +} + +func (v NullableNewAccessToken) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNewAccessToken) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_node.go b/e2b/client/model_node.go new file mode 100644 index 0000000..1bba511 --- /dev/null +++ b/e2b/client/model_node.go @@ -0,0 +1,453 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the Node type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Node{} + +// Node struct for Node +type Node struct { + // Version of the orchestrator + Version string `json:"version"` + // Commit of the orchestrator + Commit string `json:"commit"` + // Identifier of the nomad node + // Deprecated + NodeID string `json:"nodeID"` + // Identifier of the node + Id string `json:"id"` + // Service instance identifier of the node + ServiceInstanceID string `json:"serviceInstanceID"` + // Identifier of the cluster + ClusterID string `json:"clusterID"` + MachineInfo MachineInfo `json:"machineInfo"` + Status NodeStatus `json:"status"` + // Number of sandboxes running on the node + SandboxCount int32 `json:"sandboxCount"` + Metrics NodeMetrics `json:"metrics"` + // Number of sandbox create successes + CreateSuccesses int32 `json:"createSuccesses"` + // Number of sandbox create fails + CreateFails int32 `json:"createFails"` + // Number of starting Sandboxes + SandboxStartingCount int32 `json:"sandboxStartingCount"` +} + +// NewNode instantiates a new Node object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNode(version string, commit string, nodeID string, id string, serviceInstanceID string, clusterID string, machineInfo MachineInfo, status NodeStatus, sandboxCount int32, metrics NodeMetrics, createSuccesses int32, createFails int32, sandboxStartingCount int32) *Node { + this := Node{} + this.Version = version + this.Commit = commit + this.NodeID = nodeID + this.Id = id + this.ServiceInstanceID = serviceInstanceID + this.ClusterID = clusterID + this.MachineInfo = machineInfo + this.Status = status + this.SandboxCount = sandboxCount + this.Metrics = metrics + this.CreateSuccesses = createSuccesses + this.CreateFails = createFails + this.SandboxStartingCount = sandboxStartingCount + return &this +} + +// NewNodeWithDefaults instantiates a new Node object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNodeWithDefaults() *Node { + this := Node{} + return &this +} + +// GetVersion returns the Version field value +func (o *Node) GetVersion() string { + if o == nil { + var ret string + return ret + } + + return o.Version +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +func (o *Node) GetVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Version, true +} + +// SetVersion sets field value +func (o *Node) SetVersion(v string) { + o.Version = v +} + +// GetCommit returns the Commit field value +func (o *Node) GetCommit() string { + if o == nil { + var ret string + return ret + } + + return o.Commit +} + +// GetCommitOk returns a tuple with the Commit field value +// and a boolean to check if the value has been set. +func (o *Node) GetCommitOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Commit, true +} + +// SetCommit sets field value +func (o *Node) SetCommit(v string) { + o.Commit = v +} + +// GetNodeID returns the NodeID field value +// Deprecated +func (o *Node) GetNodeID() string { + if o == nil { + var ret string + return ret + } + + return o.NodeID +} + +// GetNodeIDOk returns a tuple with the NodeID field value +// and a boolean to check if the value has been set. +// Deprecated +func (o *Node) GetNodeIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NodeID, true +} + +// SetNodeID sets field value +// Deprecated +func (o *Node) SetNodeID(v string) { + o.NodeID = v +} + +// GetId returns the Id field value +func (o *Node) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Node) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *Node) SetId(v string) { + o.Id = v +} + +// GetServiceInstanceID returns the ServiceInstanceID field value +func (o *Node) GetServiceInstanceID() string { + if o == nil { + var ret string + return ret + } + + return o.ServiceInstanceID +} + +// GetServiceInstanceIDOk returns a tuple with the ServiceInstanceID field value +// and a boolean to check if the value has been set. +func (o *Node) GetServiceInstanceIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ServiceInstanceID, true +} + +// SetServiceInstanceID sets field value +func (o *Node) SetServiceInstanceID(v string) { + o.ServiceInstanceID = v +} + +// GetClusterID returns the ClusterID field value +func (o *Node) GetClusterID() string { + if o == nil { + var ret string + return ret + } + + return o.ClusterID +} + +// GetClusterIDOk returns a tuple with the ClusterID field value +// and a boolean to check if the value has been set. +func (o *Node) GetClusterIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ClusterID, true +} + +// SetClusterID sets field value +func (o *Node) SetClusterID(v string) { + o.ClusterID = v +} + +// GetMachineInfo returns the MachineInfo field value +func (o *Node) GetMachineInfo() MachineInfo { + if o == nil { + var ret MachineInfo + return ret + } + + return o.MachineInfo +} + +// GetMachineInfoOk returns a tuple with the MachineInfo field value +// and a boolean to check if the value has been set. +func (o *Node) GetMachineInfoOk() (*MachineInfo, bool) { + if o == nil { + return nil, false + } + return &o.MachineInfo, true +} + +// SetMachineInfo sets field value +func (o *Node) SetMachineInfo(v MachineInfo) { + o.MachineInfo = v +} + +// GetStatus returns the Status field value +func (o *Node) GetStatus() NodeStatus { + if o == nil { + var ret NodeStatus + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *Node) GetStatusOk() (*NodeStatus, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *Node) SetStatus(v NodeStatus) { + o.Status = v +} + +// GetSandboxCount returns the SandboxCount field value +func (o *Node) GetSandboxCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.SandboxCount +} + +// GetSandboxCountOk returns a tuple with the SandboxCount field value +// and a boolean to check if the value has been set. +func (o *Node) GetSandboxCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.SandboxCount, true +} + +// SetSandboxCount sets field value +func (o *Node) SetSandboxCount(v int32) { + o.SandboxCount = v +} + +// GetMetrics returns the Metrics field value +func (o *Node) GetMetrics() NodeMetrics { + if o == nil { + var ret NodeMetrics + return ret + } + + return o.Metrics +} + +// GetMetricsOk returns a tuple with the Metrics field value +// and a boolean to check if the value has been set. +func (o *Node) GetMetricsOk() (*NodeMetrics, bool) { + if o == nil { + return nil, false + } + return &o.Metrics, true +} + +// SetMetrics sets field value +func (o *Node) SetMetrics(v NodeMetrics) { + o.Metrics = v +} + +// GetCreateSuccesses returns the CreateSuccesses field value +func (o *Node) GetCreateSuccesses() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.CreateSuccesses +} + +// GetCreateSuccessesOk returns a tuple with the CreateSuccesses field value +// and a boolean to check if the value has been set. +func (o *Node) GetCreateSuccessesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.CreateSuccesses, true +} + +// SetCreateSuccesses sets field value +func (o *Node) SetCreateSuccesses(v int32) { + o.CreateSuccesses = v +} + +// GetCreateFails returns the CreateFails field value +func (o *Node) GetCreateFails() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.CreateFails +} + +// GetCreateFailsOk returns a tuple with the CreateFails field value +// and a boolean to check if the value has been set. +func (o *Node) GetCreateFailsOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.CreateFails, true +} + +// SetCreateFails sets field value +func (o *Node) SetCreateFails(v int32) { + o.CreateFails = v +} + +// GetSandboxStartingCount returns the SandboxStartingCount field value +func (o *Node) GetSandboxStartingCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.SandboxStartingCount +} + +// GetSandboxStartingCountOk returns a tuple with the SandboxStartingCount field value +// and a boolean to check if the value has been set. +func (o *Node) GetSandboxStartingCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.SandboxStartingCount, true +} + +// SetSandboxStartingCount sets field value +func (o *Node) SetSandboxStartingCount(v int32) { + o.SandboxStartingCount = v +} + +func (o Node) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Node) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["version"] = o.Version + toSerialize["commit"] = o.Commit + toSerialize["nodeID"] = o.NodeID + toSerialize["id"] = o.Id + toSerialize["serviceInstanceID"] = o.ServiceInstanceID + toSerialize["clusterID"] = o.ClusterID + toSerialize["machineInfo"] = o.MachineInfo + toSerialize["status"] = o.Status + toSerialize["sandboxCount"] = o.SandboxCount + toSerialize["metrics"] = o.Metrics + toSerialize["createSuccesses"] = o.CreateSuccesses + toSerialize["createFails"] = o.CreateFails + toSerialize["sandboxStartingCount"] = o.SandboxStartingCount + return toSerialize, nil +} + +type NullableNode struct { + value *Node + isSet bool +} + +func (v NullableNode) Get() *Node { + return v.value +} + +func (v *NullableNode) Set(val *Node) { + v.value = val + v.isSet = true +} + +func (v NullableNode) IsSet() bool { + return v.isSet +} + +func (v *NullableNode) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNode(val *Node) *NullableNode { + return &NullableNode{value: val, isSet: true} +} + +func (v NullableNode) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNode) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_node_detail.go b/e2b/client/model_node_detail.go new file mode 100644 index 0000000..4195a15 --- /dev/null +++ b/e2b/client/model_node_detail.go @@ -0,0 +1,453 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the NodeDetail type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NodeDetail{} + +// NodeDetail struct for NodeDetail +type NodeDetail struct { + // Identifier of the cluster + ClusterID string `json:"clusterID"` + // Version of the orchestrator + Version string `json:"version"` + // Commit of the orchestrator + Commit string `json:"commit"` + // Identifier of the node + Id string `json:"id"` + // Service instance identifier of the node + ServiceInstanceID string `json:"serviceInstanceID"` + // Identifier of the nomad node + // Deprecated + NodeID string `json:"nodeID"` + MachineInfo MachineInfo `json:"machineInfo"` + Status NodeStatus `json:"status"` + // List of sandboxes running on the node + Sandboxes []ListedSandbox `json:"sandboxes"` + Metrics NodeMetrics `json:"metrics"` + // List of cached builds id on the node + CachedBuilds []string `json:"cachedBuilds"` + // Number of sandbox create successes + CreateSuccesses int32 `json:"createSuccesses"` + // Number of sandbox create fails + CreateFails int32 `json:"createFails"` +} + +// NewNodeDetail instantiates a new NodeDetail object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNodeDetail(clusterID string, version string, commit string, id string, serviceInstanceID string, nodeID string, machineInfo MachineInfo, status NodeStatus, sandboxes []ListedSandbox, metrics NodeMetrics, cachedBuilds []string, createSuccesses int32, createFails int32) *NodeDetail { + this := NodeDetail{} + this.ClusterID = clusterID + this.Version = version + this.Commit = commit + this.Id = id + this.ServiceInstanceID = serviceInstanceID + this.NodeID = nodeID + this.MachineInfo = machineInfo + this.Status = status + this.Sandboxes = sandboxes + this.Metrics = metrics + this.CachedBuilds = cachedBuilds + this.CreateSuccesses = createSuccesses + this.CreateFails = createFails + return &this +} + +// NewNodeDetailWithDefaults instantiates a new NodeDetail object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNodeDetailWithDefaults() *NodeDetail { + this := NodeDetail{} + return &this +} + +// GetClusterID returns the ClusterID field value +func (o *NodeDetail) GetClusterID() string { + if o == nil { + var ret string + return ret + } + + return o.ClusterID +} + +// GetClusterIDOk returns a tuple with the ClusterID field value +// and a boolean to check if the value has been set. +func (o *NodeDetail) GetClusterIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ClusterID, true +} + +// SetClusterID sets field value +func (o *NodeDetail) SetClusterID(v string) { + o.ClusterID = v +} + +// GetVersion returns the Version field value +func (o *NodeDetail) GetVersion() string { + if o == nil { + var ret string + return ret + } + + return o.Version +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +func (o *NodeDetail) GetVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Version, true +} + +// SetVersion sets field value +func (o *NodeDetail) SetVersion(v string) { + o.Version = v +} + +// GetCommit returns the Commit field value +func (o *NodeDetail) GetCommit() string { + if o == nil { + var ret string + return ret + } + + return o.Commit +} + +// GetCommitOk returns a tuple with the Commit field value +// and a boolean to check if the value has been set. +func (o *NodeDetail) GetCommitOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Commit, true +} + +// SetCommit sets field value +func (o *NodeDetail) SetCommit(v string) { + o.Commit = v +} + +// GetId returns the Id field value +func (o *NodeDetail) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *NodeDetail) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *NodeDetail) SetId(v string) { + o.Id = v +} + +// GetServiceInstanceID returns the ServiceInstanceID field value +func (o *NodeDetail) GetServiceInstanceID() string { + if o == nil { + var ret string + return ret + } + + return o.ServiceInstanceID +} + +// GetServiceInstanceIDOk returns a tuple with the ServiceInstanceID field value +// and a boolean to check if the value has been set. +func (o *NodeDetail) GetServiceInstanceIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ServiceInstanceID, true +} + +// SetServiceInstanceID sets field value +func (o *NodeDetail) SetServiceInstanceID(v string) { + o.ServiceInstanceID = v +} + +// GetNodeID returns the NodeID field value +// Deprecated +func (o *NodeDetail) GetNodeID() string { + if o == nil { + var ret string + return ret + } + + return o.NodeID +} + +// GetNodeIDOk returns a tuple with the NodeID field value +// and a boolean to check if the value has been set. +// Deprecated +func (o *NodeDetail) GetNodeIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NodeID, true +} + +// SetNodeID sets field value +// Deprecated +func (o *NodeDetail) SetNodeID(v string) { + o.NodeID = v +} + +// GetMachineInfo returns the MachineInfo field value +func (o *NodeDetail) GetMachineInfo() MachineInfo { + if o == nil { + var ret MachineInfo + return ret + } + + return o.MachineInfo +} + +// GetMachineInfoOk returns a tuple with the MachineInfo field value +// and a boolean to check if the value has been set. +func (o *NodeDetail) GetMachineInfoOk() (*MachineInfo, bool) { + if o == nil { + return nil, false + } + return &o.MachineInfo, true +} + +// SetMachineInfo sets field value +func (o *NodeDetail) SetMachineInfo(v MachineInfo) { + o.MachineInfo = v +} + +// GetStatus returns the Status field value +func (o *NodeDetail) GetStatus() NodeStatus { + if o == nil { + var ret NodeStatus + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *NodeDetail) GetStatusOk() (*NodeStatus, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *NodeDetail) SetStatus(v NodeStatus) { + o.Status = v +} + +// GetSandboxes returns the Sandboxes field value +func (o *NodeDetail) GetSandboxes() []ListedSandbox { + if o == nil { + var ret []ListedSandbox + return ret + } + + return o.Sandboxes +} + +// GetSandboxesOk returns a tuple with the Sandboxes field value +// and a boolean to check if the value has been set. +func (o *NodeDetail) GetSandboxesOk() ([]ListedSandbox, bool) { + if o == nil { + return nil, false + } + return o.Sandboxes, true +} + +// SetSandboxes sets field value +func (o *NodeDetail) SetSandboxes(v []ListedSandbox) { + o.Sandboxes = v +} + +// GetMetrics returns the Metrics field value +func (o *NodeDetail) GetMetrics() NodeMetrics { + if o == nil { + var ret NodeMetrics + return ret + } + + return o.Metrics +} + +// GetMetricsOk returns a tuple with the Metrics field value +// and a boolean to check if the value has been set. +func (o *NodeDetail) GetMetricsOk() (*NodeMetrics, bool) { + if o == nil { + return nil, false + } + return &o.Metrics, true +} + +// SetMetrics sets field value +func (o *NodeDetail) SetMetrics(v NodeMetrics) { + o.Metrics = v +} + +// GetCachedBuilds returns the CachedBuilds field value +func (o *NodeDetail) GetCachedBuilds() []string { + if o == nil { + var ret []string + return ret + } + + return o.CachedBuilds +} + +// GetCachedBuildsOk returns a tuple with the CachedBuilds field value +// and a boolean to check if the value has been set. +func (o *NodeDetail) GetCachedBuildsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.CachedBuilds, true +} + +// SetCachedBuilds sets field value +func (o *NodeDetail) SetCachedBuilds(v []string) { + o.CachedBuilds = v +} + +// GetCreateSuccesses returns the CreateSuccesses field value +func (o *NodeDetail) GetCreateSuccesses() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.CreateSuccesses +} + +// GetCreateSuccessesOk returns a tuple with the CreateSuccesses field value +// and a boolean to check if the value has been set. +func (o *NodeDetail) GetCreateSuccessesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.CreateSuccesses, true +} + +// SetCreateSuccesses sets field value +func (o *NodeDetail) SetCreateSuccesses(v int32) { + o.CreateSuccesses = v +} + +// GetCreateFails returns the CreateFails field value +func (o *NodeDetail) GetCreateFails() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.CreateFails +} + +// GetCreateFailsOk returns a tuple with the CreateFails field value +// and a boolean to check if the value has been set. +func (o *NodeDetail) GetCreateFailsOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.CreateFails, true +} + +// SetCreateFails sets field value +func (o *NodeDetail) SetCreateFails(v int32) { + o.CreateFails = v +} + +func (o NodeDetail) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NodeDetail) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["clusterID"] = o.ClusterID + toSerialize["version"] = o.Version + toSerialize["commit"] = o.Commit + toSerialize["id"] = o.Id + toSerialize["serviceInstanceID"] = o.ServiceInstanceID + toSerialize["nodeID"] = o.NodeID + toSerialize["machineInfo"] = o.MachineInfo + toSerialize["status"] = o.Status + toSerialize["sandboxes"] = o.Sandboxes + toSerialize["metrics"] = o.Metrics + toSerialize["cachedBuilds"] = o.CachedBuilds + toSerialize["createSuccesses"] = o.CreateSuccesses + toSerialize["createFails"] = o.CreateFails + return toSerialize, nil +} + +type NullableNodeDetail struct { + value *NodeDetail + isSet bool +} + +func (v NullableNodeDetail) Get() *NodeDetail { + return v.value +} + +func (v *NullableNodeDetail) Set(val *NodeDetail) { + v.value = val + v.isSet = true +} + +func (v NullableNodeDetail) IsSet() bool { + return v.isSet +} + +func (v *NullableNodeDetail) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNodeDetail(val *NodeDetail) *NullableNodeDetail { + return &NullableNodeDetail{value: val, isSet: true} +} + +func (v NullableNodeDetail) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNodeDetail) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_node_metrics.go b/e2b/client/model_node_metrics.go new file mode 100644 index 0000000..7932f62 --- /dev/null +++ b/e2b/client/model_node_metrics.go @@ -0,0 +1,284 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the NodeMetrics type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NodeMetrics{} + +// NodeMetrics Node metrics +type NodeMetrics struct { + // Number of allocated CPU cores + AllocatedCPU int32 `json:"allocatedCPU"` + // Node CPU usage percentage + CpuPercent int32 `json:"cpuPercent"` + // Total number of CPU cores on the node + CpuCount int32 `json:"cpuCount"` + // Amount of allocated memory in bytes + AllocatedMemoryBytes int32 `json:"allocatedMemoryBytes"` + // Node memory used in bytes + MemoryUsedBytes int32 `json:"memoryUsedBytes"` + // Total node memory in bytes + MemoryTotalBytes int32 `json:"memoryTotalBytes"` + // Detailed metrics for each disk/mount point + Disks []DiskMetrics `json:"disks"` +} + +// NewNodeMetrics instantiates a new NodeMetrics object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNodeMetrics(allocatedCPU int32, cpuPercent int32, cpuCount int32, allocatedMemoryBytes int32, memoryUsedBytes int32, memoryTotalBytes int32, disks []DiskMetrics) *NodeMetrics { + this := NodeMetrics{} + this.AllocatedCPU = allocatedCPU + this.CpuPercent = cpuPercent + this.CpuCount = cpuCount + this.AllocatedMemoryBytes = allocatedMemoryBytes + this.MemoryUsedBytes = memoryUsedBytes + this.MemoryTotalBytes = memoryTotalBytes + this.Disks = disks + return &this +} + +// NewNodeMetricsWithDefaults instantiates a new NodeMetrics object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNodeMetricsWithDefaults() *NodeMetrics { + this := NodeMetrics{} + return &this +} + +// GetAllocatedCPU returns the AllocatedCPU field value +func (o *NodeMetrics) GetAllocatedCPU() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.AllocatedCPU +} + +// GetAllocatedCPUOk returns a tuple with the AllocatedCPU field value +// and a boolean to check if the value has been set. +func (o *NodeMetrics) GetAllocatedCPUOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.AllocatedCPU, true +} + +// SetAllocatedCPU sets field value +func (o *NodeMetrics) SetAllocatedCPU(v int32) { + o.AllocatedCPU = v +} + +// GetCpuPercent returns the CpuPercent field value +func (o *NodeMetrics) GetCpuPercent() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.CpuPercent +} + +// GetCpuPercentOk returns a tuple with the CpuPercent field value +// and a boolean to check if the value has been set. +func (o *NodeMetrics) GetCpuPercentOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.CpuPercent, true +} + +// SetCpuPercent sets field value +func (o *NodeMetrics) SetCpuPercent(v int32) { + o.CpuPercent = v +} + +// GetCpuCount returns the CpuCount field value +func (o *NodeMetrics) GetCpuCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.CpuCount +} + +// GetCpuCountOk returns a tuple with the CpuCount field value +// and a boolean to check if the value has been set. +func (o *NodeMetrics) GetCpuCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.CpuCount, true +} + +// SetCpuCount sets field value +func (o *NodeMetrics) SetCpuCount(v int32) { + o.CpuCount = v +} + +// GetAllocatedMemoryBytes returns the AllocatedMemoryBytes field value +func (o *NodeMetrics) GetAllocatedMemoryBytes() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.AllocatedMemoryBytes +} + +// GetAllocatedMemoryBytesOk returns a tuple with the AllocatedMemoryBytes field value +// and a boolean to check if the value has been set. +func (o *NodeMetrics) GetAllocatedMemoryBytesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.AllocatedMemoryBytes, true +} + +// SetAllocatedMemoryBytes sets field value +func (o *NodeMetrics) SetAllocatedMemoryBytes(v int32) { + o.AllocatedMemoryBytes = v +} + +// GetMemoryUsedBytes returns the MemoryUsedBytes field value +func (o *NodeMetrics) GetMemoryUsedBytes() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.MemoryUsedBytes +} + +// GetMemoryUsedBytesOk returns a tuple with the MemoryUsedBytes field value +// and a boolean to check if the value has been set. +func (o *NodeMetrics) GetMemoryUsedBytesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.MemoryUsedBytes, true +} + +// SetMemoryUsedBytes sets field value +func (o *NodeMetrics) SetMemoryUsedBytes(v int32) { + o.MemoryUsedBytes = v +} + +// GetMemoryTotalBytes returns the MemoryTotalBytes field value +func (o *NodeMetrics) GetMemoryTotalBytes() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.MemoryTotalBytes +} + +// GetMemoryTotalBytesOk returns a tuple with the MemoryTotalBytes field value +// and a boolean to check if the value has been set. +func (o *NodeMetrics) GetMemoryTotalBytesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.MemoryTotalBytes, true +} + +// SetMemoryTotalBytes sets field value +func (o *NodeMetrics) SetMemoryTotalBytes(v int32) { + o.MemoryTotalBytes = v +} + +// GetDisks returns the Disks field value +func (o *NodeMetrics) GetDisks() []DiskMetrics { + if o == nil { + var ret []DiskMetrics + return ret + } + + return o.Disks +} + +// GetDisksOk returns a tuple with the Disks field value +// and a boolean to check if the value has been set. +func (o *NodeMetrics) GetDisksOk() ([]DiskMetrics, bool) { + if o == nil { + return nil, false + } + return o.Disks, true +} + +// SetDisks sets field value +func (o *NodeMetrics) SetDisks(v []DiskMetrics) { + o.Disks = v +} + +func (o NodeMetrics) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NodeMetrics) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["allocatedCPU"] = o.AllocatedCPU + toSerialize["cpuPercent"] = o.CpuPercent + toSerialize["cpuCount"] = o.CpuCount + toSerialize["allocatedMemoryBytes"] = o.AllocatedMemoryBytes + toSerialize["memoryUsedBytes"] = o.MemoryUsedBytes + toSerialize["memoryTotalBytes"] = o.MemoryTotalBytes + toSerialize["disks"] = o.Disks + return toSerialize, nil +} + +type NullableNodeMetrics struct { + value *NodeMetrics + isSet bool +} + +func (v NullableNodeMetrics) Get() *NodeMetrics { + return v.value +} + +func (v *NullableNodeMetrics) Set(val *NodeMetrics) { + v.value = val + v.isSet = true +} + +func (v NullableNodeMetrics) IsSet() bool { + return v.isSet +} + +func (v *NullableNodeMetrics) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNodeMetrics(val *NodeMetrics) *NullableNodeMetrics { + return &NullableNodeMetrics{value: val, isSet: true} +} + +func (v NullableNodeMetrics) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNodeMetrics) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_node_status.go b/e2b/client/model_node_status.go new file mode 100644 index 0000000..4b91060 --- /dev/null +++ b/e2b/client/model_node_status.go @@ -0,0 +1,114 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// NodeStatus Status of the node +type NodeStatus string + +// List of NodeStatus +const ( + NODESTATUS_NodeStatusReady NodeStatus = "ready" + NODESTATUS_NodeStatusDraining NodeStatus = "draining" + NODESTATUS_NodeStatusConnecting NodeStatus = "connecting" + NODESTATUS_NodeStatusUnhealthy NodeStatus = "unhealthy" +) + +// All allowed values of NodeStatus enum +var AllowedNodeStatusEnumValues = []NodeStatus{ + "ready", + "draining", + "connecting", + "unhealthy", +} + +func (v *NodeStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := NodeStatus(value) + for _, existing := range AllowedNodeStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid NodeStatus", value) +} + +// NewNodeStatusFromValue returns a pointer to a valid NodeStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewNodeStatusFromValue(v string) (*NodeStatus, error) { + ev := NodeStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for NodeStatus: valid values are %v", v, AllowedNodeStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v NodeStatus) IsValid() bool { + for _, existing := range AllowedNodeStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to NodeStatus value +func (v NodeStatus) Ptr() *NodeStatus { + return &v +} + +type NullableNodeStatus struct { + value *NodeStatus + isSet bool +} + +func (v NullableNodeStatus) Get() *NodeStatus { + return v.value +} + +func (v *NullableNodeStatus) Set(val *NodeStatus) { + v.value = val + v.isSet = true +} + +func (v NullableNodeStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableNodeStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNodeStatus(val *NodeStatus) *NullableNodeStatus { + return &NullableNodeStatus{value: val, isSet: true} +} + +func (v NullableNodeStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNodeStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_node_status_change.go b/e2b/client/model_node_status_change.go new file mode 100644 index 0000000..4de6e26 --- /dev/null +++ b/e2b/client/model_node_status_change.go @@ -0,0 +1,152 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the NodeStatusChange type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NodeStatusChange{} + +// NodeStatusChange struct for NodeStatusChange +type NodeStatusChange struct { + // Identifier of the cluster + ClusterID *string `json:"clusterID,omitempty"` + Status NodeStatus `json:"status"` +} + +// NewNodeStatusChange instantiates a new NodeStatusChange object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNodeStatusChange(status NodeStatus) *NodeStatusChange { + this := NodeStatusChange{} + this.Status = status + return &this +} + +// NewNodeStatusChangeWithDefaults instantiates a new NodeStatusChange object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNodeStatusChangeWithDefaults() *NodeStatusChange { + this := NodeStatusChange{} + return &this +} + +// GetClusterID returns the ClusterID field value if set, zero value otherwise. +func (o *NodeStatusChange) GetClusterID() string { + if o == nil || IsNil(o.ClusterID) { + var ret string + return ret + } + return *o.ClusterID +} + +// GetClusterIDOk returns a tuple with the ClusterID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NodeStatusChange) GetClusterIDOk() (*string, bool) { + if o == nil || IsNil(o.ClusterID) { + return nil, false + } + return o.ClusterID, true +} + +// HasClusterID returns a boolean if a field has been set. +func (o *NodeStatusChange) HasClusterID() bool { + if o != nil && !IsNil(o.ClusterID) { + return true + } + + return false +} + +// SetClusterID gets a reference to the given string and assigns it to the ClusterID field. +func (o *NodeStatusChange) SetClusterID(v string) { + o.ClusterID = &v +} + +// GetStatus returns the Status field value +func (o *NodeStatusChange) GetStatus() NodeStatus { + if o == nil { + var ret NodeStatus + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *NodeStatusChange) GetStatusOk() (*NodeStatus, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *NodeStatusChange) SetStatus(v NodeStatus) { + o.Status = v +} + +func (o NodeStatusChange) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NodeStatusChange) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ClusterID) { + toSerialize["clusterID"] = o.ClusterID + } + toSerialize["status"] = o.Status + return toSerialize, nil +} + +type NullableNodeStatusChange struct { + value *NodeStatusChange + isSet bool +} + +func (v NullableNodeStatusChange) Get() *NodeStatusChange { + return v.value +} + +func (v *NullableNodeStatusChange) Set(val *NodeStatusChange) { + v.value = val + v.isSet = true +} + +func (v NullableNodeStatusChange) IsSet() bool { + return v.isSet +} + +func (v *NullableNodeStatusChange) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNodeStatusChange(val *NodeStatusChange) *NullableNodeStatusChange { + return &NullableNodeStatusChange{value: val, isSet: true} +} + +func (v NullableNodeStatusChange) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNodeStatusChange) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_resumed_sandbox.go b/e2b/client/model_resumed_sandbox.go new file mode 100644 index 0000000..50a1f6f --- /dev/null +++ b/e2b/client/model_resumed_sandbox.go @@ -0,0 +1,170 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the ResumedSandbox type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ResumedSandbox{} + +// ResumedSandbox struct for ResumedSandbox +type ResumedSandbox struct { + // Time to live for the sandbox in seconds. + Timeout *int32 `json:"timeout,omitempty"` + // Automatically pauses the sandbox after the timeout + // Deprecated + AutoPause *bool `json:"autoPause,omitempty"` +} + +// NewResumedSandbox instantiates a new ResumedSandbox object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewResumedSandbox() *ResumedSandbox { + this := ResumedSandbox{} + var timeout int32 = 15 + this.Timeout = &timeout + return &this +} + +// NewResumedSandboxWithDefaults instantiates a new ResumedSandbox object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewResumedSandboxWithDefaults() *ResumedSandbox { + this := ResumedSandbox{} + var timeout int32 = 15 + this.Timeout = &timeout + return &this +} + +// GetTimeout returns the Timeout field value if set, zero value otherwise. +func (o *ResumedSandbox) GetTimeout() int32 { + if o == nil || IsNil(o.Timeout) { + var ret int32 + return ret + } + return *o.Timeout +} + +// GetTimeoutOk returns a tuple with the Timeout field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ResumedSandbox) GetTimeoutOk() (*int32, bool) { + if o == nil || IsNil(o.Timeout) { + return nil, false + } + return o.Timeout, true +} + +// HasTimeout returns a boolean if a field has been set. +func (o *ResumedSandbox) HasTimeout() bool { + if o != nil && !IsNil(o.Timeout) { + return true + } + + return false +} + +// SetTimeout gets a reference to the given int32 and assigns it to the Timeout field. +func (o *ResumedSandbox) SetTimeout(v int32) { + o.Timeout = &v +} + +// GetAutoPause returns the AutoPause field value if set, zero value otherwise. +// Deprecated +func (o *ResumedSandbox) GetAutoPause() bool { + if o == nil || IsNil(o.AutoPause) { + var ret bool + return ret + } + return *o.AutoPause +} + +// GetAutoPauseOk returns a tuple with the AutoPause field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated +func (o *ResumedSandbox) GetAutoPauseOk() (*bool, bool) { + if o == nil || IsNil(o.AutoPause) { + return nil, false + } + return o.AutoPause, true +} + +// HasAutoPause returns a boolean if a field has been set. +func (o *ResumedSandbox) HasAutoPause() bool { + if o != nil && !IsNil(o.AutoPause) { + return true + } + + return false +} + +// SetAutoPause gets a reference to the given bool and assigns it to the AutoPause field. +// Deprecated +func (o *ResumedSandbox) SetAutoPause(v bool) { + o.AutoPause = &v +} + +func (o ResumedSandbox) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ResumedSandbox) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Timeout) { + toSerialize["timeout"] = o.Timeout + } + if !IsNil(o.AutoPause) { + toSerialize["autoPause"] = o.AutoPause + } + return toSerialize, nil +} + +type NullableResumedSandbox struct { + value *ResumedSandbox + isSet bool +} + +func (v NullableResumedSandbox) Get() *ResumedSandbox { + return v.value +} + +func (v *NullableResumedSandbox) Set(val *ResumedSandbox) { + v.value = val + v.isSet = true +} + +func (v NullableResumedSandbox) IsSet() bool { + return v.isSet +} + +func (v *NullableResumedSandbox) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableResumedSandbox(val *ResumedSandbox) *NullableResumedSandbox { + return &NullableResumedSandbox{value: val, isSet: true} +} + +func (v NullableResumedSandbox) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableResumedSandbox) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_sandbox.go b/e2b/client/model_sandbox.go new file mode 100644 index 0000000..d3602bc --- /dev/null +++ b/e2b/client/model_sandbox.go @@ -0,0 +1,374 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the Sandbox type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Sandbox{} + +// Sandbox struct for Sandbox +type Sandbox struct { + // Identifier of the template from which is the sandbox created + TemplateID string `json:"templateID"` + // Identifier of the sandbox + SandboxID string `json:"sandboxID"` + // Alias of the template + Alias *string `json:"alias,omitempty"` + // Identifier of the client + // Deprecated + ClientID string `json:"clientID"` + // Version of the envd running in the sandbox + EnvdVersion string `json:"envdVersion"` + // Access token used for envd communication + EnvdAccessToken *string `json:"envdAccessToken,omitempty"` + // Token required for accessing sandbox via proxy. + TrafficAccessToken NullableString `json:"trafficAccessToken,omitempty"` + // Base domain where the sandbox traffic is accessible + Domain NullableString `json:"domain,omitempty"` +} + +// NewSandbox instantiates a new Sandbox object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSandbox(templateID string, sandboxID string, clientID string, envdVersion string) *Sandbox { + this := Sandbox{} + this.TemplateID = templateID + this.SandboxID = sandboxID + this.ClientID = clientID + this.EnvdVersion = envdVersion + return &this +} + +// NewSandboxWithDefaults instantiates a new Sandbox object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSandboxWithDefaults() *Sandbox { + this := Sandbox{} + return &this +} + +// GetTemplateID returns the TemplateID field value +func (o *Sandbox) GetTemplateID() string { + if o == nil { + var ret string + return ret + } + + return o.TemplateID +} + +// GetTemplateIDOk returns a tuple with the TemplateID field value +// and a boolean to check if the value has been set. +func (o *Sandbox) GetTemplateIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TemplateID, true +} + +// SetTemplateID sets field value +func (o *Sandbox) SetTemplateID(v string) { + o.TemplateID = v +} + +// GetSandboxID returns the SandboxID field value +func (o *Sandbox) GetSandboxID() string { + if o == nil { + var ret string + return ret + } + + return o.SandboxID +} + +// GetSandboxIDOk returns a tuple with the SandboxID field value +// and a boolean to check if the value has been set. +func (o *Sandbox) GetSandboxIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SandboxID, true +} + +// SetSandboxID sets field value +func (o *Sandbox) SetSandboxID(v string) { + o.SandboxID = v +} + +// GetAlias returns the Alias field value if set, zero value otherwise. +func (o *Sandbox) GetAlias() string { + if o == nil || IsNil(o.Alias) { + var ret string + return ret + } + return *o.Alias +} + +// GetAliasOk returns a tuple with the Alias field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Sandbox) GetAliasOk() (*string, bool) { + if o == nil || IsNil(o.Alias) { + return nil, false + } + return o.Alias, true +} + +// HasAlias returns a boolean if a field has been set. +func (o *Sandbox) HasAlias() bool { + if o != nil && !IsNil(o.Alias) { + return true + } + + return false +} + +// SetAlias gets a reference to the given string and assigns it to the Alias field. +func (o *Sandbox) SetAlias(v string) { + o.Alias = &v +} + +// GetClientID returns the ClientID field value +// Deprecated +func (o *Sandbox) GetClientID() string { + if o == nil { + var ret string + return ret + } + + return o.ClientID +} + +// GetClientIDOk returns a tuple with the ClientID field value +// and a boolean to check if the value has been set. +// Deprecated +func (o *Sandbox) GetClientIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ClientID, true +} + +// SetClientID sets field value +// Deprecated +func (o *Sandbox) SetClientID(v string) { + o.ClientID = v +} + +// GetEnvdVersion returns the EnvdVersion field value +func (o *Sandbox) GetEnvdVersion() string { + if o == nil { + var ret string + return ret + } + + return o.EnvdVersion +} + +// GetEnvdVersionOk returns a tuple with the EnvdVersion field value +// and a boolean to check if the value has been set. +func (o *Sandbox) GetEnvdVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.EnvdVersion, true +} + +// SetEnvdVersion sets field value +func (o *Sandbox) SetEnvdVersion(v string) { + o.EnvdVersion = v +} + +// GetEnvdAccessToken returns the EnvdAccessToken field value if set, zero value otherwise. +func (o *Sandbox) GetEnvdAccessToken() string { + if o == nil || IsNil(o.EnvdAccessToken) { + var ret string + return ret + } + return *o.EnvdAccessToken +} + +// GetEnvdAccessTokenOk returns a tuple with the EnvdAccessToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Sandbox) GetEnvdAccessTokenOk() (*string, bool) { + if o == nil || IsNil(o.EnvdAccessToken) { + return nil, false + } + return o.EnvdAccessToken, true +} + +// HasEnvdAccessToken returns a boolean if a field has been set. +func (o *Sandbox) HasEnvdAccessToken() bool { + if o != nil && !IsNil(o.EnvdAccessToken) { + return true + } + + return false +} + +// SetEnvdAccessToken gets a reference to the given string and assigns it to the EnvdAccessToken field. +func (o *Sandbox) SetEnvdAccessToken(v string) { + o.EnvdAccessToken = &v +} + +// GetTrafficAccessToken returns the TrafficAccessToken field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Sandbox) GetTrafficAccessToken() string { + if o == nil || IsNil(o.TrafficAccessToken.Get()) { + var ret string + return ret + } + return *o.TrafficAccessToken.Get() +} + +// GetTrafficAccessTokenOk returns a tuple with the TrafficAccessToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Sandbox) GetTrafficAccessTokenOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.TrafficAccessToken.Get(), o.TrafficAccessToken.IsSet() +} + +// HasTrafficAccessToken returns a boolean if a field has been set. +func (o *Sandbox) HasTrafficAccessToken() bool { + if o != nil && o.TrafficAccessToken.IsSet() { + return true + } + + return false +} + +// SetTrafficAccessToken gets a reference to the given NullableString and assigns it to the TrafficAccessToken field. +func (o *Sandbox) SetTrafficAccessToken(v string) { + o.TrafficAccessToken.Set(&v) +} + +// SetTrafficAccessTokenNil sets the value for TrafficAccessToken to be an explicit nil +func (o *Sandbox) SetTrafficAccessTokenNil() { + o.TrafficAccessToken.Set(nil) +} + +// UnsetTrafficAccessToken ensures that no value is present for TrafficAccessToken, not even an explicit nil +func (o *Sandbox) UnsetTrafficAccessToken() { + o.TrafficAccessToken.Unset() +} + +// GetDomain returns the Domain field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Sandbox) GetDomain() string { + if o == nil || IsNil(o.Domain.Get()) { + var ret string + return ret + } + return *o.Domain.Get() +} + +// GetDomainOk returns a tuple with the Domain field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Sandbox) GetDomainOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Domain.Get(), o.Domain.IsSet() +} + +// HasDomain returns a boolean if a field has been set. +func (o *Sandbox) HasDomain() bool { + if o != nil && o.Domain.IsSet() { + return true + } + + return false +} + +// SetDomain gets a reference to the given NullableString and assigns it to the Domain field. +func (o *Sandbox) SetDomain(v string) { + o.Domain.Set(&v) +} + +// SetDomainNil sets the value for Domain to be an explicit nil +func (o *Sandbox) SetDomainNil() { + o.Domain.Set(nil) +} + +// UnsetDomain ensures that no value is present for Domain, not even an explicit nil +func (o *Sandbox) UnsetDomain() { + o.Domain.Unset() +} + +func (o Sandbox) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Sandbox) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["templateID"] = o.TemplateID + toSerialize["sandboxID"] = o.SandboxID + if !IsNil(o.Alias) { + toSerialize["alias"] = o.Alias + } + toSerialize["clientID"] = o.ClientID + toSerialize["envdVersion"] = o.EnvdVersion + if !IsNil(o.EnvdAccessToken) { + toSerialize["envdAccessToken"] = o.EnvdAccessToken + } + if o.TrafficAccessToken.IsSet() { + toSerialize["trafficAccessToken"] = o.TrafficAccessToken.Get() + } + if o.Domain.IsSet() { + toSerialize["domain"] = o.Domain.Get() + } + return toSerialize, nil +} + +type NullableSandbox struct { + value *Sandbox + isSet bool +} + +func (v NullableSandbox) Get() *Sandbox { + return v.value +} + +func (v *NullableSandbox) Set(val *Sandbox) { + v.value = val + v.isSet = true +} + +func (v NullableSandbox) IsSet() bool { + return v.isSet +} + +func (v *NullableSandbox) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSandbox(val *Sandbox) *NullableSandbox { + return &NullableSandbox{value: val, isSet: true} +} + +func (v NullableSandbox) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSandbox) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_sandbox_auto_resume_config.go b/e2b/client/model_sandbox_auto_resume_config.go new file mode 100644 index 0000000..f5dbe0b --- /dev/null +++ b/e2b/client/model_sandbox_auto_resume_config.go @@ -0,0 +1,118 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the SandboxAutoResumeConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SandboxAutoResumeConfig{} + +// SandboxAutoResumeConfig Auto-resume configuration for paused sandboxes. +type SandboxAutoResumeConfig struct { + // Auto-resume enabled flag for paused sandboxes. Default false. + Enabled bool `json:"enabled"` +} + +// NewSandboxAutoResumeConfig instantiates a new SandboxAutoResumeConfig object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSandboxAutoResumeConfig(enabled bool) *SandboxAutoResumeConfig { + this := SandboxAutoResumeConfig{} + this.Enabled = enabled + return &this +} + +// NewSandboxAutoResumeConfigWithDefaults instantiates a new SandboxAutoResumeConfig object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSandboxAutoResumeConfigWithDefaults() *SandboxAutoResumeConfig { + this := SandboxAutoResumeConfig{} + var enabled bool = false + this.Enabled = enabled + return &this +} + +// GetEnabled returns the Enabled field value +func (o *SandboxAutoResumeConfig) GetEnabled() bool { + if o == nil { + var ret bool + return ret + } + + return o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value +// and a boolean to check if the value has been set. +func (o *SandboxAutoResumeConfig) GetEnabledOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Enabled, true +} + +// SetEnabled sets field value +func (o *SandboxAutoResumeConfig) SetEnabled(v bool) { + o.Enabled = v +} + +func (o SandboxAutoResumeConfig) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SandboxAutoResumeConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["enabled"] = o.Enabled + return toSerialize, nil +} + +type NullableSandboxAutoResumeConfig struct { + value *SandboxAutoResumeConfig + isSet bool +} + +func (v NullableSandboxAutoResumeConfig) Get() *SandboxAutoResumeConfig { + return v.value +} + +func (v *NullableSandboxAutoResumeConfig) Set(val *SandboxAutoResumeConfig) { + v.value = val + v.isSet = true +} + +func (v NullableSandboxAutoResumeConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableSandboxAutoResumeConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSandboxAutoResumeConfig(val *SandboxAutoResumeConfig) *NullableSandboxAutoResumeConfig { + return &NullableSandboxAutoResumeConfig{value: val, isSet: true} +} + +func (v NullableSandboxAutoResumeConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSandboxAutoResumeConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_sandbox_detail.go b/e2b/client/model_sandbox_detail.go new file mode 100644 index 0000000..f5a7706 --- /dev/null +++ b/e2b/client/model_sandbox_detail.go @@ -0,0 +1,566 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" +) + +// checks if the SandboxDetail type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SandboxDetail{} + +// SandboxDetail struct for SandboxDetail +type SandboxDetail struct { + // Identifier of the template from which is the sandbox created + TemplateID string `json:"templateID"` + // Alias of the template + Alias *string `json:"alias,omitempty"` + // Identifier of the sandbox + SandboxID string `json:"sandboxID"` + // Identifier of the client + // Deprecated + ClientID string `json:"clientID"` + // Time when the sandbox was started + StartedAt time.Time `json:"startedAt"` + // Time when the sandbox will expire + EndAt time.Time `json:"endAt"` + // Version of the envd running in the sandbox + EnvdVersion string `json:"envdVersion"` + // Access token used for envd communication + EnvdAccessToken *string `json:"envdAccessToken,omitempty"` + // Base domain where the sandbox traffic is accessible + Domain NullableString `json:"domain,omitempty"` + // CPU cores for the sandbox + CpuCount int32 `json:"cpuCount"` + // Memory for the sandbox in MiB + MemoryMB int32 `json:"memoryMB"` + // Disk size for the sandbox in MiB + DiskSizeMB int32 `json:"diskSizeMB"` + Metadata *map[string]string `json:"metadata,omitempty"` + State SandboxState `json:"state"` + VolumeMounts []SandboxVolumeMount `json:"volumeMounts,omitempty"` +} + +// NewSandboxDetail instantiates a new SandboxDetail object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSandboxDetail(templateID string, sandboxID string, clientID string, startedAt time.Time, endAt time.Time, envdVersion string, cpuCount int32, memoryMB int32, diskSizeMB int32, state SandboxState) *SandboxDetail { + this := SandboxDetail{} + this.TemplateID = templateID + this.SandboxID = sandboxID + this.ClientID = clientID + this.StartedAt = startedAt + this.EndAt = endAt + this.EnvdVersion = envdVersion + this.CpuCount = cpuCount + this.MemoryMB = memoryMB + this.DiskSizeMB = diskSizeMB + this.State = state + return &this +} + +// NewSandboxDetailWithDefaults instantiates a new SandboxDetail object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSandboxDetailWithDefaults() *SandboxDetail { + this := SandboxDetail{} + return &this +} + +// GetTemplateID returns the TemplateID field value +func (o *SandboxDetail) GetTemplateID() string { + if o == nil { + var ret string + return ret + } + + return o.TemplateID +} + +// GetTemplateIDOk returns a tuple with the TemplateID field value +// and a boolean to check if the value has been set. +func (o *SandboxDetail) GetTemplateIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TemplateID, true +} + +// SetTemplateID sets field value +func (o *SandboxDetail) SetTemplateID(v string) { + o.TemplateID = v +} + +// GetAlias returns the Alias field value if set, zero value otherwise. +func (o *SandboxDetail) GetAlias() string { + if o == nil || IsNil(o.Alias) { + var ret string + return ret + } + return *o.Alias +} + +// GetAliasOk returns a tuple with the Alias field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SandboxDetail) GetAliasOk() (*string, bool) { + if o == nil || IsNil(o.Alias) { + return nil, false + } + return o.Alias, true +} + +// HasAlias returns a boolean if a field has been set. +func (o *SandboxDetail) HasAlias() bool { + if o != nil && !IsNil(o.Alias) { + return true + } + + return false +} + +// SetAlias gets a reference to the given string and assigns it to the Alias field. +func (o *SandboxDetail) SetAlias(v string) { + o.Alias = &v +} + +// GetSandboxID returns the SandboxID field value +func (o *SandboxDetail) GetSandboxID() string { + if o == nil { + var ret string + return ret + } + + return o.SandboxID +} + +// GetSandboxIDOk returns a tuple with the SandboxID field value +// and a boolean to check if the value has been set. +func (o *SandboxDetail) GetSandboxIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SandboxID, true +} + +// SetSandboxID sets field value +func (o *SandboxDetail) SetSandboxID(v string) { + o.SandboxID = v +} + +// GetClientID returns the ClientID field value +// Deprecated +func (o *SandboxDetail) GetClientID() string { + if o == nil { + var ret string + return ret + } + + return o.ClientID +} + +// GetClientIDOk returns a tuple with the ClientID field value +// and a boolean to check if the value has been set. +// Deprecated +func (o *SandboxDetail) GetClientIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ClientID, true +} + +// SetClientID sets field value +// Deprecated +func (o *SandboxDetail) SetClientID(v string) { + o.ClientID = v +} + +// GetStartedAt returns the StartedAt field value +func (o *SandboxDetail) GetStartedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.StartedAt +} + +// GetStartedAtOk returns a tuple with the StartedAt field value +// and a boolean to check if the value has been set. +func (o *SandboxDetail) GetStartedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.StartedAt, true +} + +// SetStartedAt sets field value +func (o *SandboxDetail) SetStartedAt(v time.Time) { + o.StartedAt = v +} + +// GetEndAt returns the EndAt field value +func (o *SandboxDetail) GetEndAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.EndAt +} + +// GetEndAtOk returns a tuple with the EndAt field value +// and a boolean to check if the value has been set. +func (o *SandboxDetail) GetEndAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.EndAt, true +} + +// SetEndAt sets field value +func (o *SandboxDetail) SetEndAt(v time.Time) { + o.EndAt = v +} + +// GetEnvdVersion returns the EnvdVersion field value +func (o *SandboxDetail) GetEnvdVersion() string { + if o == nil { + var ret string + return ret + } + + return o.EnvdVersion +} + +// GetEnvdVersionOk returns a tuple with the EnvdVersion field value +// and a boolean to check if the value has been set. +func (o *SandboxDetail) GetEnvdVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.EnvdVersion, true +} + +// SetEnvdVersion sets field value +func (o *SandboxDetail) SetEnvdVersion(v string) { + o.EnvdVersion = v +} + +// GetEnvdAccessToken returns the EnvdAccessToken field value if set, zero value otherwise. +func (o *SandboxDetail) GetEnvdAccessToken() string { + if o == nil || IsNil(o.EnvdAccessToken) { + var ret string + return ret + } + return *o.EnvdAccessToken +} + +// GetEnvdAccessTokenOk returns a tuple with the EnvdAccessToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SandboxDetail) GetEnvdAccessTokenOk() (*string, bool) { + if o == nil || IsNil(o.EnvdAccessToken) { + return nil, false + } + return o.EnvdAccessToken, true +} + +// HasEnvdAccessToken returns a boolean if a field has been set. +func (o *SandboxDetail) HasEnvdAccessToken() bool { + if o != nil && !IsNil(o.EnvdAccessToken) { + return true + } + + return false +} + +// SetEnvdAccessToken gets a reference to the given string and assigns it to the EnvdAccessToken field. +func (o *SandboxDetail) SetEnvdAccessToken(v string) { + o.EnvdAccessToken = &v +} + +// GetDomain returns the Domain field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *SandboxDetail) GetDomain() string { + if o == nil || IsNil(o.Domain.Get()) { + var ret string + return ret + } + return *o.Domain.Get() +} + +// GetDomainOk returns a tuple with the Domain field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *SandboxDetail) GetDomainOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Domain.Get(), o.Domain.IsSet() +} + +// HasDomain returns a boolean if a field has been set. +func (o *SandboxDetail) HasDomain() bool { + if o != nil && o.Domain.IsSet() { + return true + } + + return false +} + +// SetDomain gets a reference to the given NullableString and assigns it to the Domain field. +func (o *SandboxDetail) SetDomain(v string) { + o.Domain.Set(&v) +} + +// SetDomainNil sets the value for Domain to be an explicit nil +func (o *SandboxDetail) SetDomainNil() { + o.Domain.Set(nil) +} + +// UnsetDomain ensures that no value is present for Domain, not even an explicit nil +func (o *SandboxDetail) UnsetDomain() { + o.Domain.Unset() +} + +// GetCpuCount returns the CpuCount field value +func (o *SandboxDetail) GetCpuCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.CpuCount +} + +// GetCpuCountOk returns a tuple with the CpuCount field value +// and a boolean to check if the value has been set. +func (o *SandboxDetail) GetCpuCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.CpuCount, true +} + +// SetCpuCount sets field value +func (o *SandboxDetail) SetCpuCount(v int32) { + o.CpuCount = v +} + +// GetMemoryMB returns the MemoryMB field value +func (o *SandboxDetail) GetMemoryMB() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.MemoryMB +} + +// GetMemoryMBOk returns a tuple with the MemoryMB field value +// and a boolean to check if the value has been set. +func (o *SandboxDetail) GetMemoryMBOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.MemoryMB, true +} + +// SetMemoryMB sets field value +func (o *SandboxDetail) SetMemoryMB(v int32) { + o.MemoryMB = v +} + +// GetDiskSizeMB returns the DiskSizeMB field value +func (o *SandboxDetail) GetDiskSizeMB() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.DiskSizeMB +} + +// GetDiskSizeMBOk returns a tuple with the DiskSizeMB field value +// and a boolean to check if the value has been set. +func (o *SandboxDetail) GetDiskSizeMBOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.DiskSizeMB, true +} + +// SetDiskSizeMB sets field value +func (o *SandboxDetail) SetDiskSizeMB(v int32) { + o.DiskSizeMB = v +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *SandboxDetail) GetMetadata() map[string]string { + if o == nil || IsNil(o.Metadata) { + var ret map[string]string + return ret + } + return *o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SandboxDetail) GetMetadataOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Metadata) { + return nil, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *SandboxDetail) HasMetadata() bool { + if o != nil && !IsNil(o.Metadata) { + return true + } + + return false +} + +// SetMetadata gets a reference to the given map[string]string and assigns it to the Metadata field. +func (o *SandboxDetail) SetMetadata(v map[string]string) { + o.Metadata = &v +} + +// GetState returns the State field value +func (o *SandboxDetail) GetState() SandboxState { + if o == nil { + var ret SandboxState + return ret + } + + return o.State +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *SandboxDetail) GetStateOk() (*SandboxState, bool) { + if o == nil { + return nil, false + } + return &o.State, true +} + +// SetState sets field value +func (o *SandboxDetail) SetState(v SandboxState) { + o.State = v +} + +// GetVolumeMounts returns the VolumeMounts field value if set, zero value otherwise. +func (o *SandboxDetail) GetVolumeMounts() []SandboxVolumeMount { + if o == nil || IsNil(o.VolumeMounts) { + var ret []SandboxVolumeMount + return ret + } + return o.VolumeMounts +} + +// GetVolumeMountsOk returns a tuple with the VolumeMounts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SandboxDetail) GetVolumeMountsOk() ([]SandboxVolumeMount, bool) { + if o == nil || IsNil(o.VolumeMounts) { + return nil, false + } + return o.VolumeMounts, true +} + +// HasVolumeMounts returns a boolean if a field has been set. +func (o *SandboxDetail) HasVolumeMounts() bool { + if o != nil && !IsNil(o.VolumeMounts) { + return true + } + + return false +} + +// SetVolumeMounts gets a reference to the given []SandboxVolumeMount and assigns it to the VolumeMounts field. +func (o *SandboxDetail) SetVolumeMounts(v []SandboxVolumeMount) { + o.VolumeMounts = v +} + +func (o SandboxDetail) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SandboxDetail) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["templateID"] = o.TemplateID + if !IsNil(o.Alias) { + toSerialize["alias"] = o.Alias + } + toSerialize["sandboxID"] = o.SandboxID + toSerialize["clientID"] = o.ClientID + toSerialize["startedAt"] = o.StartedAt + toSerialize["endAt"] = o.EndAt + toSerialize["envdVersion"] = o.EnvdVersion + if !IsNil(o.EnvdAccessToken) { + toSerialize["envdAccessToken"] = o.EnvdAccessToken + } + if o.Domain.IsSet() { + toSerialize["domain"] = o.Domain.Get() + } + toSerialize["cpuCount"] = o.CpuCount + toSerialize["memoryMB"] = o.MemoryMB + toSerialize["diskSizeMB"] = o.DiskSizeMB + if !IsNil(o.Metadata) { + toSerialize["metadata"] = o.Metadata + } + toSerialize["state"] = o.State + if !IsNil(o.VolumeMounts) { + toSerialize["volumeMounts"] = o.VolumeMounts + } + return toSerialize, nil +} + +type NullableSandboxDetail struct { + value *SandboxDetail + isSet bool +} + +func (v NullableSandboxDetail) Get() *SandboxDetail { + return v.value +} + +func (v *NullableSandboxDetail) Set(val *SandboxDetail) { + v.value = val + v.isSet = true +} + +func (v NullableSandboxDetail) IsSet() bool { + return v.isSet +} + +func (v *NullableSandboxDetail) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSandboxDetail(val *SandboxDetail) *NullableSandboxDetail { + return &NullableSandboxDetail{value: val, isSet: true} +} + +func (v NullableSandboxDetail) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSandboxDetail) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_sandbox_log.go b/e2b/client/model_sandbox_log.go new file mode 100644 index 0000000..a65acc2 --- /dev/null +++ b/e2b/client/model_sandbox_log.go @@ -0,0 +1,145 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" +) + +// checks if the SandboxLog type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SandboxLog{} + +// SandboxLog Log entry with timestamp and line +type SandboxLog struct { + // Timestamp of the log entry + Timestamp time.Time `json:"timestamp"` + // Log line content + Line string `json:"line"` +} + +// NewSandboxLog instantiates a new SandboxLog object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSandboxLog(timestamp time.Time, line string) *SandboxLog { + this := SandboxLog{} + this.Timestamp = timestamp + this.Line = line + return &this +} + +// NewSandboxLogWithDefaults instantiates a new SandboxLog object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSandboxLogWithDefaults() *SandboxLog { + this := SandboxLog{} + return &this +} + +// GetTimestamp returns the Timestamp field value +func (o *SandboxLog) GetTimestamp() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value +// and a boolean to check if the value has been set. +func (o *SandboxLog) GetTimestampOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Timestamp, true +} + +// SetTimestamp sets field value +func (o *SandboxLog) SetTimestamp(v time.Time) { + o.Timestamp = v +} + +// GetLine returns the Line field value +func (o *SandboxLog) GetLine() string { + if o == nil { + var ret string + return ret + } + + return o.Line +} + +// GetLineOk returns a tuple with the Line field value +// and a boolean to check if the value has been set. +func (o *SandboxLog) GetLineOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Line, true +} + +// SetLine sets field value +func (o *SandboxLog) SetLine(v string) { + o.Line = v +} + +func (o SandboxLog) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SandboxLog) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["timestamp"] = o.Timestamp + toSerialize["line"] = o.Line + return toSerialize, nil +} + +type NullableSandboxLog struct { + value *SandboxLog + isSet bool +} + +func (v NullableSandboxLog) Get() *SandboxLog { + return v.value +} + +func (v *NullableSandboxLog) Set(val *SandboxLog) { + v.value = val + v.isSet = true +} + +func (v NullableSandboxLog) IsSet() bool { + return v.isSet +} + +func (v *NullableSandboxLog) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSandboxLog(val *SandboxLog) *NullableSandboxLog { + return &NullableSandboxLog{value: val, isSet: true} +} + +func (v NullableSandboxLog) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSandboxLog) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_sandbox_log_entry.go b/e2b/client/model_sandbox_log_entry.go new file mode 100644 index 0000000..8049ca3 --- /dev/null +++ b/e2b/client/model_sandbox_log_entry.go @@ -0,0 +1,199 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" +) + +// checks if the SandboxLogEntry type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SandboxLogEntry{} + +// SandboxLogEntry struct for SandboxLogEntry +type SandboxLogEntry struct { + // Timestamp of the log entry + Timestamp time.Time `json:"timestamp"` + // Log message content + Message string `json:"message"` + Level LogLevel `json:"level"` + Fields map[string]string `json:"fields"` +} + +// NewSandboxLogEntry instantiates a new SandboxLogEntry object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSandboxLogEntry(timestamp time.Time, message string, level LogLevel, fields map[string]string) *SandboxLogEntry { + this := SandboxLogEntry{} + this.Timestamp = timestamp + this.Message = message + this.Level = level + this.Fields = fields + return &this +} + +// NewSandboxLogEntryWithDefaults instantiates a new SandboxLogEntry object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSandboxLogEntryWithDefaults() *SandboxLogEntry { + this := SandboxLogEntry{} + return &this +} + +// GetTimestamp returns the Timestamp field value +func (o *SandboxLogEntry) GetTimestamp() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value +// and a boolean to check if the value has been set. +func (o *SandboxLogEntry) GetTimestampOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Timestamp, true +} + +// SetTimestamp sets field value +func (o *SandboxLogEntry) SetTimestamp(v time.Time) { + o.Timestamp = v +} + +// GetMessage returns the Message field value +func (o *SandboxLogEntry) GetMessage() string { + if o == nil { + var ret string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *SandboxLogEntry) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *SandboxLogEntry) SetMessage(v string) { + o.Message = v +} + +// GetLevel returns the Level field value +func (o *SandboxLogEntry) GetLevel() LogLevel { + if o == nil { + var ret LogLevel + return ret + } + + return o.Level +} + +// GetLevelOk returns a tuple with the Level field value +// and a boolean to check if the value has been set. +func (o *SandboxLogEntry) GetLevelOk() (*LogLevel, bool) { + if o == nil { + return nil, false + } + return &o.Level, true +} + +// SetLevel sets field value +func (o *SandboxLogEntry) SetLevel(v LogLevel) { + o.Level = v +} + +// GetFields returns the Fields field value +func (o *SandboxLogEntry) GetFields() map[string]string { + if o == nil { + var ret map[string]string + return ret + } + + return o.Fields +} + +// GetFieldsOk returns a tuple with the Fields field value +// and a boolean to check if the value has been set. +func (o *SandboxLogEntry) GetFieldsOk() (*map[string]string, bool) { + if o == nil { + return nil, false + } + return &o.Fields, true +} + +// SetFields sets field value +func (o *SandboxLogEntry) SetFields(v map[string]string) { + o.Fields = v +} + +func (o SandboxLogEntry) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SandboxLogEntry) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["timestamp"] = o.Timestamp + toSerialize["message"] = o.Message + toSerialize["level"] = o.Level + toSerialize["fields"] = o.Fields + return toSerialize, nil +} + +type NullableSandboxLogEntry struct { + value *SandboxLogEntry + isSet bool +} + +func (v NullableSandboxLogEntry) Get() *SandboxLogEntry { + return v.value +} + +func (v *NullableSandboxLogEntry) Set(val *SandboxLogEntry) { + v.value = val + v.isSet = true +} + +func (v NullableSandboxLogEntry) IsSet() bool { + return v.isSet +} + +func (v *NullableSandboxLogEntry) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSandboxLogEntry(val *SandboxLogEntry) *NullableSandboxLogEntry { + return &NullableSandboxLogEntry{value: val, isSet: true} +} + +func (v NullableSandboxLogEntry) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSandboxLogEntry) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_sandbox_logs.go b/e2b/client/model_sandbox_logs.go new file mode 100644 index 0000000..8b28f69 --- /dev/null +++ b/e2b/client/model_sandbox_logs.go @@ -0,0 +1,144 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the SandboxLogs type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SandboxLogs{} + +// SandboxLogs struct for SandboxLogs +type SandboxLogs struct { + // Logs of the sandbox + Logs []SandboxLog `json:"logs"` + // Structured logs of the sandbox + LogEntries []SandboxLogEntry `json:"logEntries"` +} + +// NewSandboxLogs instantiates a new SandboxLogs object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSandboxLogs(logs []SandboxLog, logEntries []SandboxLogEntry) *SandboxLogs { + this := SandboxLogs{} + this.Logs = logs + this.LogEntries = logEntries + return &this +} + +// NewSandboxLogsWithDefaults instantiates a new SandboxLogs object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSandboxLogsWithDefaults() *SandboxLogs { + this := SandboxLogs{} + return &this +} + +// GetLogs returns the Logs field value +func (o *SandboxLogs) GetLogs() []SandboxLog { + if o == nil { + var ret []SandboxLog + return ret + } + + return o.Logs +} + +// GetLogsOk returns a tuple with the Logs field value +// and a boolean to check if the value has been set. +func (o *SandboxLogs) GetLogsOk() ([]SandboxLog, bool) { + if o == nil { + return nil, false + } + return o.Logs, true +} + +// SetLogs sets field value +func (o *SandboxLogs) SetLogs(v []SandboxLog) { + o.Logs = v +} + +// GetLogEntries returns the LogEntries field value +func (o *SandboxLogs) GetLogEntries() []SandboxLogEntry { + if o == nil { + var ret []SandboxLogEntry + return ret + } + + return o.LogEntries +} + +// GetLogEntriesOk returns a tuple with the LogEntries field value +// and a boolean to check if the value has been set. +func (o *SandboxLogs) GetLogEntriesOk() ([]SandboxLogEntry, bool) { + if o == nil { + return nil, false + } + return o.LogEntries, true +} + +// SetLogEntries sets field value +func (o *SandboxLogs) SetLogEntries(v []SandboxLogEntry) { + o.LogEntries = v +} + +func (o SandboxLogs) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SandboxLogs) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["logs"] = o.Logs + toSerialize["logEntries"] = o.LogEntries + return toSerialize, nil +} + +type NullableSandboxLogs struct { + value *SandboxLogs + isSet bool +} + +func (v NullableSandboxLogs) Get() *SandboxLogs { + return v.value +} + +func (v *NullableSandboxLogs) Set(val *SandboxLogs) { + v.value = val + v.isSet = true +} + +func (v NullableSandboxLogs) IsSet() bool { + return v.isSet +} + +func (v *NullableSandboxLogs) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSandboxLogs(val *SandboxLogs) *NullableSandboxLogs { + return &NullableSandboxLogs{value: val, isSet: true} +} + +func (v NullableSandboxLogs) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSandboxLogs) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_sandbox_logs_v2_response.go b/e2b/client/model_sandbox_logs_v2_response.go new file mode 100644 index 0000000..5ee1aa5 --- /dev/null +++ b/e2b/client/model_sandbox_logs_v2_response.go @@ -0,0 +1,116 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the SandboxLogsV2Response type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SandboxLogsV2Response{} + +// SandboxLogsV2Response struct for SandboxLogsV2Response +type SandboxLogsV2Response struct { + // Sandbox logs structured + Logs []SandboxLogEntry `json:"logs"` +} + +// NewSandboxLogsV2Response instantiates a new SandboxLogsV2Response object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSandboxLogsV2Response(logs []SandboxLogEntry) *SandboxLogsV2Response { + this := SandboxLogsV2Response{} + this.Logs = logs + return &this +} + +// NewSandboxLogsV2ResponseWithDefaults instantiates a new SandboxLogsV2Response object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSandboxLogsV2ResponseWithDefaults() *SandboxLogsV2Response { + this := SandboxLogsV2Response{} + return &this +} + +// GetLogs returns the Logs field value +func (o *SandboxLogsV2Response) GetLogs() []SandboxLogEntry { + if o == nil { + var ret []SandboxLogEntry + return ret + } + + return o.Logs +} + +// GetLogsOk returns a tuple with the Logs field value +// and a boolean to check if the value has been set. +func (o *SandboxLogsV2Response) GetLogsOk() ([]SandboxLogEntry, bool) { + if o == nil { + return nil, false + } + return o.Logs, true +} + +// SetLogs sets field value +func (o *SandboxLogsV2Response) SetLogs(v []SandboxLogEntry) { + o.Logs = v +} + +func (o SandboxLogsV2Response) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SandboxLogsV2Response) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["logs"] = o.Logs + return toSerialize, nil +} + +type NullableSandboxLogsV2Response struct { + value *SandboxLogsV2Response + isSet bool +} + +func (v NullableSandboxLogsV2Response) Get() *SandboxLogsV2Response { + return v.value +} + +func (v *NullableSandboxLogsV2Response) Set(val *SandboxLogsV2Response) { + v.value = val + v.isSet = true +} + +func (v NullableSandboxLogsV2Response) IsSet() bool { + return v.isSet +} + +func (v *NullableSandboxLogsV2Response) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSandboxLogsV2Response(val *SandboxLogsV2Response) *NullableSandboxLogsV2Response { + return &NullableSandboxLogsV2Response{value: val, isSet: true} +} + +func (v NullableSandboxLogsV2Response) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSandboxLogsV2Response) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_sandbox_metric.go b/e2b/client/model_sandbox_metric.go new file mode 100644 index 0000000..fa8dc52 --- /dev/null +++ b/e2b/client/model_sandbox_metric.go @@ -0,0 +1,317 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" +) + +// checks if the SandboxMetric type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SandboxMetric{} + +// SandboxMetric Metric entry with timestamp and line +type SandboxMetric struct { + // Timestamp of the metric entry + // Deprecated + Timestamp time.Time `json:"timestamp"` + // Timestamp of the metric entry in Unix time (seconds since epoch) + TimestampUnix int64 `json:"timestampUnix"` + // Number of CPU cores + CpuCount int32 `json:"cpuCount"` + // CPU usage percentage + CpuUsedPct float32 `json:"cpuUsedPct"` + // Memory used in bytes + MemUsed int64 `json:"memUsed"` + // Total memory in bytes + MemTotal int64 `json:"memTotal"` + // Disk used in bytes + DiskUsed int64 `json:"diskUsed"` + // Total disk space in bytes + DiskTotal int64 `json:"diskTotal"` +} + +// NewSandboxMetric instantiates a new SandboxMetric object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSandboxMetric(timestamp time.Time, timestampUnix int64, cpuCount int32, cpuUsedPct float32, memUsed int64, memTotal int64, diskUsed int64, diskTotal int64) *SandboxMetric { + this := SandboxMetric{} + this.Timestamp = timestamp + this.TimestampUnix = timestampUnix + this.CpuCount = cpuCount + this.CpuUsedPct = cpuUsedPct + this.MemUsed = memUsed + this.MemTotal = memTotal + this.DiskUsed = diskUsed + this.DiskTotal = diskTotal + return &this +} + +// NewSandboxMetricWithDefaults instantiates a new SandboxMetric object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSandboxMetricWithDefaults() *SandboxMetric { + this := SandboxMetric{} + return &this +} + +// GetTimestamp returns the Timestamp field value +// Deprecated +func (o *SandboxMetric) GetTimestamp() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value +// and a boolean to check if the value has been set. +// Deprecated +func (o *SandboxMetric) GetTimestampOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Timestamp, true +} + +// SetTimestamp sets field value +// Deprecated +func (o *SandboxMetric) SetTimestamp(v time.Time) { + o.Timestamp = v +} + +// GetTimestampUnix returns the TimestampUnix field value +func (o *SandboxMetric) GetTimestampUnix() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.TimestampUnix +} + +// GetTimestampUnixOk returns a tuple with the TimestampUnix field value +// and a boolean to check if the value has been set. +func (o *SandboxMetric) GetTimestampUnixOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.TimestampUnix, true +} + +// SetTimestampUnix sets field value +func (o *SandboxMetric) SetTimestampUnix(v int64) { + o.TimestampUnix = v +} + +// GetCpuCount returns the CpuCount field value +func (o *SandboxMetric) GetCpuCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.CpuCount +} + +// GetCpuCountOk returns a tuple with the CpuCount field value +// and a boolean to check if the value has been set. +func (o *SandboxMetric) GetCpuCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.CpuCount, true +} + +// SetCpuCount sets field value +func (o *SandboxMetric) SetCpuCount(v int32) { + o.CpuCount = v +} + +// GetCpuUsedPct returns the CpuUsedPct field value +func (o *SandboxMetric) GetCpuUsedPct() float32 { + if o == nil { + var ret float32 + return ret + } + + return o.CpuUsedPct +} + +// GetCpuUsedPctOk returns a tuple with the CpuUsedPct field value +// and a boolean to check if the value has been set. +func (o *SandboxMetric) GetCpuUsedPctOk() (*float32, bool) { + if o == nil { + return nil, false + } + return &o.CpuUsedPct, true +} + +// SetCpuUsedPct sets field value +func (o *SandboxMetric) SetCpuUsedPct(v float32) { + o.CpuUsedPct = v +} + +// GetMemUsed returns the MemUsed field value +func (o *SandboxMetric) GetMemUsed() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.MemUsed +} + +// GetMemUsedOk returns a tuple with the MemUsed field value +// and a boolean to check if the value has been set. +func (o *SandboxMetric) GetMemUsedOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.MemUsed, true +} + +// SetMemUsed sets field value +func (o *SandboxMetric) SetMemUsed(v int64) { + o.MemUsed = v +} + +// GetMemTotal returns the MemTotal field value +func (o *SandboxMetric) GetMemTotal() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.MemTotal +} + +// GetMemTotalOk returns a tuple with the MemTotal field value +// and a boolean to check if the value has been set. +func (o *SandboxMetric) GetMemTotalOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.MemTotal, true +} + +// SetMemTotal sets field value +func (o *SandboxMetric) SetMemTotal(v int64) { + o.MemTotal = v +} + +// GetDiskUsed returns the DiskUsed field value +func (o *SandboxMetric) GetDiskUsed() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.DiskUsed +} + +// GetDiskUsedOk returns a tuple with the DiskUsed field value +// and a boolean to check if the value has been set. +func (o *SandboxMetric) GetDiskUsedOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.DiskUsed, true +} + +// SetDiskUsed sets field value +func (o *SandboxMetric) SetDiskUsed(v int64) { + o.DiskUsed = v +} + +// GetDiskTotal returns the DiskTotal field value +func (o *SandboxMetric) GetDiskTotal() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.DiskTotal +} + +// GetDiskTotalOk returns a tuple with the DiskTotal field value +// and a boolean to check if the value has been set. +func (o *SandboxMetric) GetDiskTotalOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.DiskTotal, true +} + +// SetDiskTotal sets field value +func (o *SandboxMetric) SetDiskTotal(v int64) { + o.DiskTotal = v +} + +func (o SandboxMetric) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SandboxMetric) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["timestamp"] = o.Timestamp + toSerialize["timestampUnix"] = o.TimestampUnix + toSerialize["cpuCount"] = o.CpuCount + toSerialize["cpuUsedPct"] = o.CpuUsedPct + toSerialize["memUsed"] = o.MemUsed + toSerialize["memTotal"] = o.MemTotal + toSerialize["diskUsed"] = o.DiskUsed + toSerialize["diskTotal"] = o.DiskTotal + return toSerialize, nil +} + +type NullableSandboxMetric struct { + value *SandboxMetric + isSet bool +} + +func (v NullableSandboxMetric) Get() *SandboxMetric { + return v.value +} + +func (v *NullableSandboxMetric) Set(val *SandboxMetric) { + v.value = val + v.isSet = true +} + +func (v NullableSandboxMetric) IsSet() bool { + return v.isSet +} + +func (v *NullableSandboxMetric) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSandboxMetric(val *SandboxMetric) *NullableSandboxMetric { + return &NullableSandboxMetric{value: val, isSet: true} +} + +func (v NullableSandboxMetric) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSandboxMetric) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_sandbox_network_config.go b/e2b/client/model_sandbox_network_config.go new file mode 100644 index 0000000..5409c52 --- /dev/null +++ b/e2b/client/model_sandbox_network_config.go @@ -0,0 +1,240 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the SandboxNetworkConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SandboxNetworkConfig{} + +// SandboxNetworkConfig struct for SandboxNetworkConfig +type SandboxNetworkConfig struct { + // Specify if the sandbox URLs should be accessible only with authentication. + AllowPublicTraffic *bool `json:"allowPublicTraffic,omitempty"` + // List of allowed CIDR blocks or IP addresses for egress traffic. Allowed addresses always take precedence over blocked addresses. + AllowOut []string `json:"allowOut,omitempty"` + // List of denied CIDR blocks or IP addresses for egress traffic + DenyOut []string `json:"denyOut,omitempty"` + // Specify host mask which will be used for all sandbox requests + MaskRequestHost *string `json:"maskRequestHost,omitempty"` +} + +// NewSandboxNetworkConfig instantiates a new SandboxNetworkConfig object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSandboxNetworkConfig() *SandboxNetworkConfig { + this := SandboxNetworkConfig{} + var allowPublicTraffic bool = true + this.AllowPublicTraffic = &allowPublicTraffic + return &this +} + +// NewSandboxNetworkConfigWithDefaults instantiates a new SandboxNetworkConfig object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSandboxNetworkConfigWithDefaults() *SandboxNetworkConfig { + this := SandboxNetworkConfig{} + var allowPublicTraffic bool = true + this.AllowPublicTraffic = &allowPublicTraffic + return &this +} + +// GetAllowPublicTraffic returns the AllowPublicTraffic field value if set, zero value otherwise. +func (o *SandboxNetworkConfig) GetAllowPublicTraffic() bool { + if o == nil || IsNil(o.AllowPublicTraffic) { + var ret bool + return ret + } + return *o.AllowPublicTraffic +} + +// GetAllowPublicTrafficOk returns a tuple with the AllowPublicTraffic field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SandboxNetworkConfig) GetAllowPublicTrafficOk() (*bool, bool) { + if o == nil || IsNil(o.AllowPublicTraffic) { + return nil, false + } + return o.AllowPublicTraffic, true +} + +// HasAllowPublicTraffic returns a boolean if a field has been set. +func (o *SandboxNetworkConfig) HasAllowPublicTraffic() bool { + if o != nil && !IsNil(o.AllowPublicTraffic) { + return true + } + + return false +} + +// SetAllowPublicTraffic gets a reference to the given bool and assigns it to the AllowPublicTraffic field. +func (o *SandboxNetworkConfig) SetAllowPublicTraffic(v bool) { + o.AllowPublicTraffic = &v +} + +// GetAllowOut returns the AllowOut field value if set, zero value otherwise. +func (o *SandboxNetworkConfig) GetAllowOut() []string { + if o == nil || IsNil(o.AllowOut) { + var ret []string + return ret + } + return o.AllowOut +} + +// GetAllowOutOk returns a tuple with the AllowOut field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SandboxNetworkConfig) GetAllowOutOk() ([]string, bool) { + if o == nil || IsNil(o.AllowOut) { + return nil, false + } + return o.AllowOut, true +} + +// HasAllowOut returns a boolean if a field has been set. +func (o *SandboxNetworkConfig) HasAllowOut() bool { + if o != nil && !IsNil(o.AllowOut) { + return true + } + + return false +} + +// SetAllowOut gets a reference to the given []string and assigns it to the AllowOut field. +func (o *SandboxNetworkConfig) SetAllowOut(v []string) { + o.AllowOut = v +} + +// GetDenyOut returns the DenyOut field value if set, zero value otherwise. +func (o *SandboxNetworkConfig) GetDenyOut() []string { + if o == nil || IsNil(o.DenyOut) { + var ret []string + return ret + } + return o.DenyOut +} + +// GetDenyOutOk returns a tuple with the DenyOut field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SandboxNetworkConfig) GetDenyOutOk() ([]string, bool) { + if o == nil || IsNil(o.DenyOut) { + return nil, false + } + return o.DenyOut, true +} + +// HasDenyOut returns a boolean if a field has been set. +func (o *SandboxNetworkConfig) HasDenyOut() bool { + if o != nil && !IsNil(o.DenyOut) { + return true + } + + return false +} + +// SetDenyOut gets a reference to the given []string and assigns it to the DenyOut field. +func (o *SandboxNetworkConfig) SetDenyOut(v []string) { + o.DenyOut = v +} + +// GetMaskRequestHost returns the MaskRequestHost field value if set, zero value otherwise. +func (o *SandboxNetworkConfig) GetMaskRequestHost() string { + if o == nil || IsNil(o.MaskRequestHost) { + var ret string + return ret + } + return *o.MaskRequestHost +} + +// GetMaskRequestHostOk returns a tuple with the MaskRequestHost field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SandboxNetworkConfig) GetMaskRequestHostOk() (*string, bool) { + if o == nil || IsNil(o.MaskRequestHost) { + return nil, false + } + return o.MaskRequestHost, true +} + +// HasMaskRequestHost returns a boolean if a field has been set. +func (o *SandboxNetworkConfig) HasMaskRequestHost() bool { + if o != nil && !IsNil(o.MaskRequestHost) { + return true + } + + return false +} + +// SetMaskRequestHost gets a reference to the given string and assigns it to the MaskRequestHost field. +func (o *SandboxNetworkConfig) SetMaskRequestHost(v string) { + o.MaskRequestHost = &v +} + +func (o SandboxNetworkConfig) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SandboxNetworkConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AllowPublicTraffic) { + toSerialize["allowPublicTraffic"] = o.AllowPublicTraffic + } + if !IsNil(o.AllowOut) { + toSerialize["allowOut"] = o.AllowOut + } + if !IsNil(o.DenyOut) { + toSerialize["denyOut"] = o.DenyOut + } + if !IsNil(o.MaskRequestHost) { + toSerialize["maskRequestHost"] = o.MaskRequestHost + } + return toSerialize, nil +} + +type NullableSandboxNetworkConfig struct { + value *SandboxNetworkConfig + isSet bool +} + +func (v NullableSandboxNetworkConfig) Get() *SandboxNetworkConfig { + return v.value +} + +func (v *NullableSandboxNetworkConfig) Set(val *SandboxNetworkConfig) { + v.value = val + v.isSet = true +} + +func (v NullableSandboxNetworkConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableSandboxNetworkConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSandboxNetworkConfig(val *SandboxNetworkConfig) *NullableSandboxNetworkConfig { + return &NullableSandboxNetworkConfig{value: val, isSet: true} +} + +func (v NullableSandboxNetworkConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSandboxNetworkConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_sandbox_state.go b/e2b/client/model_sandbox_state.go new file mode 100644 index 0000000..a731284 --- /dev/null +++ b/e2b/client/model_sandbox_state.go @@ -0,0 +1,110 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// SandboxState State of the sandbox +type SandboxState string + +// List of SandboxState +const ( + SANDBOXSTATE_RUNNING SandboxState = "running" + SANDBOXSTATE_PAUSED SandboxState = "paused" +) + +// All allowed values of SandboxState enum +var AllowedSandboxStateEnumValues = []SandboxState{ + "running", + "paused", +} + +func (v *SandboxState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := SandboxState(value) + for _, existing := range AllowedSandboxStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid SandboxState", value) +} + +// NewSandboxStateFromValue returns a pointer to a valid SandboxState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewSandboxStateFromValue(v string) (*SandboxState, error) { + ev := SandboxState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for SandboxState: valid values are %v", v, AllowedSandboxStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v SandboxState) IsValid() bool { + for _, existing := range AllowedSandboxStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SandboxState value +func (v SandboxState) Ptr() *SandboxState { + return &v +} + +type NullableSandboxState struct { + value *SandboxState + isSet bool +} + +func (v NullableSandboxState) Get() *SandboxState { + return v.value +} + +func (v *NullableSandboxState) Set(val *SandboxState) { + v.value = val + v.isSet = true +} + +func (v NullableSandboxState) IsSet() bool { + return v.isSet +} + +func (v *NullableSandboxState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSandboxState(val *SandboxState) *NullableSandboxState { + return &NullableSandboxState{value: val, isSet: true} +} + +func (v NullableSandboxState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSandboxState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_sandbox_volume_mount.go b/e2b/client/model_sandbox_volume_mount.go new file mode 100644 index 0000000..07d7bc0 --- /dev/null +++ b/e2b/client/model_sandbox_volume_mount.go @@ -0,0 +1,144 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the SandboxVolumeMount type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SandboxVolumeMount{} + +// SandboxVolumeMount struct for SandboxVolumeMount +type SandboxVolumeMount struct { + // Name of the volume + Name string `json:"name"` + // Path of the volume + Path string `json:"path"` +} + +// NewSandboxVolumeMount instantiates a new SandboxVolumeMount object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSandboxVolumeMount(name string, path string) *SandboxVolumeMount { + this := SandboxVolumeMount{} + this.Name = name + this.Path = path + return &this +} + +// NewSandboxVolumeMountWithDefaults instantiates a new SandboxVolumeMount object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSandboxVolumeMountWithDefaults() *SandboxVolumeMount { + this := SandboxVolumeMount{} + return &this +} + +// GetName returns the Name field value +func (o *SandboxVolumeMount) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *SandboxVolumeMount) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *SandboxVolumeMount) SetName(v string) { + o.Name = v +} + +// GetPath returns the Path field value +func (o *SandboxVolumeMount) GetPath() string { + if o == nil { + var ret string + return ret + } + + return o.Path +} + +// GetPathOk returns a tuple with the Path field value +// and a boolean to check if the value has been set. +func (o *SandboxVolumeMount) GetPathOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Path, true +} + +// SetPath sets field value +func (o *SandboxVolumeMount) SetPath(v string) { + o.Path = v +} + +func (o SandboxVolumeMount) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SandboxVolumeMount) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["path"] = o.Path + return toSerialize, nil +} + +type NullableSandboxVolumeMount struct { + value *SandboxVolumeMount + isSet bool +} + +func (v NullableSandboxVolumeMount) Get() *SandboxVolumeMount { + return v.value +} + +func (v *NullableSandboxVolumeMount) Set(val *SandboxVolumeMount) { + v.value = val + v.isSet = true +} + +func (v NullableSandboxVolumeMount) IsSet() bool { + return v.isSet +} + +func (v *NullableSandboxVolumeMount) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSandboxVolumeMount(val *SandboxVolumeMount) *NullableSandboxVolumeMount { + return &NullableSandboxVolumeMount{value: val, isSet: true} +} + +func (v NullableSandboxVolumeMount) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSandboxVolumeMount) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_sandboxes_with_metrics.go b/e2b/client/model_sandboxes_with_metrics.go new file mode 100644 index 0000000..305c396 --- /dev/null +++ b/e2b/client/model_sandboxes_with_metrics.go @@ -0,0 +1,115 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the SandboxesWithMetrics type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SandboxesWithMetrics{} + +// SandboxesWithMetrics struct for SandboxesWithMetrics +type SandboxesWithMetrics struct { + Sandboxes map[string]SandboxMetric `json:"sandboxes"` +} + +// NewSandboxesWithMetrics instantiates a new SandboxesWithMetrics object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSandboxesWithMetrics(sandboxes map[string]SandboxMetric) *SandboxesWithMetrics { + this := SandboxesWithMetrics{} + this.Sandboxes = sandboxes + return &this +} + +// NewSandboxesWithMetricsWithDefaults instantiates a new SandboxesWithMetrics object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSandboxesWithMetricsWithDefaults() *SandboxesWithMetrics { + this := SandboxesWithMetrics{} + return &this +} + +// GetSandboxes returns the Sandboxes field value +func (o *SandboxesWithMetrics) GetSandboxes() map[string]SandboxMetric { + if o == nil { + var ret map[string]SandboxMetric + return ret + } + + return o.Sandboxes +} + +// GetSandboxesOk returns a tuple with the Sandboxes field value +// and a boolean to check if the value has been set. +func (o *SandboxesWithMetrics) GetSandboxesOk() (*map[string]SandboxMetric, bool) { + if o == nil { + return nil, false + } + return &o.Sandboxes, true +} + +// SetSandboxes sets field value +func (o *SandboxesWithMetrics) SetSandboxes(v map[string]SandboxMetric) { + o.Sandboxes = v +} + +func (o SandboxesWithMetrics) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SandboxesWithMetrics) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["sandboxes"] = o.Sandboxes + return toSerialize, nil +} + +type NullableSandboxesWithMetrics struct { + value *SandboxesWithMetrics + isSet bool +} + +func (v NullableSandboxesWithMetrics) Get() *SandboxesWithMetrics { + return v.value +} + +func (v *NullableSandboxesWithMetrics) Set(val *SandboxesWithMetrics) { + v.value = val + v.isSet = true +} + +func (v NullableSandboxesWithMetrics) IsSet() bool { + return v.isSet +} + +func (v *NullableSandboxesWithMetrics) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSandboxesWithMetrics(val *SandboxesWithMetrics) *NullableSandboxesWithMetrics { + return &NullableSandboxesWithMetrics{value: val, isSet: true} +} + +func (v NullableSandboxesWithMetrics) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSandboxesWithMetrics) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_snapshot_info.go b/e2b/client/model_snapshot_info.go new file mode 100644 index 0000000..6580ad1 --- /dev/null +++ b/e2b/client/model_snapshot_info.go @@ -0,0 +1,144 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the SnapshotInfo type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SnapshotInfo{} + +// SnapshotInfo struct for SnapshotInfo +type SnapshotInfo struct { + // Identifier of the snapshot template + SnapshotID string `json:"snapshotID"` + // Full names of the snapshot template including team namespace and tag (e.g. team-slug/my-snapshot:v2) + Names []string `json:"names"` +} + +// NewSnapshotInfo instantiates a new SnapshotInfo object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSnapshotInfo(snapshotID string, names []string) *SnapshotInfo { + this := SnapshotInfo{} + this.SnapshotID = snapshotID + this.Names = names + return &this +} + +// NewSnapshotInfoWithDefaults instantiates a new SnapshotInfo object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSnapshotInfoWithDefaults() *SnapshotInfo { + this := SnapshotInfo{} + return &this +} + +// GetSnapshotID returns the SnapshotID field value +func (o *SnapshotInfo) GetSnapshotID() string { + if o == nil { + var ret string + return ret + } + + return o.SnapshotID +} + +// GetSnapshotIDOk returns a tuple with the SnapshotID field value +// and a boolean to check if the value has been set. +func (o *SnapshotInfo) GetSnapshotIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SnapshotID, true +} + +// SetSnapshotID sets field value +func (o *SnapshotInfo) SetSnapshotID(v string) { + o.SnapshotID = v +} + +// GetNames returns the Names field value +func (o *SnapshotInfo) GetNames() []string { + if o == nil { + var ret []string + return ret + } + + return o.Names +} + +// GetNamesOk returns a tuple with the Names field value +// and a boolean to check if the value has been set. +func (o *SnapshotInfo) GetNamesOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Names, true +} + +// SetNames sets field value +func (o *SnapshotInfo) SetNames(v []string) { + o.Names = v +} + +func (o SnapshotInfo) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SnapshotInfo) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["snapshotID"] = o.SnapshotID + toSerialize["names"] = o.Names + return toSerialize, nil +} + +type NullableSnapshotInfo struct { + value *SnapshotInfo + isSet bool +} + +func (v NullableSnapshotInfo) Get() *SnapshotInfo { + return v.value +} + +func (v *NullableSnapshotInfo) Set(val *SnapshotInfo) { + v.value = val + v.isSet = true +} + +func (v NullableSnapshotInfo) IsSet() bool { + return v.isSet +} + +func (v *NullableSnapshotInfo) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSnapshotInfo(val *SnapshotInfo) *NullableSnapshotInfo { + return &NullableSnapshotInfo{value: val, isSet: true} +} + +func (v NullableSnapshotInfo) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSnapshotInfo) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_team.go b/e2b/client/model_team.go new file mode 100644 index 0000000..ed80a35 --- /dev/null +++ b/e2b/client/model_team.go @@ -0,0 +1,200 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the Team type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Team{} + +// Team struct for Team +type Team struct { + // Identifier of the team + TeamID string `json:"teamID"` + // Name of the team + Name string `json:"name"` + // API key for the team + ApiKey string `json:"apiKey"` + // Whether the team is the default team + IsDefault bool `json:"isDefault"` +} + +// NewTeam instantiates a new Team object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTeam(teamID string, name string, apiKey string, isDefault bool) *Team { + this := Team{} + this.TeamID = teamID + this.Name = name + this.ApiKey = apiKey + this.IsDefault = isDefault + return &this +} + +// NewTeamWithDefaults instantiates a new Team object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTeamWithDefaults() *Team { + this := Team{} + return &this +} + +// GetTeamID returns the TeamID field value +func (o *Team) GetTeamID() string { + if o == nil { + var ret string + return ret + } + + return o.TeamID +} + +// GetTeamIDOk returns a tuple with the TeamID field value +// and a boolean to check if the value has been set. +func (o *Team) GetTeamIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TeamID, true +} + +// SetTeamID sets field value +func (o *Team) SetTeamID(v string) { + o.TeamID = v +} + +// GetName returns the Name field value +func (o *Team) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Team) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *Team) SetName(v string) { + o.Name = v +} + +// GetApiKey returns the ApiKey field value +func (o *Team) GetApiKey() string { + if o == nil { + var ret string + return ret + } + + return o.ApiKey +} + +// GetApiKeyOk returns a tuple with the ApiKey field value +// and a boolean to check if the value has been set. +func (o *Team) GetApiKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ApiKey, true +} + +// SetApiKey sets field value +func (o *Team) SetApiKey(v string) { + o.ApiKey = v +} + +// GetIsDefault returns the IsDefault field value +func (o *Team) GetIsDefault() bool { + if o == nil { + var ret bool + return ret + } + + return o.IsDefault +} + +// GetIsDefaultOk returns a tuple with the IsDefault field value +// and a boolean to check if the value has been set. +func (o *Team) GetIsDefaultOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IsDefault, true +} + +// SetIsDefault sets field value +func (o *Team) SetIsDefault(v bool) { + o.IsDefault = v +} + +func (o Team) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Team) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["teamID"] = o.TeamID + toSerialize["name"] = o.Name + toSerialize["apiKey"] = o.ApiKey + toSerialize["isDefault"] = o.IsDefault + return toSerialize, nil +} + +type NullableTeam struct { + value *Team + isSet bool +} + +func (v NullableTeam) Get() *Team { + return v.value +} + +func (v *NullableTeam) Set(val *Team) { + v.value = val + v.isSet = true +} + +func (v NullableTeam) IsSet() bool { + return v.isSet +} + +func (v *NullableTeam) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTeam(val *Team) *NullableTeam { + return &NullableTeam{value: val, isSet: true} +} + +func (v NullableTeam) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTeam) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_team_api_key.go b/e2b/client/model_team_api_key.go new file mode 100644 index 0000000..9cd9491 --- /dev/null +++ b/e2b/client/model_team_api_key.go @@ -0,0 +1,295 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" +) + +// checks if the TeamAPIKey type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TeamAPIKey{} + +// TeamAPIKey struct for TeamAPIKey +type TeamAPIKey struct { + // Identifier of the API key + Id string `json:"id"` + // Name of the API key + Name string `json:"name"` + Mask IdentifierMaskingDetails `json:"mask"` + // Timestamp of API key creation + CreatedAt time.Time `json:"createdAt"` + CreatedBy NullableTeamUser `json:"createdBy,omitempty"` + // Last time this API key was used + LastUsed NullableTime `json:"lastUsed,omitempty"` +} + +// NewTeamAPIKey instantiates a new TeamAPIKey object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTeamAPIKey(id string, name string, mask IdentifierMaskingDetails, createdAt time.Time) *TeamAPIKey { + this := TeamAPIKey{} + this.Id = id + this.Name = name + this.Mask = mask + this.CreatedAt = createdAt + return &this +} + +// NewTeamAPIKeyWithDefaults instantiates a new TeamAPIKey object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTeamAPIKeyWithDefaults() *TeamAPIKey { + this := TeamAPIKey{} + return &this +} + +// GetId returns the Id field value +func (o *TeamAPIKey) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *TeamAPIKey) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *TeamAPIKey) SetId(v string) { + o.Id = v +} + +// GetName returns the Name field value +func (o *TeamAPIKey) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *TeamAPIKey) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *TeamAPIKey) SetName(v string) { + o.Name = v +} + +// GetMask returns the Mask field value +func (o *TeamAPIKey) GetMask() IdentifierMaskingDetails { + if o == nil { + var ret IdentifierMaskingDetails + return ret + } + + return o.Mask +} + +// GetMaskOk returns a tuple with the Mask field value +// and a boolean to check if the value has been set. +func (o *TeamAPIKey) GetMaskOk() (*IdentifierMaskingDetails, bool) { + if o == nil { + return nil, false + } + return &o.Mask, true +} + +// SetMask sets field value +func (o *TeamAPIKey) SetMask(v IdentifierMaskingDetails) { + o.Mask = v +} + +// GetCreatedAt returns the CreatedAt field value +func (o *TeamAPIKey) GetCreatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *TeamAPIKey) GetCreatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value +func (o *TeamAPIKey) SetCreatedAt(v time.Time) { + o.CreatedAt = v +} + +// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TeamAPIKey) GetCreatedBy() TeamUser { + if o == nil || IsNil(o.CreatedBy.Get()) { + var ret TeamUser + return ret + } + return *o.CreatedBy.Get() +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TeamAPIKey) GetCreatedByOk() (*TeamUser, bool) { + if o == nil { + return nil, false + } + return o.CreatedBy.Get(), o.CreatedBy.IsSet() +} + +// HasCreatedBy returns a boolean if a field has been set. +func (o *TeamAPIKey) HasCreatedBy() bool { + if o != nil && o.CreatedBy.IsSet() { + return true + } + + return false +} + +// SetCreatedBy gets a reference to the given NullableTeamUser and assigns it to the CreatedBy field. +func (o *TeamAPIKey) SetCreatedBy(v TeamUser) { + o.CreatedBy.Set(&v) +} + +// SetCreatedByNil sets the value for CreatedBy to be an explicit nil +func (o *TeamAPIKey) SetCreatedByNil() { + o.CreatedBy.Set(nil) +} + +// UnsetCreatedBy ensures that no value is present for CreatedBy, not even an explicit nil +func (o *TeamAPIKey) UnsetCreatedBy() { + o.CreatedBy.Unset() +} + +// GetLastUsed returns the LastUsed field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TeamAPIKey) GetLastUsed() time.Time { + if o == nil || IsNil(o.LastUsed.Get()) { + var ret time.Time + return ret + } + return *o.LastUsed.Get() +} + +// GetLastUsedOk returns a tuple with the LastUsed field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TeamAPIKey) GetLastUsedOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.LastUsed.Get(), o.LastUsed.IsSet() +} + +// HasLastUsed returns a boolean if a field has been set. +func (o *TeamAPIKey) HasLastUsed() bool { + if o != nil && o.LastUsed.IsSet() { + return true + } + + return false +} + +// SetLastUsed gets a reference to the given NullableTime and assigns it to the LastUsed field. +func (o *TeamAPIKey) SetLastUsed(v time.Time) { + o.LastUsed.Set(&v) +} + +// SetLastUsedNil sets the value for LastUsed to be an explicit nil +func (o *TeamAPIKey) SetLastUsedNil() { + o.LastUsed.Set(nil) +} + +// UnsetLastUsed ensures that no value is present for LastUsed, not even an explicit nil +func (o *TeamAPIKey) UnsetLastUsed() { + o.LastUsed.Unset() +} + +func (o TeamAPIKey) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TeamAPIKey) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + toSerialize["mask"] = o.Mask + toSerialize["createdAt"] = o.CreatedAt + if o.CreatedBy.IsSet() { + toSerialize["createdBy"] = o.CreatedBy.Get() + } + if o.LastUsed.IsSet() { + toSerialize["lastUsed"] = o.LastUsed.Get() + } + return toSerialize, nil +} + +type NullableTeamAPIKey struct { + value *TeamAPIKey + isSet bool +} + +func (v NullableTeamAPIKey) Get() *TeamAPIKey { + return v.value +} + +func (v *NullableTeamAPIKey) Set(val *TeamAPIKey) { + v.value = val + v.isSet = true +} + +func (v NullableTeamAPIKey) IsSet() bool { + return v.isSet +} + +func (v *NullableTeamAPIKey) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTeamAPIKey(val *TeamAPIKey) *NullableTeamAPIKey { + return &NullableTeamAPIKey{value: val, isSet: true} +} + +func (v NullableTeamAPIKey) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTeamAPIKey) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_team_metric.go b/e2b/client/model_team_metric.go new file mode 100644 index 0000000..b0a08cc --- /dev/null +++ b/e2b/client/model_team_metric.go @@ -0,0 +1,205 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" +) + +// checks if the TeamMetric type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TeamMetric{} + +// TeamMetric Team metric with timestamp +type TeamMetric struct { + // Timestamp of the metric entry + // Deprecated + Timestamp time.Time `json:"timestamp"` + // Timestamp of the metric entry in Unix time (seconds since epoch) + TimestampUnix int64 `json:"timestampUnix"` + // The number of concurrent sandboxes for the team + ConcurrentSandboxes int32 `json:"concurrentSandboxes"` + // Number of sandboxes started per second + SandboxStartRate float32 `json:"sandboxStartRate"` +} + +// NewTeamMetric instantiates a new TeamMetric object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTeamMetric(timestamp time.Time, timestampUnix int64, concurrentSandboxes int32, sandboxStartRate float32) *TeamMetric { + this := TeamMetric{} + this.Timestamp = timestamp + this.TimestampUnix = timestampUnix + this.ConcurrentSandboxes = concurrentSandboxes + this.SandboxStartRate = sandboxStartRate + return &this +} + +// NewTeamMetricWithDefaults instantiates a new TeamMetric object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTeamMetricWithDefaults() *TeamMetric { + this := TeamMetric{} + return &this +} + +// GetTimestamp returns the Timestamp field value +// Deprecated +func (o *TeamMetric) GetTimestamp() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value +// and a boolean to check if the value has been set. +// Deprecated +func (o *TeamMetric) GetTimestampOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Timestamp, true +} + +// SetTimestamp sets field value +// Deprecated +func (o *TeamMetric) SetTimestamp(v time.Time) { + o.Timestamp = v +} + +// GetTimestampUnix returns the TimestampUnix field value +func (o *TeamMetric) GetTimestampUnix() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.TimestampUnix +} + +// GetTimestampUnixOk returns a tuple with the TimestampUnix field value +// and a boolean to check if the value has been set. +func (o *TeamMetric) GetTimestampUnixOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.TimestampUnix, true +} + +// SetTimestampUnix sets field value +func (o *TeamMetric) SetTimestampUnix(v int64) { + o.TimestampUnix = v +} + +// GetConcurrentSandboxes returns the ConcurrentSandboxes field value +func (o *TeamMetric) GetConcurrentSandboxes() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.ConcurrentSandboxes +} + +// GetConcurrentSandboxesOk returns a tuple with the ConcurrentSandboxes field value +// and a boolean to check if the value has been set. +func (o *TeamMetric) GetConcurrentSandboxesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.ConcurrentSandboxes, true +} + +// SetConcurrentSandboxes sets field value +func (o *TeamMetric) SetConcurrentSandboxes(v int32) { + o.ConcurrentSandboxes = v +} + +// GetSandboxStartRate returns the SandboxStartRate field value +func (o *TeamMetric) GetSandboxStartRate() float32 { + if o == nil { + var ret float32 + return ret + } + + return o.SandboxStartRate +} + +// GetSandboxStartRateOk returns a tuple with the SandboxStartRate field value +// and a boolean to check if the value has been set. +func (o *TeamMetric) GetSandboxStartRateOk() (*float32, bool) { + if o == nil { + return nil, false + } + return &o.SandboxStartRate, true +} + +// SetSandboxStartRate sets field value +func (o *TeamMetric) SetSandboxStartRate(v float32) { + o.SandboxStartRate = v +} + +func (o TeamMetric) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TeamMetric) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["timestamp"] = o.Timestamp + toSerialize["timestampUnix"] = o.TimestampUnix + toSerialize["concurrentSandboxes"] = o.ConcurrentSandboxes + toSerialize["sandboxStartRate"] = o.SandboxStartRate + return toSerialize, nil +} + +type NullableTeamMetric struct { + value *TeamMetric + isSet bool +} + +func (v NullableTeamMetric) Get() *TeamMetric { + return v.value +} + +func (v *NullableTeamMetric) Set(val *TeamMetric) { + v.value = val + v.isSet = true +} + +func (v NullableTeamMetric) IsSet() bool { + return v.isSet +} + +func (v *NullableTeamMetric) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTeamMetric(val *TeamMetric) *NullableTeamMetric { + return &NullableTeamMetric{value: val, isSet: true} +} + +func (v NullableTeamMetric) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTeamMetric) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_team_user.go b/e2b/client/model_team_user.go new file mode 100644 index 0000000..ef9e3d8 --- /dev/null +++ b/e2b/client/model_team_user.go @@ -0,0 +1,144 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the TeamUser type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TeamUser{} + +// TeamUser struct for TeamUser +type TeamUser struct { + // Identifier of the user + Id string `json:"id"` + // Email of the user + Email string `json:"email"` +} + +// NewTeamUser instantiates a new TeamUser object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTeamUser(id string, email string) *TeamUser { + this := TeamUser{} + this.Id = id + this.Email = email + return &this +} + +// NewTeamUserWithDefaults instantiates a new TeamUser object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTeamUserWithDefaults() *TeamUser { + this := TeamUser{} + return &this +} + +// GetId returns the Id field value +func (o *TeamUser) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *TeamUser) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *TeamUser) SetId(v string) { + o.Id = v +} + +// GetEmail returns the Email field value +func (o *TeamUser) GetEmail() string { + if o == nil { + var ret string + return ret + } + + return o.Email +} + +// GetEmailOk returns a tuple with the Email field value +// and a boolean to check if the value has been set. +func (o *TeamUser) GetEmailOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Email, true +} + +// SetEmail sets field value +func (o *TeamUser) SetEmail(v string) { + o.Email = v +} + +func (o TeamUser) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TeamUser) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["email"] = o.Email + return toSerialize, nil +} + +type NullableTeamUser struct { + value *TeamUser + isSet bool +} + +func (v NullableTeamUser) Get() *TeamUser { + return v.value +} + +func (v *NullableTeamUser) Set(val *TeamUser) { + v.value = val + v.isSet = true +} + +func (v NullableTeamUser) IsSet() bool { + return v.isSet +} + +func (v *NullableTeamUser) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTeamUser(val *TeamUser) *NullableTeamUser { + return &NullableTeamUser{value: val, isSet: true} +} + +func (v NullableTeamUser) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTeamUser) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_template.go b/e2b/client/model_template.go new file mode 100644 index 0000000..ecb40ed --- /dev/null +++ b/e2b/client/model_template.go @@ -0,0 +1,543 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" +) + +// checks if the Template type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Template{} + +// Template struct for Template +type Template struct { + // Identifier of the template + TemplateID string `json:"templateID"` + // Identifier of the last successful build for given template + BuildID string `json:"buildID"` + // CPU cores for the sandbox + CpuCount int32 `json:"cpuCount"` + // Memory for the sandbox in MiB + MemoryMB int32 `json:"memoryMB"` + // Disk size for the sandbox in MiB + DiskSizeMB int32 `json:"diskSizeMB"` + // Whether the template is public or only accessible by the team + Public bool `json:"public"` + // Aliases of the template + // Deprecated + Aliases []string `json:"aliases"` + // Names of the template (namespace/alias format when namespaced) + Names []string `json:"names"` + // Time when the template was created + CreatedAt time.Time `json:"createdAt"` + // Time when the template was last updated + UpdatedAt time.Time `json:"updatedAt"` + CreatedBy NullableTeamUser `json:"createdBy"` + // Time when the template was last used + LastSpawnedAt NullableTime `json:"lastSpawnedAt"` + // Number of times the template was used + SpawnCount int64 `json:"spawnCount"` + // Number of times the template was built + BuildCount int32 `json:"buildCount"` + // Version of the envd running in the sandbox + EnvdVersion string `json:"envdVersion"` + BuildStatus TemplateBuildStatus `json:"buildStatus"` +} + +// NewTemplate instantiates a new Template object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTemplate(templateID string, buildID string, cpuCount int32, memoryMB int32, diskSizeMB int32, public bool, aliases []string, names []string, createdAt time.Time, updatedAt time.Time, createdBy NullableTeamUser, lastSpawnedAt NullableTime, spawnCount int64, buildCount int32, envdVersion string, buildStatus TemplateBuildStatus) *Template { + this := Template{} + this.TemplateID = templateID + this.BuildID = buildID + this.CpuCount = cpuCount + this.MemoryMB = memoryMB + this.DiskSizeMB = diskSizeMB + this.Public = public + this.Aliases = aliases + this.Names = names + this.CreatedAt = createdAt + this.UpdatedAt = updatedAt + this.CreatedBy = createdBy + this.LastSpawnedAt = lastSpawnedAt + this.SpawnCount = spawnCount + this.BuildCount = buildCount + this.EnvdVersion = envdVersion + this.BuildStatus = buildStatus + return &this +} + +// NewTemplateWithDefaults instantiates a new Template object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTemplateWithDefaults() *Template { + this := Template{} + return &this +} + +// GetTemplateID returns the TemplateID field value +func (o *Template) GetTemplateID() string { + if o == nil { + var ret string + return ret + } + + return o.TemplateID +} + +// GetTemplateIDOk returns a tuple with the TemplateID field value +// and a boolean to check if the value has been set. +func (o *Template) GetTemplateIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TemplateID, true +} + +// SetTemplateID sets field value +func (o *Template) SetTemplateID(v string) { + o.TemplateID = v +} + +// GetBuildID returns the BuildID field value +func (o *Template) GetBuildID() string { + if o == nil { + var ret string + return ret + } + + return o.BuildID +} + +// GetBuildIDOk returns a tuple with the BuildID field value +// and a boolean to check if the value has been set. +func (o *Template) GetBuildIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BuildID, true +} + +// SetBuildID sets field value +func (o *Template) SetBuildID(v string) { + o.BuildID = v +} + +// GetCpuCount returns the CpuCount field value +func (o *Template) GetCpuCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.CpuCount +} + +// GetCpuCountOk returns a tuple with the CpuCount field value +// and a boolean to check if the value has been set. +func (o *Template) GetCpuCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.CpuCount, true +} + +// SetCpuCount sets field value +func (o *Template) SetCpuCount(v int32) { + o.CpuCount = v +} + +// GetMemoryMB returns the MemoryMB field value +func (o *Template) GetMemoryMB() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.MemoryMB +} + +// GetMemoryMBOk returns a tuple with the MemoryMB field value +// and a boolean to check if the value has been set. +func (o *Template) GetMemoryMBOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.MemoryMB, true +} + +// SetMemoryMB sets field value +func (o *Template) SetMemoryMB(v int32) { + o.MemoryMB = v +} + +// GetDiskSizeMB returns the DiskSizeMB field value +func (o *Template) GetDiskSizeMB() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.DiskSizeMB +} + +// GetDiskSizeMBOk returns a tuple with the DiskSizeMB field value +// and a boolean to check if the value has been set. +func (o *Template) GetDiskSizeMBOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.DiskSizeMB, true +} + +// SetDiskSizeMB sets field value +func (o *Template) SetDiskSizeMB(v int32) { + o.DiskSizeMB = v +} + +// GetPublic returns the Public field value +func (o *Template) GetPublic() bool { + if o == nil { + var ret bool + return ret + } + + return o.Public +} + +// GetPublicOk returns a tuple with the Public field value +// and a boolean to check if the value has been set. +func (o *Template) GetPublicOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Public, true +} + +// SetPublic sets field value +func (o *Template) SetPublic(v bool) { + o.Public = v +} + +// GetAliases returns the Aliases field value +// Deprecated +func (o *Template) GetAliases() []string { + if o == nil { + var ret []string + return ret + } + + return o.Aliases +} + +// GetAliasesOk returns a tuple with the Aliases field value +// and a boolean to check if the value has been set. +// Deprecated +func (o *Template) GetAliasesOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Aliases, true +} + +// SetAliases sets field value +// Deprecated +func (o *Template) SetAliases(v []string) { + o.Aliases = v +} + +// GetNames returns the Names field value +func (o *Template) GetNames() []string { + if o == nil { + var ret []string + return ret + } + + return o.Names +} + +// GetNamesOk returns a tuple with the Names field value +// and a boolean to check if the value has been set. +func (o *Template) GetNamesOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Names, true +} + +// SetNames sets field value +func (o *Template) SetNames(v []string) { + o.Names = v +} + +// GetCreatedAt returns the CreatedAt field value +func (o *Template) GetCreatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *Template) GetCreatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value +func (o *Template) SetCreatedAt(v time.Time) { + o.CreatedAt = v +} + +// GetUpdatedAt returns the UpdatedAt field value +func (o *Template) GetUpdatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value +// and a boolean to check if the value has been set. +func (o *Template) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.UpdatedAt, true +} + +// SetUpdatedAt sets field value +func (o *Template) SetUpdatedAt(v time.Time) { + o.UpdatedAt = v +} + +// GetCreatedBy returns the CreatedBy field value +// If the value is explicit nil, the zero value for TeamUser will be returned +func (o *Template) GetCreatedBy() TeamUser { + if o == nil || o.CreatedBy.Get() == nil { + var ret TeamUser + return ret + } + + return *o.CreatedBy.Get() +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Template) GetCreatedByOk() (*TeamUser, bool) { + if o == nil { + return nil, false + } + return o.CreatedBy.Get(), o.CreatedBy.IsSet() +} + +// SetCreatedBy sets field value +func (o *Template) SetCreatedBy(v TeamUser) { + o.CreatedBy.Set(&v) +} + +// GetLastSpawnedAt returns the LastSpawnedAt field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *Template) GetLastSpawnedAt() time.Time { + if o == nil || o.LastSpawnedAt.Get() == nil { + var ret time.Time + return ret + } + + return *o.LastSpawnedAt.Get() +} + +// GetLastSpawnedAtOk returns a tuple with the LastSpawnedAt field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Template) GetLastSpawnedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.LastSpawnedAt.Get(), o.LastSpawnedAt.IsSet() +} + +// SetLastSpawnedAt sets field value +func (o *Template) SetLastSpawnedAt(v time.Time) { + o.LastSpawnedAt.Set(&v) +} + +// GetSpawnCount returns the SpawnCount field value +func (o *Template) GetSpawnCount() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.SpawnCount +} + +// GetSpawnCountOk returns a tuple with the SpawnCount field value +// and a boolean to check if the value has been set. +func (o *Template) GetSpawnCountOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.SpawnCount, true +} + +// SetSpawnCount sets field value +func (o *Template) SetSpawnCount(v int64) { + o.SpawnCount = v +} + +// GetBuildCount returns the BuildCount field value +func (o *Template) GetBuildCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.BuildCount +} + +// GetBuildCountOk returns a tuple with the BuildCount field value +// and a boolean to check if the value has been set. +func (o *Template) GetBuildCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.BuildCount, true +} + +// SetBuildCount sets field value +func (o *Template) SetBuildCount(v int32) { + o.BuildCount = v +} + +// GetEnvdVersion returns the EnvdVersion field value +func (o *Template) GetEnvdVersion() string { + if o == nil { + var ret string + return ret + } + + return o.EnvdVersion +} + +// GetEnvdVersionOk returns a tuple with the EnvdVersion field value +// and a boolean to check if the value has been set. +func (o *Template) GetEnvdVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.EnvdVersion, true +} + +// SetEnvdVersion sets field value +func (o *Template) SetEnvdVersion(v string) { + o.EnvdVersion = v +} + +// GetBuildStatus returns the BuildStatus field value +func (o *Template) GetBuildStatus() TemplateBuildStatus { + if o == nil { + var ret TemplateBuildStatus + return ret + } + + return o.BuildStatus +} + +// GetBuildStatusOk returns a tuple with the BuildStatus field value +// and a boolean to check if the value has been set. +func (o *Template) GetBuildStatusOk() (*TemplateBuildStatus, bool) { + if o == nil { + return nil, false + } + return &o.BuildStatus, true +} + +// SetBuildStatus sets field value +func (o *Template) SetBuildStatus(v TemplateBuildStatus) { + o.BuildStatus = v +} + +func (o Template) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Template) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["templateID"] = o.TemplateID + toSerialize["buildID"] = o.BuildID + toSerialize["cpuCount"] = o.CpuCount + toSerialize["memoryMB"] = o.MemoryMB + toSerialize["diskSizeMB"] = o.DiskSizeMB + toSerialize["public"] = o.Public + toSerialize["aliases"] = o.Aliases + toSerialize["names"] = o.Names + toSerialize["createdAt"] = o.CreatedAt + toSerialize["updatedAt"] = o.UpdatedAt + toSerialize["createdBy"] = o.CreatedBy.Get() + toSerialize["lastSpawnedAt"] = o.LastSpawnedAt.Get() + toSerialize["spawnCount"] = o.SpawnCount + toSerialize["buildCount"] = o.BuildCount + toSerialize["envdVersion"] = o.EnvdVersion + toSerialize["buildStatus"] = o.BuildStatus + return toSerialize, nil +} + +type NullableTemplate struct { + value *Template + isSet bool +} + +func (v NullableTemplate) Get() *Template { + return v.value +} + +func (v *NullableTemplate) Set(val *Template) { + v.value = val + v.isSet = true +} + +func (v NullableTemplate) IsSet() bool { + return v.isSet +} + +func (v *NullableTemplate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTemplate(val *Template) *NullableTemplate { + return &NullableTemplate{value: val, isSet: true} +} + +func (v NullableTemplate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTemplate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_template_alias_response.go b/e2b/client/model_template_alias_response.go new file mode 100644 index 0000000..4bfe0a4 --- /dev/null +++ b/e2b/client/model_template_alias_response.go @@ -0,0 +1,144 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the TemplateAliasResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TemplateAliasResponse{} + +// TemplateAliasResponse struct for TemplateAliasResponse +type TemplateAliasResponse struct { + // Identifier of the template + TemplateID string `json:"templateID"` + // Whether the template is public or only accessible by the team + Public bool `json:"public"` +} + +// NewTemplateAliasResponse instantiates a new TemplateAliasResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTemplateAliasResponse(templateID string, public bool) *TemplateAliasResponse { + this := TemplateAliasResponse{} + this.TemplateID = templateID + this.Public = public + return &this +} + +// NewTemplateAliasResponseWithDefaults instantiates a new TemplateAliasResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTemplateAliasResponseWithDefaults() *TemplateAliasResponse { + this := TemplateAliasResponse{} + return &this +} + +// GetTemplateID returns the TemplateID field value +func (o *TemplateAliasResponse) GetTemplateID() string { + if o == nil { + var ret string + return ret + } + + return o.TemplateID +} + +// GetTemplateIDOk returns a tuple with the TemplateID field value +// and a boolean to check if the value has been set. +func (o *TemplateAliasResponse) GetTemplateIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TemplateID, true +} + +// SetTemplateID sets field value +func (o *TemplateAliasResponse) SetTemplateID(v string) { + o.TemplateID = v +} + +// GetPublic returns the Public field value +func (o *TemplateAliasResponse) GetPublic() bool { + if o == nil { + var ret bool + return ret + } + + return o.Public +} + +// GetPublicOk returns a tuple with the Public field value +// and a boolean to check if the value has been set. +func (o *TemplateAliasResponse) GetPublicOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Public, true +} + +// SetPublic sets field value +func (o *TemplateAliasResponse) SetPublic(v bool) { + o.Public = v +} + +func (o TemplateAliasResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TemplateAliasResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["templateID"] = o.TemplateID + toSerialize["public"] = o.Public + return toSerialize, nil +} + +type NullableTemplateAliasResponse struct { + value *TemplateAliasResponse + isSet bool +} + +func (v NullableTemplateAliasResponse) Get() *TemplateAliasResponse { + return v.value +} + +func (v *NullableTemplateAliasResponse) Set(val *TemplateAliasResponse) { + v.value = val + v.isSet = true +} + +func (v NullableTemplateAliasResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableTemplateAliasResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTemplateAliasResponse(val *TemplateAliasResponse) *NullableTemplateAliasResponse { + return &NullableTemplateAliasResponse{value: val, isSet: true} +} + +func (v NullableTemplateAliasResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTemplateAliasResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_template_build.go b/e2b/client/model_template_build.go new file mode 100644 index 0000000..cd1e466 --- /dev/null +++ b/e2b/client/model_template_build.go @@ -0,0 +1,367 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" +) + +// checks if the TemplateBuild type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TemplateBuild{} + +// TemplateBuild struct for TemplateBuild +type TemplateBuild struct { + // Identifier of the build + BuildID string `json:"buildID"` + Status TemplateBuildStatus `json:"status"` + // Time when the build was created + CreatedAt time.Time `json:"createdAt"` + // Time when the build was last updated + UpdatedAt time.Time `json:"updatedAt"` + // Time when the build was finished + FinishedAt *time.Time `json:"finishedAt,omitempty"` + // CPU cores for the sandbox + CpuCount int32 `json:"cpuCount"` + // Memory for the sandbox in MiB + MemoryMB int32 `json:"memoryMB"` + // Disk size for the sandbox in MiB + DiskSizeMB *int32 `json:"diskSizeMB,omitempty"` + // Version of the envd running in the sandbox + EnvdVersion *string `json:"envdVersion,omitempty"` +} + +// NewTemplateBuild instantiates a new TemplateBuild object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTemplateBuild(buildID string, status TemplateBuildStatus, createdAt time.Time, updatedAt time.Time, cpuCount int32, memoryMB int32) *TemplateBuild { + this := TemplateBuild{} + this.BuildID = buildID + this.Status = status + this.CreatedAt = createdAt + this.UpdatedAt = updatedAt + this.CpuCount = cpuCount + this.MemoryMB = memoryMB + return &this +} + +// NewTemplateBuildWithDefaults instantiates a new TemplateBuild object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTemplateBuildWithDefaults() *TemplateBuild { + this := TemplateBuild{} + return &this +} + +// GetBuildID returns the BuildID field value +func (o *TemplateBuild) GetBuildID() string { + if o == nil { + var ret string + return ret + } + + return o.BuildID +} + +// GetBuildIDOk returns a tuple with the BuildID field value +// and a boolean to check if the value has been set. +func (o *TemplateBuild) GetBuildIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BuildID, true +} + +// SetBuildID sets field value +func (o *TemplateBuild) SetBuildID(v string) { + o.BuildID = v +} + +// GetStatus returns the Status field value +func (o *TemplateBuild) GetStatus() TemplateBuildStatus { + if o == nil { + var ret TemplateBuildStatus + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *TemplateBuild) GetStatusOk() (*TemplateBuildStatus, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *TemplateBuild) SetStatus(v TemplateBuildStatus) { + o.Status = v +} + +// GetCreatedAt returns the CreatedAt field value +func (o *TemplateBuild) GetCreatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *TemplateBuild) GetCreatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value +func (o *TemplateBuild) SetCreatedAt(v time.Time) { + o.CreatedAt = v +} + +// GetUpdatedAt returns the UpdatedAt field value +func (o *TemplateBuild) GetUpdatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value +// and a boolean to check if the value has been set. +func (o *TemplateBuild) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.UpdatedAt, true +} + +// SetUpdatedAt sets field value +func (o *TemplateBuild) SetUpdatedAt(v time.Time) { + o.UpdatedAt = v +} + +// GetFinishedAt returns the FinishedAt field value if set, zero value otherwise. +func (o *TemplateBuild) GetFinishedAt() time.Time { + if o == nil || IsNil(o.FinishedAt) { + var ret time.Time + return ret + } + return *o.FinishedAt +} + +// GetFinishedAtOk returns a tuple with the FinishedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateBuild) GetFinishedAtOk() (*time.Time, bool) { + if o == nil || IsNil(o.FinishedAt) { + return nil, false + } + return o.FinishedAt, true +} + +// HasFinishedAt returns a boolean if a field has been set. +func (o *TemplateBuild) HasFinishedAt() bool { + if o != nil && !IsNil(o.FinishedAt) { + return true + } + + return false +} + +// SetFinishedAt gets a reference to the given time.Time and assigns it to the FinishedAt field. +func (o *TemplateBuild) SetFinishedAt(v time.Time) { + o.FinishedAt = &v +} + +// GetCpuCount returns the CpuCount field value +func (o *TemplateBuild) GetCpuCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.CpuCount +} + +// GetCpuCountOk returns a tuple with the CpuCount field value +// and a boolean to check if the value has been set. +func (o *TemplateBuild) GetCpuCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.CpuCount, true +} + +// SetCpuCount sets field value +func (o *TemplateBuild) SetCpuCount(v int32) { + o.CpuCount = v +} + +// GetMemoryMB returns the MemoryMB field value +func (o *TemplateBuild) GetMemoryMB() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.MemoryMB +} + +// GetMemoryMBOk returns a tuple with the MemoryMB field value +// and a boolean to check if the value has been set. +func (o *TemplateBuild) GetMemoryMBOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.MemoryMB, true +} + +// SetMemoryMB sets field value +func (o *TemplateBuild) SetMemoryMB(v int32) { + o.MemoryMB = v +} + +// GetDiskSizeMB returns the DiskSizeMB field value if set, zero value otherwise. +func (o *TemplateBuild) GetDiskSizeMB() int32 { + if o == nil || IsNil(o.DiskSizeMB) { + var ret int32 + return ret + } + return *o.DiskSizeMB +} + +// GetDiskSizeMBOk returns a tuple with the DiskSizeMB field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateBuild) GetDiskSizeMBOk() (*int32, bool) { + if o == nil || IsNil(o.DiskSizeMB) { + return nil, false + } + return o.DiskSizeMB, true +} + +// HasDiskSizeMB returns a boolean if a field has been set. +func (o *TemplateBuild) HasDiskSizeMB() bool { + if o != nil && !IsNil(o.DiskSizeMB) { + return true + } + + return false +} + +// SetDiskSizeMB gets a reference to the given int32 and assigns it to the DiskSizeMB field. +func (o *TemplateBuild) SetDiskSizeMB(v int32) { + o.DiskSizeMB = &v +} + +// GetEnvdVersion returns the EnvdVersion field value if set, zero value otherwise. +func (o *TemplateBuild) GetEnvdVersion() string { + if o == nil || IsNil(o.EnvdVersion) { + var ret string + return ret + } + return *o.EnvdVersion +} + +// GetEnvdVersionOk returns a tuple with the EnvdVersion field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateBuild) GetEnvdVersionOk() (*string, bool) { + if o == nil || IsNil(o.EnvdVersion) { + return nil, false + } + return o.EnvdVersion, true +} + +// HasEnvdVersion returns a boolean if a field has been set. +func (o *TemplateBuild) HasEnvdVersion() bool { + if o != nil && !IsNil(o.EnvdVersion) { + return true + } + + return false +} + +// SetEnvdVersion gets a reference to the given string and assigns it to the EnvdVersion field. +func (o *TemplateBuild) SetEnvdVersion(v string) { + o.EnvdVersion = &v +} + +func (o TemplateBuild) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TemplateBuild) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["buildID"] = o.BuildID + toSerialize["status"] = o.Status + toSerialize["createdAt"] = o.CreatedAt + toSerialize["updatedAt"] = o.UpdatedAt + if !IsNil(o.FinishedAt) { + toSerialize["finishedAt"] = o.FinishedAt + } + toSerialize["cpuCount"] = o.CpuCount + toSerialize["memoryMB"] = o.MemoryMB + if !IsNil(o.DiskSizeMB) { + toSerialize["diskSizeMB"] = o.DiskSizeMB + } + if !IsNil(o.EnvdVersion) { + toSerialize["envdVersion"] = o.EnvdVersion + } + return toSerialize, nil +} + +type NullableTemplateBuild struct { + value *TemplateBuild + isSet bool +} + +func (v NullableTemplateBuild) Get() *TemplateBuild { + return v.value +} + +func (v *NullableTemplateBuild) Set(val *TemplateBuild) { + v.value = val + v.isSet = true +} + +func (v NullableTemplateBuild) IsSet() bool { + return v.isSet +} + +func (v *NullableTemplateBuild) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTemplateBuild(val *TemplateBuild) *NullableTemplateBuild { + return &NullableTemplateBuild{value: val, isSet: true} +} + +func (v NullableTemplateBuild) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTemplateBuild) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_template_build_file_upload.go b/e2b/client/model_template_build_file_upload.go new file mode 100644 index 0000000..d25cc71 --- /dev/null +++ b/e2b/client/model_template_build_file_upload.go @@ -0,0 +1,153 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the TemplateBuildFileUpload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TemplateBuildFileUpload{} + +// TemplateBuildFileUpload struct for TemplateBuildFileUpload +type TemplateBuildFileUpload struct { + // Whether the file is already present in the cache + Present bool `json:"present"` + // Url where the file should be uploaded to + Url *string `json:"url,omitempty"` +} + +// NewTemplateBuildFileUpload instantiates a new TemplateBuildFileUpload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTemplateBuildFileUpload(present bool) *TemplateBuildFileUpload { + this := TemplateBuildFileUpload{} + this.Present = present + return &this +} + +// NewTemplateBuildFileUploadWithDefaults instantiates a new TemplateBuildFileUpload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTemplateBuildFileUploadWithDefaults() *TemplateBuildFileUpload { + this := TemplateBuildFileUpload{} + return &this +} + +// GetPresent returns the Present field value +func (o *TemplateBuildFileUpload) GetPresent() bool { + if o == nil { + var ret bool + return ret + } + + return o.Present +} + +// GetPresentOk returns a tuple with the Present field value +// and a boolean to check if the value has been set. +func (o *TemplateBuildFileUpload) GetPresentOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Present, true +} + +// SetPresent sets field value +func (o *TemplateBuildFileUpload) SetPresent(v bool) { + o.Present = v +} + +// GetUrl returns the Url field value if set, zero value otherwise. +func (o *TemplateBuildFileUpload) GetUrl() string { + if o == nil || IsNil(o.Url) { + var ret string + return ret + } + return *o.Url +} + +// GetUrlOk returns a tuple with the Url field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateBuildFileUpload) GetUrlOk() (*string, bool) { + if o == nil || IsNil(o.Url) { + return nil, false + } + return o.Url, true +} + +// HasUrl returns a boolean if a field has been set. +func (o *TemplateBuildFileUpload) HasUrl() bool { + if o != nil && !IsNil(o.Url) { + return true + } + + return false +} + +// SetUrl gets a reference to the given string and assigns it to the Url field. +func (o *TemplateBuildFileUpload) SetUrl(v string) { + o.Url = &v +} + +func (o TemplateBuildFileUpload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TemplateBuildFileUpload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["present"] = o.Present + if !IsNil(o.Url) { + toSerialize["url"] = o.Url + } + return toSerialize, nil +} + +type NullableTemplateBuildFileUpload struct { + value *TemplateBuildFileUpload + isSet bool +} + +func (v NullableTemplateBuildFileUpload) Get() *TemplateBuildFileUpload { + return v.value +} + +func (v *NullableTemplateBuildFileUpload) Set(val *TemplateBuildFileUpload) { + v.value = val + v.isSet = true +} + +func (v NullableTemplateBuildFileUpload) IsSet() bool { + return v.isSet +} + +func (v *NullableTemplateBuildFileUpload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTemplateBuildFileUpload(val *TemplateBuildFileUpload) *NullableTemplateBuildFileUpload { + return &NullableTemplateBuildFileUpload{value: val, isSet: true} +} + +func (v NullableTemplateBuildFileUpload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTemplateBuildFileUpload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_template_build_info.go b/e2b/client/model_template_build_info.go new file mode 100644 index 0000000..142de9d --- /dev/null +++ b/e2b/client/model_template_build_info.go @@ -0,0 +1,263 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the TemplateBuildInfo type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TemplateBuildInfo{} + +// TemplateBuildInfo struct for TemplateBuildInfo +type TemplateBuildInfo struct { + // Build logs + Logs []string `json:"logs"` + // Build logs structured + LogEntries []BuildLogEntry `json:"logEntries"` + // Identifier of the template + TemplateID string `json:"templateID"` + // Identifier of the build + BuildID string `json:"buildID"` + Status TemplateBuildStatus `json:"status"` + Reason *BuildStatusReason `json:"reason,omitempty"` +} + +// NewTemplateBuildInfo instantiates a new TemplateBuildInfo object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTemplateBuildInfo(logs []string, logEntries []BuildLogEntry, templateID string, buildID string, status TemplateBuildStatus) *TemplateBuildInfo { + this := TemplateBuildInfo{} + this.Logs = logs + this.LogEntries = logEntries + this.TemplateID = templateID + this.BuildID = buildID + this.Status = status + return &this +} + +// NewTemplateBuildInfoWithDefaults instantiates a new TemplateBuildInfo object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTemplateBuildInfoWithDefaults() *TemplateBuildInfo { + this := TemplateBuildInfo{} + return &this +} + +// GetLogs returns the Logs field value +func (o *TemplateBuildInfo) GetLogs() []string { + if o == nil { + var ret []string + return ret + } + + return o.Logs +} + +// GetLogsOk returns a tuple with the Logs field value +// and a boolean to check if the value has been set. +func (o *TemplateBuildInfo) GetLogsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Logs, true +} + +// SetLogs sets field value +func (o *TemplateBuildInfo) SetLogs(v []string) { + o.Logs = v +} + +// GetLogEntries returns the LogEntries field value +func (o *TemplateBuildInfo) GetLogEntries() []BuildLogEntry { + if o == nil { + var ret []BuildLogEntry + return ret + } + + return o.LogEntries +} + +// GetLogEntriesOk returns a tuple with the LogEntries field value +// and a boolean to check if the value has been set. +func (o *TemplateBuildInfo) GetLogEntriesOk() ([]BuildLogEntry, bool) { + if o == nil { + return nil, false + } + return o.LogEntries, true +} + +// SetLogEntries sets field value +func (o *TemplateBuildInfo) SetLogEntries(v []BuildLogEntry) { + o.LogEntries = v +} + +// GetTemplateID returns the TemplateID field value +func (o *TemplateBuildInfo) GetTemplateID() string { + if o == nil { + var ret string + return ret + } + + return o.TemplateID +} + +// GetTemplateIDOk returns a tuple with the TemplateID field value +// and a boolean to check if the value has been set. +func (o *TemplateBuildInfo) GetTemplateIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TemplateID, true +} + +// SetTemplateID sets field value +func (o *TemplateBuildInfo) SetTemplateID(v string) { + o.TemplateID = v +} + +// GetBuildID returns the BuildID field value +func (o *TemplateBuildInfo) GetBuildID() string { + if o == nil { + var ret string + return ret + } + + return o.BuildID +} + +// GetBuildIDOk returns a tuple with the BuildID field value +// and a boolean to check if the value has been set. +func (o *TemplateBuildInfo) GetBuildIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BuildID, true +} + +// SetBuildID sets field value +func (o *TemplateBuildInfo) SetBuildID(v string) { + o.BuildID = v +} + +// GetStatus returns the Status field value +func (o *TemplateBuildInfo) GetStatus() TemplateBuildStatus { + if o == nil { + var ret TemplateBuildStatus + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *TemplateBuildInfo) GetStatusOk() (*TemplateBuildStatus, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *TemplateBuildInfo) SetStatus(v TemplateBuildStatus) { + o.Status = v +} + +// GetReason returns the Reason field value if set, zero value otherwise. +func (o *TemplateBuildInfo) GetReason() BuildStatusReason { + if o == nil || IsNil(o.Reason) { + var ret BuildStatusReason + return ret + } + return *o.Reason +} + +// GetReasonOk returns a tuple with the Reason field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateBuildInfo) GetReasonOk() (*BuildStatusReason, bool) { + if o == nil || IsNil(o.Reason) { + return nil, false + } + return o.Reason, true +} + +// HasReason returns a boolean if a field has been set. +func (o *TemplateBuildInfo) HasReason() bool { + if o != nil && !IsNil(o.Reason) { + return true + } + + return false +} + +// SetReason gets a reference to the given BuildStatusReason and assigns it to the Reason field. +func (o *TemplateBuildInfo) SetReason(v BuildStatusReason) { + o.Reason = &v +} + +func (o TemplateBuildInfo) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TemplateBuildInfo) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["logs"] = o.Logs + toSerialize["logEntries"] = o.LogEntries + toSerialize["templateID"] = o.TemplateID + toSerialize["buildID"] = o.BuildID + toSerialize["status"] = o.Status + if !IsNil(o.Reason) { + toSerialize["reason"] = o.Reason + } + return toSerialize, nil +} + +type NullableTemplateBuildInfo struct { + value *TemplateBuildInfo + isSet bool +} + +func (v NullableTemplateBuildInfo) Get() *TemplateBuildInfo { + return v.value +} + +func (v *NullableTemplateBuildInfo) Set(val *TemplateBuildInfo) { + v.value = val + v.isSet = true +} + +func (v NullableTemplateBuildInfo) IsSet() bool { + return v.isSet +} + +func (v *NullableTemplateBuildInfo) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTemplateBuildInfo(val *TemplateBuildInfo) *NullableTemplateBuildInfo { + return &NullableTemplateBuildInfo{value: val, isSet: true} +} + +func (v NullableTemplateBuildInfo) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTemplateBuildInfo) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_template_build_logs_response.go b/e2b/client/model_template_build_logs_response.go new file mode 100644 index 0000000..52cb190 --- /dev/null +++ b/e2b/client/model_template_build_logs_response.go @@ -0,0 +1,116 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the TemplateBuildLogsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TemplateBuildLogsResponse{} + +// TemplateBuildLogsResponse struct for TemplateBuildLogsResponse +type TemplateBuildLogsResponse struct { + // Build logs structured + Logs []BuildLogEntry `json:"logs"` +} + +// NewTemplateBuildLogsResponse instantiates a new TemplateBuildLogsResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTemplateBuildLogsResponse(logs []BuildLogEntry) *TemplateBuildLogsResponse { + this := TemplateBuildLogsResponse{} + this.Logs = logs + return &this +} + +// NewTemplateBuildLogsResponseWithDefaults instantiates a new TemplateBuildLogsResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTemplateBuildLogsResponseWithDefaults() *TemplateBuildLogsResponse { + this := TemplateBuildLogsResponse{} + return &this +} + +// GetLogs returns the Logs field value +func (o *TemplateBuildLogsResponse) GetLogs() []BuildLogEntry { + if o == nil { + var ret []BuildLogEntry + return ret + } + + return o.Logs +} + +// GetLogsOk returns a tuple with the Logs field value +// and a boolean to check if the value has been set. +func (o *TemplateBuildLogsResponse) GetLogsOk() ([]BuildLogEntry, bool) { + if o == nil { + return nil, false + } + return o.Logs, true +} + +// SetLogs sets field value +func (o *TemplateBuildLogsResponse) SetLogs(v []BuildLogEntry) { + o.Logs = v +} + +func (o TemplateBuildLogsResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TemplateBuildLogsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["logs"] = o.Logs + return toSerialize, nil +} + +type NullableTemplateBuildLogsResponse struct { + value *TemplateBuildLogsResponse + isSet bool +} + +func (v NullableTemplateBuildLogsResponse) Get() *TemplateBuildLogsResponse { + return v.value +} + +func (v *NullableTemplateBuildLogsResponse) Set(val *TemplateBuildLogsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableTemplateBuildLogsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableTemplateBuildLogsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTemplateBuildLogsResponse(val *TemplateBuildLogsResponse) *NullableTemplateBuildLogsResponse { + return &NullableTemplateBuildLogsResponse{value: val, isSet: true} +} + +func (v NullableTemplateBuildLogsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTemplateBuildLogsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_template_build_request.go b/e2b/client/model_template_build_request.go new file mode 100644 index 0000000..8dd9975 --- /dev/null +++ b/e2b/client/model_template_build_request.go @@ -0,0 +1,338 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the TemplateBuildRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TemplateBuildRequest{} + +// TemplateBuildRequest struct for TemplateBuildRequest +type TemplateBuildRequest struct { + // Alias of the template + Alias *string `json:"alias,omitempty"` + // Dockerfile for the template + Dockerfile string `json:"dockerfile"` + // Identifier of the team + TeamID *string `json:"teamID,omitempty"` + // Start command to execute in the template after the build + StartCmd *string `json:"startCmd,omitempty"` + // Ready check command to execute in the template after the build + ReadyCmd *string `json:"readyCmd,omitempty"` + // CPU cores for the sandbox + CpuCount *int32 `json:"cpuCount,omitempty"` + // Memory for the sandbox in MiB + MemoryMB *int32 `json:"memoryMB,omitempty"` +} + +// NewTemplateBuildRequest instantiates a new TemplateBuildRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTemplateBuildRequest(dockerfile string) *TemplateBuildRequest { + this := TemplateBuildRequest{} + this.Dockerfile = dockerfile + return &this +} + +// NewTemplateBuildRequestWithDefaults instantiates a new TemplateBuildRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTemplateBuildRequestWithDefaults() *TemplateBuildRequest { + this := TemplateBuildRequest{} + return &this +} + +// GetAlias returns the Alias field value if set, zero value otherwise. +func (o *TemplateBuildRequest) GetAlias() string { + if o == nil || IsNil(o.Alias) { + var ret string + return ret + } + return *o.Alias +} + +// GetAliasOk returns a tuple with the Alias field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateBuildRequest) GetAliasOk() (*string, bool) { + if o == nil || IsNil(o.Alias) { + return nil, false + } + return o.Alias, true +} + +// HasAlias returns a boolean if a field has been set. +func (o *TemplateBuildRequest) HasAlias() bool { + if o != nil && !IsNil(o.Alias) { + return true + } + + return false +} + +// SetAlias gets a reference to the given string and assigns it to the Alias field. +func (o *TemplateBuildRequest) SetAlias(v string) { + o.Alias = &v +} + +// GetDockerfile returns the Dockerfile field value +func (o *TemplateBuildRequest) GetDockerfile() string { + if o == nil { + var ret string + return ret + } + + return o.Dockerfile +} + +// GetDockerfileOk returns a tuple with the Dockerfile field value +// and a boolean to check if the value has been set. +func (o *TemplateBuildRequest) GetDockerfileOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Dockerfile, true +} + +// SetDockerfile sets field value +func (o *TemplateBuildRequest) SetDockerfile(v string) { + o.Dockerfile = v +} + +// GetTeamID returns the TeamID field value if set, zero value otherwise. +func (o *TemplateBuildRequest) GetTeamID() string { + if o == nil || IsNil(o.TeamID) { + var ret string + return ret + } + return *o.TeamID +} + +// GetTeamIDOk returns a tuple with the TeamID field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateBuildRequest) GetTeamIDOk() (*string, bool) { + if o == nil || IsNil(o.TeamID) { + return nil, false + } + return o.TeamID, true +} + +// HasTeamID returns a boolean if a field has been set. +func (o *TemplateBuildRequest) HasTeamID() bool { + if o != nil && !IsNil(o.TeamID) { + return true + } + + return false +} + +// SetTeamID gets a reference to the given string and assigns it to the TeamID field. +func (o *TemplateBuildRequest) SetTeamID(v string) { + o.TeamID = &v +} + +// GetStartCmd returns the StartCmd field value if set, zero value otherwise. +func (o *TemplateBuildRequest) GetStartCmd() string { + if o == nil || IsNil(o.StartCmd) { + var ret string + return ret + } + return *o.StartCmd +} + +// GetStartCmdOk returns a tuple with the StartCmd field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateBuildRequest) GetStartCmdOk() (*string, bool) { + if o == nil || IsNil(o.StartCmd) { + return nil, false + } + return o.StartCmd, true +} + +// HasStartCmd returns a boolean if a field has been set. +func (o *TemplateBuildRequest) HasStartCmd() bool { + if o != nil && !IsNil(o.StartCmd) { + return true + } + + return false +} + +// SetStartCmd gets a reference to the given string and assigns it to the StartCmd field. +func (o *TemplateBuildRequest) SetStartCmd(v string) { + o.StartCmd = &v +} + +// GetReadyCmd returns the ReadyCmd field value if set, zero value otherwise. +func (o *TemplateBuildRequest) GetReadyCmd() string { + if o == nil || IsNil(o.ReadyCmd) { + var ret string + return ret + } + return *o.ReadyCmd +} + +// GetReadyCmdOk returns a tuple with the ReadyCmd field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateBuildRequest) GetReadyCmdOk() (*string, bool) { + if o == nil || IsNil(o.ReadyCmd) { + return nil, false + } + return o.ReadyCmd, true +} + +// HasReadyCmd returns a boolean if a field has been set. +func (o *TemplateBuildRequest) HasReadyCmd() bool { + if o != nil && !IsNil(o.ReadyCmd) { + return true + } + + return false +} + +// SetReadyCmd gets a reference to the given string and assigns it to the ReadyCmd field. +func (o *TemplateBuildRequest) SetReadyCmd(v string) { + o.ReadyCmd = &v +} + +// GetCpuCount returns the CpuCount field value if set, zero value otherwise. +func (o *TemplateBuildRequest) GetCpuCount() int32 { + if o == nil || IsNil(o.CpuCount) { + var ret int32 + return ret + } + return *o.CpuCount +} + +// GetCpuCountOk returns a tuple with the CpuCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateBuildRequest) GetCpuCountOk() (*int32, bool) { + if o == nil || IsNil(o.CpuCount) { + return nil, false + } + return o.CpuCount, true +} + +// HasCpuCount returns a boolean if a field has been set. +func (o *TemplateBuildRequest) HasCpuCount() bool { + if o != nil && !IsNil(o.CpuCount) { + return true + } + + return false +} + +// SetCpuCount gets a reference to the given int32 and assigns it to the CpuCount field. +func (o *TemplateBuildRequest) SetCpuCount(v int32) { + o.CpuCount = &v +} + +// GetMemoryMB returns the MemoryMB field value if set, zero value otherwise. +func (o *TemplateBuildRequest) GetMemoryMB() int32 { + if o == nil || IsNil(o.MemoryMB) { + var ret int32 + return ret + } + return *o.MemoryMB +} + +// GetMemoryMBOk returns a tuple with the MemoryMB field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateBuildRequest) GetMemoryMBOk() (*int32, bool) { + if o == nil || IsNil(o.MemoryMB) { + return nil, false + } + return o.MemoryMB, true +} + +// HasMemoryMB returns a boolean if a field has been set. +func (o *TemplateBuildRequest) HasMemoryMB() bool { + if o != nil && !IsNil(o.MemoryMB) { + return true + } + + return false +} + +// SetMemoryMB gets a reference to the given int32 and assigns it to the MemoryMB field. +func (o *TemplateBuildRequest) SetMemoryMB(v int32) { + o.MemoryMB = &v +} + +func (o TemplateBuildRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TemplateBuildRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Alias) { + toSerialize["alias"] = o.Alias + } + toSerialize["dockerfile"] = o.Dockerfile + if !IsNil(o.TeamID) { + toSerialize["teamID"] = o.TeamID + } + if !IsNil(o.StartCmd) { + toSerialize["startCmd"] = o.StartCmd + } + if !IsNil(o.ReadyCmd) { + toSerialize["readyCmd"] = o.ReadyCmd + } + if !IsNil(o.CpuCount) { + toSerialize["cpuCount"] = o.CpuCount + } + if !IsNil(o.MemoryMB) { + toSerialize["memoryMB"] = o.MemoryMB + } + return toSerialize, nil +} + +type NullableTemplateBuildRequest struct { + value *TemplateBuildRequest + isSet bool +} + +func (v NullableTemplateBuildRequest) Get() *TemplateBuildRequest { + return v.value +} + +func (v *NullableTemplateBuildRequest) Set(val *TemplateBuildRequest) { + v.value = val + v.isSet = true +} + +func (v NullableTemplateBuildRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableTemplateBuildRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTemplateBuildRequest(val *TemplateBuildRequest) *NullableTemplateBuildRequest { + return &NullableTemplateBuildRequest{value: val, isSet: true} +} + +func (v NullableTemplateBuildRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTemplateBuildRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_template_build_request_v2.go b/e2b/client/model_template_build_request_v2.go new file mode 100644 index 0000000..8a9d053 --- /dev/null +++ b/e2b/client/model_template_build_request_v2.go @@ -0,0 +1,231 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the TemplateBuildRequestV2 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TemplateBuildRequestV2{} + +// TemplateBuildRequestV2 struct for TemplateBuildRequestV2 +type TemplateBuildRequestV2 struct { + // Alias of the template + Alias string `json:"alias"` + // Identifier of the team + // Deprecated + TeamID *string `json:"teamID,omitempty"` + // CPU cores for the sandbox + CpuCount *int32 `json:"cpuCount,omitempty"` + // Memory for the sandbox in MiB + MemoryMB *int32 `json:"memoryMB,omitempty"` +} + +// NewTemplateBuildRequestV2 instantiates a new TemplateBuildRequestV2 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTemplateBuildRequestV2(alias string) *TemplateBuildRequestV2 { + this := TemplateBuildRequestV2{} + this.Alias = alias + return &this +} + +// NewTemplateBuildRequestV2WithDefaults instantiates a new TemplateBuildRequestV2 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTemplateBuildRequestV2WithDefaults() *TemplateBuildRequestV2 { + this := TemplateBuildRequestV2{} + return &this +} + +// GetAlias returns the Alias field value +func (o *TemplateBuildRequestV2) GetAlias() string { + if o == nil { + var ret string + return ret + } + + return o.Alias +} + +// GetAliasOk returns a tuple with the Alias field value +// and a boolean to check if the value has been set. +func (o *TemplateBuildRequestV2) GetAliasOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Alias, true +} + +// SetAlias sets field value +func (o *TemplateBuildRequestV2) SetAlias(v string) { + o.Alias = v +} + +// GetTeamID returns the TeamID field value if set, zero value otherwise. +// Deprecated +func (o *TemplateBuildRequestV2) GetTeamID() string { + if o == nil || IsNil(o.TeamID) { + var ret string + return ret + } + return *o.TeamID +} + +// GetTeamIDOk returns a tuple with the TeamID field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated +func (o *TemplateBuildRequestV2) GetTeamIDOk() (*string, bool) { + if o == nil || IsNil(o.TeamID) { + return nil, false + } + return o.TeamID, true +} + +// HasTeamID returns a boolean if a field has been set. +func (o *TemplateBuildRequestV2) HasTeamID() bool { + if o != nil && !IsNil(o.TeamID) { + return true + } + + return false +} + +// SetTeamID gets a reference to the given string and assigns it to the TeamID field. +// Deprecated +func (o *TemplateBuildRequestV2) SetTeamID(v string) { + o.TeamID = &v +} + +// GetCpuCount returns the CpuCount field value if set, zero value otherwise. +func (o *TemplateBuildRequestV2) GetCpuCount() int32 { + if o == nil || IsNil(o.CpuCount) { + var ret int32 + return ret + } + return *o.CpuCount +} + +// GetCpuCountOk returns a tuple with the CpuCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateBuildRequestV2) GetCpuCountOk() (*int32, bool) { + if o == nil || IsNil(o.CpuCount) { + return nil, false + } + return o.CpuCount, true +} + +// HasCpuCount returns a boolean if a field has been set. +func (o *TemplateBuildRequestV2) HasCpuCount() bool { + if o != nil && !IsNil(o.CpuCount) { + return true + } + + return false +} + +// SetCpuCount gets a reference to the given int32 and assigns it to the CpuCount field. +func (o *TemplateBuildRequestV2) SetCpuCount(v int32) { + o.CpuCount = &v +} + +// GetMemoryMB returns the MemoryMB field value if set, zero value otherwise. +func (o *TemplateBuildRequestV2) GetMemoryMB() int32 { + if o == nil || IsNil(o.MemoryMB) { + var ret int32 + return ret + } + return *o.MemoryMB +} + +// GetMemoryMBOk returns a tuple with the MemoryMB field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateBuildRequestV2) GetMemoryMBOk() (*int32, bool) { + if o == nil || IsNil(o.MemoryMB) { + return nil, false + } + return o.MemoryMB, true +} + +// HasMemoryMB returns a boolean if a field has been set. +func (o *TemplateBuildRequestV2) HasMemoryMB() bool { + if o != nil && !IsNil(o.MemoryMB) { + return true + } + + return false +} + +// SetMemoryMB gets a reference to the given int32 and assigns it to the MemoryMB field. +func (o *TemplateBuildRequestV2) SetMemoryMB(v int32) { + o.MemoryMB = &v +} + +func (o TemplateBuildRequestV2) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TemplateBuildRequestV2) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["alias"] = o.Alias + if !IsNil(o.TeamID) { + toSerialize["teamID"] = o.TeamID + } + if !IsNil(o.CpuCount) { + toSerialize["cpuCount"] = o.CpuCount + } + if !IsNil(o.MemoryMB) { + toSerialize["memoryMB"] = o.MemoryMB + } + return toSerialize, nil +} + +type NullableTemplateBuildRequestV2 struct { + value *TemplateBuildRequestV2 + isSet bool +} + +func (v NullableTemplateBuildRequestV2) Get() *TemplateBuildRequestV2 { + return v.value +} + +func (v *NullableTemplateBuildRequestV2) Set(val *TemplateBuildRequestV2) { + v.value = val + v.isSet = true +} + +func (v NullableTemplateBuildRequestV2) IsSet() bool { + return v.isSet +} + +func (v *NullableTemplateBuildRequestV2) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTemplateBuildRequestV2(val *TemplateBuildRequestV2) *NullableTemplateBuildRequestV2 { + return &NullableTemplateBuildRequestV2{value: val, isSet: true} +} + +func (v NullableTemplateBuildRequestV2) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTemplateBuildRequestV2) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_template_build_request_v3.go b/e2b/client/model_template_build_request_v3.go new file mode 100644 index 0000000..3c7a692 --- /dev/null +++ b/e2b/client/model_template_build_request_v3.go @@ -0,0 +1,318 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the TemplateBuildRequestV3 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TemplateBuildRequestV3{} + +// TemplateBuildRequestV3 struct for TemplateBuildRequestV3 +type TemplateBuildRequestV3 struct { + // Name of the template. Can include a tag with colon separator (e.g. \"my-template\" or \"my-template:v1\"). If tag is included, it will be treated as if the tag was provided in the tags array. + Name *string `json:"name,omitempty"` + // Tags to assign to the template build + Tags []string `json:"tags,omitempty"` + // Alias of the template. Deprecated, use name instead. + // Deprecated + Alias *string `json:"alias,omitempty"` + // Identifier of the team + // Deprecated + TeamID *string `json:"teamID,omitempty"` + // CPU cores for the sandbox + CpuCount *int32 `json:"cpuCount,omitempty"` + // Memory for the sandbox in MiB + MemoryMB *int32 `json:"memoryMB,omitempty"` +} + +// NewTemplateBuildRequestV3 instantiates a new TemplateBuildRequestV3 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTemplateBuildRequestV3() *TemplateBuildRequestV3 { + this := TemplateBuildRequestV3{} + return &this +} + +// NewTemplateBuildRequestV3WithDefaults instantiates a new TemplateBuildRequestV3 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTemplateBuildRequestV3WithDefaults() *TemplateBuildRequestV3 { + this := TemplateBuildRequestV3{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *TemplateBuildRequestV3) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateBuildRequestV3) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *TemplateBuildRequestV3) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *TemplateBuildRequestV3) SetName(v string) { + o.Name = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *TemplateBuildRequestV3) GetTags() []string { + if o == nil || IsNil(o.Tags) { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateBuildRequestV3) GetTagsOk() ([]string, bool) { + if o == nil || IsNil(o.Tags) { + return nil, false + } + return o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *TemplateBuildRequestV3) HasTags() bool { + if o != nil && !IsNil(o.Tags) { + return true + } + + return false +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *TemplateBuildRequestV3) SetTags(v []string) { + o.Tags = v +} + +// GetAlias returns the Alias field value if set, zero value otherwise. +// Deprecated +func (o *TemplateBuildRequestV3) GetAlias() string { + if o == nil || IsNil(o.Alias) { + var ret string + return ret + } + return *o.Alias +} + +// GetAliasOk returns a tuple with the Alias field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated +func (o *TemplateBuildRequestV3) GetAliasOk() (*string, bool) { + if o == nil || IsNil(o.Alias) { + return nil, false + } + return o.Alias, true +} + +// HasAlias returns a boolean if a field has been set. +func (o *TemplateBuildRequestV3) HasAlias() bool { + if o != nil && !IsNil(o.Alias) { + return true + } + + return false +} + +// SetAlias gets a reference to the given string and assigns it to the Alias field. +// Deprecated +func (o *TemplateBuildRequestV3) SetAlias(v string) { + o.Alias = &v +} + +// GetTeamID returns the TeamID field value if set, zero value otherwise. +// Deprecated +func (o *TemplateBuildRequestV3) GetTeamID() string { + if o == nil || IsNil(o.TeamID) { + var ret string + return ret + } + return *o.TeamID +} + +// GetTeamIDOk returns a tuple with the TeamID field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated +func (o *TemplateBuildRequestV3) GetTeamIDOk() (*string, bool) { + if o == nil || IsNil(o.TeamID) { + return nil, false + } + return o.TeamID, true +} + +// HasTeamID returns a boolean if a field has been set. +func (o *TemplateBuildRequestV3) HasTeamID() bool { + if o != nil && !IsNil(o.TeamID) { + return true + } + + return false +} + +// SetTeamID gets a reference to the given string and assigns it to the TeamID field. +// Deprecated +func (o *TemplateBuildRequestV3) SetTeamID(v string) { + o.TeamID = &v +} + +// GetCpuCount returns the CpuCount field value if set, zero value otherwise. +func (o *TemplateBuildRequestV3) GetCpuCount() int32 { + if o == nil || IsNil(o.CpuCount) { + var ret int32 + return ret + } + return *o.CpuCount +} + +// GetCpuCountOk returns a tuple with the CpuCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateBuildRequestV3) GetCpuCountOk() (*int32, bool) { + if o == nil || IsNil(o.CpuCount) { + return nil, false + } + return o.CpuCount, true +} + +// HasCpuCount returns a boolean if a field has been set. +func (o *TemplateBuildRequestV3) HasCpuCount() bool { + if o != nil && !IsNil(o.CpuCount) { + return true + } + + return false +} + +// SetCpuCount gets a reference to the given int32 and assigns it to the CpuCount field. +func (o *TemplateBuildRequestV3) SetCpuCount(v int32) { + o.CpuCount = &v +} + +// GetMemoryMB returns the MemoryMB field value if set, zero value otherwise. +func (o *TemplateBuildRequestV3) GetMemoryMB() int32 { + if o == nil || IsNil(o.MemoryMB) { + var ret int32 + return ret + } + return *o.MemoryMB +} + +// GetMemoryMBOk returns a tuple with the MemoryMB field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateBuildRequestV3) GetMemoryMBOk() (*int32, bool) { + if o == nil || IsNil(o.MemoryMB) { + return nil, false + } + return o.MemoryMB, true +} + +// HasMemoryMB returns a boolean if a field has been set. +func (o *TemplateBuildRequestV3) HasMemoryMB() bool { + if o != nil && !IsNil(o.MemoryMB) { + return true + } + + return false +} + +// SetMemoryMB gets a reference to the given int32 and assigns it to the MemoryMB field. +func (o *TemplateBuildRequestV3) SetMemoryMB(v int32) { + o.MemoryMB = &v +} + +func (o TemplateBuildRequestV3) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TemplateBuildRequestV3) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + if !IsNil(o.Alias) { + toSerialize["alias"] = o.Alias + } + if !IsNil(o.TeamID) { + toSerialize["teamID"] = o.TeamID + } + if !IsNil(o.CpuCount) { + toSerialize["cpuCount"] = o.CpuCount + } + if !IsNil(o.MemoryMB) { + toSerialize["memoryMB"] = o.MemoryMB + } + return toSerialize, nil +} + +type NullableTemplateBuildRequestV3 struct { + value *TemplateBuildRequestV3 + isSet bool +} + +func (v NullableTemplateBuildRequestV3) Get() *TemplateBuildRequestV3 { + return v.value +} + +func (v *NullableTemplateBuildRequestV3) Set(val *TemplateBuildRequestV3) { + v.value = val + v.isSet = true +} + +func (v NullableTemplateBuildRequestV3) IsSet() bool { + return v.isSet +} + +func (v *NullableTemplateBuildRequestV3) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTemplateBuildRequestV3(val *TemplateBuildRequestV3) *NullableTemplateBuildRequestV3 { + return &NullableTemplateBuildRequestV3{value: val, isSet: true} +} + +func (v NullableTemplateBuildRequestV3) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTemplateBuildRequestV3) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_template_build_start_v2.go b/e2b/client/model_template_build_start_v2.go new file mode 100644 index 0000000..0fd78d1 --- /dev/null +++ b/e2b/client/model_template_build_start_v2.go @@ -0,0 +1,350 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the TemplateBuildStartV2 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TemplateBuildStartV2{} + +// TemplateBuildStartV2 struct for TemplateBuildStartV2 +type TemplateBuildStartV2 struct { + // Image to use as a base for the template build + FromImage *string `json:"fromImage,omitempty"` + // Template to use as a base for the template build + FromTemplate *string `json:"fromTemplate,omitempty"` + FromImageRegistry *FromImageRegistry `json:"fromImageRegistry,omitempty"` + // Whether the whole build should be forced to run regardless of the cache + Force *bool `json:"force,omitempty"` + // List of steps to execute in the template build + Steps []TemplateStep `json:"steps,omitempty"` + // Start command to execute in the template after the build + StartCmd *string `json:"startCmd,omitempty"` + // Ready check command to execute in the template after the build + ReadyCmd *string `json:"readyCmd,omitempty"` +} + +// NewTemplateBuildStartV2 instantiates a new TemplateBuildStartV2 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTemplateBuildStartV2() *TemplateBuildStartV2 { + this := TemplateBuildStartV2{} + var force bool = false + this.Force = &force + return &this +} + +// NewTemplateBuildStartV2WithDefaults instantiates a new TemplateBuildStartV2 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTemplateBuildStartV2WithDefaults() *TemplateBuildStartV2 { + this := TemplateBuildStartV2{} + var force bool = false + this.Force = &force + return &this +} + +// GetFromImage returns the FromImage field value if set, zero value otherwise. +func (o *TemplateBuildStartV2) GetFromImage() string { + if o == nil || IsNil(o.FromImage) { + var ret string + return ret + } + return *o.FromImage +} + +// GetFromImageOk returns a tuple with the FromImage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateBuildStartV2) GetFromImageOk() (*string, bool) { + if o == nil || IsNil(o.FromImage) { + return nil, false + } + return o.FromImage, true +} + +// HasFromImage returns a boolean if a field has been set. +func (o *TemplateBuildStartV2) HasFromImage() bool { + if o != nil && !IsNil(o.FromImage) { + return true + } + + return false +} + +// SetFromImage gets a reference to the given string and assigns it to the FromImage field. +func (o *TemplateBuildStartV2) SetFromImage(v string) { + o.FromImage = &v +} + +// GetFromTemplate returns the FromTemplate field value if set, zero value otherwise. +func (o *TemplateBuildStartV2) GetFromTemplate() string { + if o == nil || IsNil(o.FromTemplate) { + var ret string + return ret + } + return *o.FromTemplate +} + +// GetFromTemplateOk returns a tuple with the FromTemplate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateBuildStartV2) GetFromTemplateOk() (*string, bool) { + if o == nil || IsNil(o.FromTemplate) { + return nil, false + } + return o.FromTemplate, true +} + +// HasFromTemplate returns a boolean if a field has been set. +func (o *TemplateBuildStartV2) HasFromTemplate() bool { + if o != nil && !IsNil(o.FromTemplate) { + return true + } + + return false +} + +// SetFromTemplate gets a reference to the given string and assigns it to the FromTemplate field. +func (o *TemplateBuildStartV2) SetFromTemplate(v string) { + o.FromTemplate = &v +} + +// GetFromImageRegistry returns the FromImageRegistry field value if set, zero value otherwise. +func (o *TemplateBuildStartV2) GetFromImageRegistry() FromImageRegistry { + if o == nil || IsNil(o.FromImageRegistry) { + var ret FromImageRegistry + return ret + } + return *o.FromImageRegistry +} + +// GetFromImageRegistryOk returns a tuple with the FromImageRegistry field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateBuildStartV2) GetFromImageRegistryOk() (*FromImageRegistry, bool) { + if o == nil || IsNil(o.FromImageRegistry) { + return nil, false + } + return o.FromImageRegistry, true +} + +// HasFromImageRegistry returns a boolean if a field has been set. +func (o *TemplateBuildStartV2) HasFromImageRegistry() bool { + if o != nil && !IsNil(o.FromImageRegistry) { + return true + } + + return false +} + +// SetFromImageRegistry gets a reference to the given FromImageRegistry and assigns it to the FromImageRegistry field. +func (o *TemplateBuildStartV2) SetFromImageRegistry(v FromImageRegistry) { + o.FromImageRegistry = &v +} + +// GetForce returns the Force field value if set, zero value otherwise. +func (o *TemplateBuildStartV2) GetForce() bool { + if o == nil || IsNil(o.Force) { + var ret bool + return ret + } + return *o.Force +} + +// GetForceOk returns a tuple with the Force field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateBuildStartV2) GetForceOk() (*bool, bool) { + if o == nil || IsNil(o.Force) { + return nil, false + } + return o.Force, true +} + +// HasForce returns a boolean if a field has been set. +func (o *TemplateBuildStartV2) HasForce() bool { + if o != nil && !IsNil(o.Force) { + return true + } + + return false +} + +// SetForce gets a reference to the given bool and assigns it to the Force field. +func (o *TemplateBuildStartV2) SetForce(v bool) { + o.Force = &v +} + +// GetSteps returns the Steps field value if set, zero value otherwise. +func (o *TemplateBuildStartV2) GetSteps() []TemplateStep { + if o == nil || IsNil(o.Steps) { + var ret []TemplateStep + return ret + } + return o.Steps +} + +// GetStepsOk returns a tuple with the Steps field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateBuildStartV2) GetStepsOk() ([]TemplateStep, bool) { + if o == nil || IsNil(o.Steps) { + return nil, false + } + return o.Steps, true +} + +// HasSteps returns a boolean if a field has been set. +func (o *TemplateBuildStartV2) HasSteps() bool { + if o != nil && !IsNil(o.Steps) { + return true + } + + return false +} + +// SetSteps gets a reference to the given []TemplateStep and assigns it to the Steps field. +func (o *TemplateBuildStartV2) SetSteps(v []TemplateStep) { + o.Steps = v +} + +// GetStartCmd returns the StartCmd field value if set, zero value otherwise. +func (o *TemplateBuildStartV2) GetStartCmd() string { + if o == nil || IsNil(o.StartCmd) { + var ret string + return ret + } + return *o.StartCmd +} + +// GetStartCmdOk returns a tuple with the StartCmd field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateBuildStartV2) GetStartCmdOk() (*string, bool) { + if o == nil || IsNil(o.StartCmd) { + return nil, false + } + return o.StartCmd, true +} + +// HasStartCmd returns a boolean if a field has been set. +func (o *TemplateBuildStartV2) HasStartCmd() bool { + if o != nil && !IsNil(o.StartCmd) { + return true + } + + return false +} + +// SetStartCmd gets a reference to the given string and assigns it to the StartCmd field. +func (o *TemplateBuildStartV2) SetStartCmd(v string) { + o.StartCmd = &v +} + +// GetReadyCmd returns the ReadyCmd field value if set, zero value otherwise. +func (o *TemplateBuildStartV2) GetReadyCmd() string { + if o == nil || IsNil(o.ReadyCmd) { + var ret string + return ret + } + return *o.ReadyCmd +} + +// GetReadyCmdOk returns a tuple with the ReadyCmd field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateBuildStartV2) GetReadyCmdOk() (*string, bool) { + if o == nil || IsNil(o.ReadyCmd) { + return nil, false + } + return o.ReadyCmd, true +} + +// HasReadyCmd returns a boolean if a field has been set. +func (o *TemplateBuildStartV2) HasReadyCmd() bool { + if o != nil && !IsNil(o.ReadyCmd) { + return true + } + + return false +} + +// SetReadyCmd gets a reference to the given string and assigns it to the ReadyCmd field. +func (o *TemplateBuildStartV2) SetReadyCmd(v string) { + o.ReadyCmd = &v +} + +func (o TemplateBuildStartV2) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TemplateBuildStartV2) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.FromImage) { + toSerialize["fromImage"] = o.FromImage + } + if !IsNil(o.FromTemplate) { + toSerialize["fromTemplate"] = o.FromTemplate + } + if !IsNil(o.FromImageRegistry) { + toSerialize["fromImageRegistry"] = o.FromImageRegistry + } + if !IsNil(o.Force) { + toSerialize["force"] = o.Force + } + if !IsNil(o.Steps) { + toSerialize["steps"] = o.Steps + } + if !IsNil(o.StartCmd) { + toSerialize["startCmd"] = o.StartCmd + } + if !IsNil(o.ReadyCmd) { + toSerialize["readyCmd"] = o.ReadyCmd + } + return toSerialize, nil +} + +type NullableTemplateBuildStartV2 struct { + value *TemplateBuildStartV2 + isSet bool +} + +func (v NullableTemplateBuildStartV2) Get() *TemplateBuildStartV2 { + return v.value +} + +func (v *NullableTemplateBuildStartV2) Set(val *TemplateBuildStartV2) { + v.value = val + v.isSet = true +} + +func (v NullableTemplateBuildStartV2) IsSet() bool { + return v.isSet +} + +func (v *NullableTemplateBuildStartV2) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTemplateBuildStartV2(val *TemplateBuildStartV2) *NullableTemplateBuildStartV2 { + return &NullableTemplateBuildStartV2{value: val, isSet: true} +} + +func (v NullableTemplateBuildStartV2) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTemplateBuildStartV2) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_template_build_status.go b/e2b/client/model_template_build_status.go new file mode 100644 index 0000000..e129e5c --- /dev/null +++ b/e2b/client/model_template_build_status.go @@ -0,0 +1,114 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// TemplateBuildStatus Status of the template build +type TemplateBuildStatus string + +// List of TemplateBuildStatus +const ( + TEMPLATEBUILDSTATUS_BUILDING TemplateBuildStatus = "building" + TEMPLATEBUILDSTATUS_WAITING TemplateBuildStatus = "waiting" + TEMPLATEBUILDSTATUS_READY TemplateBuildStatus = "ready" + TEMPLATEBUILDSTATUS_ERROR TemplateBuildStatus = "error" +) + +// All allowed values of TemplateBuildStatus enum +var AllowedTemplateBuildStatusEnumValues = []TemplateBuildStatus{ + "building", + "waiting", + "ready", + "error", +} + +func (v *TemplateBuildStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := TemplateBuildStatus(value) + for _, existing := range AllowedTemplateBuildStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid TemplateBuildStatus", value) +} + +// NewTemplateBuildStatusFromValue returns a pointer to a valid TemplateBuildStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewTemplateBuildStatusFromValue(v string) (*TemplateBuildStatus, error) { + ev := TemplateBuildStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for TemplateBuildStatus: valid values are %v", v, AllowedTemplateBuildStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v TemplateBuildStatus) IsValid() bool { + for _, existing := range AllowedTemplateBuildStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TemplateBuildStatus value +func (v TemplateBuildStatus) Ptr() *TemplateBuildStatus { + return &v +} + +type NullableTemplateBuildStatus struct { + value *TemplateBuildStatus + isSet bool +} + +func (v NullableTemplateBuildStatus) Get() *TemplateBuildStatus { + return v.value +} + +func (v *NullableTemplateBuildStatus) Set(val *TemplateBuildStatus) { + v.value = val + v.isSet = true +} + +func (v NullableTemplateBuildStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableTemplateBuildStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTemplateBuildStatus(val *TemplateBuildStatus) *NullableTemplateBuildStatus { + return &NullableTemplateBuildStatus{value: val, isSet: true} +} + +func (v NullableTemplateBuildStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTemplateBuildStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_template_legacy.go b/e2b/client/model_template_legacy.go new file mode 100644 index 0000000..a89bd04 --- /dev/null +++ b/e2b/client/model_template_legacy.go @@ -0,0 +1,484 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" +) + +// checks if the TemplateLegacy type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TemplateLegacy{} + +// TemplateLegacy struct for TemplateLegacy +type TemplateLegacy struct { + // Identifier of the template + TemplateID string `json:"templateID"` + // Identifier of the last successful build for given template + BuildID string `json:"buildID"` + // CPU cores for the sandbox + CpuCount int32 `json:"cpuCount"` + // Memory for the sandbox in MiB + MemoryMB int32 `json:"memoryMB"` + // Disk size for the sandbox in MiB + DiskSizeMB int32 `json:"diskSizeMB"` + // Whether the template is public or only accessible by the team + Public bool `json:"public"` + // Aliases of the template + Aliases []string `json:"aliases"` + // Time when the template was created + CreatedAt time.Time `json:"createdAt"` + // Time when the template was last updated + UpdatedAt time.Time `json:"updatedAt"` + CreatedBy NullableTeamUser `json:"createdBy"` + // Time when the template was last used + LastSpawnedAt NullableTime `json:"lastSpawnedAt"` + // Number of times the template was used + SpawnCount int64 `json:"spawnCount"` + // Number of times the template was built + BuildCount int32 `json:"buildCount"` + // Version of the envd running in the sandbox + EnvdVersion string `json:"envdVersion"` +} + +// NewTemplateLegacy instantiates a new TemplateLegacy object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTemplateLegacy(templateID string, buildID string, cpuCount int32, memoryMB int32, diskSizeMB int32, public bool, aliases []string, createdAt time.Time, updatedAt time.Time, createdBy NullableTeamUser, lastSpawnedAt NullableTime, spawnCount int64, buildCount int32, envdVersion string) *TemplateLegacy { + this := TemplateLegacy{} + this.TemplateID = templateID + this.BuildID = buildID + this.CpuCount = cpuCount + this.MemoryMB = memoryMB + this.DiskSizeMB = diskSizeMB + this.Public = public + this.Aliases = aliases + this.CreatedAt = createdAt + this.UpdatedAt = updatedAt + this.CreatedBy = createdBy + this.LastSpawnedAt = lastSpawnedAt + this.SpawnCount = spawnCount + this.BuildCount = buildCount + this.EnvdVersion = envdVersion + return &this +} + +// NewTemplateLegacyWithDefaults instantiates a new TemplateLegacy object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTemplateLegacyWithDefaults() *TemplateLegacy { + this := TemplateLegacy{} + return &this +} + +// GetTemplateID returns the TemplateID field value +func (o *TemplateLegacy) GetTemplateID() string { + if o == nil { + var ret string + return ret + } + + return o.TemplateID +} + +// GetTemplateIDOk returns a tuple with the TemplateID field value +// and a boolean to check if the value has been set. +func (o *TemplateLegacy) GetTemplateIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TemplateID, true +} + +// SetTemplateID sets field value +func (o *TemplateLegacy) SetTemplateID(v string) { + o.TemplateID = v +} + +// GetBuildID returns the BuildID field value +func (o *TemplateLegacy) GetBuildID() string { + if o == nil { + var ret string + return ret + } + + return o.BuildID +} + +// GetBuildIDOk returns a tuple with the BuildID field value +// and a boolean to check if the value has been set. +func (o *TemplateLegacy) GetBuildIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BuildID, true +} + +// SetBuildID sets field value +func (o *TemplateLegacy) SetBuildID(v string) { + o.BuildID = v +} + +// GetCpuCount returns the CpuCount field value +func (o *TemplateLegacy) GetCpuCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.CpuCount +} + +// GetCpuCountOk returns a tuple with the CpuCount field value +// and a boolean to check if the value has been set. +func (o *TemplateLegacy) GetCpuCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.CpuCount, true +} + +// SetCpuCount sets field value +func (o *TemplateLegacy) SetCpuCount(v int32) { + o.CpuCount = v +} + +// GetMemoryMB returns the MemoryMB field value +func (o *TemplateLegacy) GetMemoryMB() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.MemoryMB +} + +// GetMemoryMBOk returns a tuple with the MemoryMB field value +// and a boolean to check if the value has been set. +func (o *TemplateLegacy) GetMemoryMBOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.MemoryMB, true +} + +// SetMemoryMB sets field value +func (o *TemplateLegacy) SetMemoryMB(v int32) { + o.MemoryMB = v +} + +// GetDiskSizeMB returns the DiskSizeMB field value +func (o *TemplateLegacy) GetDiskSizeMB() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.DiskSizeMB +} + +// GetDiskSizeMBOk returns a tuple with the DiskSizeMB field value +// and a boolean to check if the value has been set. +func (o *TemplateLegacy) GetDiskSizeMBOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.DiskSizeMB, true +} + +// SetDiskSizeMB sets field value +func (o *TemplateLegacy) SetDiskSizeMB(v int32) { + o.DiskSizeMB = v +} + +// GetPublic returns the Public field value +func (o *TemplateLegacy) GetPublic() bool { + if o == nil { + var ret bool + return ret + } + + return o.Public +} + +// GetPublicOk returns a tuple with the Public field value +// and a boolean to check if the value has been set. +func (o *TemplateLegacy) GetPublicOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Public, true +} + +// SetPublic sets field value +func (o *TemplateLegacy) SetPublic(v bool) { + o.Public = v +} + +// GetAliases returns the Aliases field value +func (o *TemplateLegacy) GetAliases() []string { + if o == nil { + var ret []string + return ret + } + + return o.Aliases +} + +// GetAliasesOk returns a tuple with the Aliases field value +// and a boolean to check if the value has been set. +func (o *TemplateLegacy) GetAliasesOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Aliases, true +} + +// SetAliases sets field value +func (o *TemplateLegacy) SetAliases(v []string) { + o.Aliases = v +} + +// GetCreatedAt returns the CreatedAt field value +func (o *TemplateLegacy) GetCreatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *TemplateLegacy) GetCreatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value +func (o *TemplateLegacy) SetCreatedAt(v time.Time) { + o.CreatedAt = v +} + +// GetUpdatedAt returns the UpdatedAt field value +func (o *TemplateLegacy) GetUpdatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value +// and a boolean to check if the value has been set. +func (o *TemplateLegacy) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.UpdatedAt, true +} + +// SetUpdatedAt sets field value +func (o *TemplateLegacy) SetUpdatedAt(v time.Time) { + o.UpdatedAt = v +} + +// GetCreatedBy returns the CreatedBy field value +// If the value is explicit nil, the zero value for TeamUser will be returned +func (o *TemplateLegacy) GetCreatedBy() TeamUser { + if o == nil || o.CreatedBy.Get() == nil { + var ret TeamUser + return ret + } + + return *o.CreatedBy.Get() +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TemplateLegacy) GetCreatedByOk() (*TeamUser, bool) { + if o == nil { + return nil, false + } + return o.CreatedBy.Get(), o.CreatedBy.IsSet() +} + +// SetCreatedBy sets field value +func (o *TemplateLegacy) SetCreatedBy(v TeamUser) { + o.CreatedBy.Set(&v) +} + +// GetLastSpawnedAt returns the LastSpawnedAt field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *TemplateLegacy) GetLastSpawnedAt() time.Time { + if o == nil || o.LastSpawnedAt.Get() == nil { + var ret time.Time + return ret + } + + return *o.LastSpawnedAt.Get() +} + +// GetLastSpawnedAtOk returns a tuple with the LastSpawnedAt field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TemplateLegacy) GetLastSpawnedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.LastSpawnedAt.Get(), o.LastSpawnedAt.IsSet() +} + +// SetLastSpawnedAt sets field value +func (o *TemplateLegacy) SetLastSpawnedAt(v time.Time) { + o.LastSpawnedAt.Set(&v) +} + +// GetSpawnCount returns the SpawnCount field value +func (o *TemplateLegacy) GetSpawnCount() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.SpawnCount +} + +// GetSpawnCountOk returns a tuple with the SpawnCount field value +// and a boolean to check if the value has been set. +func (o *TemplateLegacy) GetSpawnCountOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.SpawnCount, true +} + +// SetSpawnCount sets field value +func (o *TemplateLegacy) SetSpawnCount(v int64) { + o.SpawnCount = v +} + +// GetBuildCount returns the BuildCount field value +func (o *TemplateLegacy) GetBuildCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.BuildCount +} + +// GetBuildCountOk returns a tuple with the BuildCount field value +// and a boolean to check if the value has been set. +func (o *TemplateLegacy) GetBuildCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.BuildCount, true +} + +// SetBuildCount sets field value +func (o *TemplateLegacy) SetBuildCount(v int32) { + o.BuildCount = v +} + +// GetEnvdVersion returns the EnvdVersion field value +func (o *TemplateLegacy) GetEnvdVersion() string { + if o == nil { + var ret string + return ret + } + + return o.EnvdVersion +} + +// GetEnvdVersionOk returns a tuple with the EnvdVersion field value +// and a boolean to check if the value has been set. +func (o *TemplateLegacy) GetEnvdVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.EnvdVersion, true +} + +// SetEnvdVersion sets field value +func (o *TemplateLegacy) SetEnvdVersion(v string) { + o.EnvdVersion = v +} + +func (o TemplateLegacy) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TemplateLegacy) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["templateID"] = o.TemplateID + toSerialize["buildID"] = o.BuildID + toSerialize["cpuCount"] = o.CpuCount + toSerialize["memoryMB"] = o.MemoryMB + toSerialize["diskSizeMB"] = o.DiskSizeMB + toSerialize["public"] = o.Public + toSerialize["aliases"] = o.Aliases + toSerialize["createdAt"] = o.CreatedAt + toSerialize["updatedAt"] = o.UpdatedAt + toSerialize["createdBy"] = o.CreatedBy.Get() + toSerialize["lastSpawnedAt"] = o.LastSpawnedAt.Get() + toSerialize["spawnCount"] = o.SpawnCount + toSerialize["buildCount"] = o.BuildCount + toSerialize["envdVersion"] = o.EnvdVersion + return toSerialize, nil +} + +type NullableTemplateLegacy struct { + value *TemplateLegacy + isSet bool +} + +func (v NullableTemplateLegacy) Get() *TemplateLegacy { + return v.value +} + +func (v *NullableTemplateLegacy) Set(val *TemplateLegacy) { + v.value = val + v.isSet = true +} + +func (v NullableTemplateLegacy) IsSet() bool { + return v.isSet +} + +func (v *NullableTemplateLegacy) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTemplateLegacy(val *TemplateLegacy) *NullableTemplateLegacy { + return &NullableTemplateLegacy{value: val, isSet: true} +} + +func (v NullableTemplateLegacy) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTemplateLegacy) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_template_request_response_v3.go b/e2b/client/model_template_request_response_v3.go new file mode 100644 index 0000000..78f84e0 --- /dev/null +++ b/e2b/client/model_template_request_response_v3.go @@ -0,0 +1,260 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the TemplateRequestResponseV3 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TemplateRequestResponseV3{} + +// TemplateRequestResponseV3 struct for TemplateRequestResponseV3 +type TemplateRequestResponseV3 struct { + // Identifier of the template + TemplateID string `json:"templateID"` + // Identifier of the last successful build for given template + BuildID string `json:"buildID"` + // Whether the template is public or only accessible by the team + Public bool `json:"public"` + // Names of the template + Names []string `json:"names"` + // Tags assigned to the template build + Tags []string `json:"tags"` + // Aliases of the template + // Deprecated + Aliases []string `json:"aliases"` +} + +// NewTemplateRequestResponseV3 instantiates a new TemplateRequestResponseV3 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTemplateRequestResponseV3(templateID string, buildID string, public bool, names []string, tags []string, aliases []string) *TemplateRequestResponseV3 { + this := TemplateRequestResponseV3{} + this.TemplateID = templateID + this.BuildID = buildID + this.Public = public + this.Names = names + this.Tags = tags + this.Aliases = aliases + return &this +} + +// NewTemplateRequestResponseV3WithDefaults instantiates a new TemplateRequestResponseV3 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTemplateRequestResponseV3WithDefaults() *TemplateRequestResponseV3 { + this := TemplateRequestResponseV3{} + return &this +} + +// GetTemplateID returns the TemplateID field value +func (o *TemplateRequestResponseV3) GetTemplateID() string { + if o == nil { + var ret string + return ret + } + + return o.TemplateID +} + +// GetTemplateIDOk returns a tuple with the TemplateID field value +// and a boolean to check if the value has been set. +func (o *TemplateRequestResponseV3) GetTemplateIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TemplateID, true +} + +// SetTemplateID sets field value +func (o *TemplateRequestResponseV3) SetTemplateID(v string) { + o.TemplateID = v +} + +// GetBuildID returns the BuildID field value +func (o *TemplateRequestResponseV3) GetBuildID() string { + if o == nil { + var ret string + return ret + } + + return o.BuildID +} + +// GetBuildIDOk returns a tuple with the BuildID field value +// and a boolean to check if the value has been set. +func (o *TemplateRequestResponseV3) GetBuildIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BuildID, true +} + +// SetBuildID sets field value +func (o *TemplateRequestResponseV3) SetBuildID(v string) { + o.BuildID = v +} + +// GetPublic returns the Public field value +func (o *TemplateRequestResponseV3) GetPublic() bool { + if o == nil { + var ret bool + return ret + } + + return o.Public +} + +// GetPublicOk returns a tuple with the Public field value +// and a boolean to check if the value has been set. +func (o *TemplateRequestResponseV3) GetPublicOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Public, true +} + +// SetPublic sets field value +func (o *TemplateRequestResponseV3) SetPublic(v bool) { + o.Public = v +} + +// GetNames returns the Names field value +func (o *TemplateRequestResponseV3) GetNames() []string { + if o == nil { + var ret []string + return ret + } + + return o.Names +} + +// GetNamesOk returns a tuple with the Names field value +// and a boolean to check if the value has been set. +func (o *TemplateRequestResponseV3) GetNamesOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Names, true +} + +// SetNames sets field value +func (o *TemplateRequestResponseV3) SetNames(v []string) { + o.Names = v +} + +// GetTags returns the Tags field value +func (o *TemplateRequestResponseV3) GetTags() []string { + if o == nil { + var ret []string + return ret + } + + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value +// and a boolean to check if the value has been set. +func (o *TemplateRequestResponseV3) GetTagsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Tags, true +} + +// SetTags sets field value +func (o *TemplateRequestResponseV3) SetTags(v []string) { + o.Tags = v +} + +// GetAliases returns the Aliases field value +// Deprecated +func (o *TemplateRequestResponseV3) GetAliases() []string { + if o == nil { + var ret []string + return ret + } + + return o.Aliases +} + +// GetAliasesOk returns a tuple with the Aliases field value +// and a boolean to check if the value has been set. +// Deprecated +func (o *TemplateRequestResponseV3) GetAliasesOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Aliases, true +} + +// SetAliases sets field value +// Deprecated +func (o *TemplateRequestResponseV3) SetAliases(v []string) { + o.Aliases = v +} + +func (o TemplateRequestResponseV3) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TemplateRequestResponseV3) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["templateID"] = o.TemplateID + toSerialize["buildID"] = o.BuildID + toSerialize["public"] = o.Public + toSerialize["names"] = o.Names + toSerialize["tags"] = o.Tags + toSerialize["aliases"] = o.Aliases + return toSerialize, nil +} + +type NullableTemplateRequestResponseV3 struct { + value *TemplateRequestResponseV3 + isSet bool +} + +func (v NullableTemplateRequestResponseV3) Get() *TemplateRequestResponseV3 { + return v.value +} + +func (v *NullableTemplateRequestResponseV3) Set(val *TemplateRequestResponseV3) { + v.value = val + v.isSet = true +} + +func (v NullableTemplateRequestResponseV3) IsSet() bool { + return v.isSet +} + +func (v *NullableTemplateRequestResponseV3) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTemplateRequestResponseV3(val *TemplateRequestResponseV3) *NullableTemplateRequestResponseV3 { + return &NullableTemplateRequestResponseV3{value: val, isSet: true} +} + +func (v NullableTemplateRequestResponseV3) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTemplateRequestResponseV3) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_template_step.go b/e2b/client/model_template_step.go new file mode 100644 index 0000000..d102c45 --- /dev/null +++ b/e2b/client/model_template_step.go @@ -0,0 +1,231 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the TemplateStep type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TemplateStep{} + +// TemplateStep Step in the template build process +type TemplateStep struct { + // Type of the step + Type string `json:"type"` + // Arguments for the step + Args []string `json:"args,omitempty"` + // Hash of the files used in the step + FilesHash *string `json:"filesHash,omitempty"` + // Whether the step should be forced to run regardless of the cache + Force *bool `json:"force,omitempty"` +} + +// NewTemplateStep instantiates a new TemplateStep object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTemplateStep(type_ string) *TemplateStep { + this := TemplateStep{} + this.Type = type_ + var force bool = false + this.Force = &force + return &this +} + +// NewTemplateStepWithDefaults instantiates a new TemplateStep object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTemplateStepWithDefaults() *TemplateStep { + this := TemplateStep{} + var force bool = false + this.Force = &force + return &this +} + +// GetType returns the Type field value +func (o *TemplateStep) GetType() string { + if o == nil { + var ret string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *TemplateStep) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *TemplateStep) SetType(v string) { + o.Type = v +} + +// GetArgs returns the Args field value if set, zero value otherwise. +func (o *TemplateStep) GetArgs() []string { + if o == nil || IsNil(o.Args) { + var ret []string + return ret + } + return o.Args +} + +// GetArgsOk returns a tuple with the Args field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateStep) GetArgsOk() ([]string, bool) { + if o == nil || IsNil(o.Args) { + return nil, false + } + return o.Args, true +} + +// HasArgs returns a boolean if a field has been set. +func (o *TemplateStep) HasArgs() bool { + if o != nil && !IsNil(o.Args) { + return true + } + + return false +} + +// SetArgs gets a reference to the given []string and assigns it to the Args field. +func (o *TemplateStep) SetArgs(v []string) { + o.Args = v +} + +// GetFilesHash returns the FilesHash field value if set, zero value otherwise. +func (o *TemplateStep) GetFilesHash() string { + if o == nil || IsNil(o.FilesHash) { + var ret string + return ret + } + return *o.FilesHash +} + +// GetFilesHashOk returns a tuple with the FilesHash field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateStep) GetFilesHashOk() (*string, bool) { + if o == nil || IsNil(o.FilesHash) { + return nil, false + } + return o.FilesHash, true +} + +// HasFilesHash returns a boolean if a field has been set. +func (o *TemplateStep) HasFilesHash() bool { + if o != nil && !IsNil(o.FilesHash) { + return true + } + + return false +} + +// SetFilesHash gets a reference to the given string and assigns it to the FilesHash field. +func (o *TemplateStep) SetFilesHash(v string) { + o.FilesHash = &v +} + +// GetForce returns the Force field value if set, zero value otherwise. +func (o *TemplateStep) GetForce() bool { + if o == nil || IsNil(o.Force) { + var ret bool + return ret + } + return *o.Force +} + +// GetForceOk returns a tuple with the Force field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateStep) GetForceOk() (*bool, bool) { + if o == nil || IsNil(o.Force) { + return nil, false + } + return o.Force, true +} + +// HasForce returns a boolean if a field has been set. +func (o *TemplateStep) HasForce() bool { + if o != nil && !IsNil(o.Force) { + return true + } + + return false +} + +// SetForce gets a reference to the given bool and assigns it to the Force field. +func (o *TemplateStep) SetForce(v bool) { + o.Force = &v +} + +func (o TemplateStep) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TemplateStep) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["type"] = o.Type + if !IsNil(o.Args) { + toSerialize["args"] = o.Args + } + if !IsNil(o.FilesHash) { + toSerialize["filesHash"] = o.FilesHash + } + if !IsNil(o.Force) { + toSerialize["force"] = o.Force + } + return toSerialize, nil +} + +type NullableTemplateStep struct { + value *TemplateStep + isSet bool +} + +func (v NullableTemplateStep) Get() *TemplateStep { + return v.value +} + +func (v *NullableTemplateStep) Set(val *TemplateStep) { + v.value = val + v.isSet = true +} + +func (v NullableTemplateStep) IsSet() bool { + return v.isSet +} + +func (v *NullableTemplateStep) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTemplateStep(val *TemplateStep) *NullableTemplateStep { + return &NullableTemplateStep{value: val, isSet: true} +} + +func (v NullableTemplateStep) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTemplateStep) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_template_tag.go b/e2b/client/model_template_tag.go new file mode 100644 index 0000000..df74822 --- /dev/null +++ b/e2b/client/model_template_tag.go @@ -0,0 +1,173 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" +) + +// checks if the TemplateTag type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TemplateTag{} + +// TemplateTag struct for TemplateTag +type TemplateTag struct { + // The tag name + Tag string `json:"tag"` + // Identifier of the build associated with this tag + BuildID string `json:"buildID"` + // Time when the tag was assigned + CreatedAt time.Time `json:"createdAt"` +} + +// NewTemplateTag instantiates a new TemplateTag object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTemplateTag(tag string, buildID string, createdAt time.Time) *TemplateTag { + this := TemplateTag{} + this.Tag = tag + this.BuildID = buildID + this.CreatedAt = createdAt + return &this +} + +// NewTemplateTagWithDefaults instantiates a new TemplateTag object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTemplateTagWithDefaults() *TemplateTag { + this := TemplateTag{} + return &this +} + +// GetTag returns the Tag field value +func (o *TemplateTag) GetTag() string { + if o == nil { + var ret string + return ret + } + + return o.Tag +} + +// GetTagOk returns a tuple with the Tag field value +// and a boolean to check if the value has been set. +func (o *TemplateTag) GetTagOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Tag, true +} + +// SetTag sets field value +func (o *TemplateTag) SetTag(v string) { + o.Tag = v +} + +// GetBuildID returns the BuildID field value +func (o *TemplateTag) GetBuildID() string { + if o == nil { + var ret string + return ret + } + + return o.BuildID +} + +// GetBuildIDOk returns a tuple with the BuildID field value +// and a boolean to check if the value has been set. +func (o *TemplateTag) GetBuildIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BuildID, true +} + +// SetBuildID sets field value +func (o *TemplateTag) SetBuildID(v string) { + o.BuildID = v +} + +// GetCreatedAt returns the CreatedAt field value +func (o *TemplateTag) GetCreatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *TemplateTag) GetCreatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value +func (o *TemplateTag) SetCreatedAt(v time.Time) { + o.CreatedAt = v +} + +func (o TemplateTag) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TemplateTag) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["tag"] = o.Tag + toSerialize["buildID"] = o.BuildID + toSerialize["createdAt"] = o.CreatedAt + return toSerialize, nil +} + +type NullableTemplateTag struct { + value *TemplateTag + isSet bool +} + +func (v NullableTemplateTag) Get() *TemplateTag { + return v.value +} + +func (v *NullableTemplateTag) Set(val *TemplateTag) { + v.value = val + v.isSet = true +} + +func (v NullableTemplateTag) IsSet() bool { + return v.isSet +} + +func (v *NullableTemplateTag) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTemplateTag(val *TemplateTag) *NullableTemplateTag { + return &NullableTemplateTag{value: val, isSet: true} +} + +func (v NullableTemplateTag) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTemplateTag) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_template_update_request.go b/e2b/client/model_template_update_request.go new file mode 100644 index 0000000..dedd7dd --- /dev/null +++ b/e2b/client/model_template_update_request.go @@ -0,0 +1,125 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the TemplateUpdateRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TemplateUpdateRequest{} + +// TemplateUpdateRequest struct for TemplateUpdateRequest +type TemplateUpdateRequest struct { + // Whether the template is public or only accessible by the team + Public *bool `json:"public,omitempty"` +} + +// NewTemplateUpdateRequest instantiates a new TemplateUpdateRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTemplateUpdateRequest() *TemplateUpdateRequest { + this := TemplateUpdateRequest{} + return &this +} + +// NewTemplateUpdateRequestWithDefaults instantiates a new TemplateUpdateRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTemplateUpdateRequestWithDefaults() *TemplateUpdateRequest { + this := TemplateUpdateRequest{} + return &this +} + +// GetPublic returns the Public field value if set, zero value otherwise. +func (o *TemplateUpdateRequest) GetPublic() bool { + if o == nil || IsNil(o.Public) { + var ret bool + return ret + } + return *o.Public +} + +// GetPublicOk returns a tuple with the Public field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TemplateUpdateRequest) GetPublicOk() (*bool, bool) { + if o == nil || IsNil(o.Public) { + return nil, false + } + return o.Public, true +} + +// HasPublic returns a boolean if a field has been set. +func (o *TemplateUpdateRequest) HasPublic() bool { + if o != nil && !IsNil(o.Public) { + return true + } + + return false +} + +// SetPublic gets a reference to the given bool and assigns it to the Public field. +func (o *TemplateUpdateRequest) SetPublic(v bool) { + o.Public = &v +} + +func (o TemplateUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TemplateUpdateRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Public) { + toSerialize["public"] = o.Public + } + return toSerialize, nil +} + +type NullableTemplateUpdateRequest struct { + value *TemplateUpdateRequest + isSet bool +} + +func (v NullableTemplateUpdateRequest) Get() *TemplateUpdateRequest { + return v.value +} + +func (v *NullableTemplateUpdateRequest) Set(val *TemplateUpdateRequest) { + v.value = val + v.isSet = true +} + +func (v NullableTemplateUpdateRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableTemplateUpdateRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTemplateUpdateRequest(val *TemplateUpdateRequest) *NullableTemplateUpdateRequest { + return &NullableTemplateUpdateRequest{value: val, isSet: true} +} + +func (v NullableTemplateUpdateRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTemplateUpdateRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_template_update_response.go b/e2b/client/model_template_update_response.go new file mode 100644 index 0000000..1f86bd3 --- /dev/null +++ b/e2b/client/model_template_update_response.go @@ -0,0 +1,116 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the TemplateUpdateResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TemplateUpdateResponse{} + +// TemplateUpdateResponse struct for TemplateUpdateResponse +type TemplateUpdateResponse struct { + // Names of the template (namespace/alias format when namespaced) + Names []string `json:"names"` +} + +// NewTemplateUpdateResponse instantiates a new TemplateUpdateResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTemplateUpdateResponse(names []string) *TemplateUpdateResponse { + this := TemplateUpdateResponse{} + this.Names = names + return &this +} + +// NewTemplateUpdateResponseWithDefaults instantiates a new TemplateUpdateResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTemplateUpdateResponseWithDefaults() *TemplateUpdateResponse { + this := TemplateUpdateResponse{} + return &this +} + +// GetNames returns the Names field value +func (o *TemplateUpdateResponse) GetNames() []string { + if o == nil { + var ret []string + return ret + } + + return o.Names +} + +// GetNamesOk returns a tuple with the Names field value +// and a boolean to check if the value has been set. +func (o *TemplateUpdateResponse) GetNamesOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Names, true +} + +// SetNames sets field value +func (o *TemplateUpdateResponse) SetNames(v []string) { + o.Names = v +} + +func (o TemplateUpdateResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TemplateUpdateResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["names"] = o.Names + return toSerialize, nil +} + +type NullableTemplateUpdateResponse struct { + value *TemplateUpdateResponse + isSet bool +} + +func (v NullableTemplateUpdateResponse) Get() *TemplateUpdateResponse { + return v.value +} + +func (v *NullableTemplateUpdateResponse) Set(val *TemplateUpdateResponse) { + v.value = val + v.isSet = true +} + +func (v NullableTemplateUpdateResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableTemplateUpdateResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTemplateUpdateResponse(val *TemplateUpdateResponse) *NullableTemplateUpdateResponse { + return &NullableTemplateUpdateResponse{value: val, isSet: true} +} + +func (v NullableTemplateUpdateResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTemplateUpdateResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_template_with_builds.go b/e2b/client/model_template_with_builds.go new file mode 100644 index 0000000..6e37360 --- /dev/null +++ b/e2b/client/model_template_with_builds.go @@ -0,0 +1,347 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" +) + +// checks if the TemplateWithBuilds type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TemplateWithBuilds{} + +// TemplateWithBuilds struct for TemplateWithBuilds +type TemplateWithBuilds struct { + // Identifier of the template + TemplateID string `json:"templateID"` + // Whether the template is public or only accessible by the team + Public bool `json:"public"` + // Aliases of the template + // Deprecated + Aliases []string `json:"aliases"` + // Names of the template (namespace/alias format when namespaced) + Names []string `json:"names"` + // Time when the template was created + CreatedAt time.Time `json:"createdAt"` + // Time when the template was last updated + UpdatedAt time.Time `json:"updatedAt"` + // Time when the template was last used + LastSpawnedAt NullableTime `json:"lastSpawnedAt"` + // Number of times the template was used + SpawnCount int64 `json:"spawnCount"` + // List of builds for the template + Builds []TemplateBuild `json:"builds"` +} + +// NewTemplateWithBuilds instantiates a new TemplateWithBuilds object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTemplateWithBuilds(templateID string, public bool, aliases []string, names []string, createdAt time.Time, updatedAt time.Time, lastSpawnedAt NullableTime, spawnCount int64, builds []TemplateBuild) *TemplateWithBuilds { + this := TemplateWithBuilds{} + this.TemplateID = templateID + this.Public = public + this.Aliases = aliases + this.Names = names + this.CreatedAt = createdAt + this.UpdatedAt = updatedAt + this.LastSpawnedAt = lastSpawnedAt + this.SpawnCount = spawnCount + this.Builds = builds + return &this +} + +// NewTemplateWithBuildsWithDefaults instantiates a new TemplateWithBuilds object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTemplateWithBuildsWithDefaults() *TemplateWithBuilds { + this := TemplateWithBuilds{} + return &this +} + +// GetTemplateID returns the TemplateID field value +func (o *TemplateWithBuilds) GetTemplateID() string { + if o == nil { + var ret string + return ret + } + + return o.TemplateID +} + +// GetTemplateIDOk returns a tuple with the TemplateID field value +// and a boolean to check if the value has been set. +func (o *TemplateWithBuilds) GetTemplateIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TemplateID, true +} + +// SetTemplateID sets field value +func (o *TemplateWithBuilds) SetTemplateID(v string) { + o.TemplateID = v +} + +// GetPublic returns the Public field value +func (o *TemplateWithBuilds) GetPublic() bool { + if o == nil { + var ret bool + return ret + } + + return o.Public +} + +// GetPublicOk returns a tuple with the Public field value +// and a boolean to check if the value has been set. +func (o *TemplateWithBuilds) GetPublicOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Public, true +} + +// SetPublic sets field value +func (o *TemplateWithBuilds) SetPublic(v bool) { + o.Public = v +} + +// GetAliases returns the Aliases field value +// Deprecated +func (o *TemplateWithBuilds) GetAliases() []string { + if o == nil { + var ret []string + return ret + } + + return o.Aliases +} + +// GetAliasesOk returns a tuple with the Aliases field value +// and a boolean to check if the value has been set. +// Deprecated +func (o *TemplateWithBuilds) GetAliasesOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Aliases, true +} + +// SetAliases sets field value +// Deprecated +func (o *TemplateWithBuilds) SetAliases(v []string) { + o.Aliases = v +} + +// GetNames returns the Names field value +func (o *TemplateWithBuilds) GetNames() []string { + if o == nil { + var ret []string + return ret + } + + return o.Names +} + +// GetNamesOk returns a tuple with the Names field value +// and a boolean to check if the value has been set. +func (o *TemplateWithBuilds) GetNamesOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Names, true +} + +// SetNames sets field value +func (o *TemplateWithBuilds) SetNames(v []string) { + o.Names = v +} + +// GetCreatedAt returns the CreatedAt field value +func (o *TemplateWithBuilds) GetCreatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *TemplateWithBuilds) GetCreatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value +func (o *TemplateWithBuilds) SetCreatedAt(v time.Time) { + o.CreatedAt = v +} + +// GetUpdatedAt returns the UpdatedAt field value +func (o *TemplateWithBuilds) GetUpdatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value +// and a boolean to check if the value has been set. +func (o *TemplateWithBuilds) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.UpdatedAt, true +} + +// SetUpdatedAt sets field value +func (o *TemplateWithBuilds) SetUpdatedAt(v time.Time) { + o.UpdatedAt = v +} + +// GetLastSpawnedAt returns the LastSpawnedAt field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *TemplateWithBuilds) GetLastSpawnedAt() time.Time { + if o == nil || o.LastSpawnedAt.Get() == nil { + var ret time.Time + return ret + } + + return *o.LastSpawnedAt.Get() +} + +// GetLastSpawnedAtOk returns a tuple with the LastSpawnedAt field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *TemplateWithBuilds) GetLastSpawnedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.LastSpawnedAt.Get(), o.LastSpawnedAt.IsSet() +} + +// SetLastSpawnedAt sets field value +func (o *TemplateWithBuilds) SetLastSpawnedAt(v time.Time) { + o.LastSpawnedAt.Set(&v) +} + +// GetSpawnCount returns the SpawnCount field value +func (o *TemplateWithBuilds) GetSpawnCount() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.SpawnCount +} + +// GetSpawnCountOk returns a tuple with the SpawnCount field value +// and a boolean to check if the value has been set. +func (o *TemplateWithBuilds) GetSpawnCountOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.SpawnCount, true +} + +// SetSpawnCount sets field value +func (o *TemplateWithBuilds) SetSpawnCount(v int64) { + o.SpawnCount = v +} + +// GetBuilds returns the Builds field value +func (o *TemplateWithBuilds) GetBuilds() []TemplateBuild { + if o == nil { + var ret []TemplateBuild + return ret + } + + return o.Builds +} + +// GetBuildsOk returns a tuple with the Builds field value +// and a boolean to check if the value has been set. +func (o *TemplateWithBuilds) GetBuildsOk() ([]TemplateBuild, bool) { + if o == nil { + return nil, false + } + return o.Builds, true +} + +// SetBuilds sets field value +func (o *TemplateWithBuilds) SetBuilds(v []TemplateBuild) { + o.Builds = v +} + +func (o TemplateWithBuilds) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TemplateWithBuilds) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["templateID"] = o.TemplateID + toSerialize["public"] = o.Public + toSerialize["aliases"] = o.Aliases + toSerialize["names"] = o.Names + toSerialize["createdAt"] = o.CreatedAt + toSerialize["updatedAt"] = o.UpdatedAt + toSerialize["lastSpawnedAt"] = o.LastSpawnedAt.Get() + toSerialize["spawnCount"] = o.SpawnCount + toSerialize["builds"] = o.Builds + return toSerialize, nil +} + +type NullableTemplateWithBuilds struct { + value *TemplateWithBuilds + isSet bool +} + +func (v NullableTemplateWithBuilds) Get() *TemplateWithBuilds { + return v.value +} + +func (v *NullableTemplateWithBuilds) Set(val *TemplateWithBuilds) { + v.value = val + v.isSet = true +} + +func (v NullableTemplateWithBuilds) IsSet() bool { + return v.isSet +} + +func (v *NullableTemplateWithBuilds) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTemplateWithBuilds(val *TemplateWithBuilds) *NullableTemplateWithBuilds { + return &NullableTemplateWithBuilds{value: val, isSet: true} +} + +func (v NullableTemplateWithBuilds) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTemplateWithBuilds) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_update_team_api_key.go b/e2b/client/model_update_team_api_key.go new file mode 100644 index 0000000..731ea62 --- /dev/null +++ b/e2b/client/model_update_team_api_key.go @@ -0,0 +1,116 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the UpdateTeamAPIKey type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateTeamAPIKey{} + +// UpdateTeamAPIKey struct for UpdateTeamAPIKey +type UpdateTeamAPIKey struct { + // New name for the API key + Name string `json:"name"` +} + +// NewUpdateTeamAPIKey instantiates a new UpdateTeamAPIKey object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateTeamAPIKey(name string) *UpdateTeamAPIKey { + this := UpdateTeamAPIKey{} + this.Name = name + return &this +} + +// NewUpdateTeamAPIKeyWithDefaults instantiates a new UpdateTeamAPIKey object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateTeamAPIKeyWithDefaults() *UpdateTeamAPIKey { + this := UpdateTeamAPIKey{} + return &this +} + +// GetName returns the Name field value +func (o *UpdateTeamAPIKey) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *UpdateTeamAPIKey) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *UpdateTeamAPIKey) SetName(v string) { + o.Name = v +} + +func (o UpdateTeamAPIKey) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateTeamAPIKey) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + return toSerialize, nil +} + +type NullableUpdateTeamAPIKey struct { + value *UpdateTeamAPIKey + isSet bool +} + +func (v NullableUpdateTeamAPIKey) Get() *UpdateTeamAPIKey { + return v.value +} + +func (v *NullableUpdateTeamAPIKey) Set(val *UpdateTeamAPIKey) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateTeamAPIKey) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateTeamAPIKey) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateTeamAPIKey(val *UpdateTeamAPIKey) *NullableUpdateTeamAPIKey { + return &NullableUpdateTeamAPIKey{value: val, isSet: true} +} + +func (v NullableUpdateTeamAPIKey) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateTeamAPIKey) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/model_volume.go b/e2b/client/model_volume.go new file mode 100644 index 0000000..b1bd3a2 --- /dev/null +++ b/e2b/client/model_volume.go @@ -0,0 +1,144 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the Volume type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Volume{} + +// Volume struct for Volume +type Volume struct { + // ID of the volume + VolumeID string `json:"volumeID"` + // Name of the volume + Name string `json:"name"` +} + +// NewVolume instantiates a new Volume object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVolume(volumeID string, name string) *Volume { + this := Volume{} + this.VolumeID = volumeID + this.Name = name + return &this +} + +// NewVolumeWithDefaults instantiates a new Volume object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVolumeWithDefaults() *Volume { + this := Volume{} + return &this +} + +// GetVolumeID returns the VolumeID field value +func (o *Volume) GetVolumeID() string { + if o == nil { + var ret string + return ret + } + + return o.VolumeID +} + +// GetVolumeIDOk returns a tuple with the VolumeID field value +// and a boolean to check if the value has been set. +func (o *Volume) GetVolumeIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.VolumeID, true +} + +// SetVolumeID sets field value +func (o *Volume) SetVolumeID(v string) { + o.VolumeID = v +} + +// GetName returns the Name field value +func (o *Volume) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Volume) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *Volume) SetName(v string) { + o.Name = v +} + +func (o Volume) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Volume) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["volumeID"] = o.VolumeID + toSerialize["name"] = o.Name + return toSerialize, nil +} + +type NullableVolume struct { + value *Volume + isSet bool +} + +func (v NullableVolume) Get() *Volume { + return v.value +} + +func (v *NullableVolume) Set(val *Volume) { + v.value = val + v.isSet = true +} + +func (v NullableVolume) IsSet() bool { + return v.isSet +} + +func (v *NullableVolume) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolume(val *Volume) *NullableVolume { + return &NullableVolume{value: val, isSet: true} +} + +func (v NullableVolume) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolume) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/e2b/client/response.go b/e2b/client/response.go new file mode 100644 index 0000000..ed56552 --- /dev/null +++ b/e2b/client/response.go @@ -0,0 +1,47 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResponse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/e2b/client/utils.go b/e2b/client/utils.go new file mode 100644 index 0000000..32b2d35 --- /dev/null +++ b/e2b/client/utils.go @@ -0,0 +1,347 @@ +/* +E2B API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 0.1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return v.value.MarshalJSON() +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} diff --git a/e2b/envd/client/client.go b/e2b/envd/client/client.go new file mode 100644 index 0000000..49ac540 --- /dev/null +++ b/e2b/envd/client/client.go @@ -0,0 +1,79 @@ +package client + +import ( + "net/http" + + "github.com/openkruise/agents-api/e2b/envd/filesystem/filesystemconnect" + "github.com/openkruise/agents-api/e2b/envd/process/processconnect" +) + +// Client is a thin client that talks directly to the envd service of a single +// sandbox. It only exposes in-sandbox capabilities (Files, Commands) and is +// completely decoupled from the sandbox-management REST API. +// +// Construction is purely local; New does not perform any network call. The +// caller is expected to know the sandbox already exists and is reachable. +type Client struct { + // Commands provides command execution in the sandbox. + Commands *Commands + // Files provides filesystem operations in the sandbox. + Files *Filesystem + + sandboxID string + config *Config + envdURL string + httpClient *http.Client +} + +// New constructs an envd Client for a known sandbox ID. +// +// Typical usage: +// +// c := client.New("default--code-interpreter-xxx", +// client.WithDomain("e2b-demo-sg.example.com"), +// client.WithScheme("http"), +// ) +// out, _ := c.Commands.Run(ctx, "ls /") +func New(sandboxID string, opts ...Option) *Client { + cfg := NewConfig(opts...) + return NewWithConfig(sandboxID, cfg) +} + +// NewWithConfig is like New but takes a pre-built Config. Used by upstream +// packages (e.g. sandbox) that already have their own configuration object. +func NewWithConfig(sandboxID string, cfg *Config) *Client { + if cfg == nil { + cfg = NewConfig() + } + httpClient := &http.Client{Timeout: cfg.RequestTimeout} + envdURL := cfg.SandboxURL(sandboxID) + headers := cfg.SandboxHeaders(sandboxID) + + fsRPC := filesystemconnect.NewFilesystemClient(httpClient, envdURL) + procRPC := processconnect.NewProcessClient(httpClient, envdURL) + + return &Client{ + Commands: NewCommands(procRPC, headers), + Files: NewFilesystem(fsRPC, headers), + sandboxID: sandboxID, + config: cfg, + envdURL: envdURL, + httpClient: httpClient, + } +} + +// SandboxID returns the sandbox identifier this client is bound to. +func (c *Client) SandboxID() string { + return c.sandboxID +} + +// EnvdURL returns the resolved envd base URL for the bound sandbox. +func (c *Client) EnvdURL() string { + return c.envdURL +} + +// Config returns the underlying configuration. The returned pointer must be +// treated as read-only; mutating it does not reconfigure the client. +func (c *Client) Config() *Config { + return c.config +} diff --git a/e2b/envd/client/command_handle.go b/e2b/envd/client/command_handle.go new file mode 100644 index 0000000..a7d818d --- /dev/null +++ b/e2b/envd/client/command_handle.go @@ -0,0 +1,221 @@ +package client + +import ( + "fmt" + + "connectrpc.com/connect" + "github.com/openkruise/agents-api/e2b/envd/process" +) + +// CommandResult represents the result of a command execution. +type CommandResult struct { + Stdout string + Stderr string + ExitCode int32 + Error string +} + +// CommandExitError is returned when a command exits with a non-zero exit code. +type CommandExitError struct { + Stdout string + Stderr string + ExitCode int32 + ErrorMessage string +} + +func (e *CommandExitError) Error() string { + msg := fmt.Sprintf("command exited with code %d", e.ExitCode) + if e.ErrorMessage != "" { + msg += fmt.Sprintf(": %s", e.ErrorMessage) + } + if e.Stderr != "" { + msg += fmt.Sprintf("\nstderr: %s", e.Stderr) + } + return msg +} + +// CommandHandle provides a handle to interact with a running command. +// It abstracts over both Start and Connect server-streaming responses. +type CommandHandle struct { + pid uint32 + handleKill func() bool + stdout string + stderr string + result *CommandResult + + startStream *connect.ServerStreamForClient[process.StartResponse] + connectStream *connect.ServerStreamForClient[process.ConnectResponse] +} + +// NewCommandHandle creates a CommandHandle from a Start stream. +func NewCommandHandle( + pid uint32, + stream *connect.ServerStreamForClient[process.StartResponse], + handleKill func() bool, +) *CommandHandle { + return &CommandHandle{ + pid: pid, + startStream: stream, + handleKill: handleKill, + } +} + +// NewCommandHandleFromConnect creates a CommandHandle from a Connect stream. +func NewCommandHandleFromConnect( + pid uint32, + stream *connect.ServerStreamForClient[process.ConnectResponse], + handleKill func() bool, +) *CommandHandle { + return &CommandHandle{ + pid: pid, + connectStream: stream, + handleKill: handleKill, + } +} + +// Pid returns the process ID of the command. +func (h *CommandHandle) Pid() uint32 { + return h.pid +} + +// Wait waits for the command to finish and returns the result. +// If the command exits with a non-zero exit code, a CommandExitError is returned. +func (h *CommandHandle) Wait(onStdout func(string), onStderr func(string)) (*CommandResult, error) { + if h.startStream != nil { + return h.waitStartStream(onStdout, onStderr) + } + if h.connectStream != nil { + return h.waitConnectStream(onStdout, onStderr) + } + return nil, fmt.Errorf("no stream available") +} + +func (h *CommandHandle) waitStartStream(onStdout, onStderr func(string)) (*CommandResult, error) { + defer h.startStream.Close() + + for h.startStream.Receive() { + msg := h.startStream.Msg() + event := msg.GetEvent() + if event == nil { + continue + } + + if data := event.GetData(); data != nil { + if len(data.GetStdout()) > 0 { + out := string(data.GetStdout()) + h.stdout += out + if onStdout != nil { + onStdout(out) + } + } + if len(data.GetStderr()) > 0 { + out := string(data.GetStderr()) + h.stderr += out + if onStderr != nil { + onStderr(out) + } + } + } + + if end := event.GetEnd(); end != nil { + h.result = &CommandResult{ + Stdout: h.stdout, + Stderr: h.stderr, + ExitCode: end.GetExitCode(), + Error: end.GetError(), + } + } + } + + if err := h.startStream.Err(); err != nil { + return nil, fmt.Errorf("stream error: %w", err) + } + + if h.result == nil { + return nil, fmt.Errorf("command ended without an end event") + } + + if h.result.ExitCode != 0 { + return h.result, &CommandExitError{ + Stdout: h.result.Stdout, + Stderr: h.result.Stderr, + ExitCode: h.result.ExitCode, + ErrorMessage: h.result.Error, + } + } + + return h.result, nil +} + +func (h *CommandHandle) waitConnectStream(onStdout, onStderr func(string)) (*CommandResult, error) { + defer h.connectStream.Close() + + for h.connectStream.Receive() { + msg := h.connectStream.Msg() + event := msg.GetEvent() + if event == nil { + continue + } + + if data := event.GetData(); data != nil { + if len(data.GetStdout()) > 0 { + out := string(data.GetStdout()) + h.stdout += out + if onStdout != nil { + onStdout(out) + } + } + if len(data.GetStderr()) > 0 { + out := string(data.GetStderr()) + h.stderr += out + if onStderr != nil { + onStderr(out) + } + } + } + + if end := event.GetEnd(); end != nil { + h.result = &CommandResult{ + Stdout: h.stdout, + Stderr: h.stderr, + ExitCode: end.GetExitCode(), + Error: end.GetError(), + } + } + } + + if err := h.connectStream.Err(); err != nil { + return nil, fmt.Errorf("stream error: %w", err) + } + + if h.result == nil { + return nil, fmt.Errorf("command ended without an end event") + } + + if h.result.ExitCode != 0 { + return h.result, &CommandExitError{ + Stdout: h.result.Stdout, + Stderr: h.result.Stderr, + ExitCode: h.result.ExitCode, + ErrorMessage: h.result.Error, + } + } + + return h.result, nil +} + +// Disconnect disconnects from the command without killing it. +// You can reconnect using Commands.ConnectToProcess. +func (h *CommandHandle) Disconnect() { + if h.startStream != nil { + h.startStream.Close() + } + if h.connectStream != nil { + h.connectStream.Close() + } +} + +// Kill kills the command using SIGKILL. +func (h *CommandHandle) Kill() bool { + return h.handleKill() +} diff --git a/e2b/envd/client/commands.go b/e2b/envd/client/commands.go new file mode 100644 index 0000000..e2eb61b --- /dev/null +++ b/e2b/envd/client/commands.go @@ -0,0 +1,232 @@ +package client + +import ( + "context" + "fmt" + "net/http" + + "connectrpc.com/connect" + "github.com/openkruise/agents-api/e2b/envd/process" + "github.com/openkruise/agents-api/e2b/envd/process/processconnect" +) + +// ProcessInfo represents information about a running process. +type ProcessInfo struct { + Pid uint32 + Tag string + Cmd string + Args []string + Envs map[string]string + Cwd string +} + +// Commands provides command execution functionality in the sandbox via the +// envd Process gRPC service. +type Commands struct { + Rpc processconnect.ProcessClient + headers map[string]string +} + +// NewCommands creates a new Commands instance. +func NewCommands(rpc processconnect.ProcessClient, headers map[string]string) *Commands { + return &Commands{ + Rpc: rpc, + headers: headers, + } +} + +// List lists all running commands and PTY sessions. +func (c *Commands) List(ctx context.Context) ([]ProcessInfo, error) { + req := connect.NewRequest(&process.ListRequest{}) + c.setHeaders(req) + + resp, err := c.Rpc.List(ctx, req) + if err != nil { + return nil, fmt.Errorf("failed to list processes: %w", err) + } + + processes := make([]ProcessInfo, len(resp.Msg.Processes)) + for i, p := range resp.Msg.Processes { + info := ProcessInfo{ + Pid: p.Pid, + } + if p.Tag != nil { + info.Tag = *p.Tag + } + if p.Config != nil { + info.Cmd = p.Config.Cmd + info.Args = p.Config.Args + info.Envs = p.Config.Envs + if p.Config.Cwd != nil { + info.Cwd = *p.Config.Cwd + } + } + processes[i] = info + } + + return processes, nil +} + +// Kill kills a running command by PID using SIGKILL. +func (c *Commands) Kill(ctx context.Context, pid uint32) (bool, error) { + req := connect.NewRequest(&process.SendSignalRequest{ + Process: &process.ProcessSelector{ + Selector: &process.ProcessSelector_Pid{Pid: pid}, + }, + Signal: process.Signal_SIGNAL_SIGKILL, + }) + c.setHeaders(req) + + _, err := c.Rpc.SendSignal(ctx, req) + if err != nil { + if connectErr, ok := err.(*connect.Error); ok && connectErr.Code() == connect.CodeNotFound { + return false, nil + } + return false, fmt.Errorf("failed to kill process: %w", err) + } + + return true, nil +} + +// SendStdin sends data to a command's stdin. +func (c *Commands) SendStdin(ctx context.Context, pid uint32, data string) error { + req := connect.NewRequest(&process.SendInputRequest{ + Process: &process.ProcessSelector{ + Selector: &process.ProcessSelector_Pid{Pid: pid}, + }, + Input: &process.ProcessInput{ + Input: &process.ProcessInput_Stdin{ + Stdin: []byte(data), + }, + }, + }) + c.setHeaders(req) + + _, err := c.Rpc.SendInput(ctx, req) + if err != nil { + return fmt.Errorf("failed to send stdin: %w", err) + } + + return nil +} + +// RunOpts contains options for running a command. +type RunOpts struct { + // Envs are environment variables for the command. + Envs map[string]string + // Cwd is the working directory for the command. + Cwd string + // Stdin enables stdin for the command. + Stdin bool + // Background runs the command in the background, returning a CommandHandle. + Background bool + // OnStdout is called for each stdout chunk (foreground only). + OnStdout func(string) + // OnStderr is called for each stderr chunk (foreground only). + OnStderr func(string) +} + +// Run executes a command and waits for it to finish. +func (c *Commands) Run(ctx context.Context, cmd string, opts ...RunOpts) (*CommandResult, error) { + opt := RunOpts{} + if len(opts) > 0 { + opt = opts[0] + } + + handle, err := c.Start(ctx, cmd, opt) + if err != nil { + return nil, err + } + + return handle.Wait(opt.OnStdout, opt.OnStderr) +} + +// Start starts a command and returns a CommandHandle for interacting with it. +func (c *Commands) Start(ctx context.Context, cmd string, opts ...RunOpts) (*CommandHandle, error) { + opt := RunOpts{} + if len(opts) > 0 { + opt = opts[0] + } + + processConfig := &process.ProcessConfig{ + Cmd: "/bin/bash", + Args: []string{"-l", "-c", cmd}, + } + if opt.Cwd != "" { + cwd := opt.Cwd + processConfig.Cwd = &cwd + } + if opt.Envs != nil { + processConfig.Envs = opt.Envs + } + + req := connect.NewRequest(&process.StartRequest{ + Process: processConfig, + Stdin: &opt.Stdin, + }) + c.setHeaders(req) + + stream, err := c.Rpc.Start(ctx, req) + if err != nil { + return nil, fmt.Errorf("failed to start command: %w", err) + } + + if !stream.Receive() { + if err := stream.Err(); err != nil { + return nil, fmt.Errorf("failed to receive start event: %w", err) + } + return nil, fmt.Errorf("stream closed without start event") + } + + startEvent := stream.Msg() + if startEvent.GetEvent() == nil || startEvent.GetEvent().GetStart() == nil { + return nil, fmt.Errorf("expected start event, got: %v", startEvent) + } + + pid := startEvent.GetEvent().GetStart().GetPid() + + return NewCommandHandle(pid, stream, func() bool { + killed, _ := c.Kill(ctx, pid) + return killed + }), nil +} + +// ConnectToProcess connects to a running command by PID. +func (c *Commands) ConnectToProcess(ctx context.Context, pid uint32) (*CommandHandle, error) { + req := connect.NewRequest(&process.ConnectRequest{ + Process: &process.ProcessSelector{ + Selector: &process.ProcessSelector_Pid{Pid: pid}, + }, + }) + c.setHeaders(req) + + stream, err := c.Rpc.Connect(ctx, req) + if err != nil { + return nil, fmt.Errorf("failed to connect to process: %w", err) + } + + if !stream.Receive() { + if err := stream.Err(); err != nil { + return nil, fmt.Errorf("failed to receive connect event: %w", err) + } + return nil, fmt.Errorf("stream closed without connect event") + } + + startEvent := stream.Msg() + if startEvent.GetEvent() == nil || startEvent.GetEvent().GetStart() == nil { + return nil, fmt.Errorf("expected start event, got: %v", startEvent) + } + + actualPid := startEvent.GetEvent().GetStart().GetPid() + + return NewCommandHandleFromConnect(actualPid, stream, func() bool { + killed, _ := c.Kill(ctx, actualPid) + return killed + }), nil +} + +func (c *Commands) setHeaders(req interface{ Header() http.Header }) { + for k, v := range c.headers { + req.Header().Set(k, v) + } +} diff --git a/e2b/envd/client/config.go b/e2b/envd/client/config.go new file mode 100644 index 0000000..6175699 --- /dev/null +++ b/e2b/envd/client/config.go @@ -0,0 +1,223 @@ +// Package client provides a thin client that talks directly to the envd +// service running inside a sandbox. It only handles in-sandbox operations +// (filesystem and process), and intentionally has no dependency on the +// sandbox-management REST API. Use this when you already know the sandbox ID +// and want to operate it without going through Create/Connect first. +package client + +import ( + "fmt" + "os" + "time" +) + +const ( + defaultDomain = "e2b.app" + defaultScheme = "https" + defaultRequestTimeout = 60 * time.Second + defaultEnvdPort = 49983 + // defaultEnvdAuthHeader is the basic auth header the envd service expects + // in its default deployment ("root" with empty password). Override via + // WithAuthHeader when your deployment uses different credentials. + defaultEnvdAuthHeader = "Basic cm9vdDo=" +) + +// Config stores everything needed to address and authenticate against envd. +// +// Compared to the sandbox-management connection config, this struct is +// intentionally narrow: +// - No APIKey is needed for envd itself by default; it is kept here only as +// an optional pass-through for deployments whose ingress also enforces it. +// - No OAuth access token, no API base URL, no debug toggle. +type Config struct { + // Domain is the base domain envd is served from. Default: "e2b.app". + Domain string + // Scheme is the URL scheme: "https" (default) or "http". + Scheme string + // EnvdPort is the port envd listens on inside the sandbox. + EnvdPort int + // RuntimeToken is the token used to authenticate with the runtime. + RuntimeToken string + + // SandboxBaseURL, when non-empty, fully overrides Protocol/Domain based + // URL composition. The final envd URL is "/". + SandboxBaseURL string + + // AuthHeader is the value sent in the "Authorization" header to envd. + // Defaults to "Basic cm9vdDo=" (root with empty password) which matches + // the stock envd deployment. + AuthHeader string + // APIKey, when non-empty, is sent as "X-API-Key" header. Only useful when + // the ingress in front of envd also validates this header. + APIKey string + // Headers contains additional headers to send with every envd request. + Headers map[string]string + + // RequestTimeout is the timeout applied to the underlying HTTP client. + RequestTimeout time.Duration +} + +// Option configures a Config via the functional-options pattern. +type Option func(*Config) + +// NewConfig builds a Config with defaults, environment-variable fallback and +// then user-supplied options applied in that order. +// +// Environment variables consumed: +// +// E2B_DOMAIN -> Domain +// E2B_SCHEME -> Scheme +// E2B_API_KEY -> APIKey (optional pass-through) +func NewConfig(opts ...Option) *Config { + cfg := &Config{ + Domain: defaultDomain, + Scheme: defaultScheme, + EnvdPort: defaultEnvdPort, + AuthHeader: defaultEnvdAuthHeader, + Headers: make(map[string]string), + RequestTimeout: defaultRequestTimeout, + } + + if v := os.Getenv("E2B_DOMAIN"); v != "" { + cfg.Domain = v + } + if v := os.Getenv("E2B_SCHEME"); v != "" { + cfg.Scheme = v + } + if v := os.Getenv("E2B_API_KEY"); v != "" { + cfg.APIKey = v + } + + for _, opt := range opts { + opt(cfg) + } + return cfg +} + +// WithDomain sets the envd domain. +func WithDomain(domain string) Option { + return func(c *Config) { c.Domain = domain } +} + +// WithScheme sets the URL scheme ("https" or "http"). +func WithScheme(scheme string) Option { + return func(c *Config) { c.Scheme = scheme } +} + +// WithEnvdPort sets a custom envd port. +func WithEnvdPort(port int) Option { + return func(c *Config) { c.EnvdPort = port } +} + +// WithRuntimeToken sets a runtimeToken. +func WithRuntimeToken(runtimeToken string) Option { + return func(c *Config) { c.RuntimeToken = runtimeToken } +} + +// WithSandboxBaseURL fully overrides URL composition. +func WithSandboxBaseURL(url string) Option { + return func(c *Config) { c.SandboxBaseURL = url } +} + +// WithAuthHeader overrides the default envd Authorization header. +func WithAuthHeader(header string) Option { + return func(c *Config) { c.AuthHeader = header } +} + +// WithAPIKey sets the optional X-API-Key header value. +func WithAPIKey(apiKey string) Option { + return func(c *Config) { c.APIKey = apiKey } +} + +// WithHeader adds (or overrides) a single custom header. +func WithHeader(key, value string) Option { + return func(c *Config) { + if c.Headers == nil { + c.Headers = make(map[string]string) + } + c.Headers[key] = value + } +} + +// WithHeaders merges a map of custom headers. +func WithHeaders(headers map[string]string) Option { + return func(c *Config) { + if c.Headers == nil { + c.Headers = make(map[string]string) + } + for k, v := range headers { + c.Headers[k] = v + } + } +} + +// WithRequestTimeout sets the HTTP client timeout. +func WithRequestTimeout(d time.Duration) Option { + return func(c *Config) { c.RequestTimeout = d } +} + +// WithConfig replaces the working Config with a pre-built one. Useful when an +// upstream package (e.g. sandbox) wants to forward an already-prepared Config. +func WithConfig(cfg *Config) Option { + return func(c *Config) { + if cfg == nil { + return + } + *c = *cfg + // Defensive copy of the headers map so callers cannot mutate ours. + if cfg.Headers != nil { + c.Headers = make(map[string]string, len(cfg.Headers)) + for k, v := range cfg.Headers { + c.Headers[k] = v + } + } + } +} + +// SandboxURL returns the envd base URL for a given sandbox ID. +// +// When SandboxBaseURL is set (e.g. pre-computed by the higher-level sandbox +// package which understands Protocol routing), it is returned as-is because +// the caller has already embedded the sandbox identity in it. +// +// Otherwise the URL is composed as :// — the direct-connect +// mode used by the envd client which has no notion of Protocol-based routing. +func (c *Config) SandboxURL(sandboxID string) string { + if c.SandboxBaseURL != "" { + return c.SandboxBaseURL + } + return fmt.Sprintf("%s://%s", c.scheme(), c.Domain) +} + +// SandboxHeaders builds the headers map sent with every envd request for sandboxID. +func (c *Config) SandboxHeaders(sandboxID string) map[string]string { + headers := make(map[string]string, 4+len(c.Headers)) + + auth := c.AuthHeader + if auth == "" { + auth = defaultEnvdAuthHeader + } + headers["Authorization"] = auth + + if c.APIKey != "" { + headers["X-API-Key"] = c.APIKey + } + + if c.RuntimeToken != "" { + headers["X-Access-Token"] = c.RuntimeToken + } + headers["e2b-sandbox-id"] = sandboxID + headers["e2b-sandbox-port"] = fmt.Sprintf("%d", c.EnvdPort) + + for k, v := range c.Headers { + headers[k] = v + } + return headers +} + +func (c *Config) scheme() string { + if c.Scheme != "" { + return c.Scheme + } + return defaultScheme +} diff --git a/e2b/envd/client/filesystem.go b/e2b/envd/client/filesystem.go new file mode 100644 index 0000000..7c1abdc --- /dev/null +++ b/e2b/envd/client/filesystem.go @@ -0,0 +1,199 @@ +package client + +import ( + "context" + "fmt" + "net/http" + "time" + + "connectrpc.com/connect" + "github.com/openkruise/agents-api/e2b/envd/filesystem" + "github.com/openkruise/agents-api/e2b/envd/filesystem/filesystemconnect" +) + +// EntryType represents the type of a filesystem entry. +type EntryType string + +const ( + EntryTypeFile EntryType = "file" + EntryTypeDir EntryType = "directory" + EntryTypeSymlink EntryType = "symlink" +) + +// EntryInfo represents information about a filesystem entry. +type EntryInfo struct { + Name string + Type EntryType + Path string + Size int64 + Mode uint32 + Permissions string + Owner string + Group string + ModifiedTime time.Time + SymlinkTarget *string +} + +// Filesystem provides filesystem operations in the sandbox over the official +// envd Filesystem gRPC service. +type Filesystem struct { + Rpc filesystemconnect.FilesystemClient + headers map[string]string +} + +// NewFilesystem creates a new Filesystem instance backed by the envd gRPC client. +func NewFilesystem(rpc filesystemconnect.FilesystemClient, headers map[string]string) *Filesystem { + return &Filesystem{ + Rpc: rpc, + headers: headers, + } +} + +// List lists entries in a directory. +func (f *Filesystem) List(ctx context.Context, path string, depth ...int32) ([]EntryInfo, error) { + d := uint32(1) + if len(depth) > 0 && depth[0] >= 1 { + d = uint32(depth[0]) + } + + req := connect.NewRequest(&filesystem.ListDirRequest{ + Path: path, + Depth: d, + }) + f.setRPCHeaders(req) + + resp, err := f.Rpc.ListDir(ctx, req) + if err != nil { + return nil, fmt.Errorf("failed to list directory: %w", err) + } + + entries := make([]EntryInfo, 0, len(resp.Msg.Entries)) + for _, entry := range resp.Msg.Entries { + entryType := mapFileType(entry.Type) + if entryType == "" { + continue + } + entries = append(entries, convertEntryInfo(entry)) + } + + return entries, nil +} + +// Exists checks if a file or directory exists. +func (f *Filesystem) Exists(ctx context.Context, path string) (bool, error) { + req := connect.NewRequest(&filesystem.StatRequest{Path: path}) + f.setRPCHeaders(req) + + _, err := f.Rpc.Stat(ctx, req) + if err != nil { + if connectErr, ok := err.(*connect.Error); ok && connectErr.Code() == connect.CodeNotFound { + return false, nil + } + return false, fmt.Errorf("failed to check existence: %w", err) + } + + return true, nil +} + +// GetInfo returns information about a file or directory. +func (f *Filesystem) GetInfo(ctx context.Context, path string) (*EntryInfo, error) { + req := connect.NewRequest(&filesystem.StatRequest{Path: path}) + f.setRPCHeaders(req) + + resp, err := f.Rpc.Stat(ctx, req) + if err != nil { + return nil, fmt.Errorf("failed to get file info: %w", err) + } + + info := convertEntryInfo(resp.Msg.Entry) + return &info, nil +} + +// Remove removes a file or directory. +func (f *Filesystem) Remove(ctx context.Context, path string) error { + req := connect.NewRequest(&filesystem.RemoveRequest{Path: path}) + f.setRPCHeaders(req) + + _, err := f.Rpc.Remove(ctx, req) + if err != nil { + return fmt.Errorf("failed to remove: %w", err) + } + + return nil +} + +// Rename renames/moves a file or directory. +func (f *Filesystem) Rename(ctx context.Context, oldPath, newPath string) (*EntryInfo, error) { + req := connect.NewRequest(&filesystem.MoveRequest{ + Source: oldPath, + Destination: newPath, + }) + f.setRPCHeaders(req) + + resp, err := f.Rpc.Move(ctx, req) + if err != nil { + return nil, fmt.Errorf("failed to rename: %w", err) + } + + info := convertEntryInfo(resp.Msg.Entry) + return &info, nil +} + +// MakeDir creates a new directory (and all parent directories if needed). +func (f *Filesystem) MakeDir(ctx context.Context, path string) (bool, error) { + req := connect.NewRequest(&filesystem.MakeDirRequest{Path: path}) + f.setRPCHeaders(req) + + _, err := f.Rpc.MakeDir(ctx, req) + if err != nil { + if connectErr, ok := err.(*connect.Error); ok && connectErr.Code() == connect.CodeAlreadyExists { + return false, nil + } + return false, fmt.Errorf("failed to make directory: %w", err) + } + + return true, nil +} + +func mapFileType(ft filesystem.FileType) EntryType { + switch ft { + case filesystem.FileType_FILE_TYPE_FILE: + return EntryTypeFile + case filesystem.FileType_FILE_TYPE_DIRECTORY: + return EntryTypeDir + case filesystem.FileType_FILE_TYPE_SYMLINK: + return EntryTypeSymlink + default: + return "" + } +} + +func convertEntryInfo(entry *filesystem.EntryInfo) EntryInfo { + info := EntryInfo{ + Name: entry.Name, + Type: mapFileType(entry.Type), + Path: entry.Path, + Size: entry.Size, + Mode: entry.Mode, + Permissions: entry.Permissions, + Owner: entry.Owner, + Group: entry.Group, + } + + if entry.ModifiedTime != nil { + info.ModifiedTime = entry.ModifiedTime.AsTime() + } + + if entry.SymlinkTarget != nil { + target := *entry.SymlinkTarget + info.SymlinkTarget = &target + } + + return info +} + +func (f *Filesystem) setRPCHeaders(req interface{ Header() http.Header }) { + for k, v := range f.headers { + req.Header().Set(k, v) + } +} diff --git a/e2b/envd/filesystem/filesystem.pb.go b/e2b/envd/filesystem/filesystem.pb.go new file mode 100644 index 0000000..7ee107f --- /dev/null +++ b/e2b/envd/filesystem/filesystem.pb.go @@ -0,0 +1,1847 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: filesystem/filesystem.proto + +package filesystem + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type FileType int32 + +const ( + FileType_FILE_TYPE_UNSPECIFIED FileType = 0 + FileType_FILE_TYPE_FILE FileType = 1 + FileType_FILE_TYPE_DIRECTORY FileType = 2 + FileType_FILE_TYPE_SYMLINK FileType = 3 +) + +// Enum value maps for FileType. +var ( + FileType_name = map[int32]string{ + 0: "FILE_TYPE_UNSPECIFIED", + 1: "FILE_TYPE_FILE", + 2: "FILE_TYPE_DIRECTORY", + 3: "FILE_TYPE_SYMLINK", + } + FileType_value = map[string]int32{ + "FILE_TYPE_UNSPECIFIED": 0, + "FILE_TYPE_FILE": 1, + "FILE_TYPE_DIRECTORY": 2, + "FILE_TYPE_SYMLINK": 3, + } +) + +func (x FileType) Enum() *FileType { + p := new(FileType) + *p = x + return p +} + +func (x FileType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (FileType) Descriptor() protoreflect.EnumDescriptor { + return file_filesystem_filesystem_proto_enumTypes[0].Descriptor() +} + +func (FileType) Type() protoreflect.EnumType { + return &file_filesystem_filesystem_proto_enumTypes[0] +} + +func (x FileType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use FileType.Descriptor instead. +func (FileType) EnumDescriptor() ([]byte, []int) { + return file_filesystem_filesystem_proto_rawDescGZIP(), []int{0} +} + +type EventType int32 + +const ( + EventType_EVENT_TYPE_UNSPECIFIED EventType = 0 + EventType_EVENT_TYPE_CREATE EventType = 1 + EventType_EVENT_TYPE_WRITE EventType = 2 + EventType_EVENT_TYPE_REMOVE EventType = 3 + EventType_EVENT_TYPE_RENAME EventType = 4 + EventType_EVENT_TYPE_CHMOD EventType = 5 +) + +// Enum value maps for EventType. +var ( + EventType_name = map[int32]string{ + 0: "EVENT_TYPE_UNSPECIFIED", + 1: "EVENT_TYPE_CREATE", + 2: "EVENT_TYPE_WRITE", + 3: "EVENT_TYPE_REMOVE", + 4: "EVENT_TYPE_RENAME", + 5: "EVENT_TYPE_CHMOD", + } + EventType_value = map[string]int32{ + "EVENT_TYPE_UNSPECIFIED": 0, + "EVENT_TYPE_CREATE": 1, + "EVENT_TYPE_WRITE": 2, + "EVENT_TYPE_REMOVE": 3, + "EVENT_TYPE_RENAME": 4, + "EVENT_TYPE_CHMOD": 5, + } +) + +func (x EventType) Enum() *EventType { + p := new(EventType) + *p = x + return p +} + +func (x EventType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (EventType) Descriptor() protoreflect.EnumDescriptor { + return file_filesystem_filesystem_proto_enumTypes[1].Descriptor() +} + +func (EventType) Type() protoreflect.EnumType { + return &file_filesystem_filesystem_proto_enumTypes[1] +} + +func (x EventType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use EventType.Descriptor instead. +func (EventType) EnumDescriptor() ([]byte, []int) { + return file_filesystem_filesystem_proto_rawDescGZIP(), []int{1} +} + +type MoveRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Source string `protobuf:"bytes,1,opt,name=source,proto3" json:"source,omitempty"` + Destination string `protobuf:"bytes,2,opt,name=destination,proto3" json:"destination,omitempty"` +} + +func (x *MoveRequest) Reset() { + *x = MoveRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_filesystem_filesystem_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MoveRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MoveRequest) ProtoMessage() {} + +func (x *MoveRequest) ProtoReflect() protoreflect.Message { + mi := &file_filesystem_filesystem_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MoveRequest.ProtoReflect.Descriptor instead. +func (*MoveRequest) Descriptor() ([]byte, []int) { + return file_filesystem_filesystem_proto_rawDescGZIP(), []int{0} +} + +func (x *MoveRequest) GetSource() string { + if x != nil { + return x.Source + } + return "" +} + +func (x *MoveRequest) GetDestination() string { + if x != nil { + return x.Destination + } + return "" +} + +type MoveResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Entry *EntryInfo `protobuf:"bytes,1,opt,name=entry,proto3" json:"entry,omitempty"` +} + +func (x *MoveResponse) Reset() { + *x = MoveResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_filesystem_filesystem_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MoveResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MoveResponse) ProtoMessage() {} + +func (x *MoveResponse) ProtoReflect() protoreflect.Message { + mi := &file_filesystem_filesystem_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MoveResponse.ProtoReflect.Descriptor instead. +func (*MoveResponse) Descriptor() ([]byte, []int) { + return file_filesystem_filesystem_proto_rawDescGZIP(), []int{1} +} + +func (x *MoveResponse) GetEntry() *EntryInfo { + if x != nil { + return x.Entry + } + return nil +} + +type MakeDirRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` +} + +func (x *MakeDirRequest) Reset() { + *x = MakeDirRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_filesystem_filesystem_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MakeDirRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MakeDirRequest) ProtoMessage() {} + +func (x *MakeDirRequest) ProtoReflect() protoreflect.Message { + mi := &file_filesystem_filesystem_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MakeDirRequest.ProtoReflect.Descriptor instead. +func (*MakeDirRequest) Descriptor() ([]byte, []int) { + return file_filesystem_filesystem_proto_rawDescGZIP(), []int{2} +} + +func (x *MakeDirRequest) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +type MakeDirResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Entry *EntryInfo `protobuf:"bytes,1,opt,name=entry,proto3" json:"entry,omitempty"` +} + +func (x *MakeDirResponse) Reset() { + *x = MakeDirResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_filesystem_filesystem_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MakeDirResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MakeDirResponse) ProtoMessage() {} + +func (x *MakeDirResponse) ProtoReflect() protoreflect.Message { + mi := &file_filesystem_filesystem_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MakeDirResponse.ProtoReflect.Descriptor instead. +func (*MakeDirResponse) Descriptor() ([]byte, []int) { + return file_filesystem_filesystem_proto_rawDescGZIP(), []int{3} +} + +func (x *MakeDirResponse) GetEntry() *EntryInfo { + if x != nil { + return x.Entry + } + return nil +} + +type RemoveRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` +} + +func (x *RemoveRequest) Reset() { + *x = RemoveRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_filesystem_filesystem_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveRequest) ProtoMessage() {} + +func (x *RemoveRequest) ProtoReflect() protoreflect.Message { + mi := &file_filesystem_filesystem_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveRequest.ProtoReflect.Descriptor instead. +func (*RemoveRequest) Descriptor() ([]byte, []int) { + return file_filesystem_filesystem_proto_rawDescGZIP(), []int{4} +} + +func (x *RemoveRequest) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +type RemoveResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *RemoveResponse) Reset() { + *x = RemoveResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_filesystem_filesystem_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveResponse) ProtoMessage() {} + +func (x *RemoveResponse) ProtoReflect() protoreflect.Message { + mi := &file_filesystem_filesystem_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveResponse.ProtoReflect.Descriptor instead. +func (*RemoveResponse) Descriptor() ([]byte, []int) { + return file_filesystem_filesystem_proto_rawDescGZIP(), []int{5} +} + +type StatRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` +} + +func (x *StatRequest) Reset() { + *x = StatRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_filesystem_filesystem_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StatRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatRequest) ProtoMessage() {} + +func (x *StatRequest) ProtoReflect() protoreflect.Message { + mi := &file_filesystem_filesystem_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StatRequest.ProtoReflect.Descriptor instead. +func (*StatRequest) Descriptor() ([]byte, []int) { + return file_filesystem_filesystem_proto_rawDescGZIP(), []int{6} +} + +func (x *StatRequest) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +type StatResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Entry *EntryInfo `protobuf:"bytes,1,opt,name=entry,proto3" json:"entry,omitempty"` +} + +func (x *StatResponse) Reset() { + *x = StatResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_filesystem_filesystem_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StatResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatResponse) ProtoMessage() {} + +func (x *StatResponse) ProtoReflect() protoreflect.Message { + mi := &file_filesystem_filesystem_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StatResponse.ProtoReflect.Descriptor instead. +func (*StatResponse) Descriptor() ([]byte, []int) { + return file_filesystem_filesystem_proto_rawDescGZIP(), []int{7} +} + +func (x *StatResponse) GetEntry() *EntryInfo { + if x != nil { + return x.Entry + } + return nil +} + +type EntryInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Type FileType `protobuf:"varint,2,opt,name=type,proto3,enum=filesystem.FileType" json:"type,omitempty"` + Path string `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"` + Size int64 `protobuf:"varint,4,opt,name=size,proto3" json:"size,omitempty"` + Mode uint32 `protobuf:"varint,5,opt,name=mode,proto3" json:"mode,omitempty"` + Permissions string `protobuf:"bytes,6,opt,name=permissions,proto3" json:"permissions,omitempty"` + Owner string `protobuf:"bytes,7,opt,name=owner,proto3" json:"owner,omitempty"` + Group string `protobuf:"bytes,8,opt,name=group,proto3" json:"group,omitempty"` + ModifiedTime *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=modified_time,json=modifiedTime,proto3" json:"modified_time,omitempty"` + // If the entry is a symlink, this field contains the target of the symlink. + SymlinkTarget *string `protobuf:"bytes,10,opt,name=symlink_target,json=symlinkTarget,proto3,oneof" json:"symlink_target,omitempty"` +} + +func (x *EntryInfo) Reset() { + *x = EntryInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_filesystem_filesystem_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EntryInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EntryInfo) ProtoMessage() {} + +func (x *EntryInfo) ProtoReflect() protoreflect.Message { + mi := &file_filesystem_filesystem_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EntryInfo.ProtoReflect.Descriptor instead. +func (*EntryInfo) Descriptor() ([]byte, []int) { + return file_filesystem_filesystem_proto_rawDescGZIP(), []int{8} +} + +func (x *EntryInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *EntryInfo) GetType() FileType { + if x != nil { + return x.Type + } + return FileType_FILE_TYPE_UNSPECIFIED +} + +func (x *EntryInfo) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *EntryInfo) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *EntryInfo) GetMode() uint32 { + if x != nil { + return x.Mode + } + return 0 +} + +func (x *EntryInfo) GetPermissions() string { + if x != nil { + return x.Permissions + } + return "" +} + +func (x *EntryInfo) GetOwner() string { + if x != nil { + return x.Owner + } + return "" +} + +func (x *EntryInfo) GetGroup() string { + if x != nil { + return x.Group + } + return "" +} + +func (x *EntryInfo) GetModifiedTime() *timestamppb.Timestamp { + if x != nil { + return x.ModifiedTime + } + return nil +} + +func (x *EntryInfo) GetSymlinkTarget() string { + if x != nil && x.SymlinkTarget != nil { + return *x.SymlinkTarget + } + return "" +} + +type ListDirRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + Depth uint32 `protobuf:"varint,2,opt,name=depth,proto3" json:"depth,omitempty"` +} + +func (x *ListDirRequest) Reset() { + *x = ListDirRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_filesystem_filesystem_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListDirRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListDirRequest) ProtoMessage() {} + +func (x *ListDirRequest) ProtoReflect() protoreflect.Message { + mi := &file_filesystem_filesystem_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListDirRequest.ProtoReflect.Descriptor instead. +func (*ListDirRequest) Descriptor() ([]byte, []int) { + return file_filesystem_filesystem_proto_rawDescGZIP(), []int{9} +} + +func (x *ListDirRequest) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *ListDirRequest) GetDepth() uint32 { + if x != nil { + return x.Depth + } + return 0 +} + +type ListDirResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Entries []*EntryInfo `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"` +} + +func (x *ListDirResponse) Reset() { + *x = ListDirResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_filesystem_filesystem_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListDirResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListDirResponse) ProtoMessage() {} + +func (x *ListDirResponse) ProtoReflect() protoreflect.Message { + mi := &file_filesystem_filesystem_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListDirResponse.ProtoReflect.Descriptor instead. +func (*ListDirResponse) Descriptor() ([]byte, []int) { + return file_filesystem_filesystem_proto_rawDescGZIP(), []int{10} +} + +func (x *ListDirResponse) GetEntries() []*EntryInfo { + if x != nil { + return x.Entries + } + return nil +} + +type WatchDirRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + Recursive bool `protobuf:"varint,2,opt,name=recursive,proto3" json:"recursive,omitempty"` +} + +func (x *WatchDirRequest) Reset() { + *x = WatchDirRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_filesystem_filesystem_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WatchDirRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WatchDirRequest) ProtoMessage() {} + +func (x *WatchDirRequest) ProtoReflect() protoreflect.Message { + mi := &file_filesystem_filesystem_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WatchDirRequest.ProtoReflect.Descriptor instead. +func (*WatchDirRequest) Descriptor() ([]byte, []int) { + return file_filesystem_filesystem_proto_rawDescGZIP(), []int{11} +} + +func (x *WatchDirRequest) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *WatchDirRequest) GetRecursive() bool { + if x != nil { + return x.Recursive + } + return false +} + +type FilesystemEvent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Type EventType `protobuf:"varint,2,opt,name=type,proto3,enum=filesystem.EventType" json:"type,omitempty"` +} + +func (x *FilesystemEvent) Reset() { + *x = FilesystemEvent{} + if protoimpl.UnsafeEnabled { + mi := &file_filesystem_filesystem_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FilesystemEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FilesystemEvent) ProtoMessage() {} + +func (x *FilesystemEvent) ProtoReflect() protoreflect.Message { + mi := &file_filesystem_filesystem_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FilesystemEvent.ProtoReflect.Descriptor instead. +func (*FilesystemEvent) Descriptor() ([]byte, []int) { + return file_filesystem_filesystem_proto_rawDescGZIP(), []int{12} +} + +func (x *FilesystemEvent) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *FilesystemEvent) GetType() EventType { + if x != nil { + return x.Type + } + return EventType_EVENT_TYPE_UNSPECIFIED +} + +type WatchDirResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Event: + // + // *WatchDirResponse_Start + // *WatchDirResponse_Filesystem + // *WatchDirResponse_Keepalive + Event isWatchDirResponse_Event `protobuf_oneof:"event"` +} + +func (x *WatchDirResponse) Reset() { + *x = WatchDirResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_filesystem_filesystem_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WatchDirResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WatchDirResponse) ProtoMessage() {} + +func (x *WatchDirResponse) ProtoReflect() protoreflect.Message { + mi := &file_filesystem_filesystem_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WatchDirResponse.ProtoReflect.Descriptor instead. +func (*WatchDirResponse) Descriptor() ([]byte, []int) { + return file_filesystem_filesystem_proto_rawDescGZIP(), []int{13} +} + +func (m *WatchDirResponse) GetEvent() isWatchDirResponse_Event { + if m != nil { + return m.Event + } + return nil +} + +func (x *WatchDirResponse) GetStart() *WatchDirResponse_StartEvent { + if x, ok := x.GetEvent().(*WatchDirResponse_Start); ok { + return x.Start + } + return nil +} + +func (x *WatchDirResponse) GetFilesystem() *FilesystemEvent { + if x, ok := x.GetEvent().(*WatchDirResponse_Filesystem); ok { + return x.Filesystem + } + return nil +} + +func (x *WatchDirResponse) GetKeepalive() *WatchDirResponse_KeepAlive { + if x, ok := x.GetEvent().(*WatchDirResponse_Keepalive); ok { + return x.Keepalive + } + return nil +} + +type isWatchDirResponse_Event interface { + isWatchDirResponse_Event() +} + +type WatchDirResponse_Start struct { + Start *WatchDirResponse_StartEvent `protobuf:"bytes,1,opt,name=start,proto3,oneof"` +} + +type WatchDirResponse_Filesystem struct { + Filesystem *FilesystemEvent `protobuf:"bytes,2,opt,name=filesystem,proto3,oneof"` +} + +type WatchDirResponse_Keepalive struct { + Keepalive *WatchDirResponse_KeepAlive `protobuf:"bytes,3,opt,name=keepalive,proto3,oneof"` +} + +func (*WatchDirResponse_Start) isWatchDirResponse_Event() {} + +func (*WatchDirResponse_Filesystem) isWatchDirResponse_Event() {} + +func (*WatchDirResponse_Keepalive) isWatchDirResponse_Event() {} + +type CreateWatcherRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + Recursive bool `protobuf:"varint,2,opt,name=recursive,proto3" json:"recursive,omitempty"` +} + +func (x *CreateWatcherRequest) Reset() { + *x = CreateWatcherRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_filesystem_filesystem_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateWatcherRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateWatcherRequest) ProtoMessage() {} + +func (x *CreateWatcherRequest) ProtoReflect() protoreflect.Message { + mi := &file_filesystem_filesystem_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateWatcherRequest.ProtoReflect.Descriptor instead. +func (*CreateWatcherRequest) Descriptor() ([]byte, []int) { + return file_filesystem_filesystem_proto_rawDescGZIP(), []int{14} +} + +func (x *CreateWatcherRequest) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *CreateWatcherRequest) GetRecursive() bool { + if x != nil { + return x.Recursive + } + return false +} + +type CreateWatcherResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + WatcherId string `protobuf:"bytes,1,opt,name=watcher_id,json=watcherId,proto3" json:"watcher_id,omitempty"` +} + +func (x *CreateWatcherResponse) Reset() { + *x = CreateWatcherResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_filesystem_filesystem_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateWatcherResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateWatcherResponse) ProtoMessage() {} + +func (x *CreateWatcherResponse) ProtoReflect() protoreflect.Message { + mi := &file_filesystem_filesystem_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateWatcherResponse.ProtoReflect.Descriptor instead. +func (*CreateWatcherResponse) Descriptor() ([]byte, []int) { + return file_filesystem_filesystem_proto_rawDescGZIP(), []int{15} +} + +func (x *CreateWatcherResponse) GetWatcherId() string { + if x != nil { + return x.WatcherId + } + return "" +} + +type GetWatcherEventsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + WatcherId string `protobuf:"bytes,1,opt,name=watcher_id,json=watcherId,proto3" json:"watcher_id,omitempty"` +} + +func (x *GetWatcherEventsRequest) Reset() { + *x = GetWatcherEventsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_filesystem_filesystem_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetWatcherEventsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetWatcherEventsRequest) ProtoMessage() {} + +func (x *GetWatcherEventsRequest) ProtoReflect() protoreflect.Message { + mi := &file_filesystem_filesystem_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetWatcherEventsRequest.ProtoReflect.Descriptor instead. +func (*GetWatcherEventsRequest) Descriptor() ([]byte, []int) { + return file_filesystem_filesystem_proto_rawDescGZIP(), []int{16} +} + +func (x *GetWatcherEventsRequest) GetWatcherId() string { + if x != nil { + return x.WatcherId + } + return "" +} + +type GetWatcherEventsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Events []*FilesystemEvent `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"` +} + +func (x *GetWatcherEventsResponse) Reset() { + *x = GetWatcherEventsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_filesystem_filesystem_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetWatcherEventsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetWatcherEventsResponse) ProtoMessage() {} + +func (x *GetWatcherEventsResponse) ProtoReflect() protoreflect.Message { + mi := &file_filesystem_filesystem_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetWatcherEventsResponse.ProtoReflect.Descriptor instead. +func (*GetWatcherEventsResponse) Descriptor() ([]byte, []int) { + return file_filesystem_filesystem_proto_rawDescGZIP(), []int{17} +} + +func (x *GetWatcherEventsResponse) GetEvents() []*FilesystemEvent { + if x != nil { + return x.Events + } + return nil +} + +type RemoveWatcherRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + WatcherId string `protobuf:"bytes,1,opt,name=watcher_id,json=watcherId,proto3" json:"watcher_id,omitempty"` +} + +func (x *RemoveWatcherRequest) Reset() { + *x = RemoveWatcherRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_filesystem_filesystem_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveWatcherRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveWatcherRequest) ProtoMessage() {} + +func (x *RemoveWatcherRequest) ProtoReflect() protoreflect.Message { + mi := &file_filesystem_filesystem_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveWatcherRequest.ProtoReflect.Descriptor instead. +func (*RemoveWatcherRequest) Descriptor() ([]byte, []int) { + return file_filesystem_filesystem_proto_rawDescGZIP(), []int{18} +} + +func (x *RemoveWatcherRequest) GetWatcherId() string { + if x != nil { + return x.WatcherId + } + return "" +} + +type RemoveWatcherResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *RemoveWatcherResponse) Reset() { + *x = RemoveWatcherResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_filesystem_filesystem_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveWatcherResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveWatcherResponse) ProtoMessage() {} + +func (x *RemoveWatcherResponse) ProtoReflect() protoreflect.Message { + mi := &file_filesystem_filesystem_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveWatcherResponse.ProtoReflect.Descriptor instead. +func (*RemoveWatcherResponse) Descriptor() ([]byte, []int) { + return file_filesystem_filesystem_proto_rawDescGZIP(), []int{19} +} + +type WatchDirResponse_StartEvent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *WatchDirResponse_StartEvent) Reset() { + *x = WatchDirResponse_StartEvent{} + if protoimpl.UnsafeEnabled { + mi := &file_filesystem_filesystem_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WatchDirResponse_StartEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WatchDirResponse_StartEvent) ProtoMessage() {} + +func (x *WatchDirResponse_StartEvent) ProtoReflect() protoreflect.Message { + mi := &file_filesystem_filesystem_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WatchDirResponse_StartEvent.ProtoReflect.Descriptor instead. +func (*WatchDirResponse_StartEvent) Descriptor() ([]byte, []int) { + return file_filesystem_filesystem_proto_rawDescGZIP(), []int{13, 0} +} + +type WatchDirResponse_KeepAlive struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *WatchDirResponse_KeepAlive) Reset() { + *x = WatchDirResponse_KeepAlive{} + if protoimpl.UnsafeEnabled { + mi := &file_filesystem_filesystem_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WatchDirResponse_KeepAlive) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WatchDirResponse_KeepAlive) ProtoMessage() {} + +func (x *WatchDirResponse_KeepAlive) ProtoReflect() protoreflect.Message { + mi := &file_filesystem_filesystem_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WatchDirResponse_KeepAlive.ProtoReflect.Descriptor instead. +func (*WatchDirResponse_KeepAlive) Descriptor() ([]byte, []int) { + return file_filesystem_filesystem_proto_rawDescGZIP(), []int{13, 1} +} + +var File_filesystem_filesystem_proto protoreflect.FileDescriptor + +var file_filesystem_filesystem_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x66, 0x69, 0x6c, + 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x66, + 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x47, 0x0a, 0x0b, 0x4d, 0x6f, + 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x22, 0x3b, 0x0a, 0x0c, 0x4d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x72, 0x79, + 0x22, 0x24, 0x0a, 0x0e, 0x4d, 0x61, 0x6b, 0x65, 0x44, 0x69, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0x3e, 0x0a, 0x0f, 0x4d, 0x61, 0x6b, 0x65, 0x44, 0x69, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x65, 0x6e, 0x74, + 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, + 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x52, + 0x05, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x22, 0x23, 0x0a, 0x0d, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0x10, 0x0a, 0x0e, 0x52, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, 0x0a, + 0x0b, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, + 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, + 0x22, 0x3b, 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x2b, 0x0a, 0x05, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x15, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x22, 0xd3, 0x02, + 0x0a, 0x09, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x28, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, + 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x54, + 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, + 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x12, 0x0a, + 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x65, 0x72, 0x6d, + 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x14, 0x0a, + 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x67, 0x72, + 0x6f, 0x75, 0x70, 0x12, 0x3f, 0x0a, 0x0d, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x5f, + 0x74, 0x69, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0c, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, + 0x54, 0x69, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x0e, 0x73, 0x79, 0x6d, 0x6c, 0x69, 0x6e, 0x6b, 0x5f, + 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0d, + 0x73, 0x79, 0x6d, 0x6c, 0x69, 0x6e, 0x6b, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x88, 0x01, 0x01, + 0x42, 0x11, 0x0a, 0x0f, 0x5f, 0x73, 0x79, 0x6d, 0x6c, 0x69, 0x6e, 0x6b, 0x5f, 0x74, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x22, 0x3a, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x69, 0x72, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x70, + 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x64, 0x65, 0x70, 0x74, 0x68, 0x22, + 0x42, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x69, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, + 0x2e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x07, 0x65, 0x6e, 0x74, 0x72, + 0x69, 0x65, 0x73, 0x22, 0x43, 0x0a, 0x0f, 0x57, 0x61, 0x74, 0x63, 0x68, 0x44, 0x69, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, + 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x72, + 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, 0x22, 0x50, 0x0a, 0x0f, 0x46, 0x69, 0x6c, 0x65, + 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x29, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, + 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xfe, 0x01, 0x0a, 0x10, 0x57, + 0x61, 0x74, 0x63, 0x68, 0x44, 0x69, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x3f, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, + 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x57, 0x61, 0x74, 0x63, + 0x68, 0x44, 0x69, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x74, 0x61, + 0x72, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x12, 0x3d, 0x0a, 0x0a, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, + 0x6d, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x48, 0x00, 0x52, 0x0a, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x12, + 0x46, 0x0a, 0x09, 0x6b, 0x65, 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, + 0x57, 0x61, 0x74, 0x63, 0x68, 0x44, 0x69, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x2e, 0x4b, 0x65, 0x65, 0x70, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x48, 0x00, 0x52, 0x09, 0x6b, 0x65, + 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x1a, 0x0c, 0x0a, 0x0a, 0x53, 0x74, 0x61, 0x72, 0x74, + 0x45, 0x76, 0x65, 0x6e, 0x74, 0x1a, 0x0b, 0x0a, 0x09, 0x4b, 0x65, 0x65, 0x70, 0x41, 0x6c, 0x69, + 0x76, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x22, 0x48, 0x0a, 0x14, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x57, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x75, 0x72, + 0x73, 0x69, 0x76, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x72, 0x65, 0x63, 0x75, + 0x72, 0x73, 0x69, 0x76, 0x65, 0x22, 0x36, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x57, + 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, + 0x0a, 0x0a, 0x77, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x77, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x49, 0x64, 0x22, 0x38, 0x0a, + 0x17, 0x47, 0x65, 0x74, 0x57, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x77, 0x61, 0x74, 0x63, + 0x68, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x77, 0x61, + 0x74, 0x63, 0x68, 0x65, 0x72, 0x49, 0x64, 0x22, 0x4f, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x57, 0x61, + 0x74, 0x63, 0x68, 0x65, 0x72, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, + 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x52, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x35, 0x0a, 0x14, 0x52, 0x65, 0x6d, 0x6f, + 0x76, 0x65, 0x57, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x1d, 0x0a, 0x0a, 0x77, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x77, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x49, 0x64, 0x22, + 0x17, 0x0a, 0x15, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x57, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2a, 0x69, 0x0a, 0x08, 0x46, 0x69, 0x6c, 0x65, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x15, 0x46, 0x49, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, + 0x12, 0x0a, 0x0e, 0x46, 0x49, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x49, 0x4c, + 0x45, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x46, 0x49, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x4f, 0x52, 0x59, 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, + 0x46, 0x49, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x59, 0x4d, 0x4c, 0x49, 0x4e, + 0x4b, 0x10, 0x03, 0x2a, 0x98, 0x01, 0x0a, 0x09, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, + 0x11, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x52, 0x45, 0x41, + 0x54, 0x45, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x57, 0x52, 0x49, 0x54, 0x45, 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, 0x45, 0x56, + 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x10, + 0x03, 0x12, 0x15, 0x0a, 0x11, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x52, 0x45, 0x4e, 0x41, 0x4d, 0x45, 0x10, 0x04, 0x12, 0x14, 0x0a, 0x10, 0x45, 0x56, 0x45, 0x4e, + 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x48, 0x4d, 0x4f, 0x44, 0x10, 0x05, 0x32, 0x9f, + 0x05, 0x0a, 0x0a, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x12, 0x39, 0x0a, + 0x04, 0x53, 0x74, 0x61, 0x74, 0x12, 0x17, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, + 0x65, 0x6d, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, + 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x53, 0x74, 0x61, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x07, 0x4d, 0x61, 0x6b, 0x65, + 0x44, 0x69, 0x72, 0x12, 0x1a, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, + 0x2e, 0x4d, 0x61, 0x6b, 0x65, 0x44, 0x69, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1b, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x4d, 0x61, 0x6b, + 0x65, 0x44, 0x69, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x04, + 0x4d, 0x6f, 0x76, 0x65, 0x12, 0x17, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, + 0x6d, 0x2e, 0x4d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, + 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x4d, 0x6f, 0x76, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x07, 0x4c, 0x69, 0x73, 0x74, 0x44, + 0x69, 0x72, 0x12, 0x1a, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x44, 0x69, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, + 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x44, 0x69, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x06, 0x52, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x12, 0x19, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, + 0x65, 0x6d, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1a, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x52, 0x65, + 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x08, + 0x57, 0x61, 0x74, 0x63, 0x68, 0x44, 0x69, 0x72, 0x12, 0x1b, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, + 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x57, 0x61, 0x74, 0x63, 0x68, 0x44, 0x69, 0x72, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, + 0x65, 0x6d, 0x2e, 0x57, 0x61, 0x74, 0x63, 0x68, 0x44, 0x69, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x54, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x57, + 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x20, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, + 0x74, 0x65, 0x6d, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x57, 0x61, 0x74, 0x63, 0x68, 0x65, + 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, + 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x57, 0x61, 0x74, 0x63, + 0x68, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5d, 0x0a, 0x10, 0x47, + 0x65, 0x74, 0x57, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12, + 0x23, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x47, 0x65, 0x74, + 0x57, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, + 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x0d, 0x52, 0x65, + 0x6d, 0x6f, 0x76, 0x65, 0x57, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x20, 0x2e, 0x66, 0x69, + 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x57, + 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, + 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, + 0x65, 0x57, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x42, 0x9f, 0x01, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, + 0x74, 0x65, 0x6d, 0x42, 0x0f, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x6b, 0x72, 0x75, 0x69, 0x73, 0x65, 0x2f, 0x61, 0x67, + 0x65, 0x6e, 0x74, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2f, 0x65, 0x32, 0x62, 0x2f, 0x65, 0x6e, 0x76, + 0x64, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0xa2, 0x02, 0x03, 0x46, + 0x58, 0x58, 0xaa, 0x02, 0x0a, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0xca, + 0x02, 0x0a, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0xe2, 0x02, 0x16, 0x46, + 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0a, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, + 0x65, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_filesystem_filesystem_proto_rawDescOnce sync.Once + file_filesystem_filesystem_proto_rawDescData = file_filesystem_filesystem_proto_rawDesc +) + +func file_filesystem_filesystem_proto_rawDescGZIP() []byte { + file_filesystem_filesystem_proto_rawDescOnce.Do(func() { + file_filesystem_filesystem_proto_rawDescData = protoimpl.X.CompressGZIP(file_filesystem_filesystem_proto_rawDescData) + }) + return file_filesystem_filesystem_proto_rawDescData +} + +var file_filesystem_filesystem_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_filesystem_filesystem_proto_msgTypes = make([]protoimpl.MessageInfo, 22) +var file_filesystem_filesystem_proto_goTypes = []interface{}{ + (FileType)(0), // 0: filesystem.FileType + (EventType)(0), // 1: filesystem.EventType + (*MoveRequest)(nil), // 2: filesystem.MoveRequest + (*MoveResponse)(nil), // 3: filesystem.MoveResponse + (*MakeDirRequest)(nil), // 4: filesystem.MakeDirRequest + (*MakeDirResponse)(nil), // 5: filesystem.MakeDirResponse + (*RemoveRequest)(nil), // 6: filesystem.RemoveRequest + (*RemoveResponse)(nil), // 7: filesystem.RemoveResponse + (*StatRequest)(nil), // 8: filesystem.StatRequest + (*StatResponse)(nil), // 9: filesystem.StatResponse + (*EntryInfo)(nil), // 10: filesystem.EntryInfo + (*ListDirRequest)(nil), // 11: filesystem.ListDirRequest + (*ListDirResponse)(nil), // 12: filesystem.ListDirResponse + (*WatchDirRequest)(nil), // 13: filesystem.WatchDirRequest + (*FilesystemEvent)(nil), // 14: filesystem.FilesystemEvent + (*WatchDirResponse)(nil), // 15: filesystem.WatchDirResponse + (*CreateWatcherRequest)(nil), // 16: filesystem.CreateWatcherRequest + (*CreateWatcherResponse)(nil), // 17: filesystem.CreateWatcherResponse + (*GetWatcherEventsRequest)(nil), // 18: filesystem.GetWatcherEventsRequest + (*GetWatcherEventsResponse)(nil), // 19: filesystem.GetWatcherEventsResponse + (*RemoveWatcherRequest)(nil), // 20: filesystem.RemoveWatcherRequest + (*RemoveWatcherResponse)(nil), // 21: filesystem.RemoveWatcherResponse + (*WatchDirResponse_StartEvent)(nil), // 22: filesystem.WatchDirResponse.StartEvent + (*WatchDirResponse_KeepAlive)(nil), // 23: filesystem.WatchDirResponse.KeepAlive + (*timestamppb.Timestamp)(nil), // 24: google.protobuf.Timestamp +} +var file_filesystem_filesystem_proto_depIdxs = []int32{ + 10, // 0: filesystem.MoveResponse.entry:type_name -> filesystem.EntryInfo + 10, // 1: filesystem.MakeDirResponse.entry:type_name -> filesystem.EntryInfo + 10, // 2: filesystem.StatResponse.entry:type_name -> filesystem.EntryInfo + 0, // 3: filesystem.EntryInfo.type:type_name -> filesystem.FileType + 24, // 4: filesystem.EntryInfo.modified_time:type_name -> google.protobuf.Timestamp + 10, // 5: filesystem.ListDirResponse.entries:type_name -> filesystem.EntryInfo + 1, // 6: filesystem.FilesystemEvent.type:type_name -> filesystem.EventType + 22, // 7: filesystem.WatchDirResponse.start:type_name -> filesystem.WatchDirResponse.StartEvent + 14, // 8: filesystem.WatchDirResponse.filesystem:type_name -> filesystem.FilesystemEvent + 23, // 9: filesystem.WatchDirResponse.keepalive:type_name -> filesystem.WatchDirResponse.KeepAlive + 14, // 10: filesystem.GetWatcherEventsResponse.events:type_name -> filesystem.FilesystemEvent + 8, // 11: filesystem.Filesystem.Stat:input_type -> filesystem.StatRequest + 4, // 12: filesystem.Filesystem.MakeDir:input_type -> filesystem.MakeDirRequest + 2, // 13: filesystem.Filesystem.Move:input_type -> filesystem.MoveRequest + 11, // 14: filesystem.Filesystem.ListDir:input_type -> filesystem.ListDirRequest + 6, // 15: filesystem.Filesystem.Remove:input_type -> filesystem.RemoveRequest + 13, // 16: filesystem.Filesystem.WatchDir:input_type -> filesystem.WatchDirRequest + 16, // 17: filesystem.Filesystem.CreateWatcher:input_type -> filesystem.CreateWatcherRequest + 18, // 18: filesystem.Filesystem.GetWatcherEvents:input_type -> filesystem.GetWatcherEventsRequest + 20, // 19: filesystem.Filesystem.RemoveWatcher:input_type -> filesystem.RemoveWatcherRequest + 9, // 20: filesystem.Filesystem.Stat:output_type -> filesystem.StatResponse + 5, // 21: filesystem.Filesystem.MakeDir:output_type -> filesystem.MakeDirResponse + 3, // 22: filesystem.Filesystem.Move:output_type -> filesystem.MoveResponse + 12, // 23: filesystem.Filesystem.ListDir:output_type -> filesystem.ListDirResponse + 7, // 24: filesystem.Filesystem.Remove:output_type -> filesystem.RemoveResponse + 15, // 25: filesystem.Filesystem.WatchDir:output_type -> filesystem.WatchDirResponse + 17, // 26: filesystem.Filesystem.CreateWatcher:output_type -> filesystem.CreateWatcherResponse + 19, // 27: filesystem.Filesystem.GetWatcherEvents:output_type -> filesystem.GetWatcherEventsResponse + 21, // 28: filesystem.Filesystem.RemoveWatcher:output_type -> filesystem.RemoveWatcherResponse + 20, // [20:29] is the sub-list for method output_type + 11, // [11:20] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name +} + +func init() { file_filesystem_filesystem_proto_init() } +func file_filesystem_filesystem_proto_init() { + if File_filesystem_filesystem_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_filesystem_filesystem_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MoveRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_filesystem_filesystem_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MoveResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_filesystem_filesystem_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MakeDirRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_filesystem_filesystem_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MakeDirResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_filesystem_filesystem_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_filesystem_filesystem_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_filesystem_filesystem_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StatRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_filesystem_filesystem_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StatResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_filesystem_filesystem_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EntryInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_filesystem_filesystem_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListDirRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_filesystem_filesystem_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListDirResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_filesystem_filesystem_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WatchDirRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_filesystem_filesystem_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FilesystemEvent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_filesystem_filesystem_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WatchDirResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_filesystem_filesystem_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateWatcherRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_filesystem_filesystem_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateWatcherResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_filesystem_filesystem_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetWatcherEventsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_filesystem_filesystem_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetWatcherEventsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_filesystem_filesystem_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveWatcherRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_filesystem_filesystem_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveWatcherResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_filesystem_filesystem_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WatchDirResponse_StartEvent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_filesystem_filesystem_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WatchDirResponse_KeepAlive); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_filesystem_filesystem_proto_msgTypes[8].OneofWrappers = []interface{}{} + file_filesystem_filesystem_proto_msgTypes[13].OneofWrappers = []interface{}{ + (*WatchDirResponse_Start)(nil), + (*WatchDirResponse_Filesystem)(nil), + (*WatchDirResponse_Keepalive)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_filesystem_filesystem_proto_rawDesc, + NumEnums: 2, + NumMessages: 22, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_filesystem_filesystem_proto_goTypes, + DependencyIndexes: file_filesystem_filesystem_proto_depIdxs, + EnumInfos: file_filesystem_filesystem_proto_enumTypes, + MessageInfos: file_filesystem_filesystem_proto_msgTypes, + }.Build() + File_filesystem_filesystem_proto = out.File + file_filesystem_filesystem_proto_rawDesc = nil + file_filesystem_filesystem_proto_goTypes = nil + file_filesystem_filesystem_proto_depIdxs = nil +} diff --git a/e2b/envd/filesystem/filesystemconnect/filesystem.connect.go b/e2b/envd/filesystem/filesystemconnect/filesystem.connect.go new file mode 100644 index 0000000..aa2e019 --- /dev/null +++ b/e2b/envd/filesystem/filesystemconnect/filesystem.connect.go @@ -0,0 +1,337 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: filesystem/filesystem.proto + +package filesystemconnect + +import ( + connect "connectrpc.com/connect" + context "context" + errors "errors" + filesystem "github.com/openkruise/agents-api/e2b/envd/filesystem" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect.IsAtLeastVersion1_13_0 + +const ( + // FilesystemName is the fully-qualified name of the Filesystem service. + FilesystemName = "filesystem.Filesystem" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // FilesystemStatProcedure is the fully-qualified name of the Filesystem's Stat RPC. + FilesystemStatProcedure = "/filesystem.Filesystem/Stat" + // FilesystemMakeDirProcedure is the fully-qualified name of the Filesystem's MakeDir RPC. + FilesystemMakeDirProcedure = "/filesystem.Filesystem/MakeDir" + // FilesystemMoveProcedure is the fully-qualified name of the Filesystem's Move RPC. + FilesystemMoveProcedure = "/filesystem.Filesystem/Move" + // FilesystemListDirProcedure is the fully-qualified name of the Filesystem's ListDir RPC. + FilesystemListDirProcedure = "/filesystem.Filesystem/ListDir" + // FilesystemRemoveProcedure is the fully-qualified name of the Filesystem's Remove RPC. + FilesystemRemoveProcedure = "/filesystem.Filesystem/Remove" + // FilesystemWatchDirProcedure is the fully-qualified name of the Filesystem's WatchDir RPC. + FilesystemWatchDirProcedure = "/filesystem.Filesystem/WatchDir" + // FilesystemCreateWatcherProcedure is the fully-qualified name of the Filesystem's CreateWatcher + // RPC. + FilesystemCreateWatcherProcedure = "/filesystem.Filesystem/CreateWatcher" + // FilesystemGetWatcherEventsProcedure is the fully-qualified name of the Filesystem's + // GetWatcherEvents RPC. + FilesystemGetWatcherEventsProcedure = "/filesystem.Filesystem/GetWatcherEvents" + // FilesystemRemoveWatcherProcedure is the fully-qualified name of the Filesystem's RemoveWatcher + // RPC. + FilesystemRemoveWatcherProcedure = "/filesystem.Filesystem/RemoveWatcher" +) + +// FilesystemClient is a client for the filesystem.Filesystem service. +type FilesystemClient interface { + Stat(context.Context, *connect.Request[filesystem.StatRequest]) (*connect.Response[filesystem.StatResponse], error) + MakeDir(context.Context, *connect.Request[filesystem.MakeDirRequest]) (*connect.Response[filesystem.MakeDirResponse], error) + Move(context.Context, *connect.Request[filesystem.MoveRequest]) (*connect.Response[filesystem.MoveResponse], error) + ListDir(context.Context, *connect.Request[filesystem.ListDirRequest]) (*connect.Response[filesystem.ListDirResponse], error) + Remove(context.Context, *connect.Request[filesystem.RemoveRequest]) (*connect.Response[filesystem.RemoveResponse], error) + WatchDir(context.Context, *connect.Request[filesystem.WatchDirRequest]) (*connect.ServerStreamForClient[filesystem.WatchDirResponse], error) + // Non-streaming versions of WatchDir + CreateWatcher(context.Context, *connect.Request[filesystem.CreateWatcherRequest]) (*connect.Response[filesystem.CreateWatcherResponse], error) + GetWatcherEvents(context.Context, *connect.Request[filesystem.GetWatcherEventsRequest]) (*connect.Response[filesystem.GetWatcherEventsResponse], error) + RemoveWatcher(context.Context, *connect.Request[filesystem.RemoveWatcherRequest]) (*connect.Response[filesystem.RemoveWatcherResponse], error) +} + +// NewFilesystemClient constructs a client for the filesystem.Filesystem service. By default, it +// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewFilesystemClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) FilesystemClient { + baseURL = strings.TrimRight(baseURL, "/") + filesystemMethods := filesystem.File_filesystem_filesystem_proto.Services().ByName("Filesystem").Methods() + return &filesystemClient{ + stat: connect.NewClient[filesystem.StatRequest, filesystem.StatResponse]( + httpClient, + baseURL+FilesystemStatProcedure, + connect.WithSchema(filesystemMethods.ByName("Stat")), + connect.WithClientOptions(opts...), + ), + makeDir: connect.NewClient[filesystem.MakeDirRequest, filesystem.MakeDirResponse]( + httpClient, + baseURL+FilesystemMakeDirProcedure, + connect.WithSchema(filesystemMethods.ByName("MakeDir")), + connect.WithClientOptions(opts...), + ), + move: connect.NewClient[filesystem.MoveRequest, filesystem.MoveResponse]( + httpClient, + baseURL+FilesystemMoveProcedure, + connect.WithSchema(filesystemMethods.ByName("Move")), + connect.WithClientOptions(opts...), + ), + listDir: connect.NewClient[filesystem.ListDirRequest, filesystem.ListDirResponse]( + httpClient, + baseURL+FilesystemListDirProcedure, + connect.WithSchema(filesystemMethods.ByName("ListDir")), + connect.WithClientOptions(opts...), + ), + remove: connect.NewClient[filesystem.RemoveRequest, filesystem.RemoveResponse]( + httpClient, + baseURL+FilesystemRemoveProcedure, + connect.WithSchema(filesystemMethods.ByName("Remove")), + connect.WithClientOptions(opts...), + ), + watchDir: connect.NewClient[filesystem.WatchDirRequest, filesystem.WatchDirResponse]( + httpClient, + baseURL+FilesystemWatchDirProcedure, + connect.WithSchema(filesystemMethods.ByName("WatchDir")), + connect.WithClientOptions(opts...), + ), + createWatcher: connect.NewClient[filesystem.CreateWatcherRequest, filesystem.CreateWatcherResponse]( + httpClient, + baseURL+FilesystemCreateWatcherProcedure, + connect.WithSchema(filesystemMethods.ByName("CreateWatcher")), + connect.WithClientOptions(opts...), + ), + getWatcherEvents: connect.NewClient[filesystem.GetWatcherEventsRequest, filesystem.GetWatcherEventsResponse]( + httpClient, + baseURL+FilesystemGetWatcherEventsProcedure, + connect.WithSchema(filesystemMethods.ByName("GetWatcherEvents")), + connect.WithClientOptions(opts...), + ), + removeWatcher: connect.NewClient[filesystem.RemoveWatcherRequest, filesystem.RemoveWatcherResponse]( + httpClient, + baseURL+FilesystemRemoveWatcherProcedure, + connect.WithSchema(filesystemMethods.ByName("RemoveWatcher")), + connect.WithClientOptions(opts...), + ), + } +} + +// filesystemClient implements FilesystemClient. +type filesystemClient struct { + stat *connect.Client[filesystem.StatRequest, filesystem.StatResponse] + makeDir *connect.Client[filesystem.MakeDirRequest, filesystem.MakeDirResponse] + move *connect.Client[filesystem.MoveRequest, filesystem.MoveResponse] + listDir *connect.Client[filesystem.ListDirRequest, filesystem.ListDirResponse] + remove *connect.Client[filesystem.RemoveRequest, filesystem.RemoveResponse] + watchDir *connect.Client[filesystem.WatchDirRequest, filesystem.WatchDirResponse] + createWatcher *connect.Client[filesystem.CreateWatcherRequest, filesystem.CreateWatcherResponse] + getWatcherEvents *connect.Client[filesystem.GetWatcherEventsRequest, filesystem.GetWatcherEventsResponse] + removeWatcher *connect.Client[filesystem.RemoveWatcherRequest, filesystem.RemoveWatcherResponse] +} + +// Stat calls filesystem.Filesystem.Stat. +func (c *filesystemClient) Stat(ctx context.Context, req *connect.Request[filesystem.StatRequest]) (*connect.Response[filesystem.StatResponse], error) { + return c.stat.CallUnary(ctx, req) +} + +// MakeDir calls filesystem.Filesystem.MakeDir. +func (c *filesystemClient) MakeDir(ctx context.Context, req *connect.Request[filesystem.MakeDirRequest]) (*connect.Response[filesystem.MakeDirResponse], error) { + return c.makeDir.CallUnary(ctx, req) +} + +// Move calls filesystem.Filesystem.Move. +func (c *filesystemClient) Move(ctx context.Context, req *connect.Request[filesystem.MoveRequest]) (*connect.Response[filesystem.MoveResponse], error) { + return c.move.CallUnary(ctx, req) +} + +// ListDir calls filesystem.Filesystem.ListDir. +func (c *filesystemClient) ListDir(ctx context.Context, req *connect.Request[filesystem.ListDirRequest]) (*connect.Response[filesystem.ListDirResponse], error) { + return c.listDir.CallUnary(ctx, req) +} + +// Remove calls filesystem.Filesystem.Remove. +func (c *filesystemClient) Remove(ctx context.Context, req *connect.Request[filesystem.RemoveRequest]) (*connect.Response[filesystem.RemoveResponse], error) { + return c.remove.CallUnary(ctx, req) +} + +// WatchDir calls filesystem.Filesystem.WatchDir. +func (c *filesystemClient) WatchDir(ctx context.Context, req *connect.Request[filesystem.WatchDirRequest]) (*connect.ServerStreamForClient[filesystem.WatchDirResponse], error) { + return c.watchDir.CallServerStream(ctx, req) +} + +// CreateWatcher calls filesystem.Filesystem.CreateWatcher. +func (c *filesystemClient) CreateWatcher(ctx context.Context, req *connect.Request[filesystem.CreateWatcherRequest]) (*connect.Response[filesystem.CreateWatcherResponse], error) { + return c.createWatcher.CallUnary(ctx, req) +} + +// GetWatcherEvents calls filesystem.Filesystem.GetWatcherEvents. +func (c *filesystemClient) GetWatcherEvents(ctx context.Context, req *connect.Request[filesystem.GetWatcherEventsRequest]) (*connect.Response[filesystem.GetWatcherEventsResponse], error) { + return c.getWatcherEvents.CallUnary(ctx, req) +} + +// RemoveWatcher calls filesystem.Filesystem.RemoveWatcher. +func (c *filesystemClient) RemoveWatcher(ctx context.Context, req *connect.Request[filesystem.RemoveWatcherRequest]) (*connect.Response[filesystem.RemoveWatcherResponse], error) { + return c.removeWatcher.CallUnary(ctx, req) +} + +// FilesystemHandler is an implementation of the filesystem.Filesystem service. +type FilesystemHandler interface { + Stat(context.Context, *connect.Request[filesystem.StatRequest]) (*connect.Response[filesystem.StatResponse], error) + MakeDir(context.Context, *connect.Request[filesystem.MakeDirRequest]) (*connect.Response[filesystem.MakeDirResponse], error) + Move(context.Context, *connect.Request[filesystem.MoveRequest]) (*connect.Response[filesystem.MoveResponse], error) + ListDir(context.Context, *connect.Request[filesystem.ListDirRequest]) (*connect.Response[filesystem.ListDirResponse], error) + Remove(context.Context, *connect.Request[filesystem.RemoveRequest]) (*connect.Response[filesystem.RemoveResponse], error) + WatchDir(context.Context, *connect.Request[filesystem.WatchDirRequest], *connect.ServerStream[filesystem.WatchDirResponse]) error + // Non-streaming versions of WatchDir + CreateWatcher(context.Context, *connect.Request[filesystem.CreateWatcherRequest]) (*connect.Response[filesystem.CreateWatcherResponse], error) + GetWatcherEvents(context.Context, *connect.Request[filesystem.GetWatcherEventsRequest]) (*connect.Response[filesystem.GetWatcherEventsResponse], error) + RemoveWatcher(context.Context, *connect.Request[filesystem.RemoveWatcherRequest]) (*connect.Response[filesystem.RemoveWatcherResponse], error) +} + +// NewFilesystemHandler builds an HTTP handler from the service implementation. It returns the path +// on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewFilesystemHandler(svc FilesystemHandler, opts ...connect.HandlerOption) (string, http.Handler) { + filesystemMethods := filesystem.File_filesystem_filesystem_proto.Services().ByName("Filesystem").Methods() + filesystemStatHandler := connect.NewUnaryHandler( + FilesystemStatProcedure, + svc.Stat, + connect.WithSchema(filesystemMethods.ByName("Stat")), + connect.WithHandlerOptions(opts...), + ) + filesystemMakeDirHandler := connect.NewUnaryHandler( + FilesystemMakeDirProcedure, + svc.MakeDir, + connect.WithSchema(filesystemMethods.ByName("MakeDir")), + connect.WithHandlerOptions(opts...), + ) + filesystemMoveHandler := connect.NewUnaryHandler( + FilesystemMoveProcedure, + svc.Move, + connect.WithSchema(filesystemMethods.ByName("Move")), + connect.WithHandlerOptions(opts...), + ) + filesystemListDirHandler := connect.NewUnaryHandler( + FilesystemListDirProcedure, + svc.ListDir, + connect.WithSchema(filesystemMethods.ByName("ListDir")), + connect.WithHandlerOptions(opts...), + ) + filesystemRemoveHandler := connect.NewUnaryHandler( + FilesystemRemoveProcedure, + svc.Remove, + connect.WithSchema(filesystemMethods.ByName("Remove")), + connect.WithHandlerOptions(opts...), + ) + filesystemWatchDirHandler := connect.NewServerStreamHandler( + FilesystemWatchDirProcedure, + svc.WatchDir, + connect.WithSchema(filesystemMethods.ByName("WatchDir")), + connect.WithHandlerOptions(opts...), + ) + filesystemCreateWatcherHandler := connect.NewUnaryHandler( + FilesystemCreateWatcherProcedure, + svc.CreateWatcher, + connect.WithSchema(filesystemMethods.ByName("CreateWatcher")), + connect.WithHandlerOptions(opts...), + ) + filesystemGetWatcherEventsHandler := connect.NewUnaryHandler( + FilesystemGetWatcherEventsProcedure, + svc.GetWatcherEvents, + connect.WithSchema(filesystemMethods.ByName("GetWatcherEvents")), + connect.WithHandlerOptions(opts...), + ) + filesystemRemoveWatcherHandler := connect.NewUnaryHandler( + FilesystemRemoveWatcherProcedure, + svc.RemoveWatcher, + connect.WithSchema(filesystemMethods.ByName("RemoveWatcher")), + connect.WithHandlerOptions(opts...), + ) + return "/filesystem.Filesystem/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case FilesystemStatProcedure: + filesystemStatHandler.ServeHTTP(w, r) + case FilesystemMakeDirProcedure: + filesystemMakeDirHandler.ServeHTTP(w, r) + case FilesystemMoveProcedure: + filesystemMoveHandler.ServeHTTP(w, r) + case FilesystemListDirProcedure: + filesystemListDirHandler.ServeHTTP(w, r) + case FilesystemRemoveProcedure: + filesystemRemoveHandler.ServeHTTP(w, r) + case FilesystemWatchDirProcedure: + filesystemWatchDirHandler.ServeHTTP(w, r) + case FilesystemCreateWatcherProcedure: + filesystemCreateWatcherHandler.ServeHTTP(w, r) + case FilesystemGetWatcherEventsProcedure: + filesystemGetWatcherEventsHandler.ServeHTTP(w, r) + case FilesystemRemoveWatcherProcedure: + filesystemRemoveWatcherHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedFilesystemHandler returns CodeUnimplemented from all methods. +type UnimplementedFilesystemHandler struct{} + +func (UnimplementedFilesystemHandler) Stat(context.Context, *connect.Request[filesystem.StatRequest]) (*connect.Response[filesystem.StatResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("filesystem.Filesystem.Stat is not implemented")) +} + +func (UnimplementedFilesystemHandler) MakeDir(context.Context, *connect.Request[filesystem.MakeDirRequest]) (*connect.Response[filesystem.MakeDirResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("filesystem.Filesystem.MakeDir is not implemented")) +} + +func (UnimplementedFilesystemHandler) Move(context.Context, *connect.Request[filesystem.MoveRequest]) (*connect.Response[filesystem.MoveResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("filesystem.Filesystem.Move is not implemented")) +} + +func (UnimplementedFilesystemHandler) ListDir(context.Context, *connect.Request[filesystem.ListDirRequest]) (*connect.Response[filesystem.ListDirResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("filesystem.Filesystem.ListDir is not implemented")) +} + +func (UnimplementedFilesystemHandler) Remove(context.Context, *connect.Request[filesystem.RemoveRequest]) (*connect.Response[filesystem.RemoveResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("filesystem.Filesystem.Remove is not implemented")) +} + +func (UnimplementedFilesystemHandler) WatchDir(context.Context, *connect.Request[filesystem.WatchDirRequest], *connect.ServerStream[filesystem.WatchDirResponse]) error { + return connect.NewError(connect.CodeUnimplemented, errors.New("filesystem.Filesystem.WatchDir is not implemented")) +} + +func (UnimplementedFilesystemHandler) CreateWatcher(context.Context, *connect.Request[filesystem.CreateWatcherRequest]) (*connect.Response[filesystem.CreateWatcherResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("filesystem.Filesystem.CreateWatcher is not implemented")) +} + +func (UnimplementedFilesystemHandler) GetWatcherEvents(context.Context, *connect.Request[filesystem.GetWatcherEventsRequest]) (*connect.Response[filesystem.GetWatcherEventsResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("filesystem.Filesystem.GetWatcherEvents is not implemented")) +} + +func (UnimplementedFilesystemHandler) RemoveWatcher(context.Context, *connect.Request[filesystem.RemoveWatcherRequest]) (*connect.Response[filesystem.RemoveWatcherResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("filesystem.Filesystem.RemoveWatcher is not implemented")) +} diff --git a/e2b/envd/process/process.pb.go b/e2b/envd/process/process.pb.go new file mode 100644 index 0000000..0b367c1 --- /dev/null +++ b/e2b/envd/process/process.pb.go @@ -0,0 +1,2476 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc (unknown) +// source: process/process.proto + +package process + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Signal int32 + +const ( + Signal_SIGNAL_UNSPECIFIED Signal = 0 + Signal_SIGNAL_SIGTERM Signal = 15 + Signal_SIGNAL_SIGKILL Signal = 9 +) + +// Enum value maps for Signal. +var ( + Signal_name = map[int32]string{ + 0: "SIGNAL_UNSPECIFIED", + 15: "SIGNAL_SIGTERM", + 9: "SIGNAL_SIGKILL", + } + Signal_value = map[string]int32{ + "SIGNAL_UNSPECIFIED": 0, + "SIGNAL_SIGTERM": 15, + "SIGNAL_SIGKILL": 9, + } +) + +func (x Signal) Enum() *Signal { + p := new(Signal) + *p = x + return p +} + +func (x Signal) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Signal) Descriptor() protoreflect.EnumDescriptor { + return file_process_process_proto_enumTypes[0].Descriptor() +} + +func (Signal) Type() protoreflect.EnumType { + return &file_process_process_proto_enumTypes[0] +} + +func (x Signal) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Signal.Descriptor instead. +func (Signal) EnumDescriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{0} +} + +type PTY struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Size *PTY_Size `protobuf:"bytes,1,opt,name=size,proto3" json:"size,omitempty"` +} + +func (x *PTY) Reset() { + *x = PTY{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PTY) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PTY) ProtoMessage() {} + +func (x *PTY) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PTY.ProtoReflect.Descriptor instead. +func (*PTY) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{0} +} + +func (x *PTY) GetSize() *PTY_Size { + if x != nil { + return x.Size + } + return nil +} + +type ProcessConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Cmd string `protobuf:"bytes,1,opt,name=cmd,proto3" json:"cmd,omitempty"` + Args []string `protobuf:"bytes,2,rep,name=args,proto3" json:"args,omitempty"` + Envs map[string]string `protobuf:"bytes,3,rep,name=envs,proto3" json:"envs,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Cwd *string `protobuf:"bytes,4,opt,name=cwd,proto3,oneof" json:"cwd,omitempty"` +} + +func (x *ProcessConfig) Reset() { + *x = ProcessConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProcessConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProcessConfig) ProtoMessage() {} + +func (x *ProcessConfig) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProcessConfig.ProtoReflect.Descriptor instead. +func (*ProcessConfig) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{1} +} + +func (x *ProcessConfig) GetCmd() string { + if x != nil { + return x.Cmd + } + return "" +} + +func (x *ProcessConfig) GetArgs() []string { + if x != nil { + return x.Args + } + return nil +} + +func (x *ProcessConfig) GetEnvs() map[string]string { + if x != nil { + return x.Envs + } + return nil +} + +func (x *ProcessConfig) GetCwd() string { + if x != nil && x.Cwd != nil { + return *x.Cwd + } + return "" +} + +type ListRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ListRequest) Reset() { + *x = ListRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRequest) ProtoMessage() {} + +func (x *ListRequest) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListRequest.ProtoReflect.Descriptor instead. +func (*ListRequest) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{2} +} + +type ProcessInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Config *ProcessConfig `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"` + Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` + Tag *string `protobuf:"bytes,3,opt,name=tag,proto3,oneof" json:"tag,omitempty"` +} + +func (x *ProcessInfo) Reset() { + *x = ProcessInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProcessInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProcessInfo) ProtoMessage() {} + +func (x *ProcessInfo) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProcessInfo.ProtoReflect.Descriptor instead. +func (*ProcessInfo) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{3} +} + +func (x *ProcessInfo) GetConfig() *ProcessConfig { + if x != nil { + return x.Config + } + return nil +} + +func (x *ProcessInfo) GetPid() uint32 { + if x != nil { + return x.Pid + } + return 0 +} + +func (x *ProcessInfo) GetTag() string { + if x != nil && x.Tag != nil { + return *x.Tag + } + return "" +} + +type ListResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Processes []*ProcessInfo `protobuf:"bytes,1,rep,name=processes,proto3" json:"processes,omitempty"` +} + +func (x *ListResponse) Reset() { + *x = ListResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListResponse) ProtoMessage() {} + +func (x *ListResponse) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListResponse.ProtoReflect.Descriptor instead. +func (*ListResponse) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{4} +} + +func (x *ListResponse) GetProcesses() []*ProcessInfo { + if x != nil { + return x.Processes + } + return nil +} + +type StartRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Process *ProcessConfig `protobuf:"bytes,1,opt,name=process,proto3" json:"process,omitempty"` + Pty *PTY `protobuf:"bytes,2,opt,name=pty,proto3,oneof" json:"pty,omitempty"` + Tag *string `protobuf:"bytes,3,opt,name=tag,proto3,oneof" json:"tag,omitempty"` + // This is optional for backwards compatibility. + // We default to true. New SDK versions will set this to false by default. + Stdin *bool `protobuf:"varint,4,opt,name=stdin,proto3,oneof" json:"stdin,omitempty"` +} + +func (x *StartRequest) Reset() { + *x = StartRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StartRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StartRequest) ProtoMessage() {} + +func (x *StartRequest) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StartRequest.ProtoReflect.Descriptor instead. +func (*StartRequest) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{5} +} + +func (x *StartRequest) GetProcess() *ProcessConfig { + if x != nil { + return x.Process + } + return nil +} + +func (x *StartRequest) GetPty() *PTY { + if x != nil { + return x.Pty + } + return nil +} + +func (x *StartRequest) GetTag() string { + if x != nil && x.Tag != nil { + return *x.Tag + } + return "" +} + +func (x *StartRequest) GetStdin() bool { + if x != nil && x.Stdin != nil { + return *x.Stdin + } + return false +} + +type UpdateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Process *ProcessSelector `protobuf:"bytes,1,opt,name=process,proto3" json:"process,omitempty"` + Pty *PTY `protobuf:"bytes,2,opt,name=pty,proto3,oneof" json:"pty,omitempty"` +} + +func (x *UpdateRequest) Reset() { + *x = UpdateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateRequest) ProtoMessage() {} + +func (x *UpdateRequest) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateRequest.ProtoReflect.Descriptor instead. +func (*UpdateRequest) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{6} +} + +func (x *UpdateRequest) GetProcess() *ProcessSelector { + if x != nil { + return x.Process + } + return nil +} + +func (x *UpdateRequest) GetPty() *PTY { + if x != nil { + return x.Pty + } + return nil +} + +type UpdateResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UpdateResponse) Reset() { + *x = UpdateResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateResponse) ProtoMessage() {} + +func (x *UpdateResponse) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateResponse.ProtoReflect.Descriptor instead. +func (*UpdateResponse) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{7} +} + +type ProcessEvent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Event: + // + // *ProcessEvent_Start + // *ProcessEvent_Data + // *ProcessEvent_End + // *ProcessEvent_Keepalive + Event isProcessEvent_Event `protobuf_oneof:"event"` +} + +func (x *ProcessEvent) Reset() { + *x = ProcessEvent{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProcessEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProcessEvent) ProtoMessage() {} + +func (x *ProcessEvent) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProcessEvent.ProtoReflect.Descriptor instead. +func (*ProcessEvent) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{8} +} + +func (m *ProcessEvent) GetEvent() isProcessEvent_Event { + if m != nil { + return m.Event + } + return nil +} + +func (x *ProcessEvent) GetStart() *ProcessEvent_StartEvent { + if x, ok := x.GetEvent().(*ProcessEvent_Start); ok { + return x.Start + } + return nil +} + +func (x *ProcessEvent) GetData() *ProcessEvent_DataEvent { + if x, ok := x.GetEvent().(*ProcessEvent_Data); ok { + return x.Data + } + return nil +} + +func (x *ProcessEvent) GetEnd() *ProcessEvent_EndEvent { + if x, ok := x.GetEvent().(*ProcessEvent_End); ok { + return x.End + } + return nil +} + +func (x *ProcessEvent) GetKeepalive() *ProcessEvent_KeepAlive { + if x, ok := x.GetEvent().(*ProcessEvent_Keepalive); ok { + return x.Keepalive + } + return nil +} + +type isProcessEvent_Event interface { + isProcessEvent_Event() +} + +type ProcessEvent_Start struct { + Start *ProcessEvent_StartEvent `protobuf:"bytes,1,opt,name=start,proto3,oneof"` +} + +type ProcessEvent_Data struct { + Data *ProcessEvent_DataEvent `protobuf:"bytes,2,opt,name=data,proto3,oneof"` +} + +type ProcessEvent_End struct { + End *ProcessEvent_EndEvent `protobuf:"bytes,3,opt,name=end,proto3,oneof"` +} + +type ProcessEvent_Keepalive struct { + Keepalive *ProcessEvent_KeepAlive `protobuf:"bytes,4,opt,name=keepalive,proto3,oneof"` +} + +func (*ProcessEvent_Start) isProcessEvent_Event() {} + +func (*ProcessEvent_Data) isProcessEvent_Event() {} + +func (*ProcessEvent_End) isProcessEvent_Event() {} + +func (*ProcessEvent_Keepalive) isProcessEvent_Event() {} + +type StartResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Event *ProcessEvent `protobuf:"bytes,1,opt,name=event,proto3" json:"event,omitempty"` +} + +func (x *StartResponse) Reset() { + *x = StartResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StartResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StartResponse) ProtoMessage() {} + +func (x *StartResponse) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StartResponse.ProtoReflect.Descriptor instead. +func (*StartResponse) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{9} +} + +func (x *StartResponse) GetEvent() *ProcessEvent { + if x != nil { + return x.Event + } + return nil +} + +type ConnectResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Event *ProcessEvent `protobuf:"bytes,1,opt,name=event,proto3" json:"event,omitempty"` +} + +func (x *ConnectResponse) Reset() { + *x = ConnectResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConnectResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConnectResponse) ProtoMessage() {} + +func (x *ConnectResponse) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConnectResponse.ProtoReflect.Descriptor instead. +func (*ConnectResponse) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{10} +} + +func (x *ConnectResponse) GetEvent() *ProcessEvent { + if x != nil { + return x.Event + } + return nil +} + +type SendInputRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Process *ProcessSelector `protobuf:"bytes,1,opt,name=process,proto3" json:"process,omitempty"` + Input *ProcessInput `protobuf:"bytes,2,opt,name=input,proto3" json:"input,omitempty"` +} + +func (x *SendInputRequest) Reset() { + *x = SendInputRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SendInputRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendInputRequest) ProtoMessage() {} + +func (x *SendInputRequest) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendInputRequest.ProtoReflect.Descriptor instead. +func (*SendInputRequest) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{11} +} + +func (x *SendInputRequest) GetProcess() *ProcessSelector { + if x != nil { + return x.Process + } + return nil +} + +func (x *SendInputRequest) GetInput() *ProcessInput { + if x != nil { + return x.Input + } + return nil +} + +type SendInputResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *SendInputResponse) Reset() { + *x = SendInputResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SendInputResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendInputResponse) ProtoMessage() {} + +func (x *SendInputResponse) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendInputResponse.ProtoReflect.Descriptor instead. +func (*SendInputResponse) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{12} +} + +type ProcessInput struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Input: + // + // *ProcessInput_Stdin + // *ProcessInput_Pty + Input isProcessInput_Input `protobuf_oneof:"input"` +} + +func (x *ProcessInput) Reset() { + *x = ProcessInput{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProcessInput) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProcessInput) ProtoMessage() {} + +func (x *ProcessInput) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProcessInput.ProtoReflect.Descriptor instead. +func (*ProcessInput) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{13} +} + +func (m *ProcessInput) GetInput() isProcessInput_Input { + if m != nil { + return m.Input + } + return nil +} + +func (x *ProcessInput) GetStdin() []byte { + if x, ok := x.GetInput().(*ProcessInput_Stdin); ok { + return x.Stdin + } + return nil +} + +func (x *ProcessInput) GetPty() []byte { + if x, ok := x.GetInput().(*ProcessInput_Pty); ok { + return x.Pty + } + return nil +} + +type isProcessInput_Input interface { + isProcessInput_Input() +} + +type ProcessInput_Stdin struct { + Stdin []byte `protobuf:"bytes,1,opt,name=stdin,proto3,oneof"` +} + +type ProcessInput_Pty struct { + Pty []byte `protobuf:"bytes,2,opt,name=pty,proto3,oneof"` +} + +func (*ProcessInput_Stdin) isProcessInput_Input() {} + +func (*ProcessInput_Pty) isProcessInput_Input() {} + +type StreamInputRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Event: + // + // *StreamInputRequest_Start + // *StreamInputRequest_Data + // *StreamInputRequest_Keepalive + Event isStreamInputRequest_Event `protobuf_oneof:"event"` +} + +func (x *StreamInputRequest) Reset() { + *x = StreamInputRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StreamInputRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StreamInputRequest) ProtoMessage() {} + +func (x *StreamInputRequest) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StreamInputRequest.ProtoReflect.Descriptor instead. +func (*StreamInputRequest) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{14} +} + +func (m *StreamInputRequest) GetEvent() isStreamInputRequest_Event { + if m != nil { + return m.Event + } + return nil +} + +func (x *StreamInputRequest) GetStart() *StreamInputRequest_StartEvent { + if x, ok := x.GetEvent().(*StreamInputRequest_Start); ok { + return x.Start + } + return nil +} + +func (x *StreamInputRequest) GetData() *StreamInputRequest_DataEvent { + if x, ok := x.GetEvent().(*StreamInputRequest_Data); ok { + return x.Data + } + return nil +} + +func (x *StreamInputRequest) GetKeepalive() *StreamInputRequest_KeepAlive { + if x, ok := x.GetEvent().(*StreamInputRequest_Keepalive); ok { + return x.Keepalive + } + return nil +} + +type isStreamInputRequest_Event interface { + isStreamInputRequest_Event() +} + +type StreamInputRequest_Start struct { + Start *StreamInputRequest_StartEvent `protobuf:"bytes,1,opt,name=start,proto3,oneof"` +} + +type StreamInputRequest_Data struct { + Data *StreamInputRequest_DataEvent `protobuf:"bytes,2,opt,name=data,proto3,oneof"` +} + +type StreamInputRequest_Keepalive struct { + Keepalive *StreamInputRequest_KeepAlive `protobuf:"bytes,3,opt,name=keepalive,proto3,oneof"` +} + +func (*StreamInputRequest_Start) isStreamInputRequest_Event() {} + +func (*StreamInputRequest_Data) isStreamInputRequest_Event() {} + +func (*StreamInputRequest_Keepalive) isStreamInputRequest_Event() {} + +type StreamInputResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *StreamInputResponse) Reset() { + *x = StreamInputResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StreamInputResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StreamInputResponse) ProtoMessage() {} + +func (x *StreamInputResponse) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StreamInputResponse.ProtoReflect.Descriptor instead. +func (*StreamInputResponse) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{15} +} + +type SendSignalRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Process *ProcessSelector `protobuf:"bytes,1,opt,name=process,proto3" json:"process,omitempty"` + Signal Signal `protobuf:"varint,2,opt,name=signal,proto3,enum=process.Signal" json:"signal,omitempty"` +} + +func (x *SendSignalRequest) Reset() { + *x = SendSignalRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SendSignalRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendSignalRequest) ProtoMessage() {} + +func (x *SendSignalRequest) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendSignalRequest.ProtoReflect.Descriptor instead. +func (*SendSignalRequest) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{16} +} + +func (x *SendSignalRequest) GetProcess() *ProcessSelector { + if x != nil { + return x.Process + } + return nil +} + +func (x *SendSignalRequest) GetSignal() Signal { + if x != nil { + return x.Signal + } + return Signal_SIGNAL_UNSPECIFIED +} + +type SendSignalResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *SendSignalResponse) Reset() { + *x = SendSignalResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SendSignalResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendSignalResponse) ProtoMessage() {} + +func (x *SendSignalResponse) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendSignalResponse.ProtoReflect.Descriptor instead. +func (*SendSignalResponse) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{17} +} + +type CloseStdinRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Process *ProcessSelector `protobuf:"bytes,1,opt,name=process,proto3" json:"process,omitempty"` +} + +func (x *CloseStdinRequest) Reset() { + *x = CloseStdinRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CloseStdinRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CloseStdinRequest) ProtoMessage() {} + +func (x *CloseStdinRequest) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CloseStdinRequest.ProtoReflect.Descriptor instead. +func (*CloseStdinRequest) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{18} +} + +func (x *CloseStdinRequest) GetProcess() *ProcessSelector { + if x != nil { + return x.Process + } + return nil +} + +type CloseStdinResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *CloseStdinResponse) Reset() { + *x = CloseStdinResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CloseStdinResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CloseStdinResponse) ProtoMessage() {} + +func (x *CloseStdinResponse) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CloseStdinResponse.ProtoReflect.Descriptor instead. +func (*CloseStdinResponse) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{19} +} + +type ConnectRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Process *ProcessSelector `protobuf:"bytes,1,opt,name=process,proto3" json:"process,omitempty"` +} + +func (x *ConnectRequest) Reset() { + *x = ConnectRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConnectRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConnectRequest) ProtoMessage() {} + +func (x *ConnectRequest) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConnectRequest.ProtoReflect.Descriptor instead. +func (*ConnectRequest) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{20} +} + +func (x *ConnectRequest) GetProcess() *ProcessSelector { + if x != nil { + return x.Process + } + return nil +} + +type ProcessSelector struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Selector: + // + // *ProcessSelector_Pid + // *ProcessSelector_Tag + Selector isProcessSelector_Selector `protobuf_oneof:"selector"` +} + +func (x *ProcessSelector) Reset() { + *x = ProcessSelector{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProcessSelector) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProcessSelector) ProtoMessage() {} + +func (x *ProcessSelector) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProcessSelector.ProtoReflect.Descriptor instead. +func (*ProcessSelector) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{21} +} + +func (m *ProcessSelector) GetSelector() isProcessSelector_Selector { + if m != nil { + return m.Selector + } + return nil +} + +func (x *ProcessSelector) GetPid() uint32 { + if x, ok := x.GetSelector().(*ProcessSelector_Pid); ok { + return x.Pid + } + return 0 +} + +func (x *ProcessSelector) GetTag() string { + if x, ok := x.GetSelector().(*ProcessSelector_Tag); ok { + return x.Tag + } + return "" +} + +type isProcessSelector_Selector interface { + isProcessSelector_Selector() +} + +type ProcessSelector_Pid struct { + Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3,oneof"` +} + +type ProcessSelector_Tag struct { + Tag string `protobuf:"bytes,2,opt,name=tag,proto3,oneof"` +} + +func (*ProcessSelector_Pid) isProcessSelector_Selector() {} + +func (*ProcessSelector_Tag) isProcessSelector_Selector() {} + +type PTY_Size struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Cols uint32 `protobuf:"varint,1,opt,name=cols,proto3" json:"cols,omitempty"` + Rows uint32 `protobuf:"varint,2,opt,name=rows,proto3" json:"rows,omitempty"` +} + +func (x *PTY_Size) Reset() { + *x = PTY_Size{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PTY_Size) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PTY_Size) ProtoMessage() {} + +func (x *PTY_Size) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PTY_Size.ProtoReflect.Descriptor instead. +func (*PTY_Size) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *PTY_Size) GetCols() uint32 { + if x != nil { + return x.Cols + } + return 0 +} + +func (x *PTY_Size) GetRows() uint32 { + if x != nil { + return x.Rows + } + return 0 +} + +type ProcessEvent_StartEvent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pid uint32 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` +} + +func (x *ProcessEvent_StartEvent) Reset() { + *x = ProcessEvent_StartEvent{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProcessEvent_StartEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProcessEvent_StartEvent) ProtoMessage() {} + +func (x *ProcessEvent_StartEvent) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[24] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProcessEvent_StartEvent.ProtoReflect.Descriptor instead. +func (*ProcessEvent_StartEvent) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{8, 0} +} + +func (x *ProcessEvent_StartEvent) GetPid() uint32 { + if x != nil { + return x.Pid + } + return 0 +} + +type ProcessEvent_DataEvent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Output: + // + // *ProcessEvent_DataEvent_Stdout + // *ProcessEvent_DataEvent_Stderr + // *ProcessEvent_DataEvent_Pty + Output isProcessEvent_DataEvent_Output `protobuf_oneof:"output"` +} + +func (x *ProcessEvent_DataEvent) Reset() { + *x = ProcessEvent_DataEvent{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProcessEvent_DataEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProcessEvent_DataEvent) ProtoMessage() {} + +func (x *ProcessEvent_DataEvent) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[25] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProcessEvent_DataEvent.ProtoReflect.Descriptor instead. +func (*ProcessEvent_DataEvent) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{8, 1} +} + +func (m *ProcessEvent_DataEvent) GetOutput() isProcessEvent_DataEvent_Output { + if m != nil { + return m.Output + } + return nil +} + +func (x *ProcessEvent_DataEvent) GetStdout() []byte { + if x, ok := x.GetOutput().(*ProcessEvent_DataEvent_Stdout); ok { + return x.Stdout + } + return nil +} + +func (x *ProcessEvent_DataEvent) GetStderr() []byte { + if x, ok := x.GetOutput().(*ProcessEvent_DataEvent_Stderr); ok { + return x.Stderr + } + return nil +} + +func (x *ProcessEvent_DataEvent) GetPty() []byte { + if x, ok := x.GetOutput().(*ProcessEvent_DataEvent_Pty); ok { + return x.Pty + } + return nil +} + +type isProcessEvent_DataEvent_Output interface { + isProcessEvent_DataEvent_Output() +} + +type ProcessEvent_DataEvent_Stdout struct { + Stdout []byte `protobuf:"bytes,1,opt,name=stdout,proto3,oneof"` +} + +type ProcessEvent_DataEvent_Stderr struct { + Stderr []byte `protobuf:"bytes,2,opt,name=stderr,proto3,oneof"` +} + +type ProcessEvent_DataEvent_Pty struct { + Pty []byte `protobuf:"bytes,3,opt,name=pty,proto3,oneof"` +} + +func (*ProcessEvent_DataEvent_Stdout) isProcessEvent_DataEvent_Output() {} + +func (*ProcessEvent_DataEvent_Stderr) isProcessEvent_DataEvent_Output() {} + +func (*ProcessEvent_DataEvent_Pty) isProcessEvent_DataEvent_Output() {} + +type ProcessEvent_EndEvent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ExitCode int32 `protobuf:"zigzag32,1,opt,name=exit_code,json=exitCode,proto3" json:"exit_code,omitempty"` + Exited bool `protobuf:"varint,2,opt,name=exited,proto3" json:"exited,omitempty"` + Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"` + Error *string `protobuf:"bytes,4,opt,name=error,proto3,oneof" json:"error,omitempty"` +} + +func (x *ProcessEvent_EndEvent) Reset() { + *x = ProcessEvent_EndEvent{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProcessEvent_EndEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProcessEvent_EndEvent) ProtoMessage() {} + +func (x *ProcessEvent_EndEvent) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[26] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProcessEvent_EndEvent.ProtoReflect.Descriptor instead. +func (*ProcessEvent_EndEvent) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{8, 2} +} + +func (x *ProcessEvent_EndEvent) GetExitCode() int32 { + if x != nil { + return x.ExitCode + } + return 0 +} + +func (x *ProcessEvent_EndEvent) GetExited() bool { + if x != nil { + return x.Exited + } + return false +} + +func (x *ProcessEvent_EndEvent) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + +func (x *ProcessEvent_EndEvent) GetError() string { + if x != nil && x.Error != nil { + return *x.Error + } + return "" +} + +type ProcessEvent_KeepAlive struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ProcessEvent_KeepAlive) Reset() { + *x = ProcessEvent_KeepAlive{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProcessEvent_KeepAlive) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProcessEvent_KeepAlive) ProtoMessage() {} + +func (x *ProcessEvent_KeepAlive) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[27] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProcessEvent_KeepAlive.ProtoReflect.Descriptor instead. +func (*ProcessEvent_KeepAlive) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{8, 3} +} + +type StreamInputRequest_StartEvent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Process *ProcessSelector `protobuf:"bytes,1,opt,name=process,proto3" json:"process,omitempty"` +} + +func (x *StreamInputRequest_StartEvent) Reset() { + *x = StreamInputRequest_StartEvent{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StreamInputRequest_StartEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StreamInputRequest_StartEvent) ProtoMessage() {} + +func (x *StreamInputRequest_StartEvent) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[28] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StreamInputRequest_StartEvent.ProtoReflect.Descriptor instead. +func (*StreamInputRequest_StartEvent) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{14, 0} +} + +func (x *StreamInputRequest_StartEvent) GetProcess() *ProcessSelector { + if x != nil { + return x.Process + } + return nil +} + +type StreamInputRequest_DataEvent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Input *ProcessInput `protobuf:"bytes,2,opt,name=input,proto3" json:"input,omitempty"` +} + +func (x *StreamInputRequest_DataEvent) Reset() { + *x = StreamInputRequest_DataEvent{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StreamInputRequest_DataEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StreamInputRequest_DataEvent) ProtoMessage() {} + +func (x *StreamInputRequest_DataEvent) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[29] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StreamInputRequest_DataEvent.ProtoReflect.Descriptor instead. +func (*StreamInputRequest_DataEvent) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{14, 1} +} + +func (x *StreamInputRequest_DataEvent) GetInput() *ProcessInput { + if x != nil { + return x.Input + } + return nil +} + +type StreamInputRequest_KeepAlive struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *StreamInputRequest_KeepAlive) Reset() { + *x = StreamInputRequest_KeepAlive{} + if protoimpl.UnsafeEnabled { + mi := &file_process_process_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StreamInputRequest_KeepAlive) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StreamInputRequest_KeepAlive) ProtoMessage() {} + +func (x *StreamInputRequest_KeepAlive) ProtoReflect() protoreflect.Message { + mi := &file_process_process_proto_msgTypes[30] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StreamInputRequest_KeepAlive.ProtoReflect.Descriptor instead. +func (*StreamInputRequest_KeepAlive) Descriptor() ([]byte, []int) { + return file_process_process_proto_rawDescGZIP(), []int{14, 2} +} + +var File_process_process_proto protoreflect.FileDescriptor + +var file_process_process_proto_rawDesc = []byte{ + 0x0a, 0x15, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, + 0x22, 0x5c, 0x0a, 0x03, 0x50, 0x54, 0x59, 0x12, 0x25, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, + 0x50, 0x54, 0x59, 0x2e, 0x53, 0x69, 0x7a, 0x65, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x1a, 0x2e, + 0x0a, 0x04, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x6c, 0x73, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x63, 0x6f, 0x6c, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, + 0x77, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x72, 0x6f, 0x77, 0x73, 0x22, 0xc3, + 0x01, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6d, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, + 0x6d, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x12, 0x34, 0x0a, 0x04, 0x65, 0x6e, 0x76, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x50, + 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x45, 0x6e, 0x76, + 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x65, 0x6e, 0x76, 0x73, 0x12, 0x15, 0x0a, 0x03, + 0x63, 0x77, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x63, 0x77, 0x64, + 0x88, 0x01, 0x01, 0x1a, 0x37, 0x0a, 0x09, 0x45, 0x6e, 0x76, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x0a, 0x04, + 0x5f, 0x63, 0x77, 0x64, 0x22, 0x0d, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x22, 0x6e, 0x0a, 0x0b, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x49, 0x6e, + 0x66, 0x6f, 0x12, 0x2e, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x50, 0x72, 0x6f, + 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x03, 0x70, 0x69, 0x64, 0x12, 0x15, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x00, 0x52, 0x03, 0x74, 0x61, 0x67, 0x88, 0x01, 0x01, 0x42, 0x06, 0x0a, 0x04, 0x5f, + 0x74, 0x61, 0x67, 0x22, 0x42, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, + 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x70, 0x72, + 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x22, 0xb1, 0x01, 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x72, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x30, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x63, + 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x63, + 0x65, 0x73, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x12, 0x23, 0x0a, 0x03, 0x70, 0x74, + 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, + 0x73, 0x2e, 0x50, 0x54, 0x59, 0x48, 0x00, 0x52, 0x03, 0x70, 0x74, 0x79, 0x88, 0x01, 0x01, 0x12, + 0x15, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x03, + 0x74, 0x61, 0x67, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x64, 0x69, 0x6e, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x08, 0x48, 0x02, 0x52, 0x05, 0x73, 0x74, 0x64, 0x69, 0x6e, 0x88, 0x01, + 0x01, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x70, 0x74, 0x79, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x74, 0x61, + 0x67, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x64, 0x69, 0x6e, 0x22, 0x70, 0x0a, 0x0d, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x32, 0x0a, 0x07, + 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x53, + 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, + 0x12, 0x23, 0x0a, 0x03, 0x70, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, + 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x50, 0x54, 0x59, 0x48, 0x00, 0x52, 0x03, 0x70, + 0x74, 0x79, 0x88, 0x01, 0x01, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x70, 0x74, 0x79, 0x22, 0x10, 0x0a, + 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x87, 0x04, 0x0a, 0x0c, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x12, 0x38, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, + 0x73, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x35, 0x0a, 0x04, 0x64, 0x61, + 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x63, 0x65, + 0x73, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, + 0x44, 0x61, 0x74, 0x61, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x04, 0x64, 0x61, 0x74, + 0x61, 0x12, 0x32, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, + 0x2e, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, + 0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x45, 0x6e, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, + 0x52, 0x03, 0x65, 0x6e, 0x64, 0x12, 0x3f, 0x0a, 0x09, 0x6b, 0x65, 0x65, 0x70, 0x61, 0x6c, 0x69, + 0x76, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x63, 0x65, + 0x73, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, + 0x4b, 0x65, 0x65, 0x70, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x48, 0x00, 0x52, 0x09, 0x6b, 0x65, 0x65, + 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x1a, 0x1e, 0x0a, 0x0a, 0x53, 0x74, 0x61, 0x72, 0x74, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x03, 0x70, 0x69, 0x64, 0x1a, 0x5d, 0x0a, 0x09, 0x44, 0x61, 0x74, 0x61, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x06, 0x73, 0x74, 0x64, 0x6f, 0x75, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x06, 0x73, 0x74, 0x64, 0x6f, 0x75, 0x74, 0x12, 0x18, 0x0a, + 0x06, 0x73, 0x74, 0x64, 0x65, 0x72, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, + 0x06, 0x73, 0x74, 0x64, 0x65, 0x72, 0x72, 0x12, 0x12, 0x0a, 0x03, 0x70, 0x74, 0x79, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x03, 0x70, 0x74, 0x79, 0x42, 0x08, 0x0a, 0x06, 0x6f, + 0x75, 0x74, 0x70, 0x75, 0x74, 0x1a, 0x7c, 0x0a, 0x08, 0x45, 0x6e, 0x64, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x78, 0x69, 0x74, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x11, 0x52, 0x08, 0x65, 0x78, 0x69, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x16, + 0x0a, 0x06, 0x65, 0x78, 0x69, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, + 0x65, 0x78, 0x69, 0x74, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x19, + 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, + 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x65, 0x72, + 0x72, 0x6f, 0x72, 0x1a, 0x0b, 0x0a, 0x09, 0x4b, 0x65, 0x65, 0x70, 0x41, 0x6c, 0x69, 0x76, 0x65, + 0x42, 0x07, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x22, 0x3c, 0x0a, 0x0d, 0x53, 0x74, 0x61, + 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x65, 0x76, + 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x63, + 0x65, 0x73, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x52, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x22, 0x3e, 0x0a, 0x0f, 0x43, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x65, 0x76, + 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x63, + 0x65, 0x73, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x52, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x22, 0x73, 0x0a, 0x10, 0x53, 0x65, 0x6e, 0x64, 0x49, + 0x6e, 0x70, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x32, 0x0a, 0x07, 0x70, + 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, + 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x53, 0x65, + 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x12, + 0x2b, 0x0a, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, + 0x2e, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, + 0x49, 0x6e, 0x70, 0x75, 0x74, 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x22, 0x13, 0x0a, 0x11, + 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x43, 0x0a, 0x0c, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x49, 0x6e, 0x70, 0x75, + 0x74, 0x12, 0x16, 0x0a, 0x05, 0x73, 0x74, 0x64, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, + 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x64, 0x69, 0x6e, 0x12, 0x12, 0x0a, 0x03, 0x70, 0x74, 0x79, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x03, 0x70, 0x74, 0x79, 0x42, 0x07, 0x0a, + 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x22, 0xea, 0x02, 0x0a, 0x12, 0x53, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3e, 0x0a, + 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x70, + 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x6e, 0x70, + 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x3b, 0x0a, + 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x70, 0x72, + 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x6e, 0x70, 0x75, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x48, 0x00, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x45, 0x0a, 0x09, 0x6b, 0x65, + 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, + 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x6e, + 0x70, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x4b, 0x65, 0x65, 0x70, 0x41, + 0x6c, 0x69, 0x76, 0x65, 0x48, 0x00, 0x52, 0x09, 0x6b, 0x65, 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, + 0x65, 0x1a, 0x40, 0x0a, 0x0a, 0x53, 0x74, 0x61, 0x72, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, + 0x32, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, + 0x73, 0x73, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x63, + 0x65, 0x73, 0x73, 0x1a, 0x38, 0x0a, 0x09, 0x44, 0x61, 0x74, 0x61, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x12, 0x2b, 0x0a, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, + 0x73, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x1a, 0x0b, 0x0a, + 0x09, 0x4b, 0x65, 0x65, 0x70, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x65, 0x76, + 0x65, 0x6e, 0x74, 0x22, 0x15, 0x0a, 0x13, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x6e, 0x70, + 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x70, 0x0a, 0x11, 0x53, 0x65, + 0x6e, 0x64, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x32, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, + 0x73, 0x73, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x63, + 0x65, 0x73, 0x73, 0x12, 0x27, 0x0a, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x53, 0x69, + 0x67, 0x6e, 0x61, 0x6c, 0x52, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x22, 0x14, 0x0a, 0x12, + 0x53, 0x65, 0x6e, 0x64, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x47, 0x0a, 0x11, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x53, 0x74, 0x64, 0x69, 0x6e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x32, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, + 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x63, 0x65, + 0x73, 0x73, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x22, 0x14, 0x0a, 0x12, 0x43, + 0x6c, 0x6f, 0x73, 0x65, 0x53, 0x74, 0x64, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x44, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x32, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x50, + 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x52, 0x07, + 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x22, 0x45, 0x0a, 0x0f, 0x50, 0x72, 0x6f, 0x63, 0x65, + 0x73, 0x73, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x12, 0x0a, 0x03, 0x70, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x03, 0x70, 0x69, 0x64, 0x12, 0x12, + 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x74, + 0x61, 0x67, 0x42, 0x0a, 0x0a, 0x08, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2a, 0x48, + 0x0a, 0x06, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x49, 0x47, 0x4e, + 0x41, 0x4c, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, + 0x12, 0x12, 0x0a, 0x0e, 0x53, 0x49, 0x47, 0x4e, 0x41, 0x4c, 0x5f, 0x53, 0x49, 0x47, 0x54, 0x45, + 0x52, 0x4d, 0x10, 0x0f, 0x12, 0x12, 0x0a, 0x0e, 0x53, 0x49, 0x47, 0x4e, 0x41, 0x4c, 0x5f, 0x53, + 0x49, 0x47, 0x4b, 0x49, 0x4c, 0x4c, 0x10, 0x09, 0x32, 0x91, 0x04, 0x0a, 0x07, 0x50, 0x72, 0x6f, + 0x63, 0x65, 0x73, 0x73, 0x12, 0x33, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x14, 0x2e, 0x70, + 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x07, 0x43, 0x6f, 0x6e, + 0x6e, 0x65, 0x63, 0x74, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x43, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, + 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x38, 0x0a, 0x05, 0x53, 0x74, 0x61, + 0x72, 0x74, 0x12, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x53, 0x74, 0x61, + 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x63, + 0x65, 0x73, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x30, 0x01, 0x12, 0x39, 0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x16, 0x2e, + 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4a, + 0x0a, 0x0b, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x1b, 0x2e, + 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x6e, + 0x70, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x72, 0x6f, + 0x63, 0x65, 0x73, 0x73, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x6e, 0x70, 0x75, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, 0x42, 0x0a, 0x09, 0x53, 0x65, + 0x6e, 0x64, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, + 0x73, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x53, 0x65, 0x6e, + 0x64, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, + 0x0a, 0x0a, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x12, 0x1a, 0x2e, 0x70, + 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x69, 0x67, 0x6e, 0x61, + 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x63, 0x65, + 0x73, 0x73, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x0a, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x53, 0x74, + 0x64, 0x69, 0x6e, 0x12, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x43, 0x6c, + 0x6f, 0x73, 0x65, 0x53, 0x74, 0x64, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x53, + 0x74, 0x64, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x8a, 0x01, 0x0a, + 0x0b, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x42, 0x0c, 0x50, 0x72, + 0x6f, 0x63, 0x65, 0x73, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x6b, 0x72, 0x75, + 0x69, 0x73, 0x65, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2f, 0x65, + 0x32, 0x62, 0x2f, 0x65, 0x6e, 0x76, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0xa2, + 0x02, 0x03, 0x50, 0x58, 0x58, 0xaa, 0x02, 0x07, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0xca, + 0x02, 0x07, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0xe2, 0x02, 0x13, 0x50, 0x72, 0x6f, 0x63, + 0x65, 0x73, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, + 0x02, 0x07, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_process_process_proto_rawDescOnce sync.Once + file_process_process_proto_rawDescData = file_process_process_proto_rawDesc +) + +func file_process_process_proto_rawDescGZIP() []byte { + file_process_process_proto_rawDescOnce.Do(func() { + file_process_process_proto_rawDescData = protoimpl.X.CompressGZIP(file_process_process_proto_rawDescData) + }) + return file_process_process_proto_rawDescData +} + +var file_process_process_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_process_process_proto_msgTypes = make([]protoimpl.MessageInfo, 31) +var file_process_process_proto_goTypes = []interface{}{ + (Signal)(0), // 0: process.Signal + (*PTY)(nil), // 1: process.PTY + (*ProcessConfig)(nil), // 2: process.ProcessConfig + (*ListRequest)(nil), // 3: process.ListRequest + (*ProcessInfo)(nil), // 4: process.ProcessInfo + (*ListResponse)(nil), // 5: process.ListResponse + (*StartRequest)(nil), // 6: process.StartRequest + (*UpdateRequest)(nil), // 7: process.UpdateRequest + (*UpdateResponse)(nil), // 8: process.UpdateResponse + (*ProcessEvent)(nil), // 9: process.ProcessEvent + (*StartResponse)(nil), // 10: process.StartResponse + (*ConnectResponse)(nil), // 11: process.ConnectResponse + (*SendInputRequest)(nil), // 12: process.SendInputRequest + (*SendInputResponse)(nil), // 13: process.SendInputResponse + (*ProcessInput)(nil), // 14: process.ProcessInput + (*StreamInputRequest)(nil), // 15: process.StreamInputRequest + (*StreamInputResponse)(nil), // 16: process.StreamInputResponse + (*SendSignalRequest)(nil), // 17: process.SendSignalRequest + (*SendSignalResponse)(nil), // 18: process.SendSignalResponse + (*CloseStdinRequest)(nil), // 19: process.CloseStdinRequest + (*CloseStdinResponse)(nil), // 20: process.CloseStdinResponse + (*ConnectRequest)(nil), // 21: process.ConnectRequest + (*ProcessSelector)(nil), // 22: process.ProcessSelector + (*PTY_Size)(nil), // 23: process.PTY.Size + nil, // 24: process.ProcessConfig.EnvsEntry + (*ProcessEvent_StartEvent)(nil), // 25: process.ProcessEvent.StartEvent + (*ProcessEvent_DataEvent)(nil), // 26: process.ProcessEvent.DataEvent + (*ProcessEvent_EndEvent)(nil), // 27: process.ProcessEvent.EndEvent + (*ProcessEvent_KeepAlive)(nil), // 28: process.ProcessEvent.KeepAlive + (*StreamInputRequest_StartEvent)(nil), // 29: process.StreamInputRequest.StartEvent + (*StreamInputRequest_DataEvent)(nil), // 30: process.StreamInputRequest.DataEvent + (*StreamInputRequest_KeepAlive)(nil), // 31: process.StreamInputRequest.KeepAlive +} +var file_process_process_proto_depIdxs = []int32{ + 23, // 0: process.PTY.size:type_name -> process.PTY.Size + 24, // 1: process.ProcessConfig.envs:type_name -> process.ProcessConfig.EnvsEntry + 2, // 2: process.ProcessInfo.config:type_name -> process.ProcessConfig + 4, // 3: process.ListResponse.processes:type_name -> process.ProcessInfo + 2, // 4: process.StartRequest.process:type_name -> process.ProcessConfig + 1, // 5: process.StartRequest.pty:type_name -> process.PTY + 22, // 6: process.UpdateRequest.process:type_name -> process.ProcessSelector + 1, // 7: process.UpdateRequest.pty:type_name -> process.PTY + 25, // 8: process.ProcessEvent.start:type_name -> process.ProcessEvent.StartEvent + 26, // 9: process.ProcessEvent.data:type_name -> process.ProcessEvent.DataEvent + 27, // 10: process.ProcessEvent.end:type_name -> process.ProcessEvent.EndEvent + 28, // 11: process.ProcessEvent.keepalive:type_name -> process.ProcessEvent.KeepAlive + 9, // 12: process.StartResponse.event:type_name -> process.ProcessEvent + 9, // 13: process.ConnectResponse.event:type_name -> process.ProcessEvent + 22, // 14: process.SendInputRequest.process:type_name -> process.ProcessSelector + 14, // 15: process.SendInputRequest.input:type_name -> process.ProcessInput + 29, // 16: process.StreamInputRequest.start:type_name -> process.StreamInputRequest.StartEvent + 30, // 17: process.StreamInputRequest.data:type_name -> process.StreamInputRequest.DataEvent + 31, // 18: process.StreamInputRequest.keepalive:type_name -> process.StreamInputRequest.KeepAlive + 22, // 19: process.SendSignalRequest.process:type_name -> process.ProcessSelector + 0, // 20: process.SendSignalRequest.signal:type_name -> process.Signal + 22, // 21: process.CloseStdinRequest.process:type_name -> process.ProcessSelector + 22, // 22: process.ConnectRequest.process:type_name -> process.ProcessSelector + 22, // 23: process.StreamInputRequest.StartEvent.process:type_name -> process.ProcessSelector + 14, // 24: process.StreamInputRequest.DataEvent.input:type_name -> process.ProcessInput + 3, // 25: process.Process.List:input_type -> process.ListRequest + 21, // 26: process.Process.Connect:input_type -> process.ConnectRequest + 6, // 27: process.Process.Start:input_type -> process.StartRequest + 7, // 28: process.Process.Update:input_type -> process.UpdateRequest + 15, // 29: process.Process.StreamInput:input_type -> process.StreamInputRequest + 12, // 30: process.Process.SendInput:input_type -> process.SendInputRequest + 17, // 31: process.Process.SendSignal:input_type -> process.SendSignalRequest + 19, // 32: process.Process.CloseStdin:input_type -> process.CloseStdinRequest + 5, // 33: process.Process.List:output_type -> process.ListResponse + 11, // 34: process.Process.Connect:output_type -> process.ConnectResponse + 10, // 35: process.Process.Start:output_type -> process.StartResponse + 8, // 36: process.Process.Update:output_type -> process.UpdateResponse + 16, // 37: process.Process.StreamInput:output_type -> process.StreamInputResponse + 13, // 38: process.Process.SendInput:output_type -> process.SendInputResponse + 18, // 39: process.Process.SendSignal:output_type -> process.SendSignalResponse + 20, // 40: process.Process.CloseStdin:output_type -> process.CloseStdinResponse + 33, // [33:41] is the sub-list for method output_type + 25, // [25:33] is the sub-list for method input_type + 25, // [25:25] is the sub-list for extension type_name + 25, // [25:25] is the sub-list for extension extendee + 0, // [0:25] is the sub-list for field type_name +} + +func init() { file_process_process_proto_init() } +func file_process_process_proto_init() { + if File_process_process_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_process_process_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PTY); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProcessConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProcessInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StartRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProcessEvent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StartResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConnectResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SendInputRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SendInputResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProcessInput); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StreamInputRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StreamInputResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SendSignalRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SendSignalResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CloseStdinRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CloseStdinResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConnectRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProcessSelector); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PTY_Size); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProcessEvent_StartEvent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProcessEvent_DataEvent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProcessEvent_EndEvent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProcessEvent_KeepAlive); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StreamInputRequest_StartEvent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StreamInputRequest_DataEvent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_process_process_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StreamInputRequest_KeepAlive); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_process_process_proto_msgTypes[1].OneofWrappers = []interface{}{} + file_process_process_proto_msgTypes[3].OneofWrappers = []interface{}{} + file_process_process_proto_msgTypes[5].OneofWrappers = []interface{}{} + file_process_process_proto_msgTypes[6].OneofWrappers = []interface{}{} + file_process_process_proto_msgTypes[8].OneofWrappers = []interface{}{ + (*ProcessEvent_Start)(nil), + (*ProcessEvent_Data)(nil), + (*ProcessEvent_End)(nil), + (*ProcessEvent_Keepalive)(nil), + } + file_process_process_proto_msgTypes[13].OneofWrappers = []interface{}{ + (*ProcessInput_Stdin)(nil), + (*ProcessInput_Pty)(nil), + } + file_process_process_proto_msgTypes[14].OneofWrappers = []interface{}{ + (*StreamInputRequest_Start)(nil), + (*StreamInputRequest_Data)(nil), + (*StreamInputRequest_Keepalive)(nil), + } + file_process_process_proto_msgTypes[21].OneofWrappers = []interface{}{ + (*ProcessSelector_Pid)(nil), + (*ProcessSelector_Tag)(nil), + } + file_process_process_proto_msgTypes[25].OneofWrappers = []interface{}{ + (*ProcessEvent_DataEvent_Stdout)(nil), + (*ProcessEvent_DataEvent_Stderr)(nil), + (*ProcessEvent_DataEvent_Pty)(nil), + } + file_process_process_proto_msgTypes[26].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_process_process_proto_rawDesc, + NumEnums: 1, + NumMessages: 31, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_process_process_proto_goTypes, + DependencyIndexes: file_process_process_proto_depIdxs, + EnumInfos: file_process_process_proto_enumTypes, + MessageInfos: file_process_process_proto_msgTypes, + }.Build() + File_process_process_proto = out.File + file_process_process_proto_rawDesc = nil + file_process_process_proto_goTypes = nil + file_process_process_proto_depIdxs = nil +} diff --git a/e2b/envd/process/processconnect/process.connect.go b/e2b/envd/process/processconnect/process.connect.go new file mode 100644 index 0000000..21cdd63 --- /dev/null +++ b/e2b/envd/process/processconnect/process.connect.go @@ -0,0 +1,310 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: process/process.proto + +package processconnect + +import ( + connect "connectrpc.com/connect" + context "context" + errors "errors" + process "github.com/openkruise/agents-api/e2b/envd/process" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect.IsAtLeastVersion1_13_0 + +const ( + // ProcessName is the fully-qualified name of the Process service. + ProcessName = "process.Process" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // ProcessListProcedure is the fully-qualified name of the Process's List RPC. + ProcessListProcedure = "/process.Process/List" + // ProcessConnectProcedure is the fully-qualified name of the Process's Connect RPC. + ProcessConnectProcedure = "/process.Process/Connect" + // ProcessStartProcedure is the fully-qualified name of the Process's Start RPC. + ProcessStartProcedure = "/process.Process/Start" + // ProcessUpdateProcedure is the fully-qualified name of the Process's Update RPC. + ProcessUpdateProcedure = "/process.Process/Update" + // ProcessStreamInputProcedure is the fully-qualified name of the Process's StreamInput RPC. + ProcessStreamInputProcedure = "/process.Process/StreamInput" + // ProcessSendInputProcedure is the fully-qualified name of the Process's SendInput RPC. + ProcessSendInputProcedure = "/process.Process/SendInput" + // ProcessSendSignalProcedure is the fully-qualified name of the Process's SendSignal RPC. + ProcessSendSignalProcedure = "/process.Process/SendSignal" + // ProcessCloseStdinProcedure is the fully-qualified name of the Process's CloseStdin RPC. + ProcessCloseStdinProcedure = "/process.Process/CloseStdin" +) + +// ProcessClient is a client for the process.Process service. +type ProcessClient interface { + List(context.Context, *connect.Request[process.ListRequest]) (*connect.Response[process.ListResponse], error) + Connect(context.Context, *connect.Request[process.ConnectRequest]) (*connect.ServerStreamForClient[process.ConnectResponse], error) + Start(context.Context, *connect.Request[process.StartRequest]) (*connect.ServerStreamForClient[process.StartResponse], error) + Update(context.Context, *connect.Request[process.UpdateRequest]) (*connect.Response[process.UpdateResponse], error) + // Client input stream ensures ordering of messages + StreamInput(context.Context) *connect.ClientStreamForClient[process.StreamInputRequest, process.StreamInputResponse] + SendInput(context.Context, *connect.Request[process.SendInputRequest]) (*connect.Response[process.SendInputResponse], error) + SendSignal(context.Context, *connect.Request[process.SendSignalRequest]) (*connect.Response[process.SendSignalResponse], error) + // Close stdin to signal EOF to the process. + // Only works for non-PTY processes. For PTY, send Ctrl+D (0x04) instead. + CloseStdin(context.Context, *connect.Request[process.CloseStdinRequest]) (*connect.Response[process.CloseStdinResponse], error) +} + +// NewProcessClient constructs a client for the process.Process service. By default, it uses the +// Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends +// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or +// connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewProcessClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) ProcessClient { + baseURL = strings.TrimRight(baseURL, "/") + processMethods := process.File_process_process_proto.Services().ByName("Process").Methods() + return &processClient{ + list: connect.NewClient[process.ListRequest, process.ListResponse]( + httpClient, + baseURL+ProcessListProcedure, + connect.WithSchema(processMethods.ByName("List")), + connect.WithClientOptions(opts...), + ), + connect: connect.NewClient[process.ConnectRequest, process.ConnectResponse]( + httpClient, + baseURL+ProcessConnectProcedure, + connect.WithSchema(processMethods.ByName("Connect")), + connect.WithClientOptions(opts...), + ), + start: connect.NewClient[process.StartRequest, process.StartResponse]( + httpClient, + baseURL+ProcessStartProcedure, + connect.WithSchema(processMethods.ByName("Start")), + connect.WithClientOptions(opts...), + ), + update: connect.NewClient[process.UpdateRequest, process.UpdateResponse]( + httpClient, + baseURL+ProcessUpdateProcedure, + connect.WithSchema(processMethods.ByName("Update")), + connect.WithClientOptions(opts...), + ), + streamInput: connect.NewClient[process.StreamInputRequest, process.StreamInputResponse]( + httpClient, + baseURL+ProcessStreamInputProcedure, + connect.WithSchema(processMethods.ByName("StreamInput")), + connect.WithClientOptions(opts...), + ), + sendInput: connect.NewClient[process.SendInputRequest, process.SendInputResponse]( + httpClient, + baseURL+ProcessSendInputProcedure, + connect.WithSchema(processMethods.ByName("SendInput")), + connect.WithClientOptions(opts...), + ), + sendSignal: connect.NewClient[process.SendSignalRequest, process.SendSignalResponse]( + httpClient, + baseURL+ProcessSendSignalProcedure, + connect.WithSchema(processMethods.ByName("SendSignal")), + connect.WithClientOptions(opts...), + ), + closeStdin: connect.NewClient[process.CloseStdinRequest, process.CloseStdinResponse]( + httpClient, + baseURL+ProcessCloseStdinProcedure, + connect.WithSchema(processMethods.ByName("CloseStdin")), + connect.WithClientOptions(opts...), + ), + } +} + +// processClient implements ProcessClient. +type processClient struct { + list *connect.Client[process.ListRequest, process.ListResponse] + connect *connect.Client[process.ConnectRequest, process.ConnectResponse] + start *connect.Client[process.StartRequest, process.StartResponse] + update *connect.Client[process.UpdateRequest, process.UpdateResponse] + streamInput *connect.Client[process.StreamInputRequest, process.StreamInputResponse] + sendInput *connect.Client[process.SendInputRequest, process.SendInputResponse] + sendSignal *connect.Client[process.SendSignalRequest, process.SendSignalResponse] + closeStdin *connect.Client[process.CloseStdinRequest, process.CloseStdinResponse] +} + +// List calls process.Process.List. +func (c *processClient) List(ctx context.Context, req *connect.Request[process.ListRequest]) (*connect.Response[process.ListResponse], error) { + return c.list.CallUnary(ctx, req) +} + +// Connect calls process.Process.Connect. +func (c *processClient) Connect(ctx context.Context, req *connect.Request[process.ConnectRequest]) (*connect.ServerStreamForClient[process.ConnectResponse], error) { + return c.connect.CallServerStream(ctx, req) +} + +// Start calls process.Process.Start. +func (c *processClient) Start(ctx context.Context, req *connect.Request[process.StartRequest]) (*connect.ServerStreamForClient[process.StartResponse], error) { + return c.start.CallServerStream(ctx, req) +} + +// Update calls process.Process.Update. +func (c *processClient) Update(ctx context.Context, req *connect.Request[process.UpdateRequest]) (*connect.Response[process.UpdateResponse], error) { + return c.update.CallUnary(ctx, req) +} + +// StreamInput calls process.Process.StreamInput. +func (c *processClient) StreamInput(ctx context.Context) *connect.ClientStreamForClient[process.StreamInputRequest, process.StreamInputResponse] { + return c.streamInput.CallClientStream(ctx) +} + +// SendInput calls process.Process.SendInput. +func (c *processClient) SendInput(ctx context.Context, req *connect.Request[process.SendInputRequest]) (*connect.Response[process.SendInputResponse], error) { + return c.sendInput.CallUnary(ctx, req) +} + +// SendSignal calls process.Process.SendSignal. +func (c *processClient) SendSignal(ctx context.Context, req *connect.Request[process.SendSignalRequest]) (*connect.Response[process.SendSignalResponse], error) { + return c.sendSignal.CallUnary(ctx, req) +} + +// CloseStdin calls process.Process.CloseStdin. +func (c *processClient) CloseStdin(ctx context.Context, req *connect.Request[process.CloseStdinRequest]) (*connect.Response[process.CloseStdinResponse], error) { + return c.closeStdin.CallUnary(ctx, req) +} + +// ProcessHandler is an implementation of the process.Process service. +type ProcessHandler interface { + List(context.Context, *connect.Request[process.ListRequest]) (*connect.Response[process.ListResponse], error) + Connect(context.Context, *connect.Request[process.ConnectRequest], *connect.ServerStream[process.ConnectResponse]) error + Start(context.Context, *connect.Request[process.StartRequest], *connect.ServerStream[process.StartResponse]) error + Update(context.Context, *connect.Request[process.UpdateRequest]) (*connect.Response[process.UpdateResponse], error) + // Client input stream ensures ordering of messages + StreamInput(context.Context, *connect.ClientStream[process.StreamInputRequest]) (*connect.Response[process.StreamInputResponse], error) + SendInput(context.Context, *connect.Request[process.SendInputRequest]) (*connect.Response[process.SendInputResponse], error) + SendSignal(context.Context, *connect.Request[process.SendSignalRequest]) (*connect.Response[process.SendSignalResponse], error) + // Close stdin to signal EOF to the process. + // Only works for non-PTY processes. For PTY, send Ctrl+D (0x04) instead. + CloseStdin(context.Context, *connect.Request[process.CloseStdinRequest]) (*connect.Response[process.CloseStdinResponse], error) +} + +// NewProcessHandler builds an HTTP handler from the service implementation. It returns the path on +// which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewProcessHandler(svc ProcessHandler, opts ...connect.HandlerOption) (string, http.Handler) { + processMethods := process.File_process_process_proto.Services().ByName("Process").Methods() + processListHandler := connect.NewUnaryHandler( + ProcessListProcedure, + svc.List, + connect.WithSchema(processMethods.ByName("List")), + connect.WithHandlerOptions(opts...), + ) + processConnectHandler := connect.NewServerStreamHandler( + ProcessConnectProcedure, + svc.Connect, + connect.WithSchema(processMethods.ByName("Connect")), + connect.WithHandlerOptions(opts...), + ) + processStartHandler := connect.NewServerStreamHandler( + ProcessStartProcedure, + svc.Start, + connect.WithSchema(processMethods.ByName("Start")), + connect.WithHandlerOptions(opts...), + ) + processUpdateHandler := connect.NewUnaryHandler( + ProcessUpdateProcedure, + svc.Update, + connect.WithSchema(processMethods.ByName("Update")), + connect.WithHandlerOptions(opts...), + ) + processStreamInputHandler := connect.NewClientStreamHandler( + ProcessStreamInputProcedure, + svc.StreamInput, + connect.WithSchema(processMethods.ByName("StreamInput")), + connect.WithHandlerOptions(opts...), + ) + processSendInputHandler := connect.NewUnaryHandler( + ProcessSendInputProcedure, + svc.SendInput, + connect.WithSchema(processMethods.ByName("SendInput")), + connect.WithHandlerOptions(opts...), + ) + processSendSignalHandler := connect.NewUnaryHandler( + ProcessSendSignalProcedure, + svc.SendSignal, + connect.WithSchema(processMethods.ByName("SendSignal")), + connect.WithHandlerOptions(opts...), + ) + processCloseStdinHandler := connect.NewUnaryHandler( + ProcessCloseStdinProcedure, + svc.CloseStdin, + connect.WithSchema(processMethods.ByName("CloseStdin")), + connect.WithHandlerOptions(opts...), + ) + return "/process.Process/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case ProcessListProcedure: + processListHandler.ServeHTTP(w, r) + case ProcessConnectProcedure: + processConnectHandler.ServeHTTP(w, r) + case ProcessStartProcedure: + processStartHandler.ServeHTTP(w, r) + case ProcessUpdateProcedure: + processUpdateHandler.ServeHTTP(w, r) + case ProcessStreamInputProcedure: + processStreamInputHandler.ServeHTTP(w, r) + case ProcessSendInputProcedure: + processSendInputHandler.ServeHTTP(w, r) + case ProcessSendSignalProcedure: + processSendSignalHandler.ServeHTTP(w, r) + case ProcessCloseStdinProcedure: + processCloseStdinHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedProcessHandler returns CodeUnimplemented from all methods. +type UnimplementedProcessHandler struct{} + +func (UnimplementedProcessHandler) List(context.Context, *connect.Request[process.ListRequest]) (*connect.Response[process.ListResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("process.Process.List is not implemented")) +} + +func (UnimplementedProcessHandler) Connect(context.Context, *connect.Request[process.ConnectRequest], *connect.ServerStream[process.ConnectResponse]) error { + return connect.NewError(connect.CodeUnimplemented, errors.New("process.Process.Connect is not implemented")) +} + +func (UnimplementedProcessHandler) Start(context.Context, *connect.Request[process.StartRequest], *connect.ServerStream[process.StartResponse]) error { + return connect.NewError(connect.CodeUnimplemented, errors.New("process.Process.Start is not implemented")) +} + +func (UnimplementedProcessHandler) Update(context.Context, *connect.Request[process.UpdateRequest]) (*connect.Response[process.UpdateResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("process.Process.Update is not implemented")) +} + +func (UnimplementedProcessHandler) StreamInput(context.Context, *connect.ClientStream[process.StreamInputRequest]) (*connect.Response[process.StreamInputResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("process.Process.StreamInput is not implemented")) +} + +func (UnimplementedProcessHandler) SendInput(context.Context, *connect.Request[process.SendInputRequest]) (*connect.Response[process.SendInputResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("process.Process.SendInput is not implemented")) +} + +func (UnimplementedProcessHandler) SendSignal(context.Context, *connect.Request[process.SendSignalRequest]) (*connect.Response[process.SendSignalResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("process.Process.SendSignal is not implemented")) +} + +func (UnimplementedProcessHandler) CloseStdin(context.Context, *connect.Request[process.CloseStdinRequest]) (*connect.Response[process.CloseStdinResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("process.Process.CloseStdin is not implemented")) +} diff --git a/e2b/example/envd_client/main.go b/e2b/example/envd_client/main.go new file mode 100644 index 0000000..b2661b5 --- /dev/null +++ b/e2b/example/envd_client/main.go @@ -0,0 +1,223 @@ +// Example: connect directly to an existing sandbox's envd service without +// going through the sandbox-management REST API. +// +// Usage: +// +// go run ./e2b/example/envd_client +// +// Replace `sandboxID` and connection parameters with your own values. +package main + +import ( + "context" + "fmt" + "time" + + "github.com/openkruise/agents-api/e2b/envd/client" +) + +const ( + // sandboxID must point to an already-running sandbox. This client never + // creates or destroys sandboxes; it only operates on the envd service of + // an existing one. + sandboxID = "your-sandbox-id" + domain = "your.domain.com" + runtimeToken = "you runtime token" +) + +func main() { + ctx := context.Background() + + fmt.Println("========== envd direct client example ==========") + + // Build a direct envd client. Defaults: Scheme = "https". + c := client.New(sandboxID, + client.WithDomain(domain), + client.WithRuntimeToken(runtimeToken), + client.WithScheme("http"), + ) + + fmt.Printf("envd URL: %s\n", c.EnvdURL()) + + // ========== 1. Command Operations Demo ========== + fmt.Println("\n--- Command Operations Demo ---") + demonstrateCommandOperations(ctx, c.Commands) + + // ========== 2. Filesystem Operations Demo ========== + fmt.Println("\n--- Filesystem Operations Demo ---") + demonstrateFileOperations(ctx, c.Files) + + fmt.Println("\n========== done ==========") +} + +// demonstrateCommandOperations exercises the Commands API surface. +func demonstrateCommandOperations(ctx context.Context, commands *client.Commands) { + // 1. Run a simple foreground command. + fmt.Println("\n[1] Running 'pwd'...") + if result, err := commands.Run(ctx, "pwd"); err != nil { + fmt.Printf(" Error: %v\n", err) + } else { + fmt.Printf(" Exit: %d, Stdout: %s", result.ExitCode, result.Stdout) + } + + // 2. Run a command with custom envs and cwd. + fmt.Println("\n[2] Running with env vars and cwd...") + if result, err := commands.Run(ctx, "echo $TEST_VAR && pwd", client.RunOpts{ + Cwd: "/tmp", + Envs: map[string]string{"TEST_VAR": "hello-from-go-sdk"}, + }); err != nil { + fmt.Printf(" Error: %v\n", err) + } else { + fmt.Printf(" Exit: %d, Stdout: %s", result.ExitCode, result.Stdout) + } + + // 3. List current processes. + fmt.Println("\n[3] Listing current processes...") + listProcesses(ctx, commands) + + // 4. Start a long-running background process. + fmt.Println("\n[4] Starting background process: sleep 60...") + handle, err := commands.Start(ctx, "sleep 60") + if err != nil { + fmt.Printf(" Error starting background process: %v\n", err) + return + } + pid := handle.Pid() + fmt.Printf(" Started background process with PID: %d\n", pid) + time.Sleep(time.Second) + + // 5. Verify the process appears in the list. + fmt.Println("\n[5] Listing processes again (should include new one)...") + listProcesses(ctx, commands) + + // 6. Try sending input (expected to be a no-op for `sleep`). + fmt.Println("\n[6] Sending stdin to background process...") + if err := commands.SendStdin(ctx, pid, "sample input\n"); err != nil { + fmt.Printf(" Send stdin failed (expected for non-interactive process): %v\n", err) + } else { + fmt.Printf(" Sent input to PID: %d\n", pid) + } + + // 7. Kill the background process. + fmt.Println("\n[7] Killing background process...") + if killed, err := commands.Kill(ctx, pid); err != nil { + fmt.Printf(" Error: %v\n", err) + } else { + fmt.Printf(" Kill PID %d: %v\n", pid, killed) + } + + // 8. Verify the process is gone. + time.Sleep(time.Second) + fmt.Println("\n[8] Verifying process termination...") + if running := isProcessRunning(ctx, commands, pid); running { + fmt.Printf(" Warning: Process %d still running\n", pid) + } else { + fmt.Printf(" Verified: Process %d is no longer running\n", pid) + } +} + +// listProcesses prints the currently running processes. +func listProcesses(ctx context.Context, commands *client.Commands) { + processes, err := commands.List(ctx) + if err != nil { + fmt.Printf(" Error: %v\n", err) + return + } + fmt.Printf(" Running processes: %d\n", len(processes)) + for _, p := range processes { + fmt.Printf(" - PID: %d, Cmd: %s, Cwd: %s\n", p.Pid, p.Cmd, p.Cwd) + } +} + +// isProcessRunning checks whether a process with the given PID is in the list. +func isProcessRunning(ctx context.Context, commands *client.Commands, pid uint32) bool { + processes, err := commands.List(ctx) + if err != nil { + return false + } + for _, p := range processes { + if p.Pid == pid { + return true + } + } + return false +} + +// demonstrateFileOperations exercises the official envd Filesystem gRPC API +// (Stat / MakeDir / Move / ListDir / Remove). File content read/write is not +// part of the protobuf contract, so it is intentionally not demonstrated here. +func demonstrateFileOperations(ctx context.Context, files *client.Filesystem) { + testDir := fmt.Sprintf("/tmp/test_%d", time.Now().UnixNano()) + subDir := testDir + "/subdir" + renamedDir := testDir + "/renamed_subdir" + + // 1. Create a test directory. + fmt.Printf("\n[1] Creating directory: %s\n", testDir) + if created, err := files.MakeDir(ctx, testDir); err != nil { + fmt.Printf(" Error: %v\n", err) + return + } else { + fmt.Printf(" Directory created: %v\n", created) + } + + // 2. Check existence. + fmt.Printf("\n[2] Checking directory exists: %s\n", testDir) + if exists, err := files.Exists(ctx, testDir); err != nil { + fmt.Printf(" Error: %v\n", err) + } else { + fmt.Printf(" Exists: %v\n", exists) + } + + // 3. Get directory info. + fmt.Printf("\n[3] Getting info: %s\n", testDir) + if info, err := files.GetInfo(ctx, testDir); err != nil { + fmt.Printf(" Error: %v\n", err) + } else { + fmt.Printf(" Name: %s, Type: %s, Size: %d\n", info.Name, info.Type, info.Size) + } + + // 4. Create a subdirectory and list parent. + fmt.Printf("\n[4] Creating subdirectory: %s\n", subDir) + if _, err := files.MakeDir(ctx, subDir); err != nil { + fmt.Printf(" Error: %v\n", err) + } + listEntries(ctx, files, testDir) + + // 5. Rename the subdirectory. + fmt.Printf("\n[5] Renaming %s -> %s\n", subDir, renamedDir) + if _, err := files.Rename(ctx, subDir, renamedDir); err != nil { + fmt.Printf(" Error: %v\n", err) + } else { + fmt.Println(" Rename successful") + } + listEntries(ctx, files, testDir) + + // 6. Remove the test directory recursively. + fmt.Printf("\n[6] Removing directory: %s\n", testDir) + if err := files.Remove(ctx, testDir); err != nil { + fmt.Printf(" Error: %v\n", err) + } else { + fmt.Println(" Directory removed") + } + + // 7. Verify removal. + fmt.Printf("\n[7] Verifying removal: %s\n", testDir) + if exists, err := files.Exists(ctx, testDir); err != nil { + fmt.Printf(" Error: %v\n", err) + } else { + fmt.Printf(" Exists after removal: %v\n", exists) + } +} + +// listEntries lists the entries in a directory. +func listEntries(ctx context.Context, files *client.Filesystem, path string) { + entries, err := files.List(ctx, path) + if err != nil { + fmt.Printf(" Error listing %s: %v\n", path, err) + return + } + fmt.Printf(" Entries in %s: %d\n", path, len(entries)) + for _, e := range entries { + fmt.Printf(" - %s %s (size: %d)\n", e.Type, e.Name, e.Size) + } +} diff --git a/e2b/example/sandbox/main.go b/e2b/example/sandbox/main.go new file mode 100644 index 0000000..654d943 --- /dev/null +++ b/e2b/example/sandbox/main.go @@ -0,0 +1,282 @@ +package main + +import ( + "context" + "fmt" + "log" + "time" + + envdclient "github.com/openkruise/agents-api/e2b/envd/client" + "github.com/openkruise/agents-api/e2b/sandbox" +) + +const ( + apiKey = "your-apiKey" + domain = "your.domain.com" + template = "code-interpreter" +) + +func main() { + ctx := context.Background() + + fmt.Println("========== E2B Sandbox Go SDK Example ==========") + + // ========== 1. Connection Configuration ========== + // Defaults: Protocol = Native (subdomain-based), Scheme = "https". + // Override below only when you need Private protocol or http. + // + // Native -> API: https://api. + // Sandbox: https://-. + // Private -> API: :///kruise/api + // Sandbox: :///kruise// + configOpts := []sandbox.ConnectionConfigOption{ + sandbox.WithAPIKey(apiKey), + sandbox.WithDomain(domain), + } + + // ========== 2. Sandbox Management API ========== + api := sandbox.NewSandboxApi(sandbox.NewConnectionConfig(configOpts...)) + + fmt.Println("\n--- Listing existing sandboxes ---") + listSandboxes(ctx, api) + + // ========== 3. Create Sandbox ========== + fmt.Println("\n--- Creating sandbox ---") + sb, err := sandbox.Create(ctx, template, + sandbox.WithConfig(configOpts...), + sandbox.WithTimeout(300), + ) + if err != nil { + log.Fatalf("Failed to create sandbox: %v", err) + } + fmt.Printf("Successfully created sandbox: %s (template: %s)\n", sb.SandboxID(), sb.TemplateID()) + + // Ensure cleanup on exit. + defer cleanup(ctx, sb) + + // ========== 4. Sandbox Info ========== + fmt.Println("\n--- Sandbox Info ---") + showSandboxInfo(ctx, sb) + + // ========== 5. Command Operations Demo ========== + fmt.Println("\n--- Command Operations Demo ---") + demonstrateCommandOperations(ctx, sb.Commands) + + // ========== 6. Filesystem Operations Demo ========== + fmt.Println("\n--- Filesystem Operations Demo ---") + demonstrateFileOperations(ctx, sb.Files) + + fmt.Println("\n========== Example completed ==========") +} + +// listSandboxes lists all running sandboxes. +func listSandboxes(ctx context.Context, api *sandbox.SandboxApi) { + sandboxes, err := api.List(ctx) + if err != nil { + fmt.Printf("Error listing sandboxes: %v\n", err) + return + } + fmt.Printf("Total sandboxes: %d\n", len(sandboxes)) + for _, s := range sandboxes { + fmt.Printf(" - ID: %s, Template: %s, State: %s\n", s.SandboxID, s.TemplateID, s.State) + } +} + +// showSandboxInfo prints detailed information about the sandbox. +func showSandboxInfo(ctx context.Context, sb *sandbox.Sandbox) { + info, err := sb.GetInfo(ctx) + if err != nil { + fmt.Printf("Error getting info: %v\n", err) + return + } + fmt.Printf("SandboxID: %s\n", info.SandboxID) + fmt.Printf("TemplateID: %s\n", info.TemplateID) + fmt.Printf("State: %s\n", info.State) + fmt.Printf("CPU: %d cores\n", info.CpuCount) + fmt.Printf("Memory: %d MB\n", info.MemoryMB) + fmt.Printf("Disk: %d MB\n", info.DiskSizeMB) + fmt.Printf("Metadata: %v\n", info.Metadata) +} + +// demonstrateCommandOperations exercises the Commands API surface. +func demonstrateCommandOperations(ctx context.Context, commands *envdclient.Commands) { + // 1. Run a simple foreground command. + fmt.Println("\n[1] Running 'pwd'...") + if result, err := commands.Run(ctx, "pwd"); err != nil { + fmt.Printf(" Error: %v\n", err) + } else { + fmt.Printf(" Exit: %d, Stdout: %s", result.ExitCode, result.Stdout) + } + + // 2. Run a command with custom envs and cwd. + fmt.Println("\n[2] Running with env vars and cwd...") + if result, err := commands.Run(ctx, "echo $TEST_VAR && pwd", envdclient.RunOpts{ + Cwd: "/tmp", + Envs: map[string]string{"TEST_VAR": "hello-from-go-sdk"}, + }); err != nil { + fmt.Printf(" Error: %v\n", err) + } else { + fmt.Printf(" Exit: %d, Stdout: %s", result.ExitCode, result.Stdout) + } + + // 3. List current processes. + fmt.Println("\n[3] Listing current processes...") + listProcesses(ctx, commands) + + // 4. Start a long-running background process. + fmt.Println("\n[4] Starting background process: sleep 60...") + handle, err := commands.Start(ctx, "sleep 60") + if err != nil { + fmt.Printf(" Error starting background process: %v\n", err) + return + } + pid := handle.Pid() + fmt.Printf(" Started background process with PID: %d\n", pid) + time.Sleep(time.Second) + + // 5. Verify the process appears in the list. + fmt.Println("\n[5] Listing processes again (should include new one)...") + listProcesses(ctx, commands) + + // 6. Try sending input (expected to be a no-op for `sleep`). + fmt.Println("\n[6] Sending stdin to background process...") + if err := commands.SendStdin(ctx, pid, "sample input\n"); err != nil { + fmt.Printf(" Send stdin failed (expected for non-interactive process): %v\n", err) + } else { + fmt.Printf(" Sent input to PID: %d\n", pid) + } + + // 7. Kill the background process. + fmt.Println("\n[7] Killing background process...") + if killed, err := commands.Kill(ctx, pid); err != nil { + fmt.Printf(" Error: %v\n", err) + } else { + fmt.Printf(" Kill PID %d: %v\n", pid, killed) + } + + // 8. Verify the process is gone. + time.Sleep(time.Second) + fmt.Println("\n[8] Verifying process termination...") + if running := isProcessRunning(ctx, commands, pid); running { + fmt.Printf(" Warning: Process %d still running\n", pid) + } else { + fmt.Printf(" Verified: Process %d is no longer running\n", pid) + } +} + +// listProcesses prints the currently running processes. +func listProcesses(ctx context.Context, commands *envdclient.Commands) { + processes, err := commands.List(ctx) + if err != nil { + fmt.Printf(" Error: %v\n", err) + return + } + fmt.Printf(" Running processes: %d\n", len(processes)) + for _, p := range processes { + fmt.Printf(" - PID: %d, Cmd: %s, Cwd: %s\n", p.Pid, p.Cmd, p.Cwd) + } +} + +// isProcessRunning checks whether a process with the given PID is in the list. +func isProcessRunning(ctx context.Context, commands *envdclient.Commands, pid uint32) bool { + processes, err := commands.List(ctx) + if err != nil { + return false + } + for _, p := range processes { + if p.Pid == pid { + return true + } + } + return false +} + +// demonstrateFileOperations exercises the official envd Filesystem gRPC API +// (Stat / MakeDir / Move / ListDir / Remove). File content read/write is not +// part of the protobuf contract, so it is intentionally not demonstrated here. +func demonstrateFileOperations(ctx context.Context, files *envdclient.Filesystem) { + testDir := fmt.Sprintf("/tmp/test_%d", time.Now().UnixNano()) + subDir := testDir + "/subdir" + renamedDir := testDir + "/renamed_subdir" + + // 1. Create a test directory. + fmt.Printf("\n[1] Creating directory: %s\n", testDir) + if created, err := files.MakeDir(ctx, testDir); err != nil { + fmt.Printf(" Error: %v\n", err) + return + } else { + fmt.Printf(" Directory created: %v\n", created) + } + + // 2. Check existence. + fmt.Printf("\n[2] Checking directory exists: %s\n", testDir) + if exists, err := files.Exists(ctx, testDir); err != nil { + fmt.Printf(" Error: %v\n", err) + } else { + fmt.Printf(" Exists: %v\n", exists) + } + + // 3. Get directory info. + fmt.Printf("\n[3] Getting info: %s\n", testDir) + if info, err := files.GetInfo(ctx, testDir); err != nil { + fmt.Printf(" Error: %v\n", err) + } else { + fmt.Printf(" Name: %s, Type: %s, Size: %d\n", info.Name, info.Type, info.Size) + } + + // 4. Create a subdirectory and list parent. + fmt.Printf("\n[4] Creating subdirectory: %s\n", subDir) + if _, err := files.MakeDir(ctx, subDir); err != nil { + fmt.Printf(" Error: %v\n", err) + } + listEntries(ctx, files, testDir) + + // 5. Rename the subdirectory. + fmt.Printf("\n[5] Renaming %s -> %s\n", subDir, renamedDir) + if _, err := files.Rename(ctx, subDir, renamedDir); err != nil { + fmt.Printf(" Error: %v\n", err) + } else { + fmt.Println(" Rename successful") + } + listEntries(ctx, files, testDir) + + // 6. Remove the test directory recursively. + fmt.Printf("\n[6] Removing directory: %s\n", testDir) + if err := files.Remove(ctx, testDir); err != nil { + fmt.Printf(" Error: %v\n", err) + } else { + fmt.Println(" Directory removed") + } + + // 7. Verify removal. + fmt.Printf("\n[7] Verifying removal: %s\n", testDir) + if exists, err := files.Exists(ctx, testDir); err != nil { + fmt.Printf(" Error: %v\n", err) + } else { + fmt.Printf(" Exists after removal: %v\n", exists) + } +} + +// listEntries lists the entries in a directory. +func listEntries(ctx context.Context, files *envdclient.Filesystem, path string) { + entries, err := files.List(ctx, path) + if err != nil { + fmt.Printf(" Error listing %s: %v\n", path, err) + return + } + fmt.Printf(" Entries in %s: %d\n", path, len(entries)) + for _, e := range entries { + fmt.Printf(" - %s %s (size: %d)\n", e.Type, e.Name, e.Size) + } +} + +// cleanup kills the sandbox at the end of execution. +func cleanup(ctx context.Context, sb *sandbox.Sandbox) { + fmt.Println("\n--- Cleaning up ---") + killed, err := sb.Kill(ctx) + if err != nil { + fmt.Printf("Failed to kill sandbox: %v\n", err) + return + } + fmt.Printf("Sandbox %s killed: %v\n", sb.SandboxID(), killed) +} diff --git a/e2b/sandbox/config.go b/e2b/sandbox/config.go new file mode 100644 index 0000000..4eac2e2 --- /dev/null +++ b/e2b/sandbox/config.go @@ -0,0 +1,270 @@ +package sandbox + +import ( + "fmt" + "net/http" + "os" + "time" + + "github.com/openkruise/agents-api/e2b/client" + envdclient "github.com/openkruise/agents-api/e2b/envd/client" +) + +// Protocol defines the URL routing protocol for E2B services. +// +// Two protocols are supported: +// +// Native (default): +// API URL: https://api. +// Sandbox URL: https://-. +// +// Private (gateway): +// API URL: :///kruise/api +// Sandbox URL: :///kruise// +type Protocol string + +const ( + // ProtocolNative uses subdomain-based routing (original E2B protocol). + ProtocolNative Protocol = "native" + // ProtocolPrivate uses path-based routing through a gateway. + ProtocolPrivate Protocol = "private" +) + +const ( + defaultDomain = "e2b.app" + defaultScheme = "https" + defaultRequestTimeout = 60 * time.Second + defaultSandboxTimeout = 300 // seconds + defaultEnvdPort = 49983 +) + +// ConnectionConfig stores the configuration for connecting to E2B services. +type ConnectionConfig struct { + // APIKey is the E2B API key for authentication. + APIKey string + // AccessToken is the OAuth2 access token (alternative to APIKey). + AccessToken string + // Domain is the base domain for E2B services (default: "e2b.app"). + Domain string + // Scheme is the URL scheme, "https" (default) or "http". + Scheme string + // Protocol determines the URL routing mode: ProtocolNative or ProtocolPrivate. + Protocol Protocol + // APIURL overrides the full API base URL. Highest priority, bypasses Protocol/Domain. + APIURL string + // SandboxBaseURL overrides the sandbox envd base URL pattern. Highest priority, bypasses Protocol/Domain. + SandboxBaseURL string + // Debug enables debug mode, skipping certain API calls. + Debug bool + // RequestTimeout is the timeout for HTTP requests. + RequestTimeout time.Duration + // EnvdPort is the port for the envd service inside the sandbox. + EnvdPort int + // Headers contains additional headers to send with sandbox requests. + Headers map[string]string +} + +// NewConnectionConfig creates a new ConnectionConfig with defaults and environment variable fallback. +func NewConnectionConfig(opts ...ConnectionConfigOption) *ConnectionConfig { + config := &ConnectionConfig{ + Domain: defaultDomain, + Scheme: defaultScheme, + Protocol: ProtocolNative, + RequestTimeout: defaultRequestTimeout, + EnvdPort: defaultEnvdPort, + Headers: make(map[string]string), + } + + // Apply environment variable defaults + if apiKey := os.Getenv("E2B_API_KEY"); apiKey != "" { + config.APIKey = apiKey + } + if accessToken := os.Getenv("E2B_ACCESS_TOKEN"); accessToken != "" { + config.AccessToken = accessToken + } + if domain := os.Getenv("E2B_DOMAIN"); domain != "" { + config.Domain = domain + } + if apiURL := os.Getenv("E2B_API_URL"); apiURL != "" { + config.APIURL = apiURL + } + if scheme := os.Getenv("E2B_SCHEME"); scheme != "" { + config.Scheme = scheme + } + if protocol := os.Getenv("E2B_PROTOCOL"); protocol != "" { + config.Protocol = Protocol(protocol) + } + + // Apply options + for _, opt := range opts { + opt(config) + } + + return config +} + +// ConnectionConfigOption is a functional option for ConnectionConfig. +type ConnectionConfigOption func(*ConnectionConfig) + +// WithAPIKey sets the API key. +func WithAPIKey(apiKey string) ConnectionConfigOption { + return func(c *ConnectionConfig) { + c.APIKey = apiKey + } +} + +// WithAccessToken sets the access token. +func WithAccessToken(accessToken string) ConnectionConfigOption { + return func(c *ConnectionConfig) { + c.AccessToken = accessToken + } +} + +// WithDomain sets the domain. +func WithDomain(domain string) ConnectionConfigOption { + return func(c *ConnectionConfig) { + c.Domain = domain + } +} + +// WithDebug enables debug mode. +func WithDebug(debug bool) ConnectionConfigOption { + return func(c *ConnectionConfig) { + c.Debug = debug + } +} + +// WithRequestTimeout sets the request timeout. +func WithRequestTimeout(timeout time.Duration) ConnectionConfigOption { + return func(c *ConnectionConfig) { + c.RequestTimeout = timeout + } +} + +// WithScheme sets the URL scheme ("https" or "http"). +func WithScheme(scheme string) ConnectionConfigOption { + return func(c *ConnectionConfig) { + c.Scheme = scheme + } +} + +// WithProtocol sets the URL routing protocol (ProtocolNative or ProtocolPrivate). +func WithProtocol(protocol Protocol) ConnectionConfigOption { + return func(c *ConnectionConfig) { + c.Protocol = protocol + } +} + +// WithAPIURL overrides the full API base URL. Highest priority, bypasses Protocol/Domain. +func WithAPIURL(apiURL string) ConnectionConfigOption { + return func(c *ConnectionConfig) { + c.APIURL = apiURL + } +} + +// WithSandboxBaseURL overrides the sandbox envd base URL. Highest priority, bypasses Protocol/Domain. +func WithSandboxBaseURL(sandboxBaseURL string) ConnectionConfigOption { + return func(c *ConnectionConfig) { + c.SandboxBaseURL = sandboxBaseURL + } +} + +// GetAPIURL returns the base API URL. +// +// Priority: APIURL (explicit override) > Protocol + Domain. +// +// Native: https://api. +// Private: :///kruise/api +func (c *ConnectionConfig) GetAPIURL() string { + if c.APIURL != "" { + return c.APIURL + } + scheme := c.getScheme() + if c.Protocol == ProtocolPrivate { + return fmt.Sprintf("%s://%s/kruise/api", scheme, c.Domain) + } + return fmt.Sprintf("%s://api.%s", scheme, c.Domain) +} + +// GetSandboxURL returns the envd API URL for a given sandbox. +// +// Priority: SandboxBaseURL (explicit override) > Protocol + Domain. +// +// Native: https://-. +// Private: :///kruise// +func (c *ConnectionConfig) GetSandboxURL(sandboxID string) string { + if c.SandboxBaseURL != "" { + return fmt.Sprintf("%s/%s", c.SandboxBaseURL, sandboxID) + } + scheme := c.getScheme() + if c.Protocol == ProtocolPrivate { + return fmt.Sprintf("%s://%s/kruise/%s/%d", scheme, c.Domain, sandboxID, c.EnvdPort) + } + return fmt.Sprintf("%s://%d-%s.%s", scheme, c.EnvdPort, sandboxID, c.Domain) +} + +// getScheme returns the URL scheme, defaulting to "https". +func (c *ConnectionConfig) getScheme() string { + if c.Scheme != "" { + return c.Scheme + } + return defaultScheme +} + +// GetSandboxHeaders returns headers required for sandbox communication. +func (c *ConnectionConfig) GetSandboxHeaders(sandboxID string) map[string]string { + headers := map[string]string{ + //"Content-Type": "application/json", + } + if c.APIKey != "" { + headers["X-API-Key"] = c.APIKey + } + headers["Authorization"] = "Basic cm9vdDo=" + headers["E2b-Sandbox-Id"] = sandboxID + headers["E2b-Sandbox-Port"] = fmt.Sprintf("%d", c.EnvdPort) + for k, v := range c.Headers { + headers[k] = v + } + return headers +} + +// toEnvdConfig converts this ConnectionConfig into an envdclient.Config used +// by the embedded data-plane client. The sandboxID is required so that the +// Protocol-aware sandbox URL can be pre-computed and passed as +// SandboxBaseURL — the envd client itself has no notion of Protocol. +func (c *ConnectionConfig) toEnvdConfig(sandboxID string) *envdclient.Config { + cfg := &envdclient.Config{ + Domain: c.Domain, + Scheme: c.Scheme, + EnvdPort: c.EnvdPort, + APIKey: c.APIKey, + RequestTimeout: c.RequestTimeout, + } + + // Pre-compute the full sandbox URL using the Protocol-aware logic so + // the envd client can use it directly without knowing about Protocol. + cfg.SandboxBaseURL = c.GetSandboxURL(sandboxID) + + if len(c.Headers) > 0 { + cfg.Headers = make(map[string]string, len(c.Headers)) + for k, v := range c.Headers { + cfg.Headers[k] = v + } + } + return cfg +} + +// NewAPIClient creates a new OpenAPI client configured for this connection. +func (c *ConnectionConfig) NewAPIClient() *client.APIClient { + cfg := client.NewConfiguration() + cfg.Servers = client.ServerConfigurations{ + {URL: c.GetAPIURL()}, + } + cfg.HTTPClient = &http.Client{ + Timeout: c.RequestTimeout, + } + if c.APIKey != "" { + cfg.DefaultHeader["X-API-Key"] = c.APIKey + } + return client.NewAPIClient(cfg) +} diff --git a/e2b/sandbox/sandbox.go b/e2b/sandbox/sandbox.go new file mode 100644 index 0000000..0588550 --- /dev/null +++ b/e2b/sandbox/sandbox.go @@ -0,0 +1,205 @@ +package sandbox + +import ( + "context" + "fmt" + + envdclient "github.com/openkruise/agents-api/e2b/envd/client" +) + +// SandboxOption configures sandbox creation or connection behavior. +type SandboxOption func(*sandboxOptions) + +// sandboxOptions holds all configurable parameters for creating or connecting to a sandbox. +type sandboxOptions struct { + // Connection config options + configOpts []ConnectionConfigOption + + // Create-specific options + timeout int32 + autoPause *bool + metadata map[string]string + envVars map[string]string + secure bool +} + +// WithTimeout sets the sandbox timeout in seconds. +func WithTimeout(timeout int32) SandboxOption { + return func(o *sandboxOptions) { + o.timeout = timeout + } +} + +// WithMetadata sets metadata key-value pairs for the sandbox. +func WithMetadata(metadata map[string]string) SandboxOption { + return func(o *sandboxOptions) { + o.metadata = metadata + } +} + +// WithEnvVars sets environment variables for the sandbox. +func WithEnvVars(envVars map[string]string) SandboxOption { + return func(o *sandboxOptions) { + o.envVars = envVars + } +} + +// WithAutoPause sets the auto-pause behavior. +func WithAutoPause(autoPause bool) SandboxOption { + return func(o *sandboxOptions) { + o.autoPause = &autoPause + } +} + +// WithSecure enables secure mode for the sandbox. +func WithSecure(secure bool) SandboxOption { + return func(o *sandboxOptions) { + o.secure = secure + } +} + +// WithConfig applies one or more ConnectionConfigOption to the sandbox. +// This allows embedding connection configuration (API key, domain, etc.) +// directly into Create/Connect calls. +func WithConfig(configOpts ...ConnectionConfigOption) SandboxOption { + return func(o *sandboxOptions) { + o.configOpts = append(o.configOpts, configOpts...) + } +} + +// Sandbox is the all-in-one entry point that combines the management API +// (lifecycle: Create/Connect/Pause/Kill/...) with the in-sandbox envd client +// (data plane: Files / Commands / SandboxID via the embedded +// envdclient.Client). +// +// If you only need to operate an existing sandbox without going through the +// management API, use envdclient.New directly. +type Sandbox struct { + // Embedded envd client exposes Commands, Files, SandboxID, etc. + *envdclient.Client + + templateID string + envdVersion string + config *ConnectionConfig + api *SandboxApi +} + +// Create creates a new sandbox from a template. +// +// The template defaults to "code-interpreter" if empty. Connection configuration is +// read from environment variables by default and can be overridden via +// WithConfig(...) option. +func Create(ctx context.Context, template string, opts ...SandboxOption) (*Sandbox, error) { + options := applySandboxOptions(opts) + config := NewConnectionConfig(options.configOpts...) + + if template == "" { + template = "code-interpreter" + } + + createOpts := CreateSandboxOpts{ + Template: template, + Timeout: options.timeout, + AutoPause: options.autoPause, + Metadata: options.metadata, + EnvVars: options.envVars, + Secure: options.secure, + } + if createOpts.Timeout <= 0 { + createOpts.Timeout = int32(defaultSandboxTimeout) + } + + api := NewSandboxApi(config) + + resp, err := api.CreateSandbox(ctx, createOpts) + if err != nil { + return nil, fmt.Errorf("failed to create sandbox: %w", err) + } + + sb := newSandbox(config, api, resp.SandboxID, resp.TemplateID, resp.EnvdVersion) + return sb, nil +} + +// Connect connects to an existing sandbox by its ID. +// +// If the sandbox is paused, it will be resumed. Connection configuration is +// read from environment variables by default and can be overridden via +// WithConfig(...) option. +func Connect(ctx context.Context, sandboxID string, opts ...SandboxOption) (*Sandbox, error) { + options := applySandboxOptions(opts) + config := NewConnectionConfig(options.configOpts...) + + timeout := options.timeout + if timeout <= 0 { + timeout = int32(defaultSandboxTimeout) + } + + api := NewSandboxApi(config) + + resp, err := api.ConnectSandbox(ctx, sandboxID, timeout) + if err != nil { + return nil, fmt.Errorf("failed to connect to sandbox: %w", err) + } + + sb := newSandbox(config, api, resp.GetSandboxID(), resp.GetTemplateID(), resp.GetEnvdVersion()) + return sb, nil +} + +// applySandboxOptions merges all SandboxOption into a sandboxOptions struct. +func applySandboxOptions(opts []SandboxOption) *sandboxOptions { + options := &sandboxOptions{} + for _, opt := range opts { + opt(options) + } + return options +} + +// newSandbox initializes a Sandbox by composing an envdclient.Client (data +// plane) with the management-API SandboxApi (control plane). +func newSandbox(config *ConnectionConfig, api *SandboxApi, sandboxID, templateID, envdVersion string) *Sandbox { + client := envdclient.NewWithConfig(sandboxID, config.toEnvdConfig(sandboxID)) + + return &Sandbox{ + Client: client, + templateID: templateID, + envdVersion: envdVersion, + config: config, + api: api, + } +} + +// TemplateID returns the template identifier. +func (s *Sandbox) TemplateID() string { + return s.templateID +} + +// EnvdVersion returns the envd version reported by the management API. +func (s *Sandbox) EnvdVersion() string { + return s.envdVersion +} + +// GetInfo returns detailed information about this sandbox. +func (s *Sandbox) GetInfo(ctx context.Context) (*SandboxInfo, error) { + return s.api.GetInfo(ctx, s.SandboxID()) +} + +// SetTimeout sets a new timeout for this sandbox. +func (s *Sandbox) SetTimeout(ctx context.Context, timeout int32) error { + return s.api.SetTimeout(ctx, s.SandboxID(), timeout) +} + +// Pause pauses this sandbox. +func (s *Sandbox) Pause(ctx context.Context) (string, error) { + return s.api.Pause(ctx, s.SandboxID()) +} + +// Kill kills this sandbox. +func (s *Sandbox) Kill(ctx context.Context) (bool, error) { + return s.api.Kill(ctx, s.SandboxID()) +} + +// Close is an alias for Kill, intended for use with defer. +func (s *Sandbox) Close(ctx context.Context) error { + _, err := s.Kill(ctx) + return err +} diff --git a/e2b/sandbox/sandbox_api.go b/e2b/sandbox/sandbox_api.go new file mode 100644 index 0000000..e19243c --- /dev/null +++ b/e2b/sandbox/sandbox_api.go @@ -0,0 +1,261 @@ +package sandbox + +import ( + "context" + "fmt" + "net/http" + "time" + + "github.com/openkruise/agents-api/e2b/client" +) + +// SandboxInfo represents information about a sandbox. +// Mirrors Python's SandboxInfo class. +type SandboxInfo struct { + SandboxID string + TemplateID string + Alias string + ClientID string + StartedAt time.Time + EndAt time.Time + CpuCount int32 + MemoryMB int32 + DiskSizeMB int32 + EnvdVersion string + Metadata map[string]string + State string +} + +// SandboxMetrics represents sandbox resource metrics. +type SandboxMetrics struct { + CpuCount int32 + CpuUsedPct float64 + MemTotal int64 + MemUsed int64 + DiskTotal int64 + DiskUsed int64 + Timestamp int64 +} + +// SnapshotInfo represents snapshot information. +type SnapshotInfo struct { + SnapshotID string +} + +// SandboxCreateResponse represents the response from creating a sandbox. +type SandboxCreateResponse struct { + SandboxID string + TemplateID string + EnvdVersion string + EnvdAccessToken string + TrafficAccessToken string + Domain string +} + +// SandboxApi provides sandbox lifecycle management operations. +// Mirrors Python's SandboxApi class in sandbox_api.py. +type SandboxApi struct { + config *ConnectionConfig + apiClient *client.APIClient +} + +// NewSandboxApi creates a new SandboxApi instance. +func NewSandboxApi(config *ConnectionConfig) *SandboxApi { + return &SandboxApi{ + config: config, + apiClient: config.NewAPIClient(), + } +} + +// List lists all running sandboxes. +func (s *SandboxApi) List(ctx context.Context) ([]SandboxInfo, error) { + resp, httpResp, err := s.apiClient.SandboxesApi.V2SandboxesGet(ctx).Execute() + if err != nil { + return nil, fmt.Errorf("failed to list sandboxes: %w", err) + } + if httpResp.StatusCode >= 300 { + return nil, fmt.Errorf("list sandboxes failed with status %d", httpResp.StatusCode) + } + + sandboxes := make([]SandboxInfo, len(resp)) + for i, sb := range resp { + sandboxes[i] = SandboxInfo{ + SandboxID: sb.GetSandboxID(), + TemplateID: sb.GetTemplateID(), + ClientID: sb.GetClientID(), + StartedAt: sb.GetStartedAt(), + EndAt: sb.GetEndAt(), + CpuCount: sb.GetCpuCount(), + MemoryMB: sb.GetMemoryMB(), + DiskSizeMB: sb.GetDiskSizeMB(), + EnvdVersion: sb.GetEnvdVersion(), + State: string(sb.GetState()), + } + if meta, ok := sb.GetMetadataOk(); ok && meta != nil { + sandboxes[i].Metadata = *meta + } + } + + return sandboxes, nil +} + +// GetInfo retrieves information about a specific sandbox. +func (s *SandboxApi) GetInfo(ctx context.Context, sandboxID string) (*SandboxInfo, error) { + resp, httpResp, err := s.apiClient.SandboxesApi.SandboxesSandboxIDGet(ctx, sandboxID).Execute() + if err != nil { + if httpResp != nil && httpResp.StatusCode == http.StatusNotFound { + return nil, fmt.Errorf("sandbox %s not found", sandboxID) + } + return nil, fmt.Errorf("failed to get sandbox info: %w", err) + } + + info := &SandboxInfo{ + SandboxID: resp.GetSandboxID(), + TemplateID: resp.GetTemplateID(), + ClientID: resp.GetClientID(), + StartedAt: resp.GetStartedAt(), + EndAt: resp.GetEndAt(), + CpuCount: resp.GetCpuCount(), + MemoryMB: resp.GetMemoryMB(), + DiskSizeMB: resp.GetDiskSizeMB(), + EnvdVersion: resp.GetEnvdVersion(), + State: string(resp.GetState()), + } + if meta, ok := resp.GetMetadataOk(); ok && meta != nil { + info.Metadata = *meta + } + + return info, nil +} + +// Kill kills a sandbox by ID. +func (s *SandboxApi) Kill(ctx context.Context, sandboxID string) (bool, error) { + if s.config.Debug { + return true, nil + } + + httpResp, err := s.apiClient.SandboxesApi.SandboxesSandboxIDDelete(ctx, sandboxID).Execute() + if err != nil { + if httpResp != nil && httpResp.StatusCode == http.StatusNotFound { + return false, nil + } + return false, fmt.Errorf("failed to kill sandbox: %w", err) + } + + return true, nil +} + +// SetTimeout sets a new timeout for the sandbox. +func (s *SandboxApi) SetTimeout(ctx context.Context, sandboxID string, timeout int32) error { + if s.config.Debug { + return nil + } + + body := *client.NewSandboxesSandboxIDTimeoutPostRequest(timeout) + httpResp, err := s.apiClient.SandboxesApi.SandboxesSandboxIDTimeoutPost(ctx, sandboxID). + SandboxesSandboxIDTimeoutPostRequest(body).Execute() + if err != nil { + if httpResp != nil && httpResp.StatusCode == http.StatusNotFound { + return fmt.Errorf("sandbox %s not found", sandboxID) + } + return fmt.Errorf("failed to set timeout: %w", err) + } + + return nil +} + +// CreateSandbox creates a new sandbox from a template. +func (s *SandboxApi) CreateSandbox(ctx context.Context, opts CreateSandboxOpts) (*SandboxCreateResponse, error) { + body := client.NewCreateSandboxRequest(opts.Template) + + if opts.Timeout > 0 { + body.SetTimeout(opts.Timeout) + } + if opts.Metadata != nil { + body.SetMetadata(opts.Metadata) + } + if opts.EnvVars != nil { + body.SetEnvVars(opts.EnvVars) + } + if opts.AutoPause != nil { + body.SetAutoPause(*opts.AutoPause) + } + + resp, httpResp, err := s.apiClient.SandboxesApi.SandboxesPost(ctx). + CreateSandboxRequest(*body).Execute() + if err != nil { + return nil, fmt.Errorf("failed to create sandbox: %w", err) + } + if httpResp.StatusCode >= 300 { + return nil, fmt.Errorf("create sandbox failed with status %d", httpResp.StatusCode) + } + + domain := "" + if d, ok := resp.GetDomainOk(); ok && d != nil { + domain = *d + } + envdAccessToken := "" + if t, ok := resp.GetEnvdAccessTokenOk(); ok && t != nil { + envdAccessToken = *t + } + trafficAccessToken := "" + if t, ok := resp.GetTrafficAccessTokenOk(); ok && t != nil { + trafficAccessToken = *t + } + + return &SandboxCreateResponse{ + SandboxID: resp.GetSandboxID(), + TemplateID: resp.GetTemplateID(), + EnvdVersion: resp.GetEnvdVersion(), + EnvdAccessToken: envdAccessToken, + TrafficAccessToken: trafficAccessToken, + Domain: domain, + }, nil +} + +// ConnectSandbox connects to an existing (possibly paused) sandbox. +func (s *SandboxApi) ConnectSandbox(ctx context.Context, sandboxID string, timeout int32) (*client.Sandbox, error) { + if timeout <= 0 { + timeout = int32(defaultSandboxTimeout) + } + + body := client.NewConnectSandbox(timeout) + resp, httpResp, err := s.apiClient.SandboxesApi.SandboxesSandboxIDConnectPost(ctx, sandboxID). + ConnectSandbox(*body).Execute() + if err != nil { + if httpResp != nil && httpResp.StatusCode == http.StatusNotFound { + return nil, fmt.Errorf("sandbox %s not found", sandboxID) + } + return nil, fmt.Errorf("failed to connect to sandbox: %w", err) + } + + return resp, nil +} + +// Pause pauses a sandbox. +func (s *SandboxApi) Pause(ctx context.Context, sandboxID string) (string, error) { + httpResp, err := s.apiClient.SandboxesApi.SandboxesSandboxIDPausePost(ctx, sandboxID).Execute() + if err != nil { + if httpResp != nil { + if httpResp.StatusCode == http.StatusNotFound { + return "", fmt.Errorf("sandbox %s not found", sandboxID) + } + if httpResp.StatusCode == http.StatusConflict { + return sandboxID, nil + } + } + return "", fmt.Errorf("failed to pause sandbox: %w", err) + } + + return sandboxID, nil +} + +// CreateSandboxOpts contains options for creating a sandbox. +type CreateSandboxOpts struct { + Template string + Timeout int32 + AutoPause *bool + Metadata map[string]string + EnvVars map[string]string + Secure bool +} diff --git a/go.mod b/go.mod index 4709388..c3c0d47 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,9 @@ module github.com/openkruise/agents-api go 1.25.0 require ( + connectrpc.com/connect v1.19.2 github.com/go-bindata/go-bindata v3.1.2+incompatible + google.golang.org/protobuf v1.36.9 k8s.io/api v0.35.0 k8s.io/apimachinery v0.35.0 k8s.io/client-go v0.35.0 @@ -43,7 +45,6 @@ require ( golang.org/x/text v0.31.0 // indirect golang.org/x/time v0.9.0 // indirect golang.org/x/tools v0.38.0 // indirect - google.golang.org/protobuf v1.36.8 // indirect gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 3f2f88f..c5042a5 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +connectrpc.com/connect v1.19.2 h1:McQ83FGdzL+t60peksi0gXC7MQ/iLKgLduAnThbM0mo= +connectrpc.com/connect v1.19.2/go.mod h1:tN20fjdGlewnSFeZxLKb0xwIZ6ozc3OQs2hTXy4du9w= github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0= github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= @@ -104,8 +106,8 @@ golang.org/x/tools/go/expect v0.1.1-deprecated h1:jpBZDwmgPhXsKZC6WhL20P4b/wmnps golang.org/x/tools/go/expect v0.1.1-deprecated/go.mod h1:eihoPOH+FgIqa3FpoTwguz/bVUSGBlGQU67vpBeOrBY= golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated h1:1h2MnaIAIXISqTFKdENegdpAgUXz6NrPEsbIeWaBRvM= golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated/go.mod h1:RVAQXBGNv1ib0J382/DPCRS/BPnsGebyM1Gj5VSDpG8= -google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc= -google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= +google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw= +google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=