From 5e52287fbfc5a5dbe3e44cfed118078f8e9796dd Mon Sep 17 00:00:00 2001 From: Ryan Kerry Date: Mon, 13 Jul 2026 21:53:55 +0100 Subject: [PATCH 01/10] feat: initial serverless scaffolding --- internal/cmd/root.go | 2 ++ internal/cmd/serverless/apps.go | 15 +++++++++++++++ internal/cmd/serverless/registry.go | 13 +++++++++++++ internal/cmd/serverless/secret.go | 13 +++++++++++++ internal/cmd/serverless/serverless.go | 24 ++++++++++++++++++++++++ 5 files changed, 67 insertions(+) create mode 100644 internal/cmd/serverless/apps.go create mode 100644 internal/cmd/serverless/registry.go create mode 100644 internal/cmd/serverless/secret.go create mode 100644 internal/cmd/serverless/serverless.go diff --git a/internal/cmd/root.go b/internal/cmd/root.go index 84889bc..d2583b5 100644 --- a/internal/cmd/root.go +++ b/internal/cmd/root.go @@ -16,6 +16,7 @@ import ( "github.com/runware/runware-cli/internal/cmd/ping" "github.com/runware/runware-cli/internal/cmd/preset" cmdrun "github.com/runware/runware-cli/internal/cmd/run" + "github.com/runware/runware-cli/internal/cmd/serverless" cmdupload "github.com/runware/runware-cli/internal/cmd/upload" cmdversion "github.com/runware/runware-cli/internal/cmd/version" "github.com/runware/runware-cli/internal/config" @@ -94,6 +95,7 @@ Use of Runware services is subject to our Terms of Service (https://runware.ai/t cmdrun.NewCmd(logger), cmdrun.NewResultCmd(logger), media.NewCmd(logger), + serverless.NewCmd(logger), cmdupload.NewCmd(logger), cmdversion.NewCmd(), cmdcompletion.NewCmd(), diff --git a/internal/cmd/serverless/apps.go b/internal/cmd/serverless/apps.go new file mode 100644 index 0000000..abf89ba --- /dev/null +++ b/internal/cmd/serverless/apps.go @@ -0,0 +1,15 @@ +package serverless + +import ( + "github.com/spf13/cobra" +) + +// newAppsCmd returns the "serverless apps" command group. +func newAppsCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "apps", + Short: "Manage deployed serverless applications", + } + cmd.AddCommand(newSecretCmd()) + return cmd +} diff --git a/internal/cmd/serverless/registry.go b/internal/cmd/serverless/registry.go new file mode 100644 index 0000000..21e840c --- /dev/null +++ b/internal/cmd/serverless/registry.go @@ -0,0 +1,13 @@ +package serverless + +import ( + "github.com/spf13/cobra" +) + +// newRegistryCmd returns the "serverless registry" command group. +func newRegistryCmd() *cobra.Command { + return &cobra.Command{ + Use: "registry", + Short: "Manage container registries for serverless deployments", + } +} diff --git a/internal/cmd/serverless/secret.go b/internal/cmd/serverless/secret.go new file mode 100644 index 0000000..5f3ecf7 --- /dev/null +++ b/internal/cmd/serverless/secret.go @@ -0,0 +1,13 @@ +package serverless + +import ( + "github.com/spf13/cobra" +) + +// newSecretCmd returns the "serverless apps secret" command group. +func newSecretCmd() *cobra.Command { + return &cobra.Command{ + Use: "secret", + Short: "Manage secrets for a serverless application", + } +} diff --git a/internal/cmd/serverless/serverless.go b/internal/cmd/serverless/serverless.go new file mode 100644 index 0000000..8e18290 --- /dev/null +++ b/internal/cmd/serverless/serverless.go @@ -0,0 +1,24 @@ +// Package serverless implements the "serverless" command group for deploying +// and managing Runware serverless applications. +package serverless + +import ( + "github.com/charmbracelet/log" + "github.com/spf13/cobra" +) + +// NewCmd returns the "serverless" command group. The logger is accepted for +// uniform registration with the other command groups and will be threaded to +// leaf commands as they are added. +func NewCmd(_ *log.Logger) *cobra.Command { + cmd := &cobra.Command{ + Use: "serverless", + Short: "Manage Runware serverless deployments", + Long: "Deploy, monitor, and manage Runware serverless deployments on the platform", + } + cmd.AddCommand( + newRegistryCmd(), + newAppsCmd(), + ) + return cmd +} From 02f5306a80e109349248916607f731b7f0876298 Mon Sep 17 00:00:00 2001 From: ryank90 Date: Fri, 24 Jul 2026 09:18:26 +0100 Subject: [PATCH 02/10] feat(serverless): initial command structures --- docs/runware.md | 1 + docs/runware_serverless.md | 29 +++++++++ docs/runware_serverless_gpus.md | 34 ++++++++++ docs/runware_serverless_open.md | 34 ++++++++++ internal/api/serverless/client.go | 92 +++++++++++++++++++++++++++ internal/api/serverless/errors.go | 51 +++++++++++++++ internal/api/serverless/gpu.go | 18 ++++++ internal/api/serverless/gpu_test.go | 66 +++++++++++++++++++ internal/api/serverless/types.go | 25 ++++++++ internal/cmd/serverless/gpus.go | 63 ++++++++++++++++++ internal/cmd/serverless/open.go | 52 +++++++++++++++ internal/cmd/serverless/serverless.go | 8 +-- internal/cmdutil/browser.go | 32 ++++++++++ internal/config/config.go | 31 +++++++-- 14 files changed, 527 insertions(+), 9 deletions(-) create mode 100644 docs/runware_serverless.md create mode 100644 docs/runware_serverless_gpus.md create mode 100644 docs/runware_serverless_open.md create mode 100644 internal/api/serverless/client.go create mode 100644 internal/api/serverless/errors.go create mode 100644 internal/api/serverless/gpu.go create mode 100644 internal/api/serverless/gpu_test.go create mode 100644 internal/api/serverless/types.go create mode 100644 internal/cmd/serverless/gpus.go create mode 100644 internal/cmd/serverless/open.go create mode 100644 internal/cmdutil/browser.go diff --git a/docs/runware.md b/docs/runware.md index 50e12ec..26dd7d2 100644 --- a/docs/runware.md +++ b/docs/runware.md @@ -31,5 +31,6 @@ Use of Runware services is subject to our Terms of Service (https://runware.ai/t * [runware preset](runware_preset.md) - Manage named presets * [runware result](runware_result.md) - Wait for and display the result of a task by taskUUID * [runware run](runware_run.md) - Run an inference request against any Runware model +* [runware serverless](runware_serverless.md) - Manage Runware serverless deployments * [runware version](runware_version.md) - Print version information diff --git a/docs/runware_serverless.md b/docs/runware_serverless.md new file mode 100644 index 0000000..619b5e9 --- /dev/null +++ b/docs/runware_serverless.md @@ -0,0 +1,29 @@ +## runware serverless + +Manage Runware serverless deployments + +### Synopsis + +Deploy, monitor, and manage Runware serverless deployments on the platform + +### Options + +``` + -h, --help help for serverless +``` + +### Options inherited from parent commands + +``` + --debug Show full debug output + -F, --format string CLI output format: table, json, yaml (default "table") + --transport string Transport protocol: ws (WebSocket) or http (REST) (default "ws") + -v, --verbose Show request/response details +``` + +### SEE ALSO + +* [runware](runware.md) - CLI tool for the Runware API +* [runware serverless gpus](runware_serverless_gpus.md) - List available GPU types and pricing +* [runware serverless open](runware_serverless_open.md) - Open a deployment in the Runware dashboard + diff --git a/docs/runware_serverless_gpus.md b/docs/runware_serverless_gpus.md new file mode 100644 index 0000000..5880d13 --- /dev/null +++ b/docs/runware_serverless_gpus.md @@ -0,0 +1,34 @@ +## runware serverless gpus + +List available GPU types and pricing + +``` +runware serverless gpus [flags] +``` + +### Examples + +``` + # list GPU types and per-second pricing + runware serverless gpus +``` + +### Options + +``` + -h, --help help for gpus +``` + +### Options inherited from parent commands + +``` + --debug Show full debug output + -F, --format string CLI output format: table, json, yaml (default "table") + --transport string Transport protocol: ws (WebSocket) or http (REST) (default "ws") + -v, --verbose Show request/response details +``` + +### SEE ALSO + +* [runware serverless](runware_serverless.md) - Manage Runware serverless deployments + diff --git a/docs/runware_serverless_open.md b/docs/runware_serverless_open.md new file mode 100644 index 0000000..ea2434f --- /dev/null +++ b/docs/runware_serverless_open.md @@ -0,0 +1,34 @@ +## runware serverless open + +Open a deployment in the Runware dashboard + +``` +runware serverless open [flags] +``` + +### Examples + +``` + # open a deployment's dashboard page in your browser + runware serverless open my-model-abc +``` + +### Options + +``` + -h, --help help for open +``` + +### Options inherited from parent commands + +``` + --debug Show full debug output + -F, --format string CLI output format: table, json, yaml (default "table") + --transport string Transport protocol: ws (WebSocket) or http (REST) (default "ws") + -v, --verbose Show request/response details +``` + +### SEE ALSO + +* [runware serverless](runware_serverless.md) - Manage Runware serverless deployments + diff --git a/internal/api/serverless/client.go b/internal/api/serverless/client.go new file mode 100644 index 0000000..191723f --- /dev/null +++ b/internal/api/serverless/client.go @@ -0,0 +1,92 @@ +// Package serverless is a REST client for the Runware Serverless control-plane +// API (api.serverless.runware.ai). It is separate from the inference task +// transport in internal/api/transport, which speaks the task-array protocol. +package serverless + +import ( + "context" + "encoding/json" + "fmt" + "io" + "log/slog" + "net/http" + "strings" + "time" + + "github.com/runware/runware-cli/internal/agents" + "github.com/runware/runware-cli/internal/api/transport" + "github.com/runware/runware-cli/internal/buildinfo" +) + +// defaultTimeout bounds a single REST request. +const defaultTimeout = 30 * time.Second + +// Client talks to the Serverless control-plane REST API. +type Client struct { + apiKey string + baseURL string + userAgent string + logger *slog.Logger + httpClient *http.Client +} + +// NewClient creates a Serverless API client for the given API key and base URL. +func NewClient(apiKey, baseURL string, logger *slog.Logger) *Client { + ua := buildinfo.UserAgent() + if agent := agents.Detect(); agent != "" { + ua += " agent/" + string(agent) + } + return &Client{ + apiKey: apiKey, + baseURL: strings.TrimSuffix(baseURL, "/"), + userAgent: ua, + logger: logger, + httpClient: &http.Client{Timeout: defaultTimeout}, + } +} + +// get performs an authenticated GET on path (e.g. "/v1/gpu-types") and decodes +// the JSON response body into out. +func (c *Client) get(ctx context.Context, path string, out any) error { + if c.apiKey == "" { + return transport.ErrNoAPIKey + } + + req, err := http.NewRequestWithContext(ctx, http.MethodGet, c.baseURL+path, nil) + if err != nil { + return fmt.Errorf("failed to create request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("Authorization", "Bearer "+c.apiKey) + req.Header.Set("User-Agent", c.userAgent) + + start := time.Now() + resp, err := c.httpClient.Do(req) + if err != nil { + return fmt.Errorf("request failed: %w", err) + } + defer resp.Body.Close() //nolint:errcheck,gosec + + body, err := io.ReadAll(resp.Body) + if err != nil { + return fmt.Errorf("failed to read response: %w", err) + } + + if c.logger != nil && c.logger.Enabled(ctx, slog.LevelDebug) { + c.logger.Debug("serverless response", //nolint:errcheck,gosec + "url", c.baseURL+path, + "status", resp.StatusCode, + "elapsed", time.Since(start).Round(time.Millisecond), + "body", string(body), + ) + } + + if resp.StatusCode < http.StatusOK || resp.StatusCode >= http.StatusMultipleChoices { + return parseError(body, resp.StatusCode) + } + + if err := json.Unmarshal(body, out); err != nil { + return fmt.Errorf("failed to parse response (HTTP %d): %w", resp.StatusCode, err) + } + return nil +} diff --git a/internal/api/serverless/errors.go b/internal/api/serverless/errors.go new file mode 100644 index 0000000..8c458b5 --- /dev/null +++ b/internal/api/serverless/errors.go @@ -0,0 +1,51 @@ +package serverless + +import ( + "encoding/json" + "fmt" + "net/http" + + "github.com/runware/runware-cli/internal/api/transport" +) + +// wireError is the Serverless API error envelope: {"code":int,"message":string}. +type wireError struct { + Code int `json:"code"` + Message string `json:"message"` +} + +// parseError converts a non-2xx Serverless API response into a +// *transport.RunwareError so the CLI's shared error rendering (including the +// auth hint on 401/403) applies uniformly. +func parseError(body []byte, statusCode int) error { + var w wireError + if err := json.Unmarshal(body, &w); err != nil || w.Message == "" { + return transport.CreateRunwareError( + rawCodeForStatus(statusCode), + fmt.Sprintf("HTTP %d: %s", statusCode, http.StatusText(statusCode)), + transport.RunwareErrorDetails{StatusCode: statusCode}, + ) + } + return transport.CreateRunwareError( + rawCodeForStatus(statusCode), + w.Message, + transport.RunwareErrorDetails{StatusCode: statusCode}, + ) +} + +// rawCodeForStatus maps an HTTP status to a raw error code string that +// transport.DeriveCode categorises correctly (notably 401/403 -> auth). +func rawCodeForStatus(statusCode int) string { + switch statusCode { + case http.StatusUnauthorized: + return "unauthorized" + case http.StatusForbidden: + return "forbidden" + case http.StatusNotFound: + return "notFound" + case http.StatusConflict: + return "conflict" + default: + return "serverError" + } +} diff --git a/internal/api/serverless/gpu.go b/internal/api/serverless/gpu.go new file mode 100644 index 0000000..c3c7539 --- /dev/null +++ b/internal/api/serverless/gpu.go @@ -0,0 +1,18 @@ +package serverless + +import "context" + +// gpuTypesResponse is the envelope returned by GET /v1/gpu-types. +type gpuTypesResponse struct { + Data []GpuType `json:"data"` +} + +// ListGpuTypes returns the catalogue of supported GPU types and their pricing. +// This endpoint is not workspace-scoped. +func (c *Client) ListGpuTypes(ctx context.Context) ([]GpuType, error) { + var resp gpuTypesResponse + if err := c.get(ctx, "/v1/gpu-types", &resp); err != nil { + return nil, err + } + return resp.Data, nil +} diff --git a/internal/api/serverless/gpu_test.go b/internal/api/serverless/gpu_test.go new file mode 100644 index 0000000..f36a29a --- /dev/null +++ b/internal/api/serverless/gpu_test.go @@ -0,0 +1,66 @@ +package serverless + +import ( + "context" + "errors" + "log/slog" + "net/http" + "net/http/httptest" + "testing" + + "github.com/runware/runware-cli/internal/api/transport" +) + +func TestListGpuTypes(t *testing.T) { + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path != "/v1/gpu-types" { + t.Errorf("unexpected path %q", r.URL.Path) + } + if got := r.Header.Get("Authorization"); got != "Bearer test-key" { + t.Errorf("missing/incorrect auth header: %q", got) + } + w.Header().Set("Content-Type", "application/json") + _, _ = w.Write([]byte(`{"data":[{"id":"h100","name":"H100","memory":"80GB","availability":"available","pricing":{"currency":"USD","perSecond":"0.000767"}}]}`)) + })) + defer srv.Close() + + c := NewClient("test-key", srv.URL, slog.Default()) + gpus, err := c.ListGpuTypes(context.Background()) + if err != nil { + t.Fatalf("ListGpuTypes: %v", err) + } + if len(gpus) != 1 { + t.Fatalf("expected 1 gpu, got %d", len(gpus)) + } + if gpus[0].ID != "h100" || gpus[0].Pricing.PerSecond != "0.000767" { + t.Errorf("unexpected gpu: %+v", gpus[0]) + } + if gpus[0].Memory == nil || *gpus[0].Memory != "80GB" { + t.Errorf("unexpected memory: %v", gpus[0].Memory) + } +} + +func TestListGpuTypes_NoAPIKey(t *testing.T) { + c := NewClient("", "https://example.invalid", slog.Default()) + if _, err := c.ListGpuTypes(context.Background()); !errors.Is(err, transport.ErrNoAPIKey) { + t.Fatalf("expected ErrNoAPIKey, got %v", err) + } +} + +func TestListGpuTypes_AuthError(t *testing.T) { + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusUnauthorized) + _, _ = w.Write([]byte(`{"code":401,"message":"Missing or invalid API key"}`)) + })) + defer srv.Close() + + c := NewClient("bad", srv.URL, slog.Default()) + _, err := c.ListGpuTypes(context.Background()) + var re *transport.RunwareError + if !errors.As(err, &re) { + t.Fatalf("expected *transport.RunwareError, got %T: %v", err, err) + } + if re.Code != transport.CodeAuth { + t.Errorf("expected CodeAuth, got %v", re.Code) + } +} diff --git a/internal/api/serverless/types.go b/internal/api/serverless/types.go new file mode 100644 index 0000000..bacc06c --- /dev/null +++ b/internal/api/serverless/types.go @@ -0,0 +1,25 @@ +package serverless + +// GpuAvailability is the scheduler provisioning availability for a GPU type. +type GpuAvailability string + +const ( + GpuAvailabilityAvailable GpuAvailability = "available" + GpuAvailabilityReserved GpuAvailability = "reserved" + GpuAvailabilityCustom GpuAvailability = "custom" +) + +// GpuPricing is the price for a GPU type. +type GpuPricing struct { + Currency string `json:"currency"` + PerSecond string `json:"perSecond"` +} + +// GpuType is a supported GPU hardware type and its pricing. +type GpuType struct { + ID string `json:"id"` + Name string `json:"name"` + Memory *string `json:"memory,omitempty"` + Availability GpuAvailability `json:"availability"` + Pricing GpuPricing `json:"pricing"` +} diff --git a/internal/cmd/serverless/gpus.go b/internal/cmd/serverless/gpus.go new file mode 100644 index 0000000..62bdbc6 --- /dev/null +++ b/internal/cmd/serverless/gpus.go @@ -0,0 +1,63 @@ +package serverless + +import ( + "log/slog" + + "github.com/charmbracelet/log" + serverlessapi "github.com/runware/runware-cli/internal/api/serverless" + "github.com/runware/runware-cli/internal/cmdutil" + "github.com/runware/runware-cli/internal/config" + "github.com/runware/runware-cli/internal/output" + "github.com/spf13/cobra" +) + +// gpuTypesResult wraps the GPU catalogue for display. JSON and YAML output the +// raw GpuType structs; the table renderer flattens them into columns. +type gpuTypesResult []serverlessapi.GpuType + +func (r gpuTypesResult) Headers() []string { + return []string{"ID", "Name", "Memory", "Availability", "Price ($/GPU/s)"} +} + +func (r gpuTypesResult) Rows() [][]any { + rows := make([][]any, len(r)) + for i := range r { + g := &r[i] + memory := "-" + if g.Memory != nil && *g.Memory != "" { + memory = *g.Memory + } + rows[i] = []any{ + g.ID, + g.Name, + memory, + string(g.Availability), + g.Pricing.PerSecond, + } + } + return rows +} + +func newGPUsCmd(logger *log.Logger) *cobra.Command { + return &cobra.Command{ + Use: "gpus", + Short: "List available GPU types and pricing", + Example: ` # list GPU types and per-second pricing + runware serverless gpus`, + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + spin := cmdutil.NewSpinner("Fetching GPU types...") + spin.Start() + + client := serverlessapi.NewClient(config.GetAPIKey(), config.GetServerlessBaseURL(), slog.New(logger)) + gpus, err := client.ListGpuTypes(cmd.Context()) + if err != nil { + spin.Stop() + return err + } + + spin.Stop() + return output.Print(cmdutil.FormatFor(cmd), gpuTypesResult(gpus)) + }, + } +} diff --git a/internal/cmd/serverless/open.go b/internal/cmd/serverless/open.go new file mode 100644 index 0000000..8998770 --- /dev/null +++ b/internal/cmd/serverless/open.go @@ -0,0 +1,52 @@ +package serverless + +import ( + "fmt" + "os" + "strings" + + "github.com/runware/runware-cli/internal/cmdutil" + "github.com/runware/runware-cli/internal/config" + "github.com/runware/runware-cli/internal/output" + "github.com/spf13/cobra" +) + +// openResult reports the deployment and dashboard URL that was opened. +type openResult struct { + DeploymentID string `json:"deploymentId" yaml:"deploymentId"` + URL string `json:"url" yaml:"url"` +} + +func (r openResult) Headers() []string { + return []string{"Field", "Value"} +} + +func (r openResult) Rows() [][]any { + return [][]any{ + {"Deployment", r.DeploymentID}, + {"URL", r.URL}, + } +} + +func newOpenCmd() *cobra.Command { + return &cobra.Command{ + Use: "open ", + Short: "Open a deployment in the Runware dashboard", + Example: ` # open a deployment's dashboard page in your browser + runware serverless open my-model-abc`, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + id := args[0] + url := strings.TrimSuffix(config.GetDashboardURL(), "/") + "/serverless/" + id + + if err := cmdutil.OpenBrowser(cmd.Context(), url); err != nil { + fmt.Fprintf(os.Stderr, "Could not open browser automatically: %v\n", err) + } + + return output.Print(cmdutil.FormatFor(cmd), openResult{ + DeploymentID: id, + URL: url, + }) + }, + } +} diff --git a/internal/cmd/serverless/serverless.go b/internal/cmd/serverless/serverless.go index 8e18290..3acfe73 100644 --- a/internal/cmd/serverless/serverless.go +++ b/internal/cmd/serverless/serverless.go @@ -7,16 +7,16 @@ import ( "github.com/spf13/cobra" ) -// NewCmd returns the "serverless" command group. The logger is accepted for -// uniform registration with the other command groups and will be threaded to -// leaf commands as they are added. -func NewCmd(_ *log.Logger) *cobra.Command { +// NewCmd returns the "serverless" command group. +func NewCmd(logger *log.Logger) *cobra.Command { cmd := &cobra.Command{ Use: "serverless", Short: "Manage Runware serverless deployments", Long: "Deploy, monitor, and manage Runware serverless deployments on the platform", } cmd.AddCommand( + newGPUsCmd(logger), + newOpenCmd(), newRegistryCmd(), newAppsCmd(), ) diff --git a/internal/cmdutil/browser.go b/internal/cmdutil/browser.go new file mode 100644 index 0000000..d873d27 --- /dev/null +++ b/internal/cmdutil/browser.go @@ -0,0 +1,32 @@ +package cmdutil + +import ( + "context" + "fmt" + "os/exec" + "runtime" +) + +// OpenBrowser opens url in the user's default web browser. It returns an error +// if the platform launcher cannot be started (e.g. in a headless environment). +func OpenBrowser(ctx context.Context, url string) error { + var name string + var args []string + switch runtime.GOOS { + case "darwin": + name = "open" + args = []string{url} + case "windows": + name = "rundll32" + args = []string{"url.dll,FileProtocolHandler", url} + default: + name = "xdg-open" + args = []string{url} + } + // The launcher name is a fixed per-OS constant and the URL is passed as a + // separate argv element (not shell-interpreted), so there is no injection. + if err := exec.CommandContext(ctx, name, args...).Start(); err != nil { //nolint:gosec + return fmt.Errorf("failed to open browser: %w", err) + } + return nil +} diff --git a/internal/config/config.go b/internal/config/config.go index b778904..fcd8887 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -9,11 +9,13 @@ import ( ) const ( - DefaultBaseURL = "https://api.runware.ai/v1" - DefaultWSBaseURL = "wss://ws-api.runware.ai/v1" - MaskedKeySuffix = "•••••" - DefaultOutputDir = "./outputs" - DefaultFormat = "table" + DefaultBaseURL = "https://api.runware.ai/v1" + DefaultWSBaseURL = "wss://ws-api.runware.ai/v1" + DefaultServerlessBaseURL = "https://api.serverless.runware.ai" + DefaultDashboardURL = "https://my.runware.ai" + MaskedKeySuffix = "•••••" + DefaultOutputDir = "./outputs" + DefaultFormat = "table" // DefaultTransport matches transport.SchemeWS; kept as a literal so the // config package stays free of internal imports. DefaultTransport = "ws" @@ -152,6 +154,25 @@ func GetWSBaseURL() string { return DefaultWSBaseURL } +// GetServerlessBaseURL returns the Serverless API base URL. +// RUNWARE_SERVERLESS_BASE_URL overrides the default; this is not exposed in the +// user-facing config file and is intended for internal testing only. +func GetServerlessBaseURL() string { + if v := os.Getenv("RUNWARE_SERVERLESS_BASE_URL"); v != "" { + return v + } + return DefaultServerlessBaseURL +} + +// GetDashboardURL returns the base URL of the Runware web dashboard. +// RUNWARE_DASHBOARD_URL overrides the default. +func GetDashboardURL() string { + if v := os.Getenv("RUNWARE_DASHBOARD_URL"); v != "" { + return v + } + return DefaultDashboardURL +} + // ConfigDir returns the config directory path. func ConfigDir() string { return configDir From 7521f88eb4f68dd0eafbfb99ad9f907c75624d33 Mon Sep 17 00:00:00 2001 From: ryank90 Date: Fri, 24 Jul 2026 09:25:44 +0100 Subject: [PATCH 03/10] fix(docs): generate correct descs --- docs/runware_serverless.md | 2 +- internal/cmd/serverless/serverless.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/runware_serverless.md b/docs/runware_serverless.md index 619b5e9..109f54a 100644 --- a/docs/runware_serverless.md +++ b/docs/runware_serverless.md @@ -4,7 +4,7 @@ Manage Runware serverless deployments ### Synopsis -Deploy, monitor, and manage Runware serverless deployments on the platform +Deploy, monitor, and manage Runware serverless applications on the platform ### Options diff --git a/internal/cmd/serverless/serverless.go b/internal/cmd/serverless/serverless.go index 3acfe73..1dd2333 100644 --- a/internal/cmd/serverless/serverless.go +++ b/internal/cmd/serverless/serverless.go @@ -12,7 +12,7 @@ func NewCmd(logger *log.Logger) *cobra.Command { cmd := &cobra.Command{ Use: "serverless", Short: "Manage Runware serverless deployments", - Long: "Deploy, monitor, and manage Runware serverless deployments on the platform", + Long: "Deploy, monitor, and manage Runware serverless applications on the platform", } cmd.AddCommand( newGPUsCmd(logger), From 7383c4228793a54dfa71284048e6f90d318f23be Mon Sep 17 00:00:00 2001 From: ryank90 Date: Fri, 24 Jul 2026 09:33:08 +0100 Subject: [PATCH 04/10] feat(serverless): deploy command stubbed out --- docs/runware_serverless.md | 1 + docs/runware_serverless_deploy.md | 44 +++++++++++++++++++++++++++ internal/cmd/serverless/deploy.go | 27 ++++++++++++++++ internal/cmd/serverless/serverless.go | 1 + 4 files changed, 73 insertions(+) create mode 100644 docs/runware_serverless_deploy.md create mode 100644 internal/cmd/serverless/deploy.go diff --git a/docs/runware_serverless.md b/docs/runware_serverless.md index 109f54a..23fe1a8 100644 --- a/docs/runware_serverless.md +++ b/docs/runware_serverless.md @@ -24,6 +24,7 @@ Deploy, monitor, and manage Runware serverless applications on the platform ### SEE ALSO * [runware](runware.md) - CLI tool for the Runware API +* [runware serverless deploy](runware_serverless_deploy.md) - Deploy a new serverless application * [runware serverless gpus](runware_serverless_gpus.md) - List available GPU types and pricing * [runware serverless open](runware_serverless_open.md) - Open a deployment in the Runware dashboard diff --git a/docs/runware_serverless_deploy.md b/docs/runware_serverless_deploy.md new file mode 100644 index 0000000..382aa2d --- /dev/null +++ b/docs/runware_serverless_deploy.md @@ -0,0 +1,44 @@ +## runware serverless deploy + +Deploy a new serverless application + +### Synopsis + +Deploy a new serverless application from a Python application file. + +The application settings come from the project +configuration created by 'runware serverless init' or the dashboard. + +``` +runware serverless deploy [file] [flags] +``` + +### Examples + +``` + # deploy the application in the current project + runware serverless deploy + + # deploy a specific Python file + runware serverless deploy ./app.py +``` + +### Options + +``` + -h, --help help for deploy +``` + +### Options inherited from parent commands + +``` + --debug Show full debug output + -F, --format string CLI output format: table, json, yaml (default "table") + --transport string Transport protocol: ws (WebSocket) or http (REST) (default "ws") + -v, --verbose Show request/response details +``` + +### SEE ALSO + +* [runware serverless](runware_serverless.md) - Manage Runware serverless deployments + diff --git a/internal/cmd/serverless/deploy.go b/internal/cmd/serverless/deploy.go new file mode 100644 index 0000000..adaf653 --- /dev/null +++ b/internal/cmd/serverless/deploy.go @@ -0,0 +1,27 @@ +package serverless + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +func newDeployCmd() *cobra.Command { + return &cobra.Command{ + Use: "deploy [file]", + Short: "Deploy a new serverless application", + Long: `Deploy a new serverless application from a Python file. + +The application settings come from the project +configuration created by 'runware serverless init' or the dashboard.`, + Example: ` # deploy the application in the current project + runware serverless deploy + + # deploy a specific Python file + runware serverless deploy ./app.py`, + Args: cobra.MaximumNArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + return fmt.Errorf("not implemented yet") + }, + } +} diff --git a/internal/cmd/serverless/serverless.go b/internal/cmd/serverless/serverless.go index 1dd2333..7bd70c3 100644 --- a/internal/cmd/serverless/serverless.go +++ b/internal/cmd/serverless/serverless.go @@ -15,6 +15,7 @@ func NewCmd(logger *log.Logger) *cobra.Command { Long: "Deploy, monitor, and manage Runware serverless applications on the platform", } cmd.AddCommand( + newDeployCmd(), newGPUsCmd(logger), newOpenCmd(), newRegistryCmd(), From 0248069e9da617c049b90413b4861775f4155b22 Mon Sep 17 00:00:00 2001 From: ryank90 Date: Fri, 24 Jul 2026 09:37:12 +0100 Subject: [PATCH 05/10] fix(docs): update docs for deploy commands --- docs/runware_serverless_deploy.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/runware_serverless_deploy.md b/docs/runware_serverless_deploy.md index 382aa2d..a21b171 100644 --- a/docs/runware_serverless_deploy.md +++ b/docs/runware_serverless_deploy.md @@ -4,7 +4,7 @@ Deploy a new serverless application ### Synopsis -Deploy a new serverless application from a Python application file. +Deploy a new serverless application from a Python file. The application settings come from the project configuration created by 'runware serverless init' or the dashboard. From 3a4e97ada4091ec45c8b54529943898613e32407 Mon Sep 17 00:00:00 2001 From: ryank90 Date: Wed, 29 Jul 2026 18:48:52 +0100 Subject: [PATCH 06/10] refactor(serverless): introduce gen client and fixes --- Makefile | 6 +- api/serverless/oapi-codegen.yaml | 8 + api/serverless/openapi.yaml | 2239 +++++ docs/runware_serverless_deploy.md | 4 +- go.mod | 29 +- go.sum | 190 +- internal/api/serverless/client.go | 104 +- .../{gpu_test.go => client_test.go} | 18 +- internal/api/serverless/errors.go | 32 +- internal/api/serverless/gen/client.gen.go | 8808 +++++++++++++++++ internal/api/serverless/gen/doc.go | 5 + internal/api/serverless/gpu.go | 18 - internal/api/serverless/types.go | 25 - internal/cmd/serverless/apps.go | 15 - internal/cmd/serverless/deploy.go | 7 +- internal/cmd/serverless/gpus.go | 11 +- internal/cmd/serverless/open.go | 8 +- internal/cmd/serverless/registry.go | 13 - internal/cmd/serverless/secret.go | 13 - internal/cmd/serverless/serverless.go | 2 - internal/cmdutil/browser.go | 32 - 21 files changed, 11358 insertions(+), 229 deletions(-) create mode 100644 api/serverless/oapi-codegen.yaml create mode 100644 api/serverless/openapi.yaml rename internal/api/serverless/{gpu_test.go => client_test.go} (71%) create mode 100644 internal/api/serverless/gen/client.gen.go create mode 100644 internal/api/serverless/gen/doc.go delete mode 100644 internal/api/serverless/gpu.go delete mode 100644 internal/api/serverless/types.go delete mode 100644 internal/cmd/serverless/apps.go delete mode 100644 internal/cmd/serverless/registry.go delete mode 100644 internal/cmd/serverless/secret.go delete mode 100644 internal/cmdutil/browser.go diff --git a/Makefile b/Makefile index f87f51f..39b1a3c 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ GOFLAGS = -trimpath BINARY=runware -.PHONY: build build-all windows-amd64 windows-arm64 darwin darwin-arm64 darwin-amd64 linux-amd64 linux-arm64 run test lint clean install snapshot docs go-tidy +.PHONY: build build-all windows-amd64 windows-arm64 darwin darwin-arm64 darwin-amd64 linux-amd64 linux-arm64 run test lint clean install snapshot docs go-tidy generate-serverless build: go build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o bin/${BINARY} ./cmd/runware @@ -61,3 +61,7 @@ docs: go-tidy: go mod tidy && go mod verify + +# Regenerate the Serverless API client from api/serverless/openapi.yaml. +generate-serverless: + go tool oapi-codegen -config api/serverless/oapi-codegen.yaml api/serverless/openapi.yaml diff --git a/api/serverless/oapi-codegen.yaml b/api/serverless/oapi-codegen.yaml new file mode 100644 index 0000000..bcee9da --- /dev/null +++ b/api/serverless/oapi-codegen.yaml @@ -0,0 +1,8 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/oapi-codegen/oapi-codegen/HEAD/configuration-schema.json +package: gen +generate: + models: true + client: true +output: internal/api/serverless/gen/client.gen.go +output-options: + skip-prune: false diff --git a/api/serverless/openapi.yaml b/api/serverless/openapi.yaml new file mode 100644 index 0000000..b9e6975 --- /dev/null +++ b/api/serverless/openapi.yaml @@ -0,0 +1,2239 @@ +openapi: 3.0.3 +servers: + - url: https://api.serverless.runware.ai + +info: + title: Serverless API + version: 0.3.0 + license: + name: Proprietary + description: > + Control plane and task-ingestion API for the Runware Serverless platform. + + A Runware organisation is the tenant boundary. Deployments are addressed as + `/v1/deployments/{deploymentId}` and endpoints are invoked as + `/v1/deployments/{deploymentId}/invoke-async/{endpointPath}` (async invocation) or + `/v1/deployments/{deploymentId}/invoke-sync/{endpointPath}` (sync invocation). + + Authentication uses a Runware API key validated against the existing Runware platform + (server-to-server). The key identifies the organisation; resources are always scoped to the + authenticated organisation. + +security: + - ApiKeyAuth: [] + +tags: + - name: Tasks + description: Task ingestion — submit work to a deployment endpoint + - name: Deployments + description: Manage deployments and their lifecycle + - name: Builds + description: Immutable builds + - name: Versions + description: Deployment versions produced by successful builds + - name: Endpoints + description: Named endpoints exposed by a deployment + - name: Compute + description: Compute hardware catalogues (GPU types) and pricing + - name: Workers + description: Running worker instances (read-only runtime state) + - name: Secrets + description: Organisation-scoped encrypted secrets + - name: EnvironmentVariables + description: Plain-text environment variables scoped to a deployment + - name: Observability + description: Tasks, usage, events and errors + +paths: + # --------------------------------------------------------------------------- + # Compute (GPU catalogue) + # --------------------------------------------------------------------------- + /v1/gpu-types: + get: + tags: + - Compute + summary: List supported GPU types and their pricing + description: > + Returns the global GPU type catalogue and pricing. The result is not organisation-specific, + but the request still requires authentication. + operationId: listGpuTypes + responses: + '200': + description: GPU type catalogue + content: + application/json: + schema: + $ref: '#/components/schemas/GpuTypeList' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + + # --------------------------------------------------------------------------- + # Tasks + # --------------------------------------------------------------------------- + /v1/deployments/{deploymentId}/invoke-async/{endpointPath}: + post: + tags: + - Tasks + summary: Start a new async task + description: > + Starts a new async task on `deploymentId`, routing the request body payload to an available + worker. The task runs asynchronously and the response is `202`; poll + `GET /v1/deployments/{deploymentId}/tasks/{taskId}` for completion. + operationId: startAsyncTask + parameters: + - $ref: '#/components/parameters/DeploymentId' + - $ref: '#/components/parameters/EndpointPath' + requestBody: + $ref: '#/components/requestBodies/TaskPayload' + responses: + '202': + $ref: '#/components/responses/TaskAccepted' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '400': + $ref: '#/components/responses/BadRequest' + '422': + $ref: '#/components/responses/ValidationError' + + /v1/deployments/{deploymentId}/invoke-sync/{endpointPath}: + post: + tags: + - Tasks + summary: Start a new sync task + description: > + Starts a new sync task on `deploymentId`, routing the request body payload to an available + worker. The request blocks until the task is terminal and returns the result inline (`200`), + or `504` if it does not complete within the wait window. + operationId: startSyncTask + parameters: + - $ref: '#/components/parameters/DeploymentId' + - $ref: '#/components/parameters/EndpointPath' + requestBody: + $ref: '#/components/requestBodies/TaskPayload' + responses: + '200': + $ref: '#/components/responses/Task' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '400': + $ref: '#/components/responses/BadRequest' + '422': + $ref: '#/components/responses/ValidationError' + '504': + $ref: '#/components/responses/Timeout' + + /v1/deployments/{deploymentId}/tasks/{taskId}: + get: + tags: + - Tasks + summary: Get a task + description: > + Returns the task's current status, read through the inference transport layer from the + shared result store. When `completed`, includes the result `output` and `completedAt`; + when `failed`, includes `error`; when `pending`, neither is set. + operationId: getTask + parameters: + - $ref: '#/components/parameters/DeploymentId' + - name: taskId + in: path + required: true + schema: + type: string + description: Opaque task identifier returned by the execution backend. + responses: + '200': + $ref: '#/components/responses/Task' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + + # --------------------------------------------------------------------------- + # Deployments + # --------------------------------------------------------------------------- + /v1/deployments: + get: + tags: + - Deployments + summary: List deployments + operationId: listDeployments + parameters: + - $ref: '#/components/parameters/Limit' + - $ref: '#/components/parameters/Cursor' + - name: status + in: query + required: false + schema: + $ref: '#/components/schemas/DeploymentStatus' + responses: + '200': + description: A page of deployments + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Page' + - type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/Deployment' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + post: + tags: + - Deployments + summary: Create a deployment + description: > + Creates a deployment together with its worker configuration and endpoints, as declared + in the submitted IaC config. The deployment starts in `initializing` and an initial rollout + begins immediately based on the deployment source type: + + - `code` source: the codebase is submitted to the build pipeline; once the image is built + and workers become healthy the deployment transitions to `active`. + + - `container` source: the pre-built image is deployed directly with no build step; once + workers become healthy the deployment transitions to `active`. + + If the build, validation, or rollout fails the deployment is marked `failed`. + operationId: createDeployment + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/DeploymentCreate' + responses: + '201': + description: Deployment created + content: + application/json: + schema: + $ref: '#/components/schemas/Deployment' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '409': + $ref: '#/components/responses/Conflict' + '400': + $ref: '#/components/responses/BadRequest' + '422': + $ref: '#/components/responses/ValidationError' + + /v1/deployments/{deploymentId}: + get: + tags: + - Deployments + summary: Get a deployment + operationId: getDeployment + parameters: + - $ref: '#/components/parameters/DeploymentId' + responses: + '200': + description: The deployment + content: + application/json: + schema: + $ref: '#/components/schemas/Deployment' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + patch: + tags: + - Deployments + summary: Update a deployment + description: > + Patches one or more aspects of a deployment in place. All fields are optional; omitted + fields are left unchanged. Valid in any non-`deleted` status, including `stopped` + (changes apply on `resume`). Lifecycle transitions use the dedicated `deploy`, `stop`, + `resume`, and `delete` operations. + + **Currently persisted:** `deploymentName` and `configuration` only. Supplying + `deploymentSource`, `secrets`, `environmentVariables`, or `endpoints` returns `422` + until those stores land. + + Target behaviour (once fully wired): + + - `configuration`: applied on the next Scaler cycle; triggers a rollout so workers + restart with the new configuration. If the rollout fails, the deployment remains on + the previous configuration. + + - `deploymentSource`: triggers a build (for `code` sources) or image validation (for `container` + sources); on success the new version is deployed automatically. If the build or + validation fails, the deployment remains on the previous version. + + - `secrets` / `environmentVariables` / `endpoints`: the supplied array **replaces** the + current set — any item absent from the request is deleted. Endpoints take effect + immediately. Changes to secrets or environment variables trigger a rollout so workers + restart and pick up the new values. + operationId: updateDeployment + parameters: + - $ref: '#/components/parameters/DeploymentId' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/DeploymentUpdate' + responses: + '200': + description: Updated deployment + content: + application/json: + schema: + $ref: '#/components/schemas/Deployment' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '409': + $ref: '#/components/responses/Conflict' + '400': + $ref: '#/components/responses/BadRequest' + '422': + $ref: '#/components/responses/ValidationError' + delete: + tags: + - Deployments + summary: Delete a deployment + description: > + Soft delete. Sets `status = deleting` and returns `202` once that intent is persisted. + Router removal, cancelling in-progress builds, and worker drain + (`draining → stopping → stopped`) are performed asynchronously by the deployer/Scaler; + `status` becomes `deleted` once all workers stop. All rows are retained for billing + finalisation, audit, and usage history. Idempotent if the deployment is already + `deleting`. + operationId: deleteDeployment + parameters: + - $ref: '#/components/parameters/DeploymentId' + responses: + '202': + description: Delete accepted; status is deleting + content: + application/json: + schema: + $ref: '#/components/schemas/Deployment' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + + /v1/deployments/{deploymentId}/deploy: + post: + tags: + - Deployments + summary: Deploy a version + description: > + Activates a `ready` version by number, setting `activeVersionId` and returning `202` + once that intent is persisted. Worker rollout, routing switch, and cancelling + in-progress builds (`failed` with `error: "superseded"`) are performed asynchronously + by the deployer/Scaler. Permitted in any addressable status, including `initializing` + and `failed`. + + To roll back, supply an older `versionNumber` — the operation is identical to a forward + deploy. + + **Rollout** (deployer/Scaler): the platform starts workers on the target version, waits + for at least one to become healthy, switches task routing to the new version, then + drains old-version workers gracefully. Old workers are given `gracefulStopTtlSecs` to + finish in-flight tasks before being force-terminated. If new workers fail to become + healthy, old workers are not drained and the deployment continues on the previous + version. + + Errors: + - Deploy to a `deleting` deployment returns `409 Conflict` + - `versionNumber` not found or not `ready` returns `409 Conflict` + - Deploy to a non-existent or `deleted` deployment returns `404 Not Found` + operationId: deployVersion + parameters: + - $ref: '#/components/parameters/DeploymentId' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/DeployRequest' + responses: + '202': + description: Deploy accepted; activeVersionId updated + content: + application/json: + schema: + $ref: '#/components/schemas/Deployment' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '409': + $ref: '#/components/responses/Conflict' + '422': + $ref: '#/components/responses/ValidationError' + + /v1/deployments/{deploymentId}/stop: + post: + tags: + - Deployments + summary: Stop a deployment + description: > + Moves the deployment to `stopping` and returns `202` once that intent is persisted. + Scale-to-zero and worker drain are performed asynchronously by the Scaler; `status` + becomes `stopped` once all workers drain. In-flight tasks have a grace period + (`gracefulStopTtlSecs`) to complete; workers that exceed it are force-terminated and + their tasks return to the queue per delivery guarantees. New task submissions are still + accepted and queued while stopped, but not consumed. Precondition: `status = active`. + operationId: stopDeployment + parameters: + - $ref: '#/components/parameters/DeploymentId' + responses: + '202': + description: Stop accepted; status is stopping + content: + application/json: + schema: + $ref: '#/components/schemas/Deployment' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '409': + $ref: '#/components/responses/Conflict' + + /v1/deployments/{deploymentId}/resume: + post: + tags: + - Deployments + summary: Resume a deployment + description: > + Moves the deployment to `initializing` and returns `202` once that intent is persisted. + The Scaler then starts workers and sets the deployment to `active`; tasks queued during + the stopped period are consumed as workers come online. Precondition: `status = stopped`. + operationId: resumeDeployment + parameters: + - $ref: '#/components/parameters/DeploymentId' + responses: + '202': + description: Resume accepted; deployment is initializing + content: + application/json: + schema: + $ref: '#/components/schemas/Deployment' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '409': + $ref: '#/components/responses/Conflict' + + /v1/deployment-summary: + get: + tags: + - Deployments + summary: Deployment summary metrics for the authenticated organisation + description: > + Aggregate dashboard metrics across all deployments owned by the authenticated organisation. + Metrics whose backing system is not yet available are omitted from the + response rather than reported as zero. + operationId: getDeploymentSummary + responses: + '200': + description: Deployment summary + content: + application/json: + schema: + $ref: '#/components/schemas/DeploymentSummary' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + + # --------------------------------------------------------------------------- + # Builds + # --------------------------------------------------------------------------- + /v1/deployments/{deploymentId}/builds: + get: + tags: + - Builds + summary: List builds + operationId: listBuilds + parameters: + - $ref: '#/components/parameters/DeploymentId' + - $ref: '#/components/parameters/Limit' + - $ref: '#/components/parameters/Cursor' + responses: + '200': + description: A page of builds + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Page' + - type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/Build' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + + /v1/deployments/{deploymentId}/builds/{buildId}: + get: + tags: + - Builds + summary: Get a build + operationId: getBuild + parameters: + - $ref: '#/components/parameters/DeploymentId' + - name: buildId + in: path + required: true + schema: + type: string + format: uuid + responses: + '200': + description: The build + content: + application/json: + schema: + $ref: '#/components/schemas/Build' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + + # --------------------------------------------------------------------------- + # Versions + # --------------------------------------------------------------------------- + /v1/deployments/{deploymentId}/versions: + get: + tags: + - Versions + summary: List versions + operationId: listVersions + parameters: + - $ref: '#/components/parameters/DeploymentId' + - $ref: '#/components/parameters/Limit' + - $ref: '#/components/parameters/Cursor' + responses: + '200': + description: A page of versions + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Page' + - type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/Version' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + + /v1/deployments/{deploymentId}/versions/{versionNumber}: + get: + tags: + - Versions + summary: Get a version + operationId: getVersion + parameters: + - $ref: '#/components/parameters/DeploymentId' + - name: versionNumber + in: path + required: true + schema: + type: integer + format: int32 + responses: + '200': + description: The version + content: + application/json: + schema: + $ref: '#/components/schemas/Version' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + + # --------------------------------------------------------------------------- + # Endpoints + # --------------------------------------------------------------------------- + /v1/deployments/{deploymentId}/endpoints: + get: + tags: + - Endpoints + summary: List endpoints + operationId: listEndpoints + parameters: + - $ref: '#/components/parameters/DeploymentId' + - $ref: '#/components/parameters/Limit' + - $ref: '#/components/parameters/Cursor' + responses: + '200': + description: A page of deployment's endpoints + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Page' + - type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/Endpoint' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + + # --------------------------------------------------------------------------- + # Workers (read-only runtime state) + # --------------------------------------------------------------------------- + /v1/deployments/{deploymentId}/workers: + get: + tags: + - Workers + summary: List workers + operationId: listWorkers + parameters: + - $ref: '#/components/parameters/DeploymentId' + - $ref: '#/components/parameters/Limit' + - $ref: '#/components/parameters/Cursor' + - name: status + in: query + required: false + schema: + $ref: '#/components/schemas/WorkerStatus' + responses: + '200': + description: A page of workers + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Page' + - type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/Worker' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + + # --------------------------------------------------------------------------- + # Secrets (organisation-scoped) + # --------------------------------------------------------------------------- + /v1/secrets: + get: + tags: + - Secrets + summary: List secrets + description: Returns secret metadata only; encrypted values are never returned. + operationId: listSecrets + parameters: + - $ref: '#/components/parameters/Limit' + - $ref: '#/components/parameters/Cursor' + responses: + '200': + description: A page of the authenticated organisation's secrets + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Page' + - type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/Secret' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + post: + tags: + - Secrets + summary: Create a secret + operationId: createSecret + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SecretCreate' + responses: + '201': + description: Secret created + content: + application/json: + schema: + $ref: '#/components/schemas/Secret' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '409': + $ref: '#/components/responses/Conflict' + '400': + $ref: '#/components/responses/BadRequest' + '422': + $ref: '#/components/responses/ValidationError' + + /v1/secrets/{secretName}: + put: + tags: + - Secrets + summary: Update a secret + operationId: updateSecret + parameters: + - $ref: '#/components/parameters/SecretName' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SecretUpdate' + responses: + '200': + description: Updated secret + content: + application/json: + schema: + $ref: '#/components/schemas/Secret' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '400': + $ref: '#/components/responses/BadRequest' + '422': + $ref: '#/components/responses/ValidationError' + delete: + tags: + - Secrets + summary: Delete a secret + operationId: deleteSecret + parameters: + - $ref: '#/components/parameters/SecretName' + responses: + '204': + description: Secret deleted + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + + # --------------------------------------------------------------------------- + # Deployment <-> secret attachments + # --------------------------------------------------------------------------- + /v1/deployments/{deploymentId}/secrets: + get: + tags: + - Secrets + summary: List secrets attached to a deployment + operationId: listDeploymentSecrets + parameters: + - $ref: '#/components/parameters/DeploymentId' + - $ref: '#/components/parameters/Limit' + - $ref: '#/components/parameters/Cursor' + responses: + '200': + description: A page of attached secrets + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Page' + - type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/Secret' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + post: + tags: + - Secrets + summary: Attach a secret to a deployment + description: Returns 409 if the secret is already attached to this deployment. + operationId: attachDeploymentSecret + parameters: + - $ref: '#/components/parameters/DeploymentId' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/SecretAttach' + responses: + '204': + description: Secret attached + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '409': + $ref: '#/components/responses/Conflict' + '422': + $ref: '#/components/responses/ValidationError' + + /v1/deployments/{deploymentId}/secrets/{secretName}: + delete: + tags: + - Secrets + summary: Detach a secret from a deployment + operationId: detachDeploymentSecret + parameters: + - $ref: '#/components/parameters/DeploymentId' + - $ref: '#/components/parameters/SecretName' + responses: + '204': + description: Secret detached + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + + # --------------------------------------------------------------------------- + # Environment Variables (plain-text env vars) + # --------------------------------------------------------------------------- + /v1/deployments/{deploymentId}/environment-variables: + get: + tags: + - EnvironmentVariables + summary: List deployment environment variables + operationId: listDeploymentEnvironmentVariables + parameters: + - $ref: '#/components/parameters/DeploymentId' + - $ref: '#/components/parameters/Limit' + - $ref: '#/components/parameters/Cursor' + responses: + '200': + description: A page of environment variables + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Page' + - type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/EnvironmentVariable' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + + /v1/deployments/{deploymentId}/environment-variables/{variableName}: + put: + tags: + - EnvironmentVariables + summary: Upsert a deployment environment variable + operationId: upsertDeploymentEnvironmentVariable + parameters: + - $ref: '#/components/parameters/DeploymentId' + - name: variableName + in: path + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/EnvironmentVariableUpsert' + responses: + '200': + description: Environment variable upserted + content: + application/json: + schema: + $ref: '#/components/schemas/EnvironmentVariable' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '400': + $ref: '#/components/responses/BadRequest' + '422': + $ref: '#/components/responses/ValidationError' + delete: + tags: + - EnvironmentVariables + summary: Delete a deployment environment variable + operationId: deleteDeploymentEnvironmentVariable + parameters: + - $ref: '#/components/parameters/DeploymentId' + - name: variableName + in: path + required: true + schema: + type: string + responses: + '204': + description: Environment variable deleted + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + + # --------------------------------------------------------------------------- + # Observability + # --------------------------------------------------------------------------- + /v1/deployments/{deploymentId}/tasks: + get: + tags: + - Observability + summary: List tasks for a deployment + operationId: listTasks + parameters: + - $ref: '#/components/parameters/DeploymentId' + - $ref: '#/components/parameters/Limit' + - $ref: '#/components/parameters/Cursor' + - name: status + in: query + required: false + schema: + $ref: '#/components/schemas/TaskStatus' + responses: + '200': + description: A page of tasks + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Page' + - type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/Task' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + + /v1/deployments/{deploymentId}/events: + get: + tags: + - Observability + summary: List deployment events + operationId: listDeploymentEvents + parameters: + - $ref: '#/components/parameters/DeploymentId' + - $ref: '#/components/parameters/Limit' + - $ref: '#/components/parameters/Cursor' + - name: type + in: query + required: false + schema: + $ref: '#/components/schemas/DeploymentEventType' + responses: + '200': + description: A page of events + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Page' + - type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/DeploymentEvent' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + + /v1/usage: + get: + tags: + - Observability + summary: List usage events + description: Append-only billing telemetry; one row per worker state transition. + operationId: listUsageEvents + parameters: + - $ref: '#/components/parameters/Limit' + - $ref: '#/components/parameters/Cursor' + - name: deploymentId + in: query + required: false + schema: + $ref: '#/components/schemas/DeploymentId' + - name: from + in: query + required: false + description: Inclusive lower bound on event time (RFC 3339). + schema: + type: string + format: date-time + - name: to + in: query + required: false + description: Exclusive upper bound on event time (RFC 3339). + schema: + type: string + format: date-time + responses: + '200': + description: A page of usage events + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/Page' + - type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/UsageEvent' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + +components: + securitySchemes: + ApiKeyAuth: + type: http + scheme: bearer + description: > + Runware API key supplied as a bearer token. Validated server-to-server against the + existing Runware platform; the key identifies the organisation. + + parameters: + DeploymentId: + name: deploymentId + in: path + required: true + description: Immutable deployment identifier, unique within the authenticated organisation. + schema: + $ref: '#/components/schemas/DeploymentId' + EndpointPath: + name: endpointPath + in: path + required: true + description: Path of the endpoint to route the task to, as returned by `listEndpoints`. + schema: + type: string + SecretName: + name: secretName + in: path + required: true + description: Secret name, unique within the authenticated organisation. + schema: + type: string + Limit: + name: limit + in: query + required: false + description: Maximum number of items to return. + schema: + type: integer + format: int32 + minimum: 1 + maximum: 100 + default: 20 + Cursor: + name: cursor + in: query + required: false + description: Opaque pagination cursor returned as `nextCursor` by a previous call. + schema: + type: string + + requestBodies: + TaskPayload: + required: true + description: Arbitrary JSON payload forwarded to the endpoint's RPC handler. + content: + application/json: + schema: + type: object + additionalProperties: true + + responses: + Task: + description: The task + content: + application/json: + schema: + $ref: '#/components/schemas/Task' + TaskAccepted: + description: Task accepted and pending + content: + application/json: + schema: + $ref: '#/components/schemas/Task' + BadRequest: + description: > + The request was malformed and could not be parsed (e.g. invalid JSON). + A well-formed request that fails validation returns `422` instead. + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + Unauthorized: + description: Missing or invalid API key + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + Forbidden: + description: Authenticated but not permitted to access this resource + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + NotFound: + description: Resource not found + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + Conflict: + description: Resource already exists or conflicts with current state + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + ValidationError: + description: > + The request was well-formed but semantically invalid (e.g. a missing or + out-of-range field). A request that could not be parsed returns `400`. + The `errors` array carries one entry per offending field. + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + Timeout: + description: Task timed out + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + + schemas: + DeploymentId: + type: string + description: Immutable deployment identifier, unique within the authenticated organisation. + minLength: 6 + maxLength: 30 + pattern: '^[a-z][a-z0-9-]{4,28}[a-z0-9]$' + + # ---- Enums ------------------------------------------------------------- + DeploymentStatus: + type: string + enum: + - initializing + - active + - stopping + - stopped + - deleting + - deleted + - failed + BuildStatus: + type: string + description: Build/validation lifecycle status. + enum: + - queued + - building + - ready + - failed + - superseded + ComputeType: + type: string + enum: + - gpu + - cpu + WorkerStatus: + type: string + description: > + Worker lifecycle status. Also the event type of a `UsageEvent`, which + records a transition into one of these states. + enum: + - pending + - pulling + - loading + - ready + - busy + - draining + - stopping + - stopped + TaskStatus: + type: string + enum: + - pending + - completed + - failed + SecretType: + type: string + enum: + - generic + - registry + DeploymentEventType: + type: string + enum: + - deploy + - scaling + - audit + - error + + # ---- Compute catalogue ---------------------------------------------- + GpuTypeId: + type: string + description: > + Public catalogue code for a supported GPU type (e.g. `h100`, `rtx_6000`). + Must match an `id` returned by `GET /v1/gpu-types` (validated at request + time against the catalogue). This is not the internal database row UUID. + minLength: 1 + maxLength: 64 + pattern: '^[a-z][a-z0-9_]{0,63}$' + + GpuAvailability: + type: string + description: Scheduler provisioning availability for this GPU type. + enum: + - available + - reserved + - custom + + GpuPricing: + type: object + required: + - perSecond + properties: + perSecond: + type: string + minLength: 1 + pattern: '^\d+\.\d+$' + description: > + Price per GPU per second in USD major units as an exact decimal + string (e.g. "0.000767"). Stored and billed from nanodollars + internally; the platform bills in USD only. + example: "0.000767" + + GpuType: + type: object + required: + - id + - name + - memory + - availability + - pricing + properties: + id: + allOf: + - $ref: '#/components/schemas/GpuTypeId' + description: > + Public catalogue code referenced by `gpuType` in worker configuration + (not the internal database row UUID). + name: + type: string + example: H100 + memory: + type: string + description: Human-readable memory capacity. + example: 80 GB HBM + availability: + $ref: '#/components/schemas/GpuAvailability' + pricing: + $ref: '#/components/schemas/GpuPricing' + + GpuTypeList: + type: object + required: + - data + properties: + data: + type: array + items: + $ref: '#/components/schemas/GpuType' + + # ---- Pagination -------------------------------------------------------- + Page: + type: object + properties: + nextCursor: + type: string + nullable: true + description: Cursor for the next page; null when there are no more items. + + # ---- Money ------------------------------------------------------------- + Currency: + type: string + description: ISO 4217 alphabetic code. The platform bills in USD only. + enum: + - USD + + MoneyAmount: + type: object + description: > + A monetary amount as an exact decimal string in the currency's major + unit. Money is never represented as a float (see `GpuPricing.perSecond`). + required: + - amount + - currency + properties: + amount: + type: string + pattern: '^\d+\.\d+$' + description: Amount in major units as an exact decimal string. + example: "312.40" + currency: + $ref: '#/components/schemas/Currency' + + # ---- Core resources ---------------------------------------------------- + DeploymentSummary: + type: object + description: > + Aggregate dashboard metrics for every deployment in the authenticated organisation. Metrics + whose backing system is not yet available are omitted (rendered as "no + data" by the frontend) rather than reported as zero. + required: + - totalDeployments + - activeDeployments + - calculatedAt + properties: + activeDeployments: + type: integer + format: int64 + description: Deployments currently in the `active` status. + totalDeployments: + type: integer + format: int64 + description: All deployments in the organisation excluding soft-deleted ones. + activeWorkers: + type: integer + format: int64 + description: Running workers across all deployments. Omitted until worker state is tracked. + provisionedGpuCount: + type: integer + format: int64 + description: GPUs currently provisioned across all workers. Omitted until worker state is tracked. + requests24h: + type: integer + format: int64 + description: Requests served in the last 24h. Omitted until request metrics are available. + errorRate24h: + type: number + format: double + description: Error ratio (0–1) over the last 24h. Omitted until request metrics are available. + spendToday: + allOf: + - $ref: '#/components/schemas/MoneyAmount' + description: > + Estimated spend since 00:00 UTC. Omitted until billing rollups are + available. + calculatedAt: + type: string + format: date-time + description: When these metrics were computed. + + Deployment: + type: object + required: + - deploymentId + - deploymentName + - configuration + - secrets + - environmentVariables + - status + - createdAt + - updatedAt + properties: + deploymentId: + $ref: '#/components/schemas/DeploymentId' + deploymentName: + type: string + configuration: + allOf: + - $ref: '#/components/schemas/WorkerConfig' + description: Live worker configuration. Updated via `PATCH /deployments/{deploymentId}`. + secrets: + type: array + items: + $ref: '#/components/schemas/Secret' + environmentVariables: + type: array + items: + $ref: '#/components/schemas/EnvironmentVariable' + status: + $ref: '#/components/schemas/DeploymentStatus' + activeVersionId: + type: string + format: uuid + nullable: true + description: Current deployed version; null until the first version is successfully deployed. + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + + DeploymentCreate: + type: object + # Unknown fields are rejected rather than ignored: a stale client sending a + # field that has moved (e.g. the top-level `computeType`, now inside + # `configuration`) must fail loudly instead of silently getting the default. + additionalProperties: false + required: + - deploymentId + - deploymentName + - configuration + - deploymentSource + properties: + deploymentId: + $ref: '#/components/schemas/DeploymentId' + deploymentName: + type: string + configuration: + $ref: '#/components/schemas/WorkerConfigCreate' + deploymentSource: + allOf: + - $ref: '#/components/schemas/DeploymentSourceUpsert' + description: > + Write-only. Source for the initial deployment; not returned in the Deployment response. + Use the `/builds` endpoints to inspect build status. + + - `code`: the codebase is submitted to the build pipeline; a new image is built and + deployed once ready. + + - `container`: a new version is created from the provided image reference and deployed + directly, with no build step. + + The deployment transitions to `active` once the first version is ready, or to `failed` + if the build, validation, or rollout fails. + secrets: + type: array + description: Names of existing secrets to attach to this deployment. + items: + type: string + environmentVariables: + type: object + description: Map with environment variables. Keys are the environment variable names, + values are the environment variable values + additionalProperties: + type: string + endpoints: + type: array + items: + $ref: '#/components/schemas/EndpointCreate' + + DeploymentUpdate: + type: object + description: > + Updates one or more aspects of a deployment in place. All fields are optional; + omitted fields are left unchanged. Lifecycle transitions (stop/resume/delete/deploy) + use their dedicated operations. + + **Currently applied:** `deploymentName` and `configuration`. Supplying + `deploymentSource`, `secrets`, `environmentVariables`, or `endpoints` returns `422` + until those stores land. When wired, configuration/env/secret changes take effect on + the next Scaler cycle; `deploymentSource` triggers a new build and rollout. + additionalProperties: false + properties: + deploymentName: + type: string + description: Mutable display name; does not affect deployment identity or routing. + configuration: + $ref: '#/components/schemas/WorkerConfigPatch' + deploymentSource: + allOf: + - $ref: '#/components/schemas/DeploymentSourceUpsert' + description: > + Write-only. New source to build and deploy; not returned in the Deployment response. + Use the `/builds` endpoints to inspect build status. Triggers a build (for `code` + sources) or image validation (for `container` sources); on success the resulting + version is deployed automatically. On failure the deployment remains on the previous + version. Not persisted yet — supplying this field returns `422`. + secrets: + type: array + description: > + Names of existing secrets to attach to this deployment. Not persisted yet — + supplying this field returns `422`. + items: + type: string + environmentVariables: + type: object + description: > + Map with environment variables. Keys are the environment variable names, values + are the environment variable values. Setting the value of an environment variable + to null deletes the environment variable from the deployment. Not persisted yet — + supplying this field returns `422`. + additionalProperties: + type: string + nullable: true + endpoints: + type: array + description: > + Replaces the deployment's endpoints. Not persisted yet — supplying this field + returns `422`. + items: + $ref: '#/components/schemas/EndpointCreate' + + WorkerConfig: + type: object + required: + - id + - deploymentId + - computeType + - gpusPerWorker + - minWorkers + - maxWorkers + - idleTtlSecs + - scalingDelaySecs + - concurrency + - gracefulStopTtlSecs + properties: + id: + type: string + format: uuid + deploymentId: + $ref: '#/components/schemas/DeploymentId' + computeType: + $ref: '#/components/schemas/ComputeType' + gpuType: + type: string + allOf: + - $ref: '#/components/schemas/GpuTypeId' + nullable: true + description: Preferred GPU type; null when computeType is `cpu`. + fallbackGpuType: + type: string + allOf: + - $ref: '#/components/schemas/GpuTypeId' + nullable: true + description: Secondary GPU type used if the preferred type is unavailable. + gpusPerWorker: + type: integer + format: int32 + default: 1 + minWorkers: + type: integer + format: int32 + default: 0 + minimum: 0 + description: Floor for scale-down; 0 = scale to zero. + maxWorkers: + type: integer + format: int32 + minimum: 1 + minAvailableWorkers: + type: integer + format: int32 + nullable: true + minimum: 0 + description: Minimum number of available (idle) workers kept as a pre-emptive buffer. + availableWorkersPct: + type: integer + format: int32 + nullable: true + description: Scaling buffer as a percentage of incoming task load. + idleTtlSecs: + type: integer + format: int32 + description: Seconds a worker can sit idle before the Scaler removes it. + scalingDelaySecs: + type: integer + format: int32 + description: Cooldown between consecutive scaling decisions. + concurrency: + type: integer + format: int32 + default: 1 + description: Max tasks a single worker handles simultaneously. + gracefulStopTtlSecs: + type: integer + format: int32 + default: 120 + description: Seconds a draining worker is given to finish in-flight tasks before force termination. + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + + WorkerConfigCreate: + type: object + additionalProperties: false + required: + - maxWorkers + - idleTtlSecs + - scalingDelaySecs + properties: + computeType: + allOf: + - $ref: '#/components/schemas/ComputeType' + default: 'gpu' + gpuType: + type: string + allOf: + - $ref: '#/components/schemas/GpuTypeId' + nullable: true + fallbackGpuType: + type: string + allOf: + - $ref: '#/components/schemas/GpuTypeId' + nullable: true + gpusPerWorker: + type: integer + format: int32 + minimum: 0 + default: 1 + minWorkers: + type: integer + format: int32 + minimum: 0 + default: 0 + maxWorkers: + type: integer + format: int32 + minimum: 1 + minAvailableWorkers: + type: integer + format: int32 + minimum: 0 + nullable: true + availableWorkersPct: + type: integer + format: int32 + minimum: 0 + maximum: 100 + nullable: true + idleTtlSecs: + type: integer + format: int32 + minimum: 1 + scalingDelaySecs: + type: integer + format: int32 + minimum: 1 + concurrency: + type: integer + format: int32 + minimum: 1 + default: 1 + gracefulStopTtlSecs: + type: integer + format: int32 + minimum: 1 + default: 120 + + WorkerConfigPatch: + type: object + description: > + Partial worker configuration. Any field present overwrites the live value; omitted + fields are left unchanged. Clearing a nullable live field (setting it to null) is not + supported — omit the field to leave it unchanged. `computeType` is create-time only and + cannot be patched. Changing `gpuType` or `gpusPerWorker` affects only newly created workers. + additionalProperties: false + properties: + gpuType: + type: string + allOf: + - $ref: '#/components/schemas/GpuTypeId' + description: Preferred GPU type. Omit to leave unchanged. + fallbackGpuType: + type: string + allOf: + - $ref: '#/components/schemas/GpuTypeId' + description: Secondary GPU type. Omit to leave unchanged. + gpusPerWorker: + type: integer + format: int32 + minimum: 0 + minWorkers: + type: integer + format: int32 + minimum: 0 + maxWorkers: + type: integer + format: int32 + minimum: 1 + minAvailableWorkers: + type: integer + format: int32 + minimum: 0 + description: Pre-emptive idle-worker buffer. Omit to leave unchanged. + availableWorkersPct: + type: integer + format: int32 + minimum: 0 + maximum: 100 + description: Scaling buffer as a percentage of load. Omit to leave unchanged. + idleTtlSecs: + type: integer + format: int32 + minimum: 1 + scalingDelaySecs: + type: integer + format: int32 + minimum: 1 + concurrency: + type: integer + format: int32 + minimum: 1 + gracefulStopTtlSecs: + type: integer + format: int32 + minimum: 1 + + Version: + type: object + required: + - id + - deploymentId + - versionNumber + - buildId + - createdAt + properties: + id: + type: string + format: uuid + deploymentId: + $ref: '#/components/schemas/DeploymentId' + versionNumber: + type: integer + format: int32 + description: Monotonically increasing per deployment; a failed build does not generate a version. + buildId: + type: string + format: uuid + createdAt: + type: string + format: date-time + + Build: + type: object + description: Details of a code build or container validation. + required: + - id + - status + properties: + id: + type: string + format: uuid + status: + $ref: "#/components/schemas/BuildStatus" + error: + type: string + nullable: true + description: Error message or failure reason; null when the build is still running or succeeded. + exitCode: + type: integer + format: int32 + nullable: true + logTail: + type: string + nullable: true + description: Trailing build log output. + createdAt: + type: string + format: date-time + + ContainerSource: + type: object + required: + - imageRef + properties: + imageRef: + type: string + description: Registry URI of a pre-built image, e.g. `ghcr.io/acme/model:v2`. + registrySecretName: + type: string + nullable: true + description: Name of a `registry`-type secret used to pull the image. + + CodebaseSource: + type: object + required: + - zipBase64 + - modelFile + properties: + zipBase64: + type: string + description: > + Base64-encoded zip archive of the customer's code. + Note: move to presigned URL upload for production — base64 bloats the request body for large codebases. + modelFile: + type: string + description: Path within the zip to the MLflow model entry point (e.g. `model.py`). + + DeploymentSourceUpsert: + type: object + required: + - type + - source + properties: + type: + type: string + enum: [code, container] + description: > + Selects the version creation path. `code` submits customer source code to + the Image Build Service; `container` references a pre-built OCI image. + source: + oneOf: + - $ref: '#/components/schemas/CodeSourceUpsert' + - $ref: '#/components/schemas/ContainerSource' + + CodeSourceUpsert: + type: object + required: + - baseImage + - codebase + properties: + baseImage: + type: string + description: Base image for the builder, e.g. `python:3.11-slim`. + requirements: + type: array + items: + type: string + description: Additional pip packages to install alongside the codebase. + codebase: + $ref: '#/components/schemas/CodebaseSource' + + DeployRequest: + type: object + required: + - versionNumber + properties: + versionNumber: + type: integer + format: int32 + description: > + Version number to deploy. Must reference a `ready` version on this deployment. + Any in-progress or queued builds are cancelled. Use an older version number to roll back. + + Endpoint: + type: object + required: + - id + - deploymentId + - path + properties: + id: + type: string + format: uuid + deploymentId: + $ref: '#/components/schemas/DeploymentId' + path: + type: string + description: > + HTTP path the endpoint is served under, e.g. `/infer`. Inferred from the + deployed code and unique within the deployment, so it identifies the + endpoint on its own. + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + + EndpointCreate: + type: object + required: + - path + properties: + path: + type: string + minLength: 1 + maxLength: 255 + pattern: '^\S+$' + description: > + HTTP path the endpoint is served under, e.g. `/infer`. Unique within the + deployment. Carries no whitespace, since it lands in a URL path segment, + and fits within a URI, hence the 255 character ceiling. + + Worker: + type: object + required: + - id + - deploymentId + - versionId + - podName + - nodeName + - status + properties: + id: + type: string + format: uuid + deploymentId: + $ref: '#/components/schemas/DeploymentId' + versionId: + type: string + format: uuid + podName: + type: string + nodeName: + type: string + status: + $ref: '#/components/schemas/WorkerStatus' + lastSeenAt: + type: string + format: date-time + description: Heartbeat from the shim. + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + + Secret: + type: object + description: Secret metadata. The encrypted value is never returned. + required: + - id + - name + - type + properties: + id: + type: string + format: uuid + name: + type: string + type: + $ref: '#/components/schemas/SecretType' + metadata: + type: object + additionalProperties: true + nullable: true + description: > + For `registry` secrets: `{"registry_host": "ghcr.io", "username": "acme-bot"}`. + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + + SecretAttach: + type: object + required: + - secretName + properties: + secretName: + type: string + description: Name of the secret to attach. + + SecretCreate: + type: object + required: + - name + - type + - value + properties: + name: + type: string + type: + $ref: '#/components/schemas/SecretType' + value: + type: string + description: Plain-text value; encrypted at rest by the platform. + metadata: + type: object + additionalProperties: true + nullable: true + + SecretUpdate: + type: object + required: + - value + properties: + value: + type: string + metadata: + type: object + additionalProperties: true + nullable: true + + EnvironmentVariable: + type: object + required: + - key + - value + properties: + id: + type: string + format: uuid + deploymentId: + $ref: '#/components/schemas/DeploymentId' + key: + type: string + value: + type: string + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + + EnvironmentVariableUpsert: + type: object + required: + - value + properties: + value: + type: string + + Task: + type: object + required: + - id + - status + - deploymentId + - createdAt + properties: + id: + type: string + description: Opaque task identifier returned by the execution backend. + status: + $ref: '#/components/schemas/TaskStatus' + deploymentId: + $ref: '#/components/schemas/DeploymentId' + output: + type: object + additionalProperties: true + nullable: true + description: Inference result payload on success; null otherwise. + error: + type: string + nullable: true + description: Failure detail when status is `failed`; null otherwise. + createdAt: + type: string + format: date-time + completedAt: + type: string + format: date-time + nullable: true + + UsageEvent: + type: object + required: + - id + - deploymentId + - workerId + - eventType + - gpuCount + - occurredAt + properties: + id: + type: string + format: uuid + deploymentId: + $ref: '#/components/schemas/DeploymentId' + workerId: + type: string + format: uuid + eventType: + $ref: '#/components/schemas/WorkerStatus' + gpuCount: + type: integer + format: int32 + occurredAt: + type: string + format: date-time + description: > + When the transition happened. This is the event time the `from` and + `to` filters apply to, and the field to bill on. + createdAt: + type: string + format: date-time + description: When the event was recorded. Audit only — may lag `occurredAt`. + + DeploymentEvent: + type: object + required: + - id + - deploymentId + - type + - message + properties: + id: + type: string + format: uuid + deploymentId: + $ref: '#/components/schemas/DeploymentId' + workerId: + type: string + format: uuid + nullable: true + endpointId: + type: string + format: uuid + nullable: true + type: + $ref: '#/components/schemas/DeploymentEventType' + message: + type: string + pattern: '\S' + description: Human-readable description of what happened. Never blank. + createdAt: + type: string + format: date-time + + ProblemDetails: + type: object + description: > + RFC 9457 problem details. Every error response from this API uses this + schema with media type `application/problem+json`. `type` is a URI that + identifies the problem class and dereferences to its documentation; + clients should switch on `type` (not `status` or `detail`, which are not + stable identifiers). Additional members beyond those below may appear. + required: + - type + - title + - status + properties: + type: + type: string + format: uri + default: about:blank + description: > + URI reference identifying the problem type. Dereferences to + human-readable documentation. `about:blank` denotes "no semantics + beyond the HTTP status". + example: https://docs.runware.ai/serverless/errors#not-found + title: + type: string + description: > + Short, human-readable summary of the problem type (the standard HTTP + status text). Stable for a given `type`; does not change from + occurrence to occurrence. + example: Not Found + status: + type: integer + format: int32 + description: HTTP status code generated for this occurrence. + example: 404 + detail: + type: string + description: Human-readable explanation specific to this occurrence. + example: No deployment 'img-gen' exists for the authenticated organisation. + instance: + type: string + format: uri-reference + description: URI reference identifying the specific occurrence (the request path). + example: /v1/deployments/img-gen + requestId: + type: string + description: > + Extension member. Correlation id for this request, echoed in the + `X-Request-Id` response header; quote it when reporting problems. + errors: + type: array + description: > + Extension member. Present on validation failures (`422`); one entry + per offending request field. + items: + $ref: '#/components/schemas/ProblemError' + + ProblemError: + type: object + description: A single field-level validation error within a ProblemDetails. + required: + - detail + properties: + detail: + type: string + description: Human-readable reason this field was rejected. + example: is required + pointer: + type: string + description: > + JSON Pointer (RFC 6901) to the offending field in the request body, + e.g. `/configuration/maxWorkers`. Absent for non-body parameters. + example: /configuration/maxWorkers diff --git a/docs/runware_serverless_deploy.md b/docs/runware_serverless_deploy.md index a21b171..fe1aa93 100644 --- a/docs/runware_serverless_deploy.md +++ b/docs/runware_serverless_deploy.md @@ -6,8 +6,8 @@ Deploy a new serverless application Deploy a new serverless application from a Python file. -The application settings come from the project -configuration created by 'runware serverless init' or the dashboard. +The application settings come from the project configuration (via the +dashboard, or 'runware serverless init' when available). ``` runware serverless deploy [file] [flags] diff --git a/go.mod b/go.mod index f74bea4..24bd7dd 100644 --- a/go.mod +++ b/go.mod @@ -8,12 +8,15 @@ require ( github.com/google/uuid v1.6.0 github.com/gorilla/websocket v1.5.3 github.com/jedib0t/go-pretty/v6 v6.7.10 + github.com/oapi-codegen/runtime v1.6.0 + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c github.com/spf13/cobra v1.10.2 golang.org/x/term v0.41.0 gopkg.in/yaml.v3 v3.0.1 ) require ( + github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect github.com/charmbracelet/lipgloss v1.1.0 // indirect @@ -22,22 +25,36 @@ require ( github.com/charmbracelet/x/term v0.2.1 // indirect github.com/clipperhouse/uax29/v2 v2.2.0 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.6 // indirect + github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 // indirect github.com/fatih/color v1.7.0 // indirect + github.com/getkin/kin-openapi v0.142.0 // indirect github.com/go-logfmt/logfmt v0.6.1 // indirect + github.com/go-openapi/jsonpointer v0.23.1 // indirect + github.com/go-openapi/swag/jsonname v0.26.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/kr/pretty v0.3.1 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect - github.com/mattn/go-colorable v0.1.2 // indirect + github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.21 // indirect github.com/muesli/termenv v0.16.0 // indirect + github.com/oapi-codegen/oapi-codegen/v2 v2.8.0 // indirect + github.com/oasdiff/yaml v0.1.1 // indirect + github.com/oasdiff/yaml3 v0.0.14 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect + github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 // indirect + github.com/speakeasy-api/jsonpath v0.6.3 // indirect + github.com/speakeasy-api/openapi v1.24.0 // indirect github.com/spf13/pflag v1.0.10 // indirect + github.com/vmware-labs/yaml-jsonpath v0.3.2 // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect - golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect - golang.org/x/sys v0.42.0 // indirect - golang.org/x/text v0.28.0 // indirect - gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect + golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 // indirect + golang.org/x/mod v0.38.0 // indirect + golang.org/x/sync v0.22.0 // indirect + golang.org/x/sys v0.47.0 // indirect + golang.org/x/text v0.40.0 // indirect + golang.org/x/tools v0.48.0 // indirect ) + +tool github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen diff --git a/go.sum b/go.sum index aadb86e..ac91484 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,9 @@ +github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk= +github.com/apapsch/go-jsonmerge/v2 v2.0.0 h1:axGnT1gRIfimI7gJifB699GoE/oq+F2MU7Dml6nw9rQ= +github.com/apapsch/go-jsonmerge/v2 v2.0.0/go.mod h1:lvDnEdqiQrp0O42VQGgmlKpxL1AP2+08jFMw88y4klk= github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= +github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w= github.com/briandowns/spinner v1.23.2 h1:Zc6ecUnI+YzLmJniCfDNaMbW0Wid1d5+qcTq4L2FW8w= github.com/briandowns/spinner v1.23.2/go.mod h1:LaZeM4wm2Ywy6vO571mvhQNRcWfRUnXOs0RcKV0wYKM= github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc h1:4pZI35227imm7yK2bGPcfpFEmuY1gc2YSTShr4iJBfs= @@ -14,74 +18,226 @@ github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd h1:vy0G github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd/go.mod h1:xe0nKWGd3eJgtqZRaN9RjMtK7xUYchjzPr7q6kcvCCs= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/clipperhouse/uax29/v2 v2.2.0 h1:ChwIKnQN3kcZteTXMgb1wztSgaU+ZemkgWdohwgs8tY= github.com/clipperhouse/uax29/v2 v2.2.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM= github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo5vtkx0= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo= +github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= +github.com/dprotaso/go-yit v0.0.0-20191028211022-135eb7262960/go.mod h1:9HQzr9D/0PGwMEbC3d5AB7oi67+h4TsQqItC1GVYG58= +github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 h1:PRxIJD8XjimM5aTknUK9w6DHLDox2r2M3DI4i2pnd3w= +github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936/go.mod h1:ttYvX5qlB+mlV1okblJqcSMtR4c52UKxDiX9GRBS8+Q= github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/getkin/kin-openapi v0.142.0 h1:izj0vBdFprMhitfzaX8sTqztsEQyvwhssBoB6n8NO7w= +github.com/getkin/kin-openapi v0.142.0/go.mod h1:3BH9M9XDe/y9M5DSvEocVYAYq1w0qrhJHjC/vZi0AaY= github.com/go-logfmt/logfmt v0.6.1 h1:4hvbpePJKnIzH1B+8OR/JPbTx37NktoI9LE2QZBBkvE= github.com/go-logfmt/logfmt v0.6.1/go.mod h1:EV2pOAQoZaT1ZXZbqDl5hrymndi4SY9ED9/z6CO0XAk= +github.com/go-openapi/jsonpointer v0.23.1 h1:1HBACs7XIwR2RcmItfdSFlALhGbe6S92p0ry4d1GWg4= +github.com/go-openapi/jsonpointer v0.23.1/go.mod h1:iWRmZTrGn7XwYhtPt/fvdSFj1OfNBngqRT2UG3BxSqY= +github.com/go-openapi/swag/jsonname v0.26.0 h1:gV1NFX9M8avo0YSpmWogqfQISigCmpaiNci8cGECU5w= +github.com/go-openapi/swag/jsonname v0.26.0/go.mod h1:urBBR8bZNoDYGr653ynhIx+gTeIz0ARZxHkAPktJK2M= +github.com/go-openapi/testify/v2 v2.4.2 h1:tiByHpvE9uHrrKjOszax7ZvKB7QOgizBWGBLuq0ePx4= +github.com/go-openapi/testify/v2 v2.4.2/go.mod h1:SgsVHtfooshd0tublTtJ50FPKhujf47YRqauXXOUxfw= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jedib0t/go-pretty/v6 v6.7.10 h1:B/2qW2Bkv2L6n14PP8o1kx75kWzHOQ3YTluWzg9icac= github.com/jedib0t/go-pretty/v6 v6.7.10/go.mod h1:YwC5CE4fJ1HFUDeivSV1r//AmANFHyqczZk+U6BDALU= +github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d/go.mod h1:2PavIy+JPciBPrBUjwbNvtwB6RQlve+hkpll6QSNmOE= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= -github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= +github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.21 h1:jJKAZiQH+2mIinzCJIaIG9Be1+0NR+5sz/lYEEjdM8w= github.com/mattn/go-runewidth v0.0.21/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs= github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc= github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/oapi-codegen/nullable v1.1.0 h1:eAh8JVc5430VtYVnq00Hrbpag9PFRGWLjxR1/3KntMs= +github.com/oapi-codegen/nullable v1.1.0/go.mod h1:KUZ3vUzkmEKY90ksAmit2+5juDIhIZhfDl+0PwOQlFY= +github.com/oapi-codegen/oapi-codegen/v2 v2.8.0 h1:s4hxMxuqtR8jPzXkBTtFwY/SBuj3gEAYikmbBSdtLMM= +github.com/oapi-codegen/oapi-codegen/v2 v2.8.0/go.mod h1:yae2TI9IYB5vxQ35gFrpXh9L5H1eJv4MAUK1jumGMTo= +github.com/oapi-codegen/runtime v1.6.0 h1:7Xx+GlueD6nRuyKoCPzL434Jfi3BetbiJOrzCHp/VPU= +github.com/oapi-codegen/runtime v1.6.0/go.mod h1:GwV7hC2hviaMzj+ITfHVRESK5J2W/GefVwIND/bMGvU= +github.com/oasdiff/yaml v0.1.1 h1:6nHx+pn9gBRM6YpBlFZFQGCCd1nuvqOBtTD3KKTgGxY= +github.com/oasdiff/yaml v0.1.1/go.mod h1:EYJNoyktvWMJ0Hmhx+6qTaqMOsalUaRGT8Sj1hNcegU= +github.com/oasdiff/yaml3 v0.0.14 h1:aLJee3hxBK2H5wdXd9iPcIXb93Nty1Ge0pT171eHtkw= +github.com/oasdiff/yaml3 v0.0.14/go.mod h1:csto2xfDjYccdUn/yw/bPjj/cYTdp6HtFA0J4TWG+gg= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.2/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= +github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw= +github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= +github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 h1:KRzFb2m7YtdldCEkzs6KqmJw4nqEVZGK7IN2kJkjTuQ= +github.com/santhosh-tekuri/jsonschema/v6 v6.0.2/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU= +github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= +github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/speakeasy-api/jsonpath v0.6.3 h1:c+QPwzAOdrWvzycuc9HFsIZcxKIaWcNpC+xhOW9rJxU= +github.com/speakeasy-api/jsonpath v0.6.3/go.mod h1:2cXloNuQ+RSXi5HTRaeBh7JEmjRXTiaKpFTdZiL7URI= +github.com/speakeasy-api/openapi v1.24.0 h1:opoD27rupX7zBVPq1HkIGLeMOzNNA7JalhYP8q34i04= +github.com/speakeasy-api/openapi v1.24.0/go.mod h1:g3+dIMe0AYgbbGvnlQZqesmjAVWSm9BmsjLevnefQrg= github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad/go.mod h1:qLr4V1qq6nMqFKkMo8ZTx3f+BZEkzsRUY10Xsm2mwU0= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/vmware-labs/yaml-jsonpath v0.3.2 h1:/5QKeCBGdsInyDCyVNLbXyilb61MXGi9NP674f9Hobk= +github.com/vmware-labs/yaml-jsonpath v0.3.2/go.mod h1:U6whw1z03QyqgWdgXxvVnQ90zN1BWz5V+51Ewf8k+rQ= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 h1:985EYyeCOxTpcgOTJpflJUwOeEz0CQOdPt73OzpE9F8= +golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.38.0 h1:MECBjubtXD7yj4HrhIUcywNaGeNVUdfVnxmPajOk4yk= +golang.org/x/mod v0.38.0/go.mod h1:V6Xz0pq8TQ3dGqVQ1FVHuelZpAL0uNhSkk9ogYP3c40= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE= +golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= +golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= -golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= +golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.41.0 h1:QCgPso/Q3RTJx2Th4bDLqML4W6iJiaXFq2/ftQF13YU= golang.org/x/term v0.41.0/go.mod h1:3pfBgksrReYfZ5lvYM0kSO0LIkAl4Yl2bXOkKP7Ec2A= -golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= -golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs= +golang.org/x/text v0.40.0/go.mod h1:hpnzDAfGV753zIKo+wk3u1bVKCGPbrnF7+7LBF/UHVY= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.48.0 h1:3+hClM1aLL5mjMKm5ovokw9epgRXPuu2tILgismM6RE= +golang.org/x/tools v0.48.0/go.mod h1:08xX0orndb/F7jJxGDicx061tyd5pcMto75YMAXr6lk= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/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= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20191026110619-0b21df46bc1d/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/api/serverless/client.go b/internal/api/serverless/client.go index 191723f..2c9c669 100644 --- a/internal/api/serverless/client.go +++ b/internal/api/serverless/client.go @@ -1,19 +1,21 @@ -// Package serverless is a REST client for the Runware Serverless control-plane -// API (api.serverless.runware.ai). It is separate from the inference task -// transport in internal/api/transport, which speaks the task-array protocol. +// Package serverless is a thin wrapper around the OpenAPI-generated client for +// the Runware Serverless control-plane API (api.serverless.runware.ai). +// +// Regenerate the client after updating api/serverless/openapi.yaml: +// +// make generate-serverless package serverless import ( "context" - "encoding/json" "fmt" - "io" "log/slog" "net/http" "strings" "time" "github.com/runware/runware-cli/internal/agents" + "github.com/runware/runware-cli/internal/api/serverless/gen" "github.com/runware/runware-cli/internal/api/transport" "github.com/runware/runware-cli/internal/buildinfo" ) @@ -21,72 +23,80 @@ import ( // defaultTimeout bounds a single REST request. const defaultTimeout = 30 * time.Second +// GpuType is the public catalogue entry for a supported GPU type. +type GpuType = gen.GpuType + // Client talks to the Serverless control-plane REST API. type Client struct { - apiKey string - baseURL string - userAgent string - logger *slog.Logger - httpClient *http.Client + apiKey string + inner *gen.ClientWithResponses + logger *slog.Logger } // NewClient creates a Serverless API client for the given API key and base URL. func NewClient(apiKey, baseURL string, logger *slog.Logger) *Client { + return newClient(apiKey, baseURL, logger, &http.Client{Timeout: defaultTimeout}) +} + +func newClient(apiKey, baseURL string, logger *slog.Logger, httpClient gen.HttpRequestDoer) *Client { ua := buildinfo.UserAgent() if agent := agents.Detect(); agent != "" { ua += " agent/" + string(agent) } - return &Client{ - apiKey: apiKey, - baseURL: strings.TrimSuffix(baseURL, "/"), - userAgent: ua, - logger: logger, - httpClient: &http.Client{Timeout: defaultTimeout}, - } -} -// get performs an authenticated GET on path (e.g. "/v1/gpu-types") and decodes -// the JSON response body into out. -func (c *Client) get(ctx context.Context, path string, out any) error { - if c.apiKey == "" { - return transport.ErrNoAPIKey + inner, err := gen.NewClientWithResponses( + strings.TrimSuffix(baseURL, "/")+"/", + gen.WithHTTPClient(httpClient), + gen.WithRequestEditorFn(func(_ context.Context, req *http.Request) error { + req.Header.Set("Authorization", "Bearer "+apiKey) + req.Header.Set("User-Agent", ua) + req.Header.Set("Accept", "application/json") + return nil + }), + ) + if err != nil { + // NewClientWithResponses only fails if an option returns an error; + // our options do not, so treat this as a programmer error. + panic(fmt.Sprintf("serverless client: %v", err)) } - req, err := http.NewRequestWithContext(ctx, http.MethodGet, c.baseURL+path, nil) - if err != nil { - return fmt.Errorf("failed to create request: %w", err) + return &Client{ + apiKey: apiKey, + inner: inner, + logger: logger, } - req.Header.Set("Accept", "application/json") - req.Header.Set("Authorization", "Bearer "+c.apiKey) - req.Header.Set("User-Agent", c.userAgent) +} - start := time.Now() - resp, err := c.httpClient.Do(req) - if err != nil { - return fmt.Errorf("request failed: %w", err) +// ListGpuTypes returns the catalogue of supported GPU types and their pricing. +func (c *Client) ListGpuTypes(ctx context.Context) ([]GpuType, error) { + if c.apiKey == "" { + return nil, transport.ErrNoAPIKey } - defer resp.Body.Close() //nolint:errcheck,gosec - body, err := io.ReadAll(resp.Body) + resp, err := c.inner.ListGpuTypesWithResponse(ctx) if err != nil { - return fmt.Errorf("failed to read response: %w", err) + return nil, fmt.Errorf("list GPU types: %w", err) } if c.logger != nil && c.logger.Enabled(ctx, slog.LevelDebug) { c.logger.Debug("serverless response", //nolint:errcheck,gosec - "url", c.baseURL+path, - "status", resp.StatusCode, - "elapsed", time.Since(start).Round(time.Millisecond), - "body", string(body), + "path", "/v1/gpu-types", + "status", resp.StatusCode(), + "body", string(resp.Body), ) } - if resp.StatusCode < http.StatusOK || resp.StatusCode >= http.StatusMultipleChoices { - return parseError(body, resp.StatusCode) - } - - if err := json.Unmarshal(body, out); err != nil { - return fmt.Errorf("failed to parse response (HTTP %d): %w", resp.StatusCode, err) + switch resp.StatusCode() { + case http.StatusOK: + if resp.JSON200 == nil { + return nil, fmt.Errorf("list GPU types: empty 200 response") + } + return resp.JSON200.Data, nil + case http.StatusUnauthorized: + return nil, problemToError(resp.ApplicationproblemJSON401, http.StatusUnauthorized) + case http.StatusForbidden: + return nil, problemToError(resp.ApplicationproblemJSON403, http.StatusForbidden) + default: + return nil, problemToError(nil, resp.StatusCode()) } - return nil } diff --git a/internal/api/serverless/gpu_test.go b/internal/api/serverless/client_test.go similarity index 71% rename from internal/api/serverless/gpu_test.go rename to internal/api/serverless/client_test.go index f36a29a..873a3cf 100644 --- a/internal/api/serverless/gpu_test.go +++ b/internal/api/serverless/client_test.go @@ -20,11 +20,11 @@ func TestListGpuTypes(t *testing.T) { t.Errorf("missing/incorrect auth header: %q", got) } w.Header().Set("Content-Type", "application/json") - _, _ = w.Write([]byte(`{"data":[{"id":"h100","name":"H100","memory":"80GB","availability":"available","pricing":{"currency":"USD","perSecond":"0.000767"}}]}`)) + _, _ = w.Write([]byte(`{"data":[{"id":"h100","name":"H100","memory":"80 GB HBM","availability":"available","pricing":{"perSecond":"0.000767"}}]}`)) })) defer srv.Close() - c := NewClient("test-key", srv.URL, slog.Default()) + c := newClient("test-key", srv.URL, slog.Default(), srv.Client()) gpus, err := c.ListGpuTypes(context.Background()) if err != nil { t.Fatalf("ListGpuTypes: %v", err) @@ -32,11 +32,11 @@ func TestListGpuTypes(t *testing.T) { if len(gpus) != 1 { t.Fatalf("expected 1 gpu, got %d", len(gpus)) } - if gpus[0].ID != "h100" || gpus[0].Pricing.PerSecond != "0.000767" { + if gpus[0].Id != "h100" || gpus[0].Pricing.PerSecond != "0.000767" { t.Errorf("unexpected gpu: %+v", gpus[0]) } - if gpus[0].Memory == nil || *gpus[0].Memory != "80GB" { - t.Errorf("unexpected memory: %v", gpus[0].Memory) + if gpus[0].Memory != "80 GB HBM" { + t.Errorf("unexpected memory: %q", gpus[0].Memory) } } @@ -49,12 +49,13 @@ func TestListGpuTypes_NoAPIKey(t *testing.T) { func TestListGpuTypes_AuthError(t *testing.T) { srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/problem+json") w.WriteHeader(http.StatusUnauthorized) - _, _ = w.Write([]byte(`{"code":401,"message":"Missing or invalid API key"}`)) + _, _ = w.Write([]byte(`{"type":"about:blank","title":"Unauthorized","status":401,"detail":"Missing or invalid API key"}`)) })) defer srv.Close() - c := NewClient("bad", srv.URL, slog.Default()) + c := newClient("bad", srv.URL, slog.Default(), srv.Client()) _, err := c.ListGpuTypes(context.Background()) var re *transport.RunwareError if !errors.As(err, &re) { @@ -63,4 +64,7 @@ func TestListGpuTypes_AuthError(t *testing.T) { if re.Code != transport.CodeAuth { t.Errorf("expected CodeAuth, got %v", re.Code) } + if re.Message != "Missing or invalid API key" { + t.Errorf("unexpected message: %q", re.Message) + } } diff --git a/internal/api/serverless/errors.go b/internal/api/serverless/errors.go index 8c458b5..2199f75 100644 --- a/internal/api/serverless/errors.go +++ b/internal/api/serverless/errors.go @@ -1,34 +1,32 @@ package serverless import ( - "encoding/json" "fmt" "net/http" + "github.com/runware/runware-cli/internal/api/serverless/gen" "github.com/runware/runware-cli/internal/api/transport" ) -// wireError is the Serverless API error envelope: {"code":int,"message":string}. -type wireError struct { - Code int `json:"code"` - Message string `json:"message"` -} - -// parseError converts a non-2xx Serverless API response into a +// problemToError converts an RFC 9457 ProblemDetails (or a bare status) into a // *transport.RunwareError so the CLI's shared error rendering (including the // auth hint on 401/403) applies uniformly. -func parseError(body []byte, statusCode int) error { - var w wireError - if err := json.Unmarshal(body, &w); err != nil || w.Message == "" { - return transport.CreateRunwareError( - rawCodeForStatus(statusCode), - fmt.Sprintf("HTTP %d: %s", statusCode, http.StatusText(statusCode)), - transport.RunwareErrorDetails{StatusCode: statusCode}, - ) +func problemToError(p *gen.ProblemDetails, statusCode int) error { + msg := fmt.Sprintf("HTTP %d: %s", statusCode, http.StatusText(statusCode)) + if p != nil { + if p.Status != 0 { + statusCode = int(p.Status) + } + switch { + case p.Detail != nil && *p.Detail != "": + msg = *p.Detail + case p.Title != "": + msg = p.Title + } } return transport.CreateRunwareError( rawCodeForStatus(statusCode), - w.Message, + msg, transport.RunwareErrorDetails{StatusCode: statusCode}, ) } diff --git a/internal/api/serverless/gen/client.gen.go b/internal/api/serverless/gen/client.gen.go new file mode 100644 index 0000000..85dc916 --- /dev/null +++ b/internal/api/serverless/gen/client.gen.go @@ -0,0 +1,8808 @@ +// Package gen provides primitives to interact with the openapi HTTP API. +// +// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.8.0 DO NOT EDIT. +package gen + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + "net/http" + "net/url" + "strings" + "time" + + "github.com/oapi-codegen/runtime" + openapi_types "github.com/oapi-codegen/runtime/types" +) + +// Defines values for BuildStatus. +const ( + BuildStatusBuilding BuildStatus = "building" + BuildStatusFailed BuildStatus = "failed" + BuildStatusQueued BuildStatus = "queued" + BuildStatusReady BuildStatus = "ready" + BuildStatusSuperseded BuildStatus = "superseded" +) + +// Valid indicates whether the value is a known member of the BuildStatus enum. +func (e BuildStatus) Valid() bool { + switch e { + case BuildStatusBuilding: + return true + case BuildStatusFailed: + return true + case BuildStatusQueued: + return true + case BuildStatusReady: + return true + case BuildStatusSuperseded: + return true + default: + return false + } +} + +// Defines values for ComputeType. +const ( + Cpu ComputeType = "cpu" + Gpu ComputeType = "gpu" +) + +// Valid indicates whether the value is a known member of the ComputeType enum. +func (e ComputeType) Valid() bool { + switch e { + case Cpu: + return true + case Gpu: + return true + default: + return false + } +} + +// Defines values for Currency. +const ( + USD Currency = "USD" +) + +// Valid indicates whether the value is a known member of the Currency enum. +func (e Currency) Valid() bool { + switch e { + case USD: + return true + default: + return false + } +} + +// Defines values for DeploymentEventType. +const ( + Audit DeploymentEventType = "audit" + Deploy DeploymentEventType = "deploy" + Error DeploymentEventType = "error" + Scaling DeploymentEventType = "scaling" +) + +// Valid indicates whether the value is a known member of the DeploymentEventType enum. +func (e DeploymentEventType) Valid() bool { + switch e { + case Audit: + return true + case Deploy: + return true + case Error: + return true + case Scaling: + return true + default: + return false + } +} + +// Defines values for DeploymentSourceUpsertType. +const ( + Code DeploymentSourceUpsertType = "code" + Container DeploymentSourceUpsertType = "container" +) + +// Valid indicates whether the value is a known member of the DeploymentSourceUpsertType enum. +func (e DeploymentSourceUpsertType) Valid() bool { + switch e { + case Code: + return true + case Container: + return true + default: + return false + } +} + +// Defines values for DeploymentStatus. +const ( + DeploymentStatusActive DeploymentStatus = "active" + DeploymentStatusDeleted DeploymentStatus = "deleted" + DeploymentStatusDeleting DeploymentStatus = "deleting" + DeploymentStatusFailed DeploymentStatus = "failed" + DeploymentStatusInitializing DeploymentStatus = "initializing" + DeploymentStatusStopped DeploymentStatus = "stopped" + DeploymentStatusStopping DeploymentStatus = "stopping" +) + +// Valid indicates whether the value is a known member of the DeploymentStatus enum. +func (e DeploymentStatus) Valid() bool { + switch e { + case DeploymentStatusActive: + return true + case DeploymentStatusDeleted: + return true + case DeploymentStatusDeleting: + return true + case DeploymentStatusFailed: + return true + case DeploymentStatusInitializing: + return true + case DeploymentStatusStopped: + return true + case DeploymentStatusStopping: + return true + default: + return false + } +} + +// Defines values for GpuAvailability. +const ( + Available GpuAvailability = "available" + Custom GpuAvailability = "custom" + Reserved GpuAvailability = "reserved" +) + +// Valid indicates whether the value is a known member of the GpuAvailability enum. +func (e GpuAvailability) Valid() bool { + switch e { + case Available: + return true + case Custom: + return true + case Reserved: + return true + default: + return false + } +} + +// Defines values for SecretType. +const ( + Generic SecretType = "generic" + Registry SecretType = "registry" +) + +// Valid indicates whether the value is a known member of the SecretType enum. +func (e SecretType) Valid() bool { + switch e { + case Generic: + return true + case Registry: + return true + default: + return false + } +} + +// Defines values for TaskStatus. +const ( + TaskStatusCompleted TaskStatus = "completed" + TaskStatusFailed TaskStatus = "failed" + TaskStatusPending TaskStatus = "pending" +) + +// Valid indicates whether the value is a known member of the TaskStatus enum. +func (e TaskStatus) Valid() bool { + switch e { + case TaskStatusCompleted: + return true + case TaskStatusFailed: + return true + case TaskStatusPending: + return true + default: + return false + } +} + +// Defines values for WorkerStatus. +const ( + WorkerStatusBusy WorkerStatus = "busy" + WorkerStatusDraining WorkerStatus = "draining" + WorkerStatusLoading WorkerStatus = "loading" + WorkerStatusPending WorkerStatus = "pending" + WorkerStatusPulling WorkerStatus = "pulling" + WorkerStatusReady WorkerStatus = "ready" + WorkerStatusStopped WorkerStatus = "stopped" + WorkerStatusStopping WorkerStatus = "stopping" +) + +// Valid indicates whether the value is a known member of the WorkerStatus enum. +func (e WorkerStatus) Valid() bool { + switch e { + case WorkerStatusBusy: + return true + case WorkerStatusDraining: + return true + case WorkerStatusLoading: + return true + case WorkerStatusPending: + return true + case WorkerStatusPulling: + return true + case WorkerStatusReady: + return true + case WorkerStatusStopped: + return true + case WorkerStatusStopping: + return true + default: + return false + } +} + +// Build Details of a code build or container validation. +type Build struct { + CreatedAt *time.Time `json:"createdAt,omitempty"` + + // Error Error message or failure reason; null when the build is still running or succeeded. + Error *string `json:"error,omitempty"` + ExitCode *int32 `json:"exitCode,omitempty"` + Id openapi_types.UUID `json:"id"` + + // LogTail Trailing build log output. + LogTail *string `json:"logTail,omitempty"` + + // Status Build/validation lifecycle status. + Status BuildStatus `json:"status"` +} + +// BuildStatus Build/validation lifecycle status. +type BuildStatus string + +// CodeSourceUpsert defines model for CodeSourceUpsert. +type CodeSourceUpsert struct { + // BaseImage Base image for the builder, e.g. `python:3.11-slim`. + BaseImage string `json:"baseImage"` + Codebase CodebaseSource `json:"codebase"` + + // Requirements Additional pip packages to install alongside the codebase. + Requirements *[]string `json:"requirements,omitempty"` +} + +// CodebaseSource defines model for CodebaseSource. +type CodebaseSource struct { + // ModelFile Path within the zip to the MLflow model entry point (e.g. `model.py`). + ModelFile string `json:"modelFile"` + + // ZipBase64 Base64-encoded zip archive of the customer's code. Note: move to presigned URL upload for production — base64 bloats the request body for large codebases. + ZipBase64 string `json:"zipBase64"` +} + +// ComputeType defines model for ComputeType. +type ComputeType string + +// ContainerSource defines model for ContainerSource. +type ContainerSource struct { + // ImageRef Registry URI of a pre-built image, e.g. `ghcr.io/acme/model:v2`. + ImageRef string `json:"imageRef"` + + // RegistrySecretName Name of a `registry`-type secret used to pull the image. + RegistrySecretName *string `json:"registrySecretName,omitempty"` +} + +// Currency ISO 4217 alphabetic code. The platform bills in USD only. +type Currency string + +// DeployRequest defines model for DeployRequest. +type DeployRequest struct { + // VersionNumber Version number to deploy. Must reference a `ready` version on this deployment. Any in-progress or queued builds are cancelled. Use an older version number to roll back. + VersionNumber int32 `json:"versionNumber"` +} + +// Deployment defines model for Deployment. +type Deployment struct { + // ActiveVersionId Current deployed version; null until the first version is successfully deployed. + ActiveVersionId *openapi_types.UUID `json:"activeVersionId,omitempty"` + + // Configuration Live worker configuration. Updated via `PATCH /deployments/{deploymentId}`. + Configuration WorkerConfig `json:"configuration"` + CreatedAt time.Time `json:"createdAt"` + + // DeploymentId Immutable deployment identifier, unique within the authenticated organisation. + DeploymentId DeploymentId `json:"deploymentId"` + DeploymentName string `json:"deploymentName"` + EnvironmentVariables []EnvironmentVariable `json:"environmentVariables"` + Secrets []Secret `json:"secrets"` + Status DeploymentStatus `json:"status"` + UpdatedAt time.Time `json:"updatedAt"` +} + +// DeploymentCreate defines model for DeploymentCreate. +type DeploymentCreate struct { + Configuration WorkerConfigCreate `json:"configuration"` + + // DeploymentId Immutable deployment identifier, unique within the authenticated organisation. + DeploymentId DeploymentId `json:"deploymentId"` + DeploymentName string `json:"deploymentName"` + + // DeploymentSource Write-only. Source for the initial deployment; not returned in the Deployment response. Use the `/builds` endpoints to inspect build status. + // - `code`: the codebase is submitted to the build pipeline; a new image is built and + // deployed once ready. + // + // - `container`: a new version is created from the provided image reference and deployed + // directly, with no build step. + // + // The deployment transitions to `active` once the first version is ready, or to `failed` if the build, validation, or rollout fails. + DeploymentSource DeploymentSourceUpsert `json:"deploymentSource"` + Endpoints *[]EndpointCreate `json:"endpoints,omitempty"` + + // EnvironmentVariables Map with environment variables. Keys are the environment variable names, values are the environment variable values + EnvironmentVariables *map[string]string `json:"environmentVariables,omitempty"` + + // Secrets Names of existing secrets to attach to this deployment. + Secrets *[]string `json:"secrets,omitempty"` +} + +// DeploymentEvent defines model for DeploymentEvent. +type DeploymentEvent struct { + CreatedAt *time.Time `json:"createdAt,omitempty"` + + // DeploymentId Immutable deployment identifier, unique within the authenticated organisation. + DeploymentId DeploymentId `json:"deploymentId"` + EndpointId *openapi_types.UUID `json:"endpointId,omitempty"` + Id openapi_types.UUID `json:"id"` + + // Message Human-readable description of what happened. Never blank. + Message string `json:"message"` + Type DeploymentEventType `json:"type"` + WorkerId *openapi_types.UUID `json:"workerId,omitempty"` +} + +// DeploymentEventType defines model for DeploymentEventType. +type DeploymentEventType string + +// DeploymentId Immutable deployment identifier, unique within the authenticated organisation. +type DeploymentId = string + +// DeploymentSourceUpsert defines model for DeploymentSourceUpsert. +type DeploymentSourceUpsert struct { + Source DeploymentSourceUpsert_Source `json:"source"` + + // Type Selects the version creation path. `code` submits customer source code to the Image Build Service; `container` references a pre-built OCI image. + Type DeploymentSourceUpsertType `json:"type"` +} + +// DeploymentSourceUpsert_Source defines model for DeploymentSourceUpsert.Source. +type DeploymentSourceUpsert_Source struct { + union json.RawMessage +} + +// DeploymentSourceUpsertType Selects the version creation path. `code` submits customer source code to the Image Build Service; `container` references a pre-built OCI image. +type DeploymentSourceUpsertType string + +// DeploymentStatus defines model for DeploymentStatus. +type DeploymentStatus string + +// DeploymentSummary Aggregate dashboard metrics for every deployment in the authenticated organisation. Metrics whose backing system is not yet available are omitted (rendered as "no data" by the frontend) rather than reported as zero. +type DeploymentSummary struct { + // ActiveDeployments Deployments currently in the `active` status. + ActiveDeployments int64 `json:"activeDeployments"` + + // ActiveWorkers Running workers across all deployments. Omitted until worker state is tracked. + ActiveWorkers *int64 `json:"activeWorkers,omitempty"` + + // CalculatedAt When these metrics were computed. + CalculatedAt time.Time `json:"calculatedAt"` + + // ErrorRate24h Error ratio (0–1) over the last 24h. Omitted until request metrics are available. + ErrorRate24h *float64 `json:"errorRate24h,omitempty"` + + // ProvisionedGpuCount GPUs currently provisioned across all workers. Omitted until worker state is tracked. + ProvisionedGpuCount *int64 `json:"provisionedGpuCount,omitempty"` + + // Requests24h Requests served in the last 24h. Omitted until request metrics are available. + Requests24h *int64 `json:"requests24h,omitempty"` + + // SpendToday Estimated spend since 00:00 UTC. Omitted until billing rollups are available. + SpendToday *MoneyAmount `json:"spendToday,omitempty"` + + // TotalDeployments All deployments in the organisation excluding soft-deleted ones. + TotalDeployments int64 `json:"totalDeployments"` +} + +// DeploymentUpdate Updates one or more aspects of a deployment in place. All fields are optional; omitted fields are left unchanged. Lifecycle transitions (stop/resume/delete/deploy) use their dedicated operations. +// **Currently applied:** `deploymentName` and `configuration`. Supplying `deploymentSource`, `secrets`, `environmentVariables`, or `endpoints` returns `422` until those stores land. When wired, configuration/env/secret changes take effect on the next Scaler cycle; `deploymentSource` triggers a new build and rollout. +type DeploymentUpdate struct { + // Configuration Partial worker configuration. Any field present overwrites the live value; omitted fields are left unchanged. Clearing a nullable live field (setting it to null) is not supported — omit the field to leave it unchanged. `computeType` is create-time only and cannot be patched. Changing `gpuType` or `gpusPerWorker` affects only newly created workers. + Configuration *WorkerConfigPatch `json:"configuration,omitempty"` + + // DeploymentName Mutable display name; does not affect deployment identity or routing. + DeploymentName *string `json:"deploymentName,omitempty"` + + // DeploymentSource Write-only. New source to build and deploy; not returned in the Deployment response. Use the `/builds` endpoints to inspect build status. Triggers a build (for `code` sources) or image validation (for `container` sources); on success the resulting version is deployed automatically. On failure the deployment remains on the previous version. Not persisted yet — supplying this field returns `422`. + DeploymentSource *DeploymentSourceUpsert `json:"deploymentSource,omitempty"` + + // Endpoints Replaces the deployment's endpoints. Not persisted yet — supplying this field returns `422`. + Endpoints *[]EndpointCreate `json:"endpoints,omitempty"` + + // EnvironmentVariables Map with environment variables. Keys are the environment variable names, values are the environment variable values. Setting the value of an environment variable to null deletes the environment variable from the deployment. Not persisted yet — supplying this field returns `422`. + EnvironmentVariables *map[string]*string `json:"environmentVariables,omitempty"` + + // Secrets Names of existing secrets to attach to this deployment. Not persisted yet — supplying this field returns `422`. + Secrets *[]string `json:"secrets,omitempty"` +} + +// Endpoint defines model for Endpoint. +type Endpoint struct { + CreatedAt *time.Time `json:"createdAt,omitempty"` + + // DeploymentId Immutable deployment identifier, unique within the authenticated organisation. + DeploymentId DeploymentId `json:"deploymentId"` + Id openapi_types.UUID `json:"id"` + + // Path HTTP path the endpoint is served under, e.g. `/infer`. Inferred from the deployed code and unique within the deployment, so it identifies the endpoint on its own. + Path string `json:"path"` + UpdatedAt *time.Time `json:"updatedAt,omitempty"` +} + +// EndpointCreate defines model for EndpointCreate. +type EndpointCreate struct { + // Path HTTP path the endpoint is served under, e.g. `/infer`. Unique within the deployment. Carries no whitespace, since it lands in a URL path segment, and fits within a URI, hence the 255 character ceiling. + Path string `json:"path"` +} + +// EnvironmentVariable defines model for EnvironmentVariable. +type EnvironmentVariable struct { + CreatedAt *time.Time `json:"createdAt,omitempty"` + + // DeploymentId Immutable deployment identifier, unique within the authenticated organisation. + DeploymentId *DeploymentId `json:"deploymentId,omitempty"` + Id *openapi_types.UUID `json:"id,omitempty"` + Key string `json:"key"` + UpdatedAt *time.Time `json:"updatedAt,omitempty"` + Value string `json:"value"` +} + +// EnvironmentVariableUpsert defines model for EnvironmentVariableUpsert. +type EnvironmentVariableUpsert struct { + Value string `json:"value"` +} + +// GpuAvailability Scheduler provisioning availability for this GPU type. +type GpuAvailability string + +// GpuPricing defines model for GpuPricing. +type GpuPricing struct { + // PerSecond Price per GPU per second in USD major units as an exact decimal string (e.g. "0.000767"). Stored and billed from nanodollars internally; the platform bills in USD only. + // + // + // Example: 0.000767 + PerSecond string `json:"perSecond"` +} + +// GpuType defines model for GpuType. +type GpuType struct { + // Availability Scheduler provisioning availability for this GPU type. + Availability GpuAvailability `json:"availability"` + + // Id Public catalogue code referenced by `gpuType` in worker configuration (not the internal database row UUID). + Id GpuTypeId `json:"id"` + + // Memory Human-readable memory capacity. + // + // Example: 80 GB HBM + Memory string `json:"memory"` + + // Name Example: H100 + Name string `json:"name"` + Pricing GpuPricing `json:"pricing"` +} + +// GpuTypeId Public catalogue code for a supported GPU type (e.g. `h100`, `rtx_6000`). Must match an `id` returned by `GET /v1/gpu-types` (validated at request time against the catalogue). This is not the internal database row UUID. +type GpuTypeId = string + +// GpuTypeList defines model for GpuTypeList. +type GpuTypeList struct { + Data []GpuType `json:"data"` +} + +// MoneyAmount A monetary amount as an exact decimal string in the currency's major unit. Money is never represented as a float (see `GpuPricing.perSecond`). +type MoneyAmount struct { + // Amount Amount in major units as an exact decimal string. + // + // Example: 312.40 + Amount string `json:"amount"` + + // Currency ISO 4217 alphabetic code. The platform bills in USD only. + Currency Currency `json:"currency"` +} + +// Page defines model for Page. +type Page struct { + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` +} + +// ProblemDetails RFC 9457 problem details. Every error response from this API uses this schema with media type `application/problem+json`. `type` is a URI that identifies the problem class and dereferences to its documentation; clients should switch on `type` (not `status` or `detail`, which are not stable identifiers). Additional members beyond those below may appear. +type ProblemDetails struct { + // Detail Human-readable explanation specific to this occurrence. + // + // Example: No deployment 'img-gen' exists for the authenticated organisation. + Detail *string `json:"detail,omitempty"` + + // Errors Extension member. Present on validation failures (`422`); one entry per offending request field. + Errors *[]ProblemError `json:"errors,omitempty"` + + // Instance URI reference identifying the specific occurrence (the request path). + // + // Example: /v1/deployments/img-gen + Instance *string `json:"instance,omitempty"` + + // RequestId Extension member. Correlation id for this request, echoed in the `X-Request-Id` response header; quote it when reporting problems. + RequestId *string `json:"requestId,omitempty"` + + // Status HTTP status code generated for this occurrence. + // + // Example: 404 + Status int32 `json:"status"` + + // Title Short, human-readable summary of the problem type (the standard HTTP status text). Stable for a given `type`; does not change from occurrence to occurrence. + // + // + // Example: Not Found + Title string `json:"title"` + + // Type URI reference identifying the problem type. Dereferences to human-readable documentation. `about:blank` denotes "no semantics beyond the HTTP status". + // + // + // Example: https://docs.runware.ai/serverless/errors#not-found + Type string `json:"type"` +} + +// ProblemError A single field-level validation error within a ProblemDetails. +type ProblemError struct { + // Detail Human-readable reason this field was rejected. + // + // Example: is required + Detail string `json:"detail"` + + // Pointer JSON Pointer (RFC 6901) to the offending field in the request body, e.g. `/configuration/maxWorkers`. Absent for non-body parameters. + // + // + // Example: /configuration/maxWorkers + Pointer *string `json:"pointer,omitempty"` +} + +// Secret Secret metadata. The encrypted value is never returned. +type Secret struct { + CreatedAt *time.Time `json:"createdAt,omitempty"` + Id openapi_types.UUID `json:"id"` + + // Metadata For `registry` secrets: `{"registry_host": "ghcr.io", "username": "acme-bot"}`. + Metadata *map[string]interface{} `json:"metadata,omitempty"` + Name string `json:"name"` + Type SecretType `json:"type"` + UpdatedAt *time.Time `json:"updatedAt,omitempty"` +} + +// SecretAttach defines model for SecretAttach. +type SecretAttach struct { + // SecretName Name of the secret to attach. + SecretName string `json:"secretName"` +} + +// SecretCreate defines model for SecretCreate. +type SecretCreate struct { + Metadata *map[string]interface{} `json:"metadata,omitempty"` + Name string `json:"name"` + Type SecretType `json:"type"` + + // Value Plain-text value; encrypted at rest by the platform. + Value string `json:"value"` +} + +// SecretType defines model for SecretType. +type SecretType string + +// SecretUpdate defines model for SecretUpdate. +type SecretUpdate struct { + Metadata *map[string]interface{} `json:"metadata,omitempty"` + Value string `json:"value"` +} + +// Task defines model for Task. +type Task struct { + CompletedAt *time.Time `json:"completedAt,omitempty"` + CreatedAt time.Time `json:"createdAt"` + + // DeploymentId Immutable deployment identifier, unique within the authenticated organisation. + DeploymentId DeploymentId `json:"deploymentId"` + + // Error Failure detail when status is `failed`; null otherwise. + Error *string `json:"error,omitempty"` + + // Id Opaque task identifier returned by the execution backend. + Id string `json:"id"` + + // Output Inference result payload on success; null otherwise. + Output *map[string]interface{} `json:"output,omitempty"` + Status TaskStatus `json:"status"` +} + +// TaskStatus defines model for TaskStatus. +type TaskStatus string + +// UsageEvent defines model for UsageEvent. +type UsageEvent struct { + // CreatedAt When the event was recorded. Audit only — may lag `occurredAt`. + CreatedAt *time.Time `json:"createdAt,omitempty"` + + // DeploymentId Immutable deployment identifier, unique within the authenticated organisation. + DeploymentId DeploymentId `json:"deploymentId"` + + // EventType Worker lifecycle status. Also the event type of a `UsageEvent`, which records a transition into one of these states. + EventType WorkerStatus `json:"eventType"` + GpuCount int32 `json:"gpuCount"` + Id openapi_types.UUID `json:"id"` + + // OccurredAt When the transition happened. This is the event time the `from` and `to` filters apply to, and the field to bill on. + OccurredAt time.Time `json:"occurredAt"` + WorkerId openapi_types.UUID `json:"workerId"` +} + +// Version defines model for Version. +type Version struct { + BuildId openapi_types.UUID `json:"buildId"` + CreatedAt time.Time `json:"createdAt"` + + // DeploymentId Immutable deployment identifier, unique within the authenticated organisation. + DeploymentId DeploymentId `json:"deploymentId"` + Id openapi_types.UUID `json:"id"` + + // VersionNumber Monotonically increasing per deployment; a failed build does not generate a version. + VersionNumber int32 `json:"versionNumber"` +} + +// Worker defines model for Worker. +type Worker struct { + CreatedAt *time.Time `json:"createdAt,omitempty"` + + // DeploymentId Immutable deployment identifier, unique within the authenticated organisation. + DeploymentId DeploymentId `json:"deploymentId"` + Id openapi_types.UUID `json:"id"` + + // LastSeenAt Heartbeat from the shim. + LastSeenAt *time.Time `json:"lastSeenAt,omitempty"` + NodeName string `json:"nodeName"` + PodName string `json:"podName"` + + // Status Worker lifecycle status. Also the event type of a `UsageEvent`, which records a transition into one of these states. + Status WorkerStatus `json:"status"` + UpdatedAt *time.Time `json:"updatedAt,omitempty"` + VersionId openapi_types.UUID `json:"versionId"` +} + +// WorkerConfig defines model for WorkerConfig. +type WorkerConfig struct { + // AvailableWorkersPct Scaling buffer as a percentage of incoming task load. + AvailableWorkersPct *int32 `json:"availableWorkersPct,omitempty"` + ComputeType ComputeType `json:"computeType"` + + // Concurrency Max tasks a single worker handles simultaneously. + Concurrency int32 `json:"concurrency"` + CreatedAt *time.Time `json:"createdAt,omitempty"` + + // DeploymentId Immutable deployment identifier, unique within the authenticated organisation. + DeploymentId DeploymentId `json:"deploymentId"` + + // FallbackGpuType Secondary GPU type used if the preferred type is unavailable. + FallbackGpuType *GpuTypeId `json:"fallbackGpuType,omitempty"` + + // GpuType Preferred GPU type; null when computeType is `cpu`. + GpuType *GpuTypeId `json:"gpuType,omitempty"` + GpusPerWorker int32 `json:"gpusPerWorker"` + + // GracefulStopTtlSecs Seconds a draining worker is given to finish in-flight tasks before force termination. + GracefulStopTtlSecs int32 `json:"gracefulStopTtlSecs"` + Id openapi_types.UUID `json:"id"` + + // IdleTtlSecs Seconds a worker can sit idle before the Scaler removes it. + IdleTtlSecs int32 `json:"idleTtlSecs"` + MaxWorkers int32 `json:"maxWorkers"` + + // MinAvailableWorkers Minimum number of available (idle) workers kept as a pre-emptive buffer. + MinAvailableWorkers *int32 `json:"minAvailableWorkers,omitempty"` + + // MinWorkers Floor for scale-down; 0 = scale to zero. + MinWorkers int32 `json:"minWorkers"` + + // ScalingDelaySecs Cooldown between consecutive scaling decisions. + ScalingDelaySecs int32 `json:"scalingDelaySecs"` + UpdatedAt *time.Time `json:"updatedAt,omitempty"` +} + +// WorkerConfigCreate defines model for WorkerConfigCreate. +type WorkerConfigCreate struct { + AvailableWorkersPct *int32 `json:"availableWorkersPct,omitempty"` + ComputeType *ComputeType `json:"computeType,omitempty"` + Concurrency *int32 `json:"concurrency,omitempty"` + FallbackGpuType *GpuTypeId `json:"fallbackGpuType,omitempty"` + GpuType *GpuTypeId `json:"gpuType,omitempty"` + GpusPerWorker *int32 `json:"gpusPerWorker,omitempty"` + GracefulStopTtlSecs *int32 `json:"gracefulStopTtlSecs,omitempty"` + IdleTtlSecs int32 `json:"idleTtlSecs"` + MaxWorkers int32 `json:"maxWorkers"` + MinAvailableWorkers *int32 `json:"minAvailableWorkers,omitempty"` + MinWorkers *int32 `json:"minWorkers,omitempty"` + ScalingDelaySecs int32 `json:"scalingDelaySecs"` +} + +// WorkerConfigPatch Partial worker configuration. Any field present overwrites the live value; omitted fields are left unchanged. Clearing a nullable live field (setting it to null) is not supported — omit the field to leave it unchanged. `computeType` is create-time only and cannot be patched. Changing `gpuType` or `gpusPerWorker` affects only newly created workers. +type WorkerConfigPatch struct { + // AvailableWorkersPct Scaling buffer as a percentage of load. Omit to leave unchanged. + AvailableWorkersPct *int32 `json:"availableWorkersPct,omitempty"` + Concurrency *int32 `json:"concurrency,omitempty"` + + // FallbackGpuType Secondary GPU type. Omit to leave unchanged. + FallbackGpuType *GpuTypeId `json:"fallbackGpuType,omitempty"` + + // GpuType Preferred GPU type. Omit to leave unchanged. + GpuType *GpuTypeId `json:"gpuType,omitempty"` + GpusPerWorker *int32 `json:"gpusPerWorker,omitempty"` + GracefulStopTtlSecs *int32 `json:"gracefulStopTtlSecs,omitempty"` + IdleTtlSecs *int32 `json:"idleTtlSecs,omitempty"` + MaxWorkers *int32 `json:"maxWorkers,omitempty"` + + // MinAvailableWorkers Pre-emptive idle-worker buffer. Omit to leave unchanged. + MinAvailableWorkers *int32 `json:"minAvailableWorkers,omitempty"` + MinWorkers *int32 `json:"minWorkers,omitempty"` + ScalingDelaySecs *int32 `json:"scalingDelaySecs,omitempty"` +} + +// WorkerStatus Worker lifecycle status. Also the event type of a `UsageEvent`, which records a transition into one of these states. +type WorkerStatus string + +// Cursor defines model for Cursor. +type Cursor = string + +// EndpointPath defines model for EndpointPath. +type EndpointPath = string + +// Limit defines model for Limit. +type Limit = int32 + +// SecretName defines model for SecretName. +type SecretName = string + +// BadRequest RFC 9457 problem details. Every error response from this API uses this schema with media type `application/problem+json`. `type` is a URI that identifies the problem class and dereferences to its documentation; clients should switch on `type` (not `status` or `detail`, which are not stable identifiers). Additional members beyond those below may appear. +type BadRequest = ProblemDetails + +// Conflict RFC 9457 problem details. Every error response from this API uses this schema with media type `application/problem+json`. `type` is a URI that identifies the problem class and dereferences to its documentation; clients should switch on `type` (not `status` or `detail`, which are not stable identifiers). Additional members beyond those below may appear. +type Conflict = ProblemDetails + +// Forbidden RFC 9457 problem details. Every error response from this API uses this schema with media type `application/problem+json`. `type` is a URI that identifies the problem class and dereferences to its documentation; clients should switch on `type` (not `status` or `detail`, which are not stable identifiers). Additional members beyond those below may appear. +type Forbidden = ProblemDetails + +// NotFound RFC 9457 problem details. Every error response from this API uses this schema with media type `application/problem+json`. `type` is a URI that identifies the problem class and dereferences to its documentation; clients should switch on `type` (not `status` or `detail`, which are not stable identifiers). Additional members beyond those below may appear. +type NotFound = ProblemDetails + +// TaskAccepted defines model for TaskAccepted. +type TaskAccepted = Task + +// Timeout RFC 9457 problem details. Every error response from this API uses this schema with media type `application/problem+json`. `type` is a URI that identifies the problem class and dereferences to its documentation; clients should switch on `type` (not `status` or `detail`, which are not stable identifiers). Additional members beyond those below may appear. +type Timeout = ProblemDetails + +// Unauthorized RFC 9457 problem details. Every error response from this API uses this schema with media type `application/problem+json`. `type` is a URI that identifies the problem class and dereferences to its documentation; clients should switch on `type` (not `status` or `detail`, which are not stable identifiers). Additional members beyond those below may appear. +type Unauthorized = ProblemDetails + +// ValidationError RFC 9457 problem details. Every error response from this API uses this schema with media type `application/problem+json`. `type` is a URI that identifies the problem class and dereferences to its documentation; clients should switch on `type` (not `status` or `detail`, which are not stable identifiers). Additional members beyond those below may appear. +type ValidationError = ProblemDetails + +// TaskPayload defines model for TaskPayload. +type TaskPayload map[string]interface{} + +// ListDeploymentsParams defines parameters for ListDeployments. +type ListDeploymentsParams struct { + // Limit Maximum number of items to return. + Limit *Limit `form:"limit,omitempty" json:"limit,omitempty"` + + // Cursor Opaque pagination cursor returned as `nextCursor` by a previous call. + Cursor *Cursor `form:"cursor,omitempty" json:"cursor,omitempty"` + Status *DeploymentStatus `form:"status,omitempty" json:"status,omitempty"` +} + +// ListBuildsParams defines parameters for ListBuilds. +type ListBuildsParams struct { + // Limit Maximum number of items to return. + Limit *Limit `form:"limit,omitempty" json:"limit,omitempty"` + + // Cursor Opaque pagination cursor returned as `nextCursor` by a previous call. + Cursor *Cursor `form:"cursor,omitempty" json:"cursor,omitempty"` +} + +// ListEndpointsParams defines parameters for ListEndpoints. +type ListEndpointsParams struct { + // Limit Maximum number of items to return. + Limit *Limit `form:"limit,omitempty" json:"limit,omitempty"` + + // Cursor Opaque pagination cursor returned as `nextCursor` by a previous call. + Cursor *Cursor `form:"cursor,omitempty" json:"cursor,omitempty"` +} + +// ListDeploymentEnvironmentVariablesParams defines parameters for ListDeploymentEnvironmentVariables. +type ListDeploymentEnvironmentVariablesParams struct { + // Limit Maximum number of items to return. + Limit *Limit `form:"limit,omitempty" json:"limit,omitempty"` + + // Cursor Opaque pagination cursor returned as `nextCursor` by a previous call. + Cursor *Cursor `form:"cursor,omitempty" json:"cursor,omitempty"` +} + +// ListDeploymentEventsParams defines parameters for ListDeploymentEvents. +type ListDeploymentEventsParams struct { + // Limit Maximum number of items to return. + Limit *Limit `form:"limit,omitempty" json:"limit,omitempty"` + + // Cursor Opaque pagination cursor returned as `nextCursor` by a previous call. + Cursor *Cursor `form:"cursor,omitempty" json:"cursor,omitempty"` + Type *DeploymentEventType `form:"type,omitempty" json:"type,omitempty"` +} + +// StartAsyncTaskJSONBody defines parameters for StartAsyncTask. +type StartAsyncTaskJSONBody map[string]interface{} + +// StartSyncTaskJSONBody defines parameters for StartSyncTask. +type StartSyncTaskJSONBody map[string]interface{} + +// ListDeploymentSecretsParams defines parameters for ListDeploymentSecrets. +type ListDeploymentSecretsParams struct { + // Limit Maximum number of items to return. + Limit *Limit `form:"limit,omitempty" json:"limit,omitempty"` + + // Cursor Opaque pagination cursor returned as `nextCursor` by a previous call. + Cursor *Cursor `form:"cursor,omitempty" json:"cursor,omitempty"` +} + +// ListTasksParams defines parameters for ListTasks. +type ListTasksParams struct { + // Limit Maximum number of items to return. + Limit *Limit `form:"limit,omitempty" json:"limit,omitempty"` + + // Cursor Opaque pagination cursor returned as `nextCursor` by a previous call. + Cursor *Cursor `form:"cursor,omitempty" json:"cursor,omitempty"` + Status *TaskStatus `form:"status,omitempty" json:"status,omitempty"` +} + +// ListVersionsParams defines parameters for ListVersions. +type ListVersionsParams struct { + // Limit Maximum number of items to return. + Limit *Limit `form:"limit,omitempty" json:"limit,omitempty"` + + // Cursor Opaque pagination cursor returned as `nextCursor` by a previous call. + Cursor *Cursor `form:"cursor,omitempty" json:"cursor,omitempty"` +} + +// ListWorkersParams defines parameters for ListWorkers. +type ListWorkersParams struct { + // Limit Maximum number of items to return. + Limit *Limit `form:"limit,omitempty" json:"limit,omitempty"` + + // Cursor Opaque pagination cursor returned as `nextCursor` by a previous call. + Cursor *Cursor `form:"cursor,omitempty" json:"cursor,omitempty"` + Status *WorkerStatus `form:"status,omitempty" json:"status,omitempty"` +} + +// ListSecretsParams defines parameters for ListSecrets. +type ListSecretsParams struct { + // Limit Maximum number of items to return. + Limit *Limit `form:"limit,omitempty" json:"limit,omitempty"` + + // Cursor Opaque pagination cursor returned as `nextCursor` by a previous call. + Cursor *Cursor `form:"cursor,omitempty" json:"cursor,omitempty"` +} + +// ListUsageEventsParams defines parameters for ListUsageEvents. +type ListUsageEventsParams struct { + // Limit Maximum number of items to return. + Limit *Limit `form:"limit,omitempty" json:"limit,omitempty"` + + // Cursor Opaque pagination cursor returned as `nextCursor` by a previous call. + Cursor *Cursor `form:"cursor,omitempty" json:"cursor,omitempty"` + DeploymentId *DeploymentId `form:"deploymentId,omitempty" json:"deploymentId,omitempty"` + + // From Inclusive lower bound on event time (RFC 3339). + From *time.Time `form:"from,omitempty" json:"from,omitempty"` + + // To Exclusive upper bound on event time (RFC 3339). + To *time.Time `form:"to,omitempty" json:"to,omitempty"` +} + +// CreateDeploymentJSONRequestBody defines body for CreateDeployment for application/json ContentType. +type CreateDeploymentJSONRequestBody = DeploymentCreate + +// UpdateDeploymentJSONRequestBody defines body for UpdateDeployment for application/json ContentType. +type UpdateDeploymentJSONRequestBody = DeploymentUpdate + +// DeployVersionJSONRequestBody defines body for DeployVersion for application/json ContentType. +type DeployVersionJSONRequestBody = DeployRequest + +// UpsertDeploymentEnvironmentVariableJSONRequestBody defines body for UpsertDeploymentEnvironmentVariable for application/json ContentType. +type UpsertDeploymentEnvironmentVariableJSONRequestBody = EnvironmentVariableUpsert + +// StartAsyncTaskJSONRequestBody defines body for StartAsyncTask for application/json ContentType. +type StartAsyncTaskJSONRequestBody StartAsyncTaskJSONBody + +// StartSyncTaskJSONRequestBody defines body for StartSyncTask for application/json ContentType. +type StartSyncTaskJSONRequestBody StartSyncTaskJSONBody + +// AttachDeploymentSecretJSONRequestBody defines body for AttachDeploymentSecret for application/json ContentType. +type AttachDeploymentSecretJSONRequestBody = SecretAttach + +// CreateSecretJSONRequestBody defines body for CreateSecret for application/json ContentType. +type CreateSecretJSONRequestBody = SecretCreate + +// UpdateSecretJSONRequestBody defines body for UpdateSecret for application/json ContentType. +type UpdateSecretJSONRequestBody = SecretUpdate + +// AsCodeSourceUpsert returns the union data inside the DeploymentSourceUpsert_Source as a CodeSourceUpsert +func (t DeploymentSourceUpsert_Source) AsCodeSourceUpsert() (CodeSourceUpsert, error) { + var body CodeSourceUpsert + err := json.Unmarshal(t.union, &body) + return body, err +} + +// FromCodeSourceUpsert overwrites any union data inside the DeploymentSourceUpsert_Source as the provided CodeSourceUpsert +func (t *DeploymentSourceUpsert_Source) FromCodeSourceUpsert(v CodeSourceUpsert) error { + b, err := json.Marshal(v) + t.union = b + return err +} + +// MergeCodeSourceUpsert performs a merge with any union data inside the DeploymentSourceUpsert_Source, using the provided CodeSourceUpsert +func (t *DeploymentSourceUpsert_Source) MergeCodeSourceUpsert(v CodeSourceUpsert) error { + b, err := json.Marshal(v) + if err != nil { + return err + } + + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err +} + +// AsContainerSource returns the union data inside the DeploymentSourceUpsert_Source as a ContainerSource +func (t DeploymentSourceUpsert_Source) AsContainerSource() (ContainerSource, error) { + var body ContainerSource + err := json.Unmarshal(t.union, &body) + return body, err +} + +// FromContainerSource overwrites any union data inside the DeploymentSourceUpsert_Source as the provided ContainerSource +func (t *DeploymentSourceUpsert_Source) FromContainerSource(v ContainerSource) error { + b, err := json.Marshal(v) + t.union = b + return err +} + +// MergeContainerSource performs a merge with any union data inside the DeploymentSourceUpsert_Source, using the provided ContainerSource +func (t *DeploymentSourceUpsert_Source) MergeContainerSource(v ContainerSource) error { + b, err := json.Marshal(v) + if err != nil { + return err + } + + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err +} + +func (t DeploymentSourceUpsert_Source) MarshalJSON() ([]byte, error) { + b, err := t.union.MarshalJSON() + return b, err +} + +func (t *DeploymentSourceUpsert_Source) UnmarshalJSON(b []byte) error { + err := t.union.UnmarshalJSON(b) + return err +} + +// RequestEditorFn is the function signature for the RequestEditor callback function +type RequestEditorFn func(ctx context.Context, req *http.Request) error + +// Doer performs HTTP requests. +// +// The standard http.Client implements this interface. +type HttpRequestDoer interface { + Do(req *http.Request) (*http.Response, error) +} + +// Client which conforms to the OpenAPI3 specification for this service. +type Client struct { + // The endpoint of the server conforming to this interface, with scheme, + // https://api.deepmap.com for example. This can contain a path relative + // to the server, such as https://api.deepmap.com/dev-test, and all the + // paths in the swagger spec will be appended to the server. + Server string + + // Doer for performing requests, typically a *http.Client with any + // customized settings, such as certificate chains. + Client HttpRequestDoer + + // A list of callbacks for modifying requests which are generated before sending over + // the network. + RequestEditors []RequestEditorFn +} + +// ClientOption allows setting custom parameters during construction +type ClientOption func(*Client) error + +// Creates a new Client, with reasonable defaults +func NewClient(server string, opts ...ClientOption) (*Client, error) { + // create a client with sane default values + client := Client{ + Server: server, + } + // mutate client and add all optional params + for _, o := range opts { + if err := o(&client); err != nil { + return nil, err + } + } + // ensure the server URL always has a trailing slash + if !strings.HasSuffix(client.Server, "/") { + client.Server += "/" + } + // create httpClient, if not already present + if client.Client == nil { + client.Client = &http.Client{} + } + return &client, nil +} + +// WithHTTPClient allows overriding the default Doer, which is +// automatically created using http.Client. This is useful for tests. +func WithHTTPClient(doer HttpRequestDoer) ClientOption { + return func(c *Client) error { + c.Client = doer + return nil + } +} + +// WithRequestEditorFn allows setting up a callback function, which will be +// called right before sending the request. This can be used to mutate the request. +func WithRequestEditorFn(fn RequestEditorFn) ClientOption { + return func(c *Client) error { + c.RequestEditors = append(c.RequestEditors, fn) + return nil + } +} + +// The interface specification for the client above. +type ClientInterface interface { + + // GetDeploymentSummary Deployment summary metrics for the authenticated organisation + // + // Aggregate dashboard metrics across all deployments owned by the authenticated organisation. Metrics whose backing system is not yet available are omitted from the response rather than reported as zero. + // + // Corresponds with GET /v1/deployment-summary (the `GetDeploymentSummary` operationId). + GetDeploymentSummary(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ListDeployments List deployments + // + // Corresponds with GET /v1/deployments (the `ListDeployments` operationId). + ListDeployments(ctx context.Context, params *ListDeploymentsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // CreateDeploymentWithBody Create a deployment + // + // Creates a deployment together with its worker configuration and endpoints, as declared in the submitted IaC config. The deployment starts in `initializing` and an initial rollout begins immediately based on the deployment source type: + // - `code` source: the codebase is submitted to the build pipeline; once the image is built + // and workers become healthy the deployment transitions to `active`. + // + // - `container` source: the pre-built image is deployed directly with no build step; once + // workers become healthy the deployment transitions to `active`. + // + // If the build, validation, or rollout fails the deployment is marked `failed`. + // + // Takes any type of body and a specified content type. + // + // Corresponds with POST /v1/deployments (the `CreateDeployment` operationId). + CreateDeploymentWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + // CreateDeployment Create a deployment + // + // Creates a deployment together with its worker configuration and endpoints, as declared in the submitted IaC config. The deployment starts in `initializing` and an initial rollout begins immediately based on the deployment source type: + // - `code` source: the codebase is submitted to the build pipeline; once the image is built + // and workers become healthy the deployment transitions to `active`. + // + // - `container` source: the pre-built image is deployed directly with no build step; once + // workers become healthy the deployment transitions to `active`. + // + // If the build, validation, or rollout fails the deployment is marked `failed`. + // + // Takes a body of the `application/json` content type. + // + // Corresponds with POST /v1/deployments (the `CreateDeployment` operationId). + CreateDeployment(ctx context.Context, body CreateDeploymentJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // DeleteDeployment Delete a deployment + // + // Soft delete. Sets `status = deleting` and returns `202` once that intent is persisted. Router removal, cancelling in-progress builds, and worker drain (`draining → stopping → stopped`) are performed asynchronously by the deployer/Scaler; `status` becomes `deleted` once all workers stop. All rows are retained for billing finalisation, audit, and usage history. Idempotent if the deployment is already `deleting`. + // + // Corresponds with DELETE /v1/deployments/{deploymentId} (the `DeleteDeployment` operationId). + DeleteDeployment(ctx context.Context, deploymentId DeploymentId, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetDeployment Get a deployment + // + // Corresponds with GET /v1/deployments/{deploymentId} (the `GetDeployment` operationId). + GetDeployment(ctx context.Context, deploymentId DeploymentId, reqEditors ...RequestEditorFn) (*http.Response, error) + + // UpdateDeploymentWithBody Update a deployment + // + // Patches one or more aspects of a deployment in place. All fields are optional; omitted fields are left unchanged. Valid in any non-`deleted` status, including `stopped` (changes apply on `resume`). Lifecycle transitions use the dedicated `deploy`, `stop`, `resume`, and `delete` operations. + // **Currently persisted:** `deploymentName` and `configuration` only. Supplying `deploymentSource`, `secrets`, `environmentVariables`, or `endpoints` returns `422` until those stores land. + // Target behaviour (once fully wired): + // - `configuration`: applied on the next Scaler cycle; triggers a rollout so workers + // restart with the new configuration. If the rollout fails, the deployment remains on + // the previous configuration. + // + // - `deploymentSource`: triggers a build (for `code` sources) or image validation (for `container` + // sources); on success the new version is deployed automatically. If the build or + // validation fails, the deployment remains on the previous version. + // + // - `secrets` / `environmentVariables` / `endpoints`: the supplied array **replaces** the + // current set — any item absent from the request is deleted. Endpoints take effect + // immediately. Changes to secrets or environment variables trigger a rollout so workers + // restart and pick up the new values. + // + // Takes any type of body and a specified content type. + // + // Corresponds with PATCH /v1/deployments/{deploymentId} (the `UpdateDeployment` operationId). + UpdateDeploymentWithBody(ctx context.Context, deploymentId DeploymentId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + // UpdateDeployment Update a deployment + // + // Patches one or more aspects of a deployment in place. All fields are optional; omitted fields are left unchanged. Valid in any non-`deleted` status, including `stopped` (changes apply on `resume`). Lifecycle transitions use the dedicated `deploy`, `stop`, `resume`, and `delete` operations. + // **Currently persisted:** `deploymentName` and `configuration` only. Supplying `deploymentSource`, `secrets`, `environmentVariables`, or `endpoints` returns `422` until those stores land. + // Target behaviour (once fully wired): + // - `configuration`: applied on the next Scaler cycle; triggers a rollout so workers + // restart with the new configuration. If the rollout fails, the deployment remains on + // the previous configuration. + // + // - `deploymentSource`: triggers a build (for `code` sources) or image validation (for `container` + // sources); on success the new version is deployed automatically. If the build or + // validation fails, the deployment remains on the previous version. + // + // - `secrets` / `environmentVariables` / `endpoints`: the supplied array **replaces** the + // current set — any item absent from the request is deleted. Endpoints take effect + // immediately. Changes to secrets or environment variables trigger a rollout so workers + // restart and pick up the new values. + // + // Takes a body of the `application/json` content type. + // + // Corresponds with PATCH /v1/deployments/{deploymentId} (the `UpdateDeployment` operationId). + UpdateDeployment(ctx context.Context, deploymentId DeploymentId, body UpdateDeploymentJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ListBuilds List builds + // + // Corresponds with GET /v1/deployments/{deploymentId}/builds (the `ListBuilds` operationId). + ListBuilds(ctx context.Context, deploymentId DeploymentId, params *ListBuildsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetBuild Get a build + // + // Corresponds with GET /v1/deployments/{deploymentId}/builds/{buildId} (the `GetBuild` operationId). + GetBuild(ctx context.Context, deploymentId DeploymentId, buildId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) + + // DeployVersionWithBody Deploy a version + // + // Activates a `ready` version by number, setting `activeVersionId` and returning `202` once that intent is persisted. Worker rollout, routing switch, and cancelling in-progress builds (`failed` with `error: "superseded"`) are performed asynchronously by the deployer/Scaler. Permitted in any addressable status, including `initializing` and `failed`. + // To roll back, supply an older `versionNumber` — the operation is identical to a forward deploy. + // **Rollout** (deployer/Scaler): the platform starts workers on the target version, waits for at least one to become healthy, switches task routing to the new version, then drains old-version workers gracefully. Old workers are given `gracefulStopTtlSecs` to finish in-flight tasks before being force-terminated. If new workers fail to become healthy, old workers are not drained and the deployment continues on the previous version. + // Errors: - Deploy to a `deleting` deployment returns `409 Conflict` - `versionNumber` not found or not `ready` returns `409 Conflict` - Deploy to a non-existent or `deleted` deployment returns `404 Not Found` + // + // Takes any type of body and a specified content type. + // + // Corresponds with POST /v1/deployments/{deploymentId}/deploy (the `DeployVersion` operationId). + DeployVersionWithBody(ctx context.Context, deploymentId DeploymentId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + // DeployVersion Deploy a version + // + // Activates a `ready` version by number, setting `activeVersionId` and returning `202` once that intent is persisted. Worker rollout, routing switch, and cancelling in-progress builds (`failed` with `error: "superseded"`) are performed asynchronously by the deployer/Scaler. Permitted in any addressable status, including `initializing` and `failed`. + // To roll back, supply an older `versionNumber` — the operation is identical to a forward deploy. + // **Rollout** (deployer/Scaler): the platform starts workers on the target version, waits for at least one to become healthy, switches task routing to the new version, then drains old-version workers gracefully. Old workers are given `gracefulStopTtlSecs` to finish in-flight tasks before being force-terminated. If new workers fail to become healthy, old workers are not drained and the deployment continues on the previous version. + // Errors: - Deploy to a `deleting` deployment returns `409 Conflict` - `versionNumber` not found or not `ready` returns `409 Conflict` - Deploy to a non-existent or `deleted` deployment returns `404 Not Found` + // + // Takes a body of the `application/json` content type. + // + // Corresponds with POST /v1/deployments/{deploymentId}/deploy (the `DeployVersion` operationId). + DeployVersion(ctx context.Context, deploymentId DeploymentId, body DeployVersionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ListEndpoints List endpoints + // + // Corresponds with GET /v1/deployments/{deploymentId}/endpoints (the `ListEndpoints` operationId). + ListEndpoints(ctx context.Context, deploymentId DeploymentId, params *ListEndpointsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ListDeploymentEnvironmentVariables List deployment environment variables + // + // Corresponds with GET /v1/deployments/{deploymentId}/environment-variables (the `ListDeploymentEnvironmentVariables` operationId). + ListDeploymentEnvironmentVariables(ctx context.Context, deploymentId DeploymentId, params *ListDeploymentEnvironmentVariablesParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // DeleteDeploymentEnvironmentVariable Delete a deployment environment variable + // + // Corresponds with DELETE /v1/deployments/{deploymentId}/environment-variables/{variableName} (the `DeleteDeploymentEnvironmentVariable` operationId). + DeleteDeploymentEnvironmentVariable(ctx context.Context, deploymentId DeploymentId, variableName string, reqEditors ...RequestEditorFn) (*http.Response, error) + + // UpsertDeploymentEnvironmentVariableWithBody Upsert a deployment environment variable + // + // Takes any type of body and a specified content type. + // + // Corresponds with PUT /v1/deployments/{deploymentId}/environment-variables/{variableName} (the `UpsertDeploymentEnvironmentVariable` operationId). + UpsertDeploymentEnvironmentVariableWithBody(ctx context.Context, deploymentId DeploymentId, variableName string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + // UpsertDeploymentEnvironmentVariable Upsert a deployment environment variable + // + // Takes a body of the `application/json` content type. + // + // Corresponds with PUT /v1/deployments/{deploymentId}/environment-variables/{variableName} (the `UpsertDeploymentEnvironmentVariable` operationId). + UpsertDeploymentEnvironmentVariable(ctx context.Context, deploymentId DeploymentId, variableName string, body UpsertDeploymentEnvironmentVariableJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ListDeploymentEvents List deployment events + // + // Corresponds with GET /v1/deployments/{deploymentId}/events (the `ListDeploymentEvents` operationId). + ListDeploymentEvents(ctx context.Context, deploymentId DeploymentId, params *ListDeploymentEventsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // StartAsyncTaskWithBody Start a new async task + // + // Starts a new async task on `deploymentId`, routing the request body payload to an available worker. The task runs asynchronously and the response is `202`; poll `GET /v1/deployments/{deploymentId}/tasks/{taskId}` for completion. + // + // Takes any type of body and a specified content type. + // + // Corresponds with POST /v1/deployments/{deploymentId}/invoke-async/{endpointPath} (the `StartAsyncTask` operationId). + StartAsyncTaskWithBody(ctx context.Context, deploymentId DeploymentId, endpointPath EndpointPath, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + // StartAsyncTask Start a new async task + // + // Starts a new async task on `deploymentId`, routing the request body payload to an available worker. The task runs asynchronously and the response is `202`; poll `GET /v1/deployments/{deploymentId}/tasks/{taskId}` for completion. + // + // Takes a body of the `application/json` content type. + // + // Corresponds with POST /v1/deployments/{deploymentId}/invoke-async/{endpointPath} (the `StartAsyncTask` operationId). + StartAsyncTask(ctx context.Context, deploymentId DeploymentId, endpointPath EndpointPath, body StartAsyncTaskJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // StartSyncTaskWithBody Start a new sync task + // + // Starts a new sync task on `deploymentId`, routing the request body payload to an available worker. The request blocks until the task is terminal and returns the result inline (`200`), or `504` if it does not complete within the wait window. + // + // Takes any type of body and a specified content type. + // + // Corresponds with POST /v1/deployments/{deploymentId}/invoke-sync/{endpointPath} (the `StartSyncTask` operationId). + StartSyncTaskWithBody(ctx context.Context, deploymentId DeploymentId, endpointPath EndpointPath, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + // StartSyncTask Start a new sync task + // + // Starts a new sync task on `deploymentId`, routing the request body payload to an available worker. The request blocks until the task is terminal and returns the result inline (`200`), or `504` if it does not complete within the wait window. + // + // Takes a body of the `application/json` content type. + // + // Corresponds with POST /v1/deployments/{deploymentId}/invoke-sync/{endpointPath} (the `StartSyncTask` operationId). + StartSyncTask(ctx context.Context, deploymentId DeploymentId, endpointPath EndpointPath, body StartSyncTaskJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ResumeDeployment Resume a deployment + // + // Moves the deployment to `initializing` and returns `202` once that intent is persisted. The Scaler then starts workers and sets the deployment to `active`; tasks queued during the stopped period are consumed as workers come online. Precondition: `status = stopped`. + // + // Corresponds with POST /v1/deployments/{deploymentId}/resume (the `ResumeDeployment` operationId). + ResumeDeployment(ctx context.Context, deploymentId DeploymentId, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ListDeploymentSecrets List secrets attached to a deployment + // + // Corresponds with GET /v1/deployments/{deploymentId}/secrets (the `ListDeploymentSecrets` operationId). + ListDeploymentSecrets(ctx context.Context, deploymentId DeploymentId, params *ListDeploymentSecretsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // AttachDeploymentSecretWithBody Attach a secret to a deployment + // + // Returns 409 if the secret is already attached to this deployment. + // + // Takes any type of body and a specified content type. + // + // Corresponds with POST /v1/deployments/{deploymentId}/secrets (the `AttachDeploymentSecret` operationId). + AttachDeploymentSecretWithBody(ctx context.Context, deploymentId DeploymentId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + // AttachDeploymentSecret Attach a secret to a deployment + // + // Returns 409 if the secret is already attached to this deployment. + // + // Takes a body of the `application/json` content type. + // + // Corresponds with POST /v1/deployments/{deploymentId}/secrets (the `AttachDeploymentSecret` operationId). + AttachDeploymentSecret(ctx context.Context, deploymentId DeploymentId, body AttachDeploymentSecretJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // DetachDeploymentSecret Detach a secret from a deployment + // + // Corresponds with DELETE /v1/deployments/{deploymentId}/secrets/{secretName} (the `DetachDeploymentSecret` operationId). + DetachDeploymentSecret(ctx context.Context, deploymentId DeploymentId, secretName SecretName, reqEditors ...RequestEditorFn) (*http.Response, error) + + // StopDeployment Stop a deployment + // + // Moves the deployment to `stopping` and returns `202` once that intent is persisted. Scale-to-zero and worker drain are performed asynchronously by the Scaler; `status` becomes `stopped` once all workers drain. In-flight tasks have a grace period (`gracefulStopTtlSecs`) to complete; workers that exceed it are force-terminated and their tasks return to the queue per delivery guarantees. New task submissions are still accepted and queued while stopped, but not consumed. Precondition: `status = active`. + // + // Corresponds with POST /v1/deployments/{deploymentId}/stop (the `StopDeployment` operationId). + StopDeployment(ctx context.Context, deploymentId DeploymentId, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ListTasks List tasks for a deployment + // + // Corresponds with GET /v1/deployments/{deploymentId}/tasks (the `ListTasks` operationId). + ListTasks(ctx context.Context, deploymentId DeploymentId, params *ListTasksParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetTask Get a task + // + // Returns the task's current status, read through the inference transport layer from the shared result store. When `completed`, includes the result `output` and `completedAt`; when `failed`, includes `error`; when `pending`, neither is set. + // + // Corresponds with GET /v1/deployments/{deploymentId}/tasks/{taskId} (the `GetTask` operationId). + GetTask(ctx context.Context, deploymentId DeploymentId, taskId string, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ListVersions List versions + // + // Corresponds with GET /v1/deployments/{deploymentId}/versions (the `ListVersions` operationId). + ListVersions(ctx context.Context, deploymentId DeploymentId, params *ListVersionsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetVersion Get a version + // + // Corresponds with GET /v1/deployments/{deploymentId}/versions/{versionNumber} (the `GetVersion` operationId). + GetVersion(ctx context.Context, deploymentId DeploymentId, versionNumber int32, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ListWorkers List workers + // + // Corresponds with GET /v1/deployments/{deploymentId}/workers (the `ListWorkers` operationId). + ListWorkers(ctx context.Context, deploymentId DeploymentId, params *ListWorkersParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ListGpuTypes List supported GPU types and their pricing + // + // Returns the global GPU type catalogue and pricing. The result is not organisation-specific, but the request still requires authentication. + // + // Corresponds with GET /v1/gpu-types (the `ListGpuTypes` operationId). + ListGpuTypes(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ListSecrets List secrets + // + // Returns secret metadata only; encrypted values are never returned. + // + // Corresponds with GET /v1/secrets (the `ListSecrets` operationId). + ListSecrets(ctx context.Context, params *ListSecretsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // CreateSecretWithBody Create a secret + // + // Takes any type of body and a specified content type. + // + // Corresponds with POST /v1/secrets (the `CreateSecret` operationId). + CreateSecretWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + // CreateSecret Create a secret + // + // Takes a body of the `application/json` content type. + // + // Corresponds with POST /v1/secrets (the `CreateSecret` operationId). + CreateSecret(ctx context.Context, body CreateSecretJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // DeleteSecret Delete a secret + // + // Corresponds with DELETE /v1/secrets/{secretName} (the `DeleteSecret` operationId). + DeleteSecret(ctx context.Context, secretName SecretName, reqEditors ...RequestEditorFn) (*http.Response, error) + + // UpdateSecretWithBody Update a secret + // + // Takes any type of body and a specified content type. + // + // Corresponds with PUT /v1/secrets/{secretName} (the `UpdateSecret` operationId). + UpdateSecretWithBody(ctx context.Context, secretName SecretName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + // UpdateSecret Update a secret + // + // Takes a body of the `application/json` content type. + // + // Corresponds with PUT /v1/secrets/{secretName} (the `UpdateSecret` operationId). + UpdateSecret(ctx context.Context, secretName SecretName, body UpdateSecretJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ListUsageEvents List usage events + // + // Append-only billing telemetry; one row per worker state transition. + // + // Corresponds with GET /v1/usage (the `ListUsageEvents` operationId). + ListUsageEvents(ctx context.Context, params *ListUsageEventsParams, reqEditors ...RequestEditorFn) (*http.Response, error) +} + +// GetDeploymentSummary Deployment summary metrics for the authenticated organisation +// +// Aggregate dashboard metrics across all deployments owned by the authenticated organisation. Metrics whose backing system is not yet available are omitted from the response rather than reported as zero. +// +// Corresponds with GET /v1/deployment-summary (the `GetDeploymentSummary` operationId). +func (c *Client) GetDeploymentSummary(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetDeploymentSummaryRequest(c.Server) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// ListDeployments List deployments +// +// Corresponds with GET /v1/deployments (the `ListDeployments` operationId). +func (c *Client) ListDeployments(ctx context.Context, params *ListDeploymentsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListDeploymentsRequest(c.Server, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// CreateDeploymentWithBody Create a deployment +// +// Creates a deployment together with its worker configuration and endpoints, as declared in the submitted IaC config. The deployment starts in `initializing` and an initial rollout begins immediately based on the deployment source type: +// +// - `code` source: the codebase is submitted to the build pipeline; once the image is built +// and workers become healthy the deployment transitions to `active`. +// +// - `container` source: the pre-built image is deployed directly with no build step; once +// workers become healthy the deployment transitions to `active`. +// +// If the build, validation, or rollout fails the deployment is marked `failed`. +// +// Takes any type of body and a specified content type. +// +// Corresponds with POST /v1/deployments (the `CreateDeployment` operationId). +func (c *Client) CreateDeploymentWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateDeploymentRequestWithBody(c.Server, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// CreateDeployment Create a deployment +// +// Creates a deployment together with its worker configuration and endpoints, as declared in the submitted IaC config. The deployment starts in `initializing` and an initial rollout begins immediately based on the deployment source type: +// +// - `code` source: the codebase is submitted to the build pipeline; once the image is built +// and workers become healthy the deployment transitions to `active`. +// +// - `container` source: the pre-built image is deployed directly with no build step; once +// workers become healthy the deployment transitions to `active`. +// +// If the build, validation, or rollout fails the deployment is marked `failed`. +// +// Takes a body of the `application/json` content type. +// +// Corresponds with POST /v1/deployments (the `CreateDeployment` operationId). +func (c *Client) CreateDeployment(ctx context.Context, body CreateDeploymentJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateDeploymentRequest(c.Server, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// DeleteDeployment Delete a deployment +// +// Soft delete. Sets `status = deleting` and returns `202` once that intent is persisted. Router removal, cancelling in-progress builds, and worker drain (`draining → stopping → stopped`) are performed asynchronously by the deployer/Scaler; `status` becomes `deleted` once all workers stop. All rows are retained for billing finalisation, audit, and usage history. Idempotent if the deployment is already `deleting`. +// +// Corresponds with DELETE /v1/deployments/{deploymentId} (the `DeleteDeployment` operationId). +func (c *Client) DeleteDeployment(ctx context.Context, deploymentId DeploymentId, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewDeleteDeploymentRequest(c.Server, deploymentId) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// GetDeployment Get a deployment +// +// Corresponds with GET /v1/deployments/{deploymentId} (the `GetDeployment` operationId). +func (c *Client) GetDeployment(ctx context.Context, deploymentId DeploymentId, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetDeploymentRequest(c.Server, deploymentId) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// UpdateDeploymentWithBody Update a deployment +// +// Patches one or more aspects of a deployment in place. All fields are optional; omitted fields are left unchanged. Valid in any non-`deleted` status, including `stopped` (changes apply on `resume`). Lifecycle transitions use the dedicated `deploy`, `stop`, `resume`, and `delete` operations. +// **Currently persisted:** `deploymentName` and `configuration` only. Supplying `deploymentSource`, `secrets`, `environmentVariables`, or `endpoints` returns `422` until those stores land. +// Target behaviour (once fully wired): +// +// - `configuration`: applied on the next Scaler cycle; triggers a rollout so workers +// restart with the new configuration. If the rollout fails, the deployment remains on +// the previous configuration. +// +// - `deploymentSource`: triggers a build (for `code` sources) or image validation (for `container` +// sources); on success the new version is deployed automatically. If the build or +// validation fails, the deployment remains on the previous version. +// +// - `secrets` / `environmentVariables` / `endpoints`: the supplied array **replaces** the +// current set — any item absent from the request is deleted. Endpoints take effect +// immediately. Changes to secrets or environment variables trigger a rollout so workers +// restart and pick up the new values. +// +// Takes any type of body and a specified content type. +// +// Corresponds with PATCH /v1/deployments/{deploymentId} (the `UpdateDeployment` operationId). +func (c *Client) UpdateDeploymentWithBody(ctx context.Context, deploymentId DeploymentId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdateDeploymentRequestWithBody(c.Server, deploymentId, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// UpdateDeployment Update a deployment +// +// Patches one or more aspects of a deployment in place. All fields are optional; omitted fields are left unchanged. Valid in any non-`deleted` status, including `stopped` (changes apply on `resume`). Lifecycle transitions use the dedicated `deploy`, `stop`, `resume`, and `delete` operations. +// **Currently persisted:** `deploymentName` and `configuration` only. Supplying `deploymentSource`, `secrets`, `environmentVariables`, or `endpoints` returns `422` until those stores land. +// Target behaviour (once fully wired): +// +// - `configuration`: applied on the next Scaler cycle; triggers a rollout so workers +// restart with the new configuration. If the rollout fails, the deployment remains on +// the previous configuration. +// +// - `deploymentSource`: triggers a build (for `code` sources) or image validation (for `container` +// sources); on success the new version is deployed automatically. If the build or +// validation fails, the deployment remains on the previous version. +// +// - `secrets` / `environmentVariables` / `endpoints`: the supplied array **replaces** the +// current set — any item absent from the request is deleted. Endpoints take effect +// immediately. Changes to secrets or environment variables trigger a rollout so workers +// restart and pick up the new values. +// +// Takes a body of the `application/json` content type. +// +// Corresponds with PATCH /v1/deployments/{deploymentId} (the `UpdateDeployment` operationId). +func (c *Client) UpdateDeployment(ctx context.Context, deploymentId DeploymentId, body UpdateDeploymentJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdateDeploymentRequest(c.Server, deploymentId, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// ListBuilds List builds +// +// Corresponds with GET /v1/deployments/{deploymentId}/builds (the `ListBuilds` operationId). +func (c *Client) ListBuilds(ctx context.Context, deploymentId DeploymentId, params *ListBuildsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListBuildsRequest(c.Server, deploymentId, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// GetBuild Get a build +// +// Corresponds with GET /v1/deployments/{deploymentId}/builds/{buildId} (the `GetBuild` operationId). +func (c *Client) GetBuild(ctx context.Context, deploymentId DeploymentId, buildId openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetBuildRequest(c.Server, deploymentId, buildId) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// DeployVersionWithBody Deploy a version +// +// Activates a `ready` version by number, setting `activeVersionId` and returning `202` once that intent is persisted. Worker rollout, routing switch, and cancelling in-progress builds (`failed` with `error: "superseded"`) are performed asynchronously by the deployer/Scaler. Permitted in any addressable status, including `initializing` and `failed`. +// To roll back, supply an older `versionNumber` — the operation is identical to a forward deploy. +// **Rollout** (deployer/Scaler): the platform starts workers on the target version, waits for at least one to become healthy, switches task routing to the new version, then drains old-version workers gracefully. Old workers are given `gracefulStopTtlSecs` to finish in-flight tasks before being force-terminated. If new workers fail to become healthy, old workers are not drained and the deployment continues on the previous version. +// Errors: - Deploy to a `deleting` deployment returns `409 Conflict` - `versionNumber` not found or not `ready` returns `409 Conflict` - Deploy to a non-existent or `deleted` deployment returns `404 Not Found` +// +// Takes any type of body and a specified content type. +// +// Corresponds with POST /v1/deployments/{deploymentId}/deploy (the `DeployVersion` operationId). +func (c *Client) DeployVersionWithBody(ctx context.Context, deploymentId DeploymentId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewDeployVersionRequestWithBody(c.Server, deploymentId, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// DeployVersion Deploy a version +// +// Activates a `ready` version by number, setting `activeVersionId` and returning `202` once that intent is persisted. Worker rollout, routing switch, and cancelling in-progress builds (`failed` with `error: "superseded"`) are performed asynchronously by the deployer/Scaler. Permitted in any addressable status, including `initializing` and `failed`. +// To roll back, supply an older `versionNumber` — the operation is identical to a forward deploy. +// **Rollout** (deployer/Scaler): the platform starts workers on the target version, waits for at least one to become healthy, switches task routing to the new version, then drains old-version workers gracefully. Old workers are given `gracefulStopTtlSecs` to finish in-flight tasks before being force-terminated. If new workers fail to become healthy, old workers are not drained and the deployment continues on the previous version. +// Errors: - Deploy to a `deleting` deployment returns `409 Conflict` - `versionNumber` not found or not `ready` returns `409 Conflict` - Deploy to a non-existent or `deleted` deployment returns `404 Not Found` +// +// Takes a body of the `application/json` content type. +// +// Corresponds with POST /v1/deployments/{deploymentId}/deploy (the `DeployVersion` operationId). +func (c *Client) DeployVersion(ctx context.Context, deploymentId DeploymentId, body DeployVersionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewDeployVersionRequest(c.Server, deploymentId, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// ListEndpoints List endpoints +// +// Corresponds with GET /v1/deployments/{deploymentId}/endpoints (the `ListEndpoints` operationId). +func (c *Client) ListEndpoints(ctx context.Context, deploymentId DeploymentId, params *ListEndpointsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListEndpointsRequest(c.Server, deploymentId, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// ListDeploymentEnvironmentVariables List deployment environment variables +// +// Corresponds with GET /v1/deployments/{deploymentId}/environment-variables (the `ListDeploymentEnvironmentVariables` operationId). +func (c *Client) ListDeploymentEnvironmentVariables(ctx context.Context, deploymentId DeploymentId, params *ListDeploymentEnvironmentVariablesParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListDeploymentEnvironmentVariablesRequest(c.Server, deploymentId, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// DeleteDeploymentEnvironmentVariable Delete a deployment environment variable +// +// Corresponds with DELETE /v1/deployments/{deploymentId}/environment-variables/{variableName} (the `DeleteDeploymentEnvironmentVariable` operationId). +func (c *Client) DeleteDeploymentEnvironmentVariable(ctx context.Context, deploymentId DeploymentId, variableName string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewDeleteDeploymentEnvironmentVariableRequest(c.Server, deploymentId, variableName) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// UpsertDeploymentEnvironmentVariableWithBody Upsert a deployment environment variable +// +// Takes any type of body and a specified content type. +// +// Corresponds with PUT /v1/deployments/{deploymentId}/environment-variables/{variableName} (the `UpsertDeploymentEnvironmentVariable` operationId). +func (c *Client) UpsertDeploymentEnvironmentVariableWithBody(ctx context.Context, deploymentId DeploymentId, variableName string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpsertDeploymentEnvironmentVariableRequestWithBody(c.Server, deploymentId, variableName, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// UpsertDeploymentEnvironmentVariable Upsert a deployment environment variable +// +// Takes a body of the `application/json` content type. +// +// Corresponds with PUT /v1/deployments/{deploymentId}/environment-variables/{variableName} (the `UpsertDeploymentEnvironmentVariable` operationId). +func (c *Client) UpsertDeploymentEnvironmentVariable(ctx context.Context, deploymentId DeploymentId, variableName string, body UpsertDeploymentEnvironmentVariableJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpsertDeploymentEnvironmentVariableRequest(c.Server, deploymentId, variableName, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// ListDeploymentEvents List deployment events +// +// Corresponds with GET /v1/deployments/{deploymentId}/events (the `ListDeploymentEvents` operationId). +func (c *Client) ListDeploymentEvents(ctx context.Context, deploymentId DeploymentId, params *ListDeploymentEventsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListDeploymentEventsRequest(c.Server, deploymentId, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// StartAsyncTaskWithBody Start a new async task +// +// Starts a new async task on `deploymentId`, routing the request body payload to an available worker. The task runs asynchronously and the response is `202`; poll `GET /v1/deployments/{deploymentId}/tasks/{taskId}` for completion. +// +// Takes any type of body and a specified content type. +// +// Corresponds with POST /v1/deployments/{deploymentId}/invoke-async/{endpointPath} (the `StartAsyncTask` operationId). +func (c *Client) StartAsyncTaskWithBody(ctx context.Context, deploymentId DeploymentId, endpointPath EndpointPath, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewStartAsyncTaskRequestWithBody(c.Server, deploymentId, endpointPath, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// StartAsyncTask Start a new async task +// +// Starts a new async task on `deploymentId`, routing the request body payload to an available worker. The task runs asynchronously and the response is `202`; poll `GET /v1/deployments/{deploymentId}/tasks/{taskId}` for completion. +// +// Takes a body of the `application/json` content type. +// +// Corresponds with POST /v1/deployments/{deploymentId}/invoke-async/{endpointPath} (the `StartAsyncTask` operationId). +func (c *Client) StartAsyncTask(ctx context.Context, deploymentId DeploymentId, endpointPath EndpointPath, body StartAsyncTaskJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewStartAsyncTaskRequest(c.Server, deploymentId, endpointPath, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// StartSyncTaskWithBody Start a new sync task +// +// Starts a new sync task on `deploymentId`, routing the request body payload to an available worker. The request blocks until the task is terminal and returns the result inline (`200`), or `504` if it does not complete within the wait window. +// +// Takes any type of body and a specified content type. +// +// Corresponds with POST /v1/deployments/{deploymentId}/invoke-sync/{endpointPath} (the `StartSyncTask` operationId). +func (c *Client) StartSyncTaskWithBody(ctx context.Context, deploymentId DeploymentId, endpointPath EndpointPath, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewStartSyncTaskRequestWithBody(c.Server, deploymentId, endpointPath, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// StartSyncTask Start a new sync task +// +// Starts a new sync task on `deploymentId`, routing the request body payload to an available worker. The request blocks until the task is terminal and returns the result inline (`200`), or `504` if it does not complete within the wait window. +// +// Takes a body of the `application/json` content type. +// +// Corresponds with POST /v1/deployments/{deploymentId}/invoke-sync/{endpointPath} (the `StartSyncTask` operationId). +func (c *Client) StartSyncTask(ctx context.Context, deploymentId DeploymentId, endpointPath EndpointPath, body StartSyncTaskJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewStartSyncTaskRequest(c.Server, deploymentId, endpointPath, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// ResumeDeployment Resume a deployment +// +// Moves the deployment to `initializing` and returns `202` once that intent is persisted. The Scaler then starts workers and sets the deployment to `active`; tasks queued during the stopped period are consumed as workers come online. Precondition: `status = stopped`. +// +// Corresponds with POST /v1/deployments/{deploymentId}/resume (the `ResumeDeployment` operationId). +func (c *Client) ResumeDeployment(ctx context.Context, deploymentId DeploymentId, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewResumeDeploymentRequest(c.Server, deploymentId) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// ListDeploymentSecrets List secrets attached to a deployment +// +// Corresponds with GET /v1/deployments/{deploymentId}/secrets (the `ListDeploymentSecrets` operationId). +func (c *Client) ListDeploymentSecrets(ctx context.Context, deploymentId DeploymentId, params *ListDeploymentSecretsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListDeploymentSecretsRequest(c.Server, deploymentId, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// AttachDeploymentSecretWithBody Attach a secret to a deployment +// +// Returns 409 if the secret is already attached to this deployment. +// +// Takes any type of body and a specified content type. +// +// Corresponds with POST /v1/deployments/{deploymentId}/secrets (the `AttachDeploymentSecret` operationId). +func (c *Client) AttachDeploymentSecretWithBody(ctx context.Context, deploymentId DeploymentId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewAttachDeploymentSecretRequestWithBody(c.Server, deploymentId, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// AttachDeploymentSecret Attach a secret to a deployment +// +// Returns 409 if the secret is already attached to this deployment. +// +// Takes a body of the `application/json` content type. +// +// Corresponds with POST /v1/deployments/{deploymentId}/secrets (the `AttachDeploymentSecret` operationId). +func (c *Client) AttachDeploymentSecret(ctx context.Context, deploymentId DeploymentId, body AttachDeploymentSecretJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewAttachDeploymentSecretRequest(c.Server, deploymentId, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// DetachDeploymentSecret Detach a secret from a deployment +// +// Corresponds with DELETE /v1/deployments/{deploymentId}/secrets/{secretName} (the `DetachDeploymentSecret` operationId). +func (c *Client) DetachDeploymentSecret(ctx context.Context, deploymentId DeploymentId, secretName SecretName, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewDetachDeploymentSecretRequest(c.Server, deploymentId, secretName) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// StopDeployment Stop a deployment +// +// Moves the deployment to `stopping` and returns `202` once that intent is persisted. Scale-to-zero and worker drain are performed asynchronously by the Scaler; `status` becomes `stopped` once all workers drain. In-flight tasks have a grace period (`gracefulStopTtlSecs`) to complete; workers that exceed it are force-terminated and their tasks return to the queue per delivery guarantees. New task submissions are still accepted and queued while stopped, but not consumed. Precondition: `status = active`. +// +// Corresponds with POST /v1/deployments/{deploymentId}/stop (the `StopDeployment` operationId). +func (c *Client) StopDeployment(ctx context.Context, deploymentId DeploymentId, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewStopDeploymentRequest(c.Server, deploymentId) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// ListTasks List tasks for a deployment +// +// Corresponds with GET /v1/deployments/{deploymentId}/tasks (the `ListTasks` operationId). +func (c *Client) ListTasks(ctx context.Context, deploymentId DeploymentId, params *ListTasksParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListTasksRequest(c.Server, deploymentId, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// GetTask Get a task +// +// Returns the task's current status, read through the inference transport layer from the shared result store. When `completed`, includes the result `output` and `completedAt`; when `failed`, includes `error`; when `pending`, neither is set. +// +// Corresponds with GET /v1/deployments/{deploymentId}/tasks/{taskId} (the `GetTask` operationId). +func (c *Client) GetTask(ctx context.Context, deploymentId DeploymentId, taskId string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetTaskRequest(c.Server, deploymentId, taskId) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// ListVersions List versions +// +// Corresponds with GET /v1/deployments/{deploymentId}/versions (the `ListVersions` operationId). +func (c *Client) ListVersions(ctx context.Context, deploymentId DeploymentId, params *ListVersionsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListVersionsRequest(c.Server, deploymentId, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// GetVersion Get a version +// +// Corresponds with GET /v1/deployments/{deploymentId}/versions/{versionNumber} (the `GetVersion` operationId). +func (c *Client) GetVersion(ctx context.Context, deploymentId DeploymentId, versionNumber int32, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetVersionRequest(c.Server, deploymentId, versionNumber) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// ListWorkers List workers +// +// Corresponds with GET /v1/deployments/{deploymentId}/workers (the `ListWorkers` operationId). +func (c *Client) ListWorkers(ctx context.Context, deploymentId DeploymentId, params *ListWorkersParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListWorkersRequest(c.Server, deploymentId, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// ListGpuTypes List supported GPU types and their pricing +// +// Returns the global GPU type catalogue and pricing. The result is not organisation-specific, but the request still requires authentication. +// +// Corresponds with GET /v1/gpu-types (the `ListGpuTypes` operationId). +func (c *Client) ListGpuTypes(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListGpuTypesRequest(c.Server) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// ListSecrets List secrets +// +// Returns secret metadata only; encrypted values are never returned. +// +// Corresponds with GET /v1/secrets (the `ListSecrets` operationId). +func (c *Client) ListSecrets(ctx context.Context, params *ListSecretsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListSecretsRequest(c.Server, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// CreateSecretWithBody Create a secret +// +// Takes any type of body and a specified content type. +// +// Corresponds with POST /v1/secrets (the `CreateSecret` operationId). +func (c *Client) CreateSecretWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateSecretRequestWithBody(c.Server, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// CreateSecret Create a secret +// +// Takes a body of the `application/json` content type. +// +// Corresponds with POST /v1/secrets (the `CreateSecret` operationId). +func (c *Client) CreateSecret(ctx context.Context, body CreateSecretJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateSecretRequest(c.Server, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// DeleteSecret Delete a secret +// +// Corresponds with DELETE /v1/secrets/{secretName} (the `DeleteSecret` operationId). +func (c *Client) DeleteSecret(ctx context.Context, secretName SecretName, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewDeleteSecretRequest(c.Server, secretName) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// UpdateSecretWithBody Update a secret +// +// Takes any type of body and a specified content type. +// +// Corresponds with PUT /v1/secrets/{secretName} (the `UpdateSecret` operationId). +func (c *Client) UpdateSecretWithBody(ctx context.Context, secretName SecretName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdateSecretRequestWithBody(c.Server, secretName, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// UpdateSecret Update a secret +// +// Takes a body of the `application/json` content type. +// +// Corresponds with PUT /v1/secrets/{secretName} (the `UpdateSecret` operationId). +func (c *Client) UpdateSecret(ctx context.Context, secretName SecretName, body UpdateSecretJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdateSecretRequest(c.Server, secretName, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// ListUsageEvents List usage events +// +// Append-only billing telemetry; one row per worker state transition. +// +// Corresponds with GET /v1/usage (the `ListUsageEvents` operationId). +func (c *Client) ListUsageEvents(ctx context.Context, params *ListUsageEventsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListUsageEventsRequest(c.Server, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// NewGetDeploymentSummaryRequest constructs an http.Request for the GetDeploymentSummary method +func NewGetDeploymentSummaryRequest(server string) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/deployment-summary") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewListDeploymentsRequest constructs an http.Request for the ListDeployments method +func NewListDeploymentsRequest(server string, params *ListDeploymentsParams) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/deployments") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + // queryValues collects non-styled parameters (passthrough, JSON) + // that are safe to round-trip through url.Values.Encode(). + queryValues := queryURL.Query() + // rawQueryFragments collects pre-encoded query fragments from + // styled parameters, preserving literal commas as delimiters + // per the OpenAPI spec (e.g. "color=blue,black,brown"). + var rawQueryFragments []string + + if params.Limit != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "limit", *params.Limit, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: "int32"}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if params.Cursor != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "cursor", *params.Cursor, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if params.Status != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "status", *params.Status, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if encoded := queryValues.Encode(); encoded != "" { + rawQueryFragments = append(rawQueryFragments, encoded) + } + queryURL.RawQuery = strings.Join(rawQueryFragments, "&") + } + + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewCreateDeploymentRequest calls the generic CreateDeployment builder with application/json body +func NewCreateDeploymentRequest(server string, body CreateDeploymentJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewCreateDeploymentRequestWithBody(server, "application/json", bodyReader) +} + +// NewCreateDeploymentRequestWithBody constructs an http.Request for the CreateDeployment method, with any body, and a specified content type +func NewCreateDeploymentRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/deployments") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewDeleteDeploymentRequest constructs an http.Request for the DeleteDeployment method +func NewDeleteDeploymentRequest(server string, deploymentId DeploymentId) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "deploymentId", deploymentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/deployments/%s", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest(http.MethodDelete, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewGetDeploymentRequest constructs an http.Request for the GetDeployment method +func NewGetDeploymentRequest(server string, deploymentId DeploymentId) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "deploymentId", deploymentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/deployments/%s", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewUpdateDeploymentRequest calls the generic UpdateDeployment builder with application/json body +func NewUpdateDeploymentRequest(server string, deploymentId DeploymentId, body UpdateDeploymentJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewUpdateDeploymentRequestWithBody(server, deploymentId, "application/json", bodyReader) +} + +// NewUpdateDeploymentRequestWithBody constructs an http.Request for the UpdateDeployment method, with any body, and a specified content type +func NewUpdateDeploymentRequestWithBody(server string, deploymentId DeploymentId, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "deploymentId", deploymentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/deployments/%s", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest(http.MethodPatch, queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewListBuildsRequest constructs an http.Request for the ListBuilds method +func NewListBuildsRequest(server string, deploymentId DeploymentId, params *ListBuildsParams) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "deploymentId", deploymentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/deployments/%s/builds", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + // queryValues collects non-styled parameters (passthrough, JSON) + // that are safe to round-trip through url.Values.Encode(). + queryValues := queryURL.Query() + // rawQueryFragments collects pre-encoded query fragments from + // styled parameters, preserving literal commas as delimiters + // per the OpenAPI spec (e.g. "color=blue,black,brown"). + var rawQueryFragments []string + + if params.Limit != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "limit", *params.Limit, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: "int32"}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if params.Cursor != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "cursor", *params.Cursor, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if encoded := queryValues.Encode(); encoded != "" { + rawQueryFragments = append(rawQueryFragments, encoded) + } + queryURL.RawQuery = strings.Join(rawQueryFragments, "&") + } + + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewGetBuildRequest constructs an http.Request for the GetBuild method +func NewGetBuildRequest(server string, deploymentId DeploymentId, buildId openapi_types.UUID) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "deploymentId", deploymentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithOptions("simple", false, "buildId", buildId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: "uuid"}) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/deployments/%s/builds/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewDeployVersionRequest calls the generic DeployVersion builder with application/json body +func NewDeployVersionRequest(server string, deploymentId DeploymentId, body DeployVersionJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewDeployVersionRequestWithBody(server, deploymentId, "application/json", bodyReader) +} + +// NewDeployVersionRequestWithBody constructs an http.Request for the DeployVersion method, with any body, and a specified content type +func NewDeployVersionRequestWithBody(server string, deploymentId DeploymentId, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "deploymentId", deploymentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/deployments/%s/deploy", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewListEndpointsRequest constructs an http.Request for the ListEndpoints method +func NewListEndpointsRequest(server string, deploymentId DeploymentId, params *ListEndpointsParams) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "deploymentId", deploymentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/deployments/%s/endpoints", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + // queryValues collects non-styled parameters (passthrough, JSON) + // that are safe to round-trip through url.Values.Encode(). + queryValues := queryURL.Query() + // rawQueryFragments collects pre-encoded query fragments from + // styled parameters, preserving literal commas as delimiters + // per the OpenAPI spec (e.g. "color=blue,black,brown"). + var rawQueryFragments []string + + if params.Limit != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "limit", *params.Limit, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: "int32"}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if params.Cursor != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "cursor", *params.Cursor, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if encoded := queryValues.Encode(); encoded != "" { + rawQueryFragments = append(rawQueryFragments, encoded) + } + queryURL.RawQuery = strings.Join(rawQueryFragments, "&") + } + + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewListDeploymentEnvironmentVariablesRequest constructs an http.Request for the ListDeploymentEnvironmentVariables method +func NewListDeploymentEnvironmentVariablesRequest(server string, deploymentId DeploymentId, params *ListDeploymentEnvironmentVariablesParams) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "deploymentId", deploymentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/deployments/%s/environment-variables", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + // queryValues collects non-styled parameters (passthrough, JSON) + // that are safe to round-trip through url.Values.Encode(). + queryValues := queryURL.Query() + // rawQueryFragments collects pre-encoded query fragments from + // styled parameters, preserving literal commas as delimiters + // per the OpenAPI spec (e.g. "color=blue,black,brown"). + var rawQueryFragments []string + + if params.Limit != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "limit", *params.Limit, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: "int32"}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if params.Cursor != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "cursor", *params.Cursor, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if encoded := queryValues.Encode(); encoded != "" { + rawQueryFragments = append(rawQueryFragments, encoded) + } + queryURL.RawQuery = strings.Join(rawQueryFragments, "&") + } + + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewDeleteDeploymentEnvironmentVariableRequest constructs an http.Request for the DeleteDeploymentEnvironmentVariable method +func NewDeleteDeploymentEnvironmentVariableRequest(server string, deploymentId DeploymentId, variableName string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "deploymentId", deploymentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithOptions("simple", false, "variableName", variableName, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/deployments/%s/environment-variables/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest(http.MethodDelete, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewUpsertDeploymentEnvironmentVariableRequest calls the generic UpsertDeploymentEnvironmentVariable builder with application/json body +func NewUpsertDeploymentEnvironmentVariableRequest(server string, deploymentId DeploymentId, variableName string, body UpsertDeploymentEnvironmentVariableJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewUpsertDeploymentEnvironmentVariableRequestWithBody(server, deploymentId, variableName, "application/json", bodyReader) +} + +// NewUpsertDeploymentEnvironmentVariableRequestWithBody constructs an http.Request for the UpsertDeploymentEnvironmentVariable method, with any body, and a specified content type +func NewUpsertDeploymentEnvironmentVariableRequestWithBody(server string, deploymentId DeploymentId, variableName string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "deploymentId", deploymentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithOptions("simple", false, "variableName", variableName, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/deployments/%s/environment-variables/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest(http.MethodPut, queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewListDeploymentEventsRequest constructs an http.Request for the ListDeploymentEvents method +func NewListDeploymentEventsRequest(server string, deploymentId DeploymentId, params *ListDeploymentEventsParams) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "deploymentId", deploymentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/deployments/%s/events", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + // queryValues collects non-styled parameters (passthrough, JSON) + // that are safe to round-trip through url.Values.Encode(). + queryValues := queryURL.Query() + // rawQueryFragments collects pre-encoded query fragments from + // styled parameters, preserving literal commas as delimiters + // per the OpenAPI spec (e.g. "color=blue,black,brown"). + var rawQueryFragments []string + + if params.Limit != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "limit", *params.Limit, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: "int32"}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if params.Cursor != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "cursor", *params.Cursor, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if params.Type != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "type", *params.Type, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if encoded := queryValues.Encode(); encoded != "" { + rawQueryFragments = append(rawQueryFragments, encoded) + } + queryURL.RawQuery = strings.Join(rawQueryFragments, "&") + } + + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewStartAsyncTaskRequest calls the generic StartAsyncTask builder with application/json body +func NewStartAsyncTaskRequest(server string, deploymentId DeploymentId, endpointPath EndpointPath, body StartAsyncTaskJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewStartAsyncTaskRequestWithBody(server, deploymentId, endpointPath, "application/json", bodyReader) +} + +// NewStartAsyncTaskRequestWithBody constructs an http.Request for the StartAsyncTask method, with any body, and a specified content type +func NewStartAsyncTaskRequestWithBody(server string, deploymentId DeploymentId, endpointPath EndpointPath, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "deploymentId", deploymentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithOptions("simple", false, "endpointPath", endpointPath, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/deployments/%s/invoke-async/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewStartSyncTaskRequest calls the generic StartSyncTask builder with application/json body +func NewStartSyncTaskRequest(server string, deploymentId DeploymentId, endpointPath EndpointPath, body StartSyncTaskJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewStartSyncTaskRequestWithBody(server, deploymentId, endpointPath, "application/json", bodyReader) +} + +// NewStartSyncTaskRequestWithBody constructs an http.Request for the StartSyncTask method, with any body, and a specified content type +func NewStartSyncTaskRequestWithBody(server string, deploymentId DeploymentId, endpointPath EndpointPath, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "deploymentId", deploymentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithOptions("simple", false, "endpointPath", endpointPath, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/deployments/%s/invoke-sync/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewResumeDeploymentRequest constructs an http.Request for the ResumeDeployment method +func NewResumeDeploymentRequest(server string, deploymentId DeploymentId) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "deploymentId", deploymentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/deployments/%s/resume", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest(http.MethodPost, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewListDeploymentSecretsRequest constructs an http.Request for the ListDeploymentSecrets method +func NewListDeploymentSecretsRequest(server string, deploymentId DeploymentId, params *ListDeploymentSecretsParams) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "deploymentId", deploymentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/deployments/%s/secrets", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + // queryValues collects non-styled parameters (passthrough, JSON) + // that are safe to round-trip through url.Values.Encode(). + queryValues := queryURL.Query() + // rawQueryFragments collects pre-encoded query fragments from + // styled parameters, preserving literal commas as delimiters + // per the OpenAPI spec (e.g. "color=blue,black,brown"). + var rawQueryFragments []string + + if params.Limit != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "limit", *params.Limit, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: "int32"}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if params.Cursor != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "cursor", *params.Cursor, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if encoded := queryValues.Encode(); encoded != "" { + rawQueryFragments = append(rawQueryFragments, encoded) + } + queryURL.RawQuery = strings.Join(rawQueryFragments, "&") + } + + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewAttachDeploymentSecretRequest calls the generic AttachDeploymentSecret builder with application/json body +func NewAttachDeploymentSecretRequest(server string, deploymentId DeploymentId, body AttachDeploymentSecretJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewAttachDeploymentSecretRequestWithBody(server, deploymentId, "application/json", bodyReader) +} + +// NewAttachDeploymentSecretRequestWithBody constructs an http.Request for the AttachDeploymentSecret method, with any body, and a specified content type +func NewAttachDeploymentSecretRequestWithBody(server string, deploymentId DeploymentId, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "deploymentId", deploymentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/deployments/%s/secrets", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewDetachDeploymentSecretRequest constructs an http.Request for the DetachDeploymentSecret method +func NewDetachDeploymentSecretRequest(server string, deploymentId DeploymentId, secretName SecretName) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "deploymentId", deploymentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithOptions("simple", false, "secretName", secretName, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/deployments/%s/secrets/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest(http.MethodDelete, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewStopDeploymentRequest constructs an http.Request for the StopDeployment method +func NewStopDeploymentRequest(server string, deploymentId DeploymentId) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "deploymentId", deploymentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/deployments/%s/stop", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest(http.MethodPost, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewListTasksRequest constructs an http.Request for the ListTasks method +func NewListTasksRequest(server string, deploymentId DeploymentId, params *ListTasksParams) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "deploymentId", deploymentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/deployments/%s/tasks", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + // queryValues collects non-styled parameters (passthrough, JSON) + // that are safe to round-trip through url.Values.Encode(). + queryValues := queryURL.Query() + // rawQueryFragments collects pre-encoded query fragments from + // styled parameters, preserving literal commas as delimiters + // per the OpenAPI spec (e.g. "color=blue,black,brown"). + var rawQueryFragments []string + + if params.Limit != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "limit", *params.Limit, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: "int32"}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if params.Cursor != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "cursor", *params.Cursor, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if params.Status != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "status", *params.Status, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if encoded := queryValues.Encode(); encoded != "" { + rawQueryFragments = append(rawQueryFragments, encoded) + } + queryURL.RawQuery = strings.Join(rawQueryFragments, "&") + } + + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewGetTaskRequest constructs an http.Request for the GetTask method +func NewGetTaskRequest(server string, deploymentId DeploymentId, taskId string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "deploymentId", deploymentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithOptions("simple", false, "taskId", taskId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/deployments/%s/tasks/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewListVersionsRequest constructs an http.Request for the ListVersions method +func NewListVersionsRequest(server string, deploymentId DeploymentId, params *ListVersionsParams) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "deploymentId", deploymentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/deployments/%s/versions", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + // queryValues collects non-styled parameters (passthrough, JSON) + // that are safe to round-trip through url.Values.Encode(). + queryValues := queryURL.Query() + // rawQueryFragments collects pre-encoded query fragments from + // styled parameters, preserving literal commas as delimiters + // per the OpenAPI spec (e.g. "color=blue,black,brown"). + var rawQueryFragments []string + + if params.Limit != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "limit", *params.Limit, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: "int32"}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if params.Cursor != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "cursor", *params.Cursor, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if encoded := queryValues.Encode(); encoded != "" { + rawQueryFragments = append(rawQueryFragments, encoded) + } + queryURL.RawQuery = strings.Join(rawQueryFragments, "&") + } + + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewGetVersionRequest constructs an http.Request for the GetVersion method +func NewGetVersionRequest(server string, deploymentId DeploymentId, versionNumber int32) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "deploymentId", deploymentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithOptions("simple", false, "versionNumber", versionNumber, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "integer", Format: "int32"}) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/deployments/%s/versions/%s", pathParam0, pathParam1) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewListWorkersRequest constructs an http.Request for the ListWorkers method +func NewListWorkersRequest(server string, deploymentId DeploymentId, params *ListWorkersParams) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "deploymentId", deploymentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/deployments/%s/workers", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + // queryValues collects non-styled parameters (passthrough, JSON) + // that are safe to round-trip through url.Values.Encode(). + queryValues := queryURL.Query() + // rawQueryFragments collects pre-encoded query fragments from + // styled parameters, preserving literal commas as delimiters + // per the OpenAPI spec (e.g. "color=blue,black,brown"). + var rawQueryFragments []string + + if params.Limit != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "limit", *params.Limit, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: "int32"}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if params.Cursor != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "cursor", *params.Cursor, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if params.Status != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "status", *params.Status, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if encoded := queryValues.Encode(); encoded != "" { + rawQueryFragments = append(rawQueryFragments, encoded) + } + queryURL.RawQuery = strings.Join(rawQueryFragments, "&") + } + + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewListGpuTypesRequest constructs an http.Request for the ListGpuTypes method +func NewListGpuTypesRequest(server string) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/gpu-types") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewListSecretsRequest constructs an http.Request for the ListSecrets method +func NewListSecretsRequest(server string, params *ListSecretsParams) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/secrets") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + // queryValues collects non-styled parameters (passthrough, JSON) + // that are safe to round-trip through url.Values.Encode(). + queryValues := queryURL.Query() + // rawQueryFragments collects pre-encoded query fragments from + // styled parameters, preserving literal commas as delimiters + // per the OpenAPI spec (e.g. "color=blue,black,brown"). + var rawQueryFragments []string + + if params.Limit != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "limit", *params.Limit, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: "int32"}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if params.Cursor != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "cursor", *params.Cursor, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if encoded := queryValues.Encode(); encoded != "" { + rawQueryFragments = append(rawQueryFragments, encoded) + } + queryURL.RawQuery = strings.Join(rawQueryFragments, "&") + } + + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewCreateSecretRequest calls the generic CreateSecret builder with application/json body +func NewCreateSecretRequest(server string, body CreateSecretJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewCreateSecretRequestWithBody(server, "application/json", bodyReader) +} + +// NewCreateSecretRequestWithBody constructs an http.Request for the CreateSecret method, with any body, and a specified content type +func NewCreateSecretRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/secrets") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest(http.MethodPost, queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewDeleteSecretRequest constructs an http.Request for the DeleteSecret method +func NewDeleteSecretRequest(server string, secretName SecretName) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "secretName", secretName, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/secrets/%s", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest(http.MethodDelete, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewUpdateSecretRequest calls the generic UpdateSecret builder with application/json body +func NewUpdateSecretRequest(server string, secretName SecretName, body UpdateSecretJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewUpdateSecretRequestWithBody(server, secretName, "application/json", bodyReader) +} + +// NewUpdateSecretRequestWithBody constructs an http.Request for the UpdateSecret method, with any body, and a specified content type +func NewUpdateSecretRequestWithBody(server string, secretName SecretName, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithOptions("simple", false, "secretName", secretName, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/secrets/%s", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest(http.MethodPut, queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewListUsageEventsRequest constructs an http.Request for the ListUsageEvents method +func NewListUsageEventsRequest(server string, params *ListUsageEventsParams) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/usage") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + // queryValues collects non-styled parameters (passthrough, JSON) + // that are safe to round-trip through url.Values.Encode(). + queryValues := queryURL.Query() + // rawQueryFragments collects pre-encoded query fragments from + // styled parameters, preserving literal commas as delimiters + // per the OpenAPI spec (e.g. "color=blue,black,brown"). + var rawQueryFragments []string + + if params.Limit != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "limit", *params.Limit, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: "int32"}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if params.Cursor != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "cursor", *params.Cursor, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if params.DeploymentId != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "deploymentId", *params.DeploymentId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: ""}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if params.From != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "from", *params.From, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: "date-time"}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if params.To != nil { + + if queryFrag, err := runtime.StyleParamWithOptions("form", true, "to", *params.To, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "string", Format: "date-time"}); err != nil { + return nil, err + } else { + for _, qp := range strings.Split(queryFrag, "&") { + rawQueryFragments = append(rawQueryFragments, qp) + } + } + + } + + if encoded := queryValues.Encode(); encoded != "" { + rawQueryFragments = append(rawQueryFragments, encoded) + } + queryURL.RawQuery = strings.Join(rawQueryFragments, "&") + } + + req, err := http.NewRequest(http.MethodGet, queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error { + for _, r := range c.RequestEditors { + if err := r(ctx, req); err != nil { + return err + } + } + for _, r := range additionalEditors { + if err := r(ctx, req); err != nil { + return err + } + } + return nil +} + +// ClientWithResponses builds on ClientInterface to offer response payloads +type ClientWithResponses struct { + ClientInterface +} + +// NewClientWithResponses creates a new ClientWithResponses, which wraps +// Client with return type handling +func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error) { + client, err := NewClient(server, opts...) + if err != nil { + return nil, err + } + return &ClientWithResponses{client}, nil +} + +// WithBaseURL overrides the baseURL. +func WithBaseURL(baseURL string) ClientOption { + return func(c *Client) error { + newBaseURL, err := url.Parse(baseURL) + if err != nil { + return err + } + c.Server = newBaseURL.String() + return nil + } +} + +// ClientWithResponsesInterface is the interface specification for the client with responses above. +type ClientWithResponsesInterface interface { + + // GetDeploymentSummaryWithResponse Deployment summary metrics for the authenticated organisation + // + // Aggregate dashboard metrics across all deployments owned by the authenticated organisation. Metrics whose backing system is not yet available are omitted from the response rather than reported as zero. + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with GET /v1/deployment-summary (the `GetDeploymentSummary` operationId). + GetDeploymentSummaryWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetDeploymentSummaryResponse, error) + + // ListDeploymentsWithResponse List deployments + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with GET /v1/deployments (the `ListDeployments` operationId). + ListDeploymentsWithResponse(ctx context.Context, params *ListDeploymentsParams, reqEditors ...RequestEditorFn) (*ListDeploymentsResponse, error) + + // CreateDeploymentWithBodyWithResponse Create a deployment + // + // Creates a deployment together with its worker configuration and endpoints, as declared in the submitted IaC config. The deployment starts in `initializing` and an initial rollout begins immediately based on the deployment source type: + // - `code` source: the codebase is submitted to the build pipeline; once the image is built + // and workers become healthy the deployment transitions to `active`. + // + // - `container` source: the pre-built image is deployed directly with no build step; once + // workers become healthy the deployment transitions to `active`. + // + // If the build, validation, or rollout fails the deployment is marked `failed`. + // + // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). + // + // Corresponds with POST /v1/deployments (the `CreateDeployment` operationId). + CreateDeploymentWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDeploymentResponse, error) + + // CreateDeploymentWithResponse Create a deployment + // + // Creates a deployment together with its worker configuration and endpoints, as declared in the submitted IaC config. The deployment starts in `initializing` and an initial rollout begins immediately based on the deployment source type: + // - `code` source: the codebase is submitted to the build pipeline; once the image is built + // and workers become healthy the deployment transitions to `active`. + // + // - `container` source: the pre-built image is deployed directly with no build step; once + // workers become healthy the deployment transitions to `active`. + // + // If the build, validation, or rollout fails the deployment is marked `failed`. + // + // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). + // + // Corresponds with POST /v1/deployments (the `CreateDeployment` operationId). + CreateDeploymentWithResponse(ctx context.Context, body CreateDeploymentJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDeploymentResponse, error) + + // DeleteDeploymentWithResponse Delete a deployment + // + // Soft delete. Sets `status = deleting` and returns `202` once that intent is persisted. Router removal, cancelling in-progress builds, and worker drain (`draining → stopping → stopped`) are performed asynchronously by the deployer/Scaler; `status` becomes `deleted` once all workers stop. All rows are retained for billing finalisation, audit, and usage history. Idempotent if the deployment is already `deleting`. + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with DELETE /v1/deployments/{deploymentId} (the `DeleteDeployment` operationId). + DeleteDeploymentWithResponse(ctx context.Context, deploymentId DeploymentId, reqEditors ...RequestEditorFn) (*DeleteDeploymentResponse, error) + + // GetDeploymentWithResponse Get a deployment + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with GET /v1/deployments/{deploymentId} (the `GetDeployment` operationId). + GetDeploymentWithResponse(ctx context.Context, deploymentId DeploymentId, reqEditors ...RequestEditorFn) (*GetDeploymentResponse, error) + + // UpdateDeploymentWithBodyWithResponse Update a deployment + // + // Patches one or more aspects of a deployment in place. All fields are optional; omitted fields are left unchanged. Valid in any non-`deleted` status, including `stopped` (changes apply on `resume`). Lifecycle transitions use the dedicated `deploy`, `stop`, `resume`, and `delete` operations. + // **Currently persisted:** `deploymentName` and `configuration` only. Supplying `deploymentSource`, `secrets`, `environmentVariables`, or `endpoints` returns `422` until those stores land. + // Target behaviour (once fully wired): + // - `configuration`: applied on the next Scaler cycle; triggers a rollout so workers + // restart with the new configuration. If the rollout fails, the deployment remains on + // the previous configuration. + // + // - `deploymentSource`: triggers a build (for `code` sources) or image validation (for `container` + // sources); on success the new version is deployed automatically. If the build or + // validation fails, the deployment remains on the previous version. + // + // - `secrets` / `environmentVariables` / `endpoints`: the supplied array **replaces** the + // current set — any item absent from the request is deleted. Endpoints take effect + // immediately. Changes to secrets or environment variables trigger a rollout so workers + // restart and pick up the new values. + // + // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). + // + // Corresponds with PATCH /v1/deployments/{deploymentId} (the `UpdateDeployment` operationId). + UpdateDeploymentWithBodyWithResponse(ctx context.Context, deploymentId DeploymentId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateDeploymentResponse, error) + + // UpdateDeploymentWithResponse Update a deployment + // + // Patches one or more aspects of a deployment in place. All fields are optional; omitted fields are left unchanged. Valid in any non-`deleted` status, including `stopped` (changes apply on `resume`). Lifecycle transitions use the dedicated `deploy`, `stop`, `resume`, and `delete` operations. + // **Currently persisted:** `deploymentName` and `configuration` only. Supplying `deploymentSource`, `secrets`, `environmentVariables`, or `endpoints` returns `422` until those stores land. + // Target behaviour (once fully wired): + // - `configuration`: applied on the next Scaler cycle; triggers a rollout so workers + // restart with the new configuration. If the rollout fails, the deployment remains on + // the previous configuration. + // + // - `deploymentSource`: triggers a build (for `code` sources) or image validation (for `container` + // sources); on success the new version is deployed automatically. If the build or + // validation fails, the deployment remains on the previous version. + // + // - `secrets` / `environmentVariables` / `endpoints`: the supplied array **replaces** the + // current set — any item absent from the request is deleted. Endpoints take effect + // immediately. Changes to secrets or environment variables trigger a rollout so workers + // restart and pick up the new values. + // + // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). + // + // Corresponds with PATCH /v1/deployments/{deploymentId} (the `UpdateDeployment` operationId). + UpdateDeploymentWithResponse(ctx context.Context, deploymentId DeploymentId, body UpdateDeploymentJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateDeploymentResponse, error) + + // ListBuildsWithResponse List builds + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with GET /v1/deployments/{deploymentId}/builds (the `ListBuilds` operationId). + ListBuildsWithResponse(ctx context.Context, deploymentId DeploymentId, params *ListBuildsParams, reqEditors ...RequestEditorFn) (*ListBuildsResponse, error) + + // GetBuildWithResponse Get a build + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with GET /v1/deployments/{deploymentId}/builds/{buildId} (the `GetBuild` operationId). + GetBuildWithResponse(ctx context.Context, deploymentId DeploymentId, buildId openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetBuildResponse, error) + + // DeployVersionWithBodyWithResponse Deploy a version + // + // Activates a `ready` version by number, setting `activeVersionId` and returning `202` once that intent is persisted. Worker rollout, routing switch, and cancelling in-progress builds (`failed` with `error: "superseded"`) are performed asynchronously by the deployer/Scaler. Permitted in any addressable status, including `initializing` and `failed`. + // To roll back, supply an older `versionNumber` — the operation is identical to a forward deploy. + // **Rollout** (deployer/Scaler): the platform starts workers on the target version, waits for at least one to become healthy, switches task routing to the new version, then drains old-version workers gracefully. Old workers are given `gracefulStopTtlSecs` to finish in-flight tasks before being force-terminated. If new workers fail to become healthy, old workers are not drained and the deployment continues on the previous version. + // Errors: - Deploy to a `deleting` deployment returns `409 Conflict` - `versionNumber` not found or not `ready` returns `409 Conflict` - Deploy to a non-existent or `deleted` deployment returns `404 Not Found` + // + // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). + // + // Corresponds with POST /v1/deployments/{deploymentId}/deploy (the `DeployVersion` operationId). + DeployVersionWithBodyWithResponse(ctx context.Context, deploymentId DeploymentId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*DeployVersionResponse, error) + + // DeployVersionWithResponse Deploy a version + // + // Activates a `ready` version by number, setting `activeVersionId` and returning `202` once that intent is persisted. Worker rollout, routing switch, and cancelling in-progress builds (`failed` with `error: "superseded"`) are performed asynchronously by the deployer/Scaler. Permitted in any addressable status, including `initializing` and `failed`. + // To roll back, supply an older `versionNumber` — the operation is identical to a forward deploy. + // **Rollout** (deployer/Scaler): the platform starts workers on the target version, waits for at least one to become healthy, switches task routing to the new version, then drains old-version workers gracefully. Old workers are given `gracefulStopTtlSecs` to finish in-flight tasks before being force-terminated. If new workers fail to become healthy, old workers are not drained and the deployment continues on the previous version. + // Errors: - Deploy to a `deleting` deployment returns `409 Conflict` - `versionNumber` not found or not `ready` returns `409 Conflict` - Deploy to a non-existent or `deleted` deployment returns `404 Not Found` + // + // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). + // + // Corresponds with POST /v1/deployments/{deploymentId}/deploy (the `DeployVersion` operationId). + DeployVersionWithResponse(ctx context.Context, deploymentId DeploymentId, body DeployVersionJSONRequestBody, reqEditors ...RequestEditorFn) (*DeployVersionResponse, error) + + // ListEndpointsWithResponse List endpoints + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with GET /v1/deployments/{deploymentId}/endpoints (the `ListEndpoints` operationId). + ListEndpointsWithResponse(ctx context.Context, deploymentId DeploymentId, params *ListEndpointsParams, reqEditors ...RequestEditorFn) (*ListEndpointsResponse, error) + + // ListDeploymentEnvironmentVariablesWithResponse List deployment environment variables + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with GET /v1/deployments/{deploymentId}/environment-variables (the `ListDeploymentEnvironmentVariables` operationId). + ListDeploymentEnvironmentVariablesWithResponse(ctx context.Context, deploymentId DeploymentId, params *ListDeploymentEnvironmentVariablesParams, reqEditors ...RequestEditorFn) (*ListDeploymentEnvironmentVariablesResponse, error) + + // DeleteDeploymentEnvironmentVariableWithResponse Delete a deployment environment variable + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with DELETE /v1/deployments/{deploymentId}/environment-variables/{variableName} (the `DeleteDeploymentEnvironmentVariable` operationId). + DeleteDeploymentEnvironmentVariableWithResponse(ctx context.Context, deploymentId DeploymentId, variableName string, reqEditors ...RequestEditorFn) (*DeleteDeploymentEnvironmentVariableResponse, error) + + // UpsertDeploymentEnvironmentVariableWithBodyWithResponse Upsert a deployment environment variable + // + // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). + // + // Corresponds with PUT /v1/deployments/{deploymentId}/environment-variables/{variableName} (the `UpsertDeploymentEnvironmentVariable` operationId). + UpsertDeploymentEnvironmentVariableWithBodyWithResponse(ctx context.Context, deploymentId DeploymentId, variableName string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpsertDeploymentEnvironmentVariableResponse, error) + + // UpsertDeploymentEnvironmentVariableWithResponse Upsert a deployment environment variable + // + // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). + // + // Corresponds with PUT /v1/deployments/{deploymentId}/environment-variables/{variableName} (the `UpsertDeploymentEnvironmentVariable` operationId). + UpsertDeploymentEnvironmentVariableWithResponse(ctx context.Context, deploymentId DeploymentId, variableName string, body UpsertDeploymentEnvironmentVariableJSONRequestBody, reqEditors ...RequestEditorFn) (*UpsertDeploymentEnvironmentVariableResponse, error) + + // ListDeploymentEventsWithResponse List deployment events + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with GET /v1/deployments/{deploymentId}/events (the `ListDeploymentEvents` operationId). + ListDeploymentEventsWithResponse(ctx context.Context, deploymentId DeploymentId, params *ListDeploymentEventsParams, reqEditors ...RequestEditorFn) (*ListDeploymentEventsResponse, error) + + // StartAsyncTaskWithBodyWithResponse Start a new async task + // + // Starts a new async task on `deploymentId`, routing the request body payload to an available worker. The task runs asynchronously and the response is `202`; poll `GET /v1/deployments/{deploymentId}/tasks/{taskId}` for completion. + // + // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). + // + // Corresponds with POST /v1/deployments/{deploymentId}/invoke-async/{endpointPath} (the `StartAsyncTask` operationId). + StartAsyncTaskWithBodyWithResponse(ctx context.Context, deploymentId DeploymentId, endpointPath EndpointPath, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*StartAsyncTaskResponse, error) + + // StartAsyncTaskWithResponse Start a new async task + // + // Starts a new async task on `deploymentId`, routing the request body payload to an available worker. The task runs asynchronously and the response is `202`; poll `GET /v1/deployments/{deploymentId}/tasks/{taskId}` for completion. + // + // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). + // + // Corresponds with POST /v1/deployments/{deploymentId}/invoke-async/{endpointPath} (the `StartAsyncTask` operationId). + StartAsyncTaskWithResponse(ctx context.Context, deploymentId DeploymentId, endpointPath EndpointPath, body StartAsyncTaskJSONRequestBody, reqEditors ...RequestEditorFn) (*StartAsyncTaskResponse, error) + + // StartSyncTaskWithBodyWithResponse Start a new sync task + // + // Starts a new sync task on `deploymentId`, routing the request body payload to an available worker. The request blocks until the task is terminal and returns the result inline (`200`), or `504` if it does not complete within the wait window. + // + // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). + // + // Corresponds with POST /v1/deployments/{deploymentId}/invoke-sync/{endpointPath} (the `StartSyncTask` operationId). + StartSyncTaskWithBodyWithResponse(ctx context.Context, deploymentId DeploymentId, endpointPath EndpointPath, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*StartSyncTaskResponse, error) + + // StartSyncTaskWithResponse Start a new sync task + // + // Starts a new sync task on `deploymentId`, routing the request body payload to an available worker. The request blocks until the task is terminal and returns the result inline (`200`), or `504` if it does not complete within the wait window. + // + // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). + // + // Corresponds with POST /v1/deployments/{deploymentId}/invoke-sync/{endpointPath} (the `StartSyncTask` operationId). + StartSyncTaskWithResponse(ctx context.Context, deploymentId DeploymentId, endpointPath EndpointPath, body StartSyncTaskJSONRequestBody, reqEditors ...RequestEditorFn) (*StartSyncTaskResponse, error) + + // ResumeDeploymentWithResponse Resume a deployment + // + // Moves the deployment to `initializing` and returns `202` once that intent is persisted. The Scaler then starts workers and sets the deployment to `active`; tasks queued during the stopped period are consumed as workers come online. Precondition: `status = stopped`. + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with POST /v1/deployments/{deploymentId}/resume (the `ResumeDeployment` operationId). + ResumeDeploymentWithResponse(ctx context.Context, deploymentId DeploymentId, reqEditors ...RequestEditorFn) (*ResumeDeploymentResponse, error) + + // ListDeploymentSecretsWithResponse List secrets attached to a deployment + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with GET /v1/deployments/{deploymentId}/secrets (the `ListDeploymentSecrets` operationId). + ListDeploymentSecretsWithResponse(ctx context.Context, deploymentId DeploymentId, params *ListDeploymentSecretsParams, reqEditors ...RequestEditorFn) (*ListDeploymentSecretsResponse, error) + + // AttachDeploymentSecretWithBodyWithResponse Attach a secret to a deployment + // + // Returns 409 if the secret is already attached to this deployment. + // + // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). + // + // Corresponds with POST /v1/deployments/{deploymentId}/secrets (the `AttachDeploymentSecret` operationId). + AttachDeploymentSecretWithBodyWithResponse(ctx context.Context, deploymentId DeploymentId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AttachDeploymentSecretResponse, error) + + // AttachDeploymentSecretWithResponse Attach a secret to a deployment + // + // Returns 409 if the secret is already attached to this deployment. + // + // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). + // + // Corresponds with POST /v1/deployments/{deploymentId}/secrets (the `AttachDeploymentSecret` operationId). + AttachDeploymentSecretWithResponse(ctx context.Context, deploymentId DeploymentId, body AttachDeploymentSecretJSONRequestBody, reqEditors ...RequestEditorFn) (*AttachDeploymentSecretResponse, error) + + // DetachDeploymentSecretWithResponse Detach a secret from a deployment + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with DELETE /v1/deployments/{deploymentId}/secrets/{secretName} (the `DetachDeploymentSecret` operationId). + DetachDeploymentSecretWithResponse(ctx context.Context, deploymentId DeploymentId, secretName SecretName, reqEditors ...RequestEditorFn) (*DetachDeploymentSecretResponse, error) + + // StopDeploymentWithResponse Stop a deployment + // + // Moves the deployment to `stopping` and returns `202` once that intent is persisted. Scale-to-zero and worker drain are performed asynchronously by the Scaler; `status` becomes `stopped` once all workers drain. In-flight tasks have a grace period (`gracefulStopTtlSecs`) to complete; workers that exceed it are force-terminated and their tasks return to the queue per delivery guarantees. New task submissions are still accepted and queued while stopped, but not consumed. Precondition: `status = active`. + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with POST /v1/deployments/{deploymentId}/stop (the `StopDeployment` operationId). + StopDeploymentWithResponse(ctx context.Context, deploymentId DeploymentId, reqEditors ...RequestEditorFn) (*StopDeploymentResponse, error) + + // ListTasksWithResponse List tasks for a deployment + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with GET /v1/deployments/{deploymentId}/tasks (the `ListTasks` operationId). + ListTasksWithResponse(ctx context.Context, deploymentId DeploymentId, params *ListTasksParams, reqEditors ...RequestEditorFn) (*ListTasksResponse, error) + + // GetTaskWithResponse Get a task + // + // Returns the task's current status, read through the inference transport layer from the shared result store. When `completed`, includes the result `output` and `completedAt`; when `failed`, includes `error`; when `pending`, neither is set. + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with GET /v1/deployments/{deploymentId}/tasks/{taskId} (the `GetTask` operationId). + GetTaskWithResponse(ctx context.Context, deploymentId DeploymentId, taskId string, reqEditors ...RequestEditorFn) (*GetTaskResponse, error) + + // ListVersionsWithResponse List versions + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with GET /v1/deployments/{deploymentId}/versions (the `ListVersions` operationId). + ListVersionsWithResponse(ctx context.Context, deploymentId DeploymentId, params *ListVersionsParams, reqEditors ...RequestEditorFn) (*ListVersionsResponse, error) + + // GetVersionWithResponse Get a version + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with GET /v1/deployments/{deploymentId}/versions/{versionNumber} (the `GetVersion` operationId). + GetVersionWithResponse(ctx context.Context, deploymentId DeploymentId, versionNumber int32, reqEditors ...RequestEditorFn) (*GetVersionResponse, error) + + // ListWorkersWithResponse List workers + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with GET /v1/deployments/{deploymentId}/workers (the `ListWorkers` operationId). + ListWorkersWithResponse(ctx context.Context, deploymentId DeploymentId, params *ListWorkersParams, reqEditors ...RequestEditorFn) (*ListWorkersResponse, error) + + // ListGpuTypesWithResponse List supported GPU types and their pricing + // + // Returns the global GPU type catalogue and pricing. The result is not organisation-specific, but the request still requires authentication. + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with GET /v1/gpu-types (the `ListGpuTypes` operationId). + ListGpuTypesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListGpuTypesResponse, error) + + // ListSecretsWithResponse List secrets + // + // Returns secret metadata only; encrypted values are never returned. + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with GET /v1/secrets (the `ListSecrets` operationId). + ListSecretsWithResponse(ctx context.Context, params *ListSecretsParams, reqEditors ...RequestEditorFn) (*ListSecretsResponse, error) + + // CreateSecretWithBodyWithResponse Create a secret + // + // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). + // + // Corresponds with POST /v1/secrets (the `CreateSecret` operationId). + CreateSecretWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateSecretResponse, error) + + // CreateSecretWithResponse Create a secret + // + // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). + // + // Corresponds with POST /v1/secrets (the `CreateSecret` operationId). + CreateSecretWithResponse(ctx context.Context, body CreateSecretJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateSecretResponse, error) + + // DeleteSecretWithResponse Delete a secret + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with DELETE /v1/secrets/{secretName} (the `DeleteSecret` operationId). + DeleteSecretWithResponse(ctx context.Context, secretName SecretName, reqEditors ...RequestEditorFn) (*DeleteSecretResponse, error) + + // UpdateSecretWithBodyWithResponse Update a secret + // + // Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). + // + // Corresponds with PUT /v1/secrets/{secretName} (the `UpdateSecret` operationId). + UpdateSecretWithBodyWithResponse(ctx context.Context, secretName SecretName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateSecretResponse, error) + + // UpdateSecretWithResponse Update a secret + // + // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). + // + // Corresponds with PUT /v1/secrets/{secretName} (the `UpdateSecret` operationId). + UpdateSecretWithResponse(ctx context.Context, secretName SecretName, body UpdateSecretJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateSecretResponse, error) + + // ListUsageEventsWithResponse List usage events + // + // Append-only billing telemetry; one row per worker state transition. + // + // Returns a wrapper object for the known response body format(s). + // + // Corresponds with GET /v1/usage (the `ListUsageEvents` operationId). + ListUsageEventsWithResponse(ctx context.Context, params *ListUsageEventsParams, reqEditors ...RequestEditorFn) (*ListUsageEventsResponse, error) +} + +type GetDeploymentSummaryResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON200 the response for an HTTP 200 `application/json` response + JSON200 *DeploymentSummary + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden +} + +// GetJSON200 returns the response for an HTTP 200 `application/json` response +func (r GetDeploymentSummaryResponse) GetJSON200() *DeploymentSummary { + return r.JSON200 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r GetDeploymentSummaryResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r GetDeploymentSummaryResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetBody returns the raw response body bytes +func (r GetDeploymentSummaryResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r GetDeploymentSummaryResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetDeploymentSummaryResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r GetDeploymentSummaryResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type ListDeploymentsResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON200 the response for an HTTP 200 `application/json` response + JSON200 *struct { + Data *[]Deployment `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` + } + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden +} + +// GetJSON200 returns the response for an HTTP 200 `application/json` response +func (r ListDeploymentsResponse) GetJSON200() *struct { + Data *[]Deployment `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` +} { + return r.JSON200 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r ListDeploymentsResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r ListDeploymentsResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetBody returns the raw response body bytes +func (r ListDeploymentsResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r ListDeploymentsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ListDeploymentsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r ListDeploymentsResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type CreateDeploymentResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON201 the response for an HTTP 201 `application/json` response + JSON201 *Deployment + // ApplicationproblemJSON400 the response for an HTTP 400 `application/problem+json` response + ApplicationproblemJSON400 *BadRequest + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden + // ApplicationproblemJSON409 the response for an HTTP 409 `application/problem+json` response + ApplicationproblemJSON409 *Conflict + // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response + ApplicationproblemJSON422 *ValidationError +} + +// GetJSON201 returns the response for an HTTP 201 `application/json` response +func (r CreateDeploymentResponse) GetJSON201() *Deployment { + return r.JSON201 +} + +// GetApplicationproblemJSON400 returns the response for an HTTP 400 `application/problem+json` response +func (r CreateDeploymentResponse) GetApplicationproblemJSON400() *BadRequest { + return r.ApplicationproblemJSON400 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r CreateDeploymentResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r CreateDeploymentResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetApplicationproblemJSON409 returns the response for an HTTP 409 `application/problem+json` response +func (r CreateDeploymentResponse) GetApplicationproblemJSON409() *Conflict { + return r.ApplicationproblemJSON409 +} + +// GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response +func (r CreateDeploymentResponse) GetApplicationproblemJSON422() *ValidationError { + return r.ApplicationproblemJSON422 +} + +// GetBody returns the raw response body bytes +func (r CreateDeploymentResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r CreateDeploymentResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r CreateDeploymentResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r CreateDeploymentResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type DeleteDeploymentResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON202 the response for an HTTP 202 `application/json` response + JSON202 *Deployment + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden + // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response + ApplicationproblemJSON404 *NotFound +} + +// GetJSON202 returns the response for an HTTP 202 `application/json` response +func (r DeleteDeploymentResponse) GetJSON202() *Deployment { + return r.JSON202 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r DeleteDeploymentResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r DeleteDeploymentResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response +func (r DeleteDeploymentResponse) GetApplicationproblemJSON404() *NotFound { + return r.ApplicationproblemJSON404 +} + +// GetBody returns the raw response body bytes +func (r DeleteDeploymentResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r DeleteDeploymentResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r DeleteDeploymentResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r DeleteDeploymentResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type GetDeploymentResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON200 the response for an HTTP 200 `application/json` response + JSON200 *Deployment + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden + // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response + ApplicationproblemJSON404 *NotFound +} + +// GetJSON200 returns the response for an HTTP 200 `application/json` response +func (r GetDeploymentResponse) GetJSON200() *Deployment { + return r.JSON200 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r GetDeploymentResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r GetDeploymentResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response +func (r GetDeploymentResponse) GetApplicationproblemJSON404() *NotFound { + return r.ApplicationproblemJSON404 +} + +// GetBody returns the raw response body bytes +func (r GetDeploymentResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r GetDeploymentResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetDeploymentResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r GetDeploymentResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type UpdateDeploymentResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON200 the response for an HTTP 200 `application/json` response + JSON200 *Deployment + // ApplicationproblemJSON400 the response for an HTTP 400 `application/problem+json` response + ApplicationproblemJSON400 *BadRequest + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden + // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response + ApplicationproblemJSON404 *NotFound + // ApplicationproblemJSON409 the response for an HTTP 409 `application/problem+json` response + ApplicationproblemJSON409 *Conflict + // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response + ApplicationproblemJSON422 *ValidationError +} + +// GetJSON200 returns the response for an HTTP 200 `application/json` response +func (r UpdateDeploymentResponse) GetJSON200() *Deployment { + return r.JSON200 +} + +// GetApplicationproblemJSON400 returns the response for an HTTP 400 `application/problem+json` response +func (r UpdateDeploymentResponse) GetApplicationproblemJSON400() *BadRequest { + return r.ApplicationproblemJSON400 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r UpdateDeploymentResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r UpdateDeploymentResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response +func (r UpdateDeploymentResponse) GetApplicationproblemJSON404() *NotFound { + return r.ApplicationproblemJSON404 +} + +// GetApplicationproblemJSON409 returns the response for an HTTP 409 `application/problem+json` response +func (r UpdateDeploymentResponse) GetApplicationproblemJSON409() *Conflict { + return r.ApplicationproblemJSON409 +} + +// GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response +func (r UpdateDeploymentResponse) GetApplicationproblemJSON422() *ValidationError { + return r.ApplicationproblemJSON422 +} + +// GetBody returns the raw response body bytes +func (r UpdateDeploymentResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r UpdateDeploymentResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r UpdateDeploymentResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r UpdateDeploymentResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type ListBuildsResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON200 the response for an HTTP 200 `application/json` response + JSON200 *struct { + Data *[]Build `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` + } + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden + // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response + ApplicationproblemJSON404 *NotFound +} + +// GetJSON200 returns the response for an HTTP 200 `application/json` response +func (r ListBuildsResponse) GetJSON200() *struct { + Data *[]Build `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` +} { + return r.JSON200 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r ListBuildsResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r ListBuildsResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response +func (r ListBuildsResponse) GetApplicationproblemJSON404() *NotFound { + return r.ApplicationproblemJSON404 +} + +// GetBody returns the raw response body bytes +func (r ListBuildsResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r ListBuildsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ListBuildsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r ListBuildsResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type GetBuildResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON200 the response for an HTTP 200 `application/json` response + JSON200 *Build + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden + // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response + ApplicationproblemJSON404 *NotFound +} + +// GetJSON200 returns the response for an HTTP 200 `application/json` response +func (r GetBuildResponse) GetJSON200() *Build { + return r.JSON200 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r GetBuildResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r GetBuildResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response +func (r GetBuildResponse) GetApplicationproblemJSON404() *NotFound { + return r.ApplicationproblemJSON404 +} + +// GetBody returns the raw response body bytes +func (r GetBuildResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r GetBuildResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetBuildResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r GetBuildResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type DeployVersionResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON202 the response for an HTTP 202 `application/json` response + JSON202 *Deployment + // ApplicationproblemJSON400 the response for an HTTP 400 `application/problem+json` response + ApplicationproblemJSON400 *BadRequest + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden + // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response + ApplicationproblemJSON404 *NotFound + // ApplicationproblemJSON409 the response for an HTTP 409 `application/problem+json` response + ApplicationproblemJSON409 *Conflict + // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response + ApplicationproblemJSON422 *ValidationError +} + +// GetJSON202 returns the response for an HTTP 202 `application/json` response +func (r DeployVersionResponse) GetJSON202() *Deployment { + return r.JSON202 +} + +// GetApplicationproblemJSON400 returns the response for an HTTP 400 `application/problem+json` response +func (r DeployVersionResponse) GetApplicationproblemJSON400() *BadRequest { + return r.ApplicationproblemJSON400 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r DeployVersionResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r DeployVersionResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response +func (r DeployVersionResponse) GetApplicationproblemJSON404() *NotFound { + return r.ApplicationproblemJSON404 +} + +// GetApplicationproblemJSON409 returns the response for an HTTP 409 `application/problem+json` response +func (r DeployVersionResponse) GetApplicationproblemJSON409() *Conflict { + return r.ApplicationproblemJSON409 +} + +// GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response +func (r DeployVersionResponse) GetApplicationproblemJSON422() *ValidationError { + return r.ApplicationproblemJSON422 +} + +// GetBody returns the raw response body bytes +func (r DeployVersionResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r DeployVersionResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r DeployVersionResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r DeployVersionResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type ListEndpointsResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON200 the response for an HTTP 200 `application/json` response + JSON200 *struct { + Data *[]Endpoint `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` + } + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden + // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response + ApplicationproblemJSON404 *NotFound +} + +// GetJSON200 returns the response for an HTTP 200 `application/json` response +func (r ListEndpointsResponse) GetJSON200() *struct { + Data *[]Endpoint `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` +} { + return r.JSON200 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r ListEndpointsResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r ListEndpointsResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response +func (r ListEndpointsResponse) GetApplicationproblemJSON404() *NotFound { + return r.ApplicationproblemJSON404 +} + +// GetBody returns the raw response body bytes +func (r ListEndpointsResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r ListEndpointsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ListEndpointsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r ListEndpointsResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type ListDeploymentEnvironmentVariablesResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON200 the response for an HTTP 200 `application/json` response + JSON200 *struct { + Data *[]EnvironmentVariable `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` + } + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden + // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response + ApplicationproblemJSON404 *NotFound +} + +// GetJSON200 returns the response for an HTTP 200 `application/json` response +func (r ListDeploymentEnvironmentVariablesResponse) GetJSON200() *struct { + Data *[]EnvironmentVariable `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` +} { + return r.JSON200 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r ListDeploymentEnvironmentVariablesResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r ListDeploymentEnvironmentVariablesResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response +func (r ListDeploymentEnvironmentVariablesResponse) GetApplicationproblemJSON404() *NotFound { + return r.ApplicationproblemJSON404 +} + +// GetBody returns the raw response body bytes +func (r ListDeploymentEnvironmentVariablesResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r ListDeploymentEnvironmentVariablesResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ListDeploymentEnvironmentVariablesResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r ListDeploymentEnvironmentVariablesResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type DeleteDeploymentEnvironmentVariableResponse struct { + Body []byte + HTTPResponse *http.Response + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden + // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response + ApplicationproblemJSON404 *NotFound +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r DeleteDeploymentEnvironmentVariableResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r DeleteDeploymentEnvironmentVariableResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response +func (r DeleteDeploymentEnvironmentVariableResponse) GetApplicationproblemJSON404() *NotFound { + return r.ApplicationproblemJSON404 +} + +// GetBody returns the raw response body bytes +func (r DeleteDeploymentEnvironmentVariableResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r DeleteDeploymentEnvironmentVariableResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r DeleteDeploymentEnvironmentVariableResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r DeleteDeploymentEnvironmentVariableResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type UpsertDeploymentEnvironmentVariableResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON200 the response for an HTTP 200 `application/json` response + JSON200 *EnvironmentVariable + // ApplicationproblemJSON400 the response for an HTTP 400 `application/problem+json` response + ApplicationproblemJSON400 *BadRequest + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden + // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response + ApplicationproblemJSON404 *NotFound + // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response + ApplicationproblemJSON422 *ValidationError +} + +// GetJSON200 returns the response for an HTTP 200 `application/json` response +func (r UpsertDeploymentEnvironmentVariableResponse) GetJSON200() *EnvironmentVariable { + return r.JSON200 +} + +// GetApplicationproblemJSON400 returns the response for an HTTP 400 `application/problem+json` response +func (r UpsertDeploymentEnvironmentVariableResponse) GetApplicationproblemJSON400() *BadRequest { + return r.ApplicationproblemJSON400 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r UpsertDeploymentEnvironmentVariableResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r UpsertDeploymentEnvironmentVariableResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response +func (r UpsertDeploymentEnvironmentVariableResponse) GetApplicationproblemJSON404() *NotFound { + return r.ApplicationproblemJSON404 +} + +// GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response +func (r UpsertDeploymentEnvironmentVariableResponse) GetApplicationproblemJSON422() *ValidationError { + return r.ApplicationproblemJSON422 +} + +// GetBody returns the raw response body bytes +func (r UpsertDeploymentEnvironmentVariableResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r UpsertDeploymentEnvironmentVariableResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r UpsertDeploymentEnvironmentVariableResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r UpsertDeploymentEnvironmentVariableResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type ListDeploymentEventsResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON200 the response for an HTTP 200 `application/json` response + JSON200 *struct { + Data *[]DeploymentEvent `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` + } + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden + // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response + ApplicationproblemJSON404 *NotFound +} + +// GetJSON200 returns the response for an HTTP 200 `application/json` response +func (r ListDeploymentEventsResponse) GetJSON200() *struct { + Data *[]DeploymentEvent `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` +} { + return r.JSON200 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r ListDeploymentEventsResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r ListDeploymentEventsResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response +func (r ListDeploymentEventsResponse) GetApplicationproblemJSON404() *NotFound { + return r.ApplicationproblemJSON404 +} + +// GetBody returns the raw response body bytes +func (r ListDeploymentEventsResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r ListDeploymentEventsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ListDeploymentEventsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r ListDeploymentEventsResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type StartAsyncTaskResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON202 the response for an HTTP 202 `application/json` response + JSON202 *TaskAccepted + // ApplicationproblemJSON400 the response for an HTTP 400 `application/problem+json` response + ApplicationproblemJSON400 *BadRequest + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden + // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response + ApplicationproblemJSON404 *NotFound + // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response + ApplicationproblemJSON422 *ValidationError +} + +// GetJSON202 returns the response for an HTTP 202 `application/json` response +func (r StartAsyncTaskResponse) GetJSON202() *TaskAccepted { + return r.JSON202 +} + +// GetApplicationproblemJSON400 returns the response for an HTTP 400 `application/problem+json` response +func (r StartAsyncTaskResponse) GetApplicationproblemJSON400() *BadRequest { + return r.ApplicationproblemJSON400 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r StartAsyncTaskResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r StartAsyncTaskResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response +func (r StartAsyncTaskResponse) GetApplicationproblemJSON404() *NotFound { + return r.ApplicationproblemJSON404 +} + +// GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response +func (r StartAsyncTaskResponse) GetApplicationproblemJSON422() *ValidationError { + return r.ApplicationproblemJSON422 +} + +// GetBody returns the raw response body bytes +func (r StartAsyncTaskResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r StartAsyncTaskResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r StartAsyncTaskResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r StartAsyncTaskResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type StartSyncTaskResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON200 the response for an HTTP 200 `application/json` response + JSON200 *Task + // ApplicationproblemJSON400 the response for an HTTP 400 `application/problem+json` response + ApplicationproblemJSON400 *BadRequest + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden + // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response + ApplicationproblemJSON404 *NotFound + // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response + ApplicationproblemJSON422 *ValidationError + // ApplicationproblemJSON504 the response for an HTTP 504 `application/problem+json` response + ApplicationproblemJSON504 *Timeout +} + +// GetJSON200 returns the response for an HTTP 200 `application/json` response +func (r StartSyncTaskResponse) GetJSON200() *Task { + return r.JSON200 +} + +// GetApplicationproblemJSON400 returns the response for an HTTP 400 `application/problem+json` response +func (r StartSyncTaskResponse) GetApplicationproblemJSON400() *BadRequest { + return r.ApplicationproblemJSON400 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r StartSyncTaskResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r StartSyncTaskResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response +func (r StartSyncTaskResponse) GetApplicationproblemJSON404() *NotFound { + return r.ApplicationproblemJSON404 +} + +// GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response +func (r StartSyncTaskResponse) GetApplicationproblemJSON422() *ValidationError { + return r.ApplicationproblemJSON422 +} + +// GetApplicationproblemJSON504 returns the response for an HTTP 504 `application/problem+json` response +func (r StartSyncTaskResponse) GetApplicationproblemJSON504() *Timeout { + return r.ApplicationproblemJSON504 +} + +// GetBody returns the raw response body bytes +func (r StartSyncTaskResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r StartSyncTaskResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r StartSyncTaskResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r StartSyncTaskResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type ResumeDeploymentResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON202 the response for an HTTP 202 `application/json` response + JSON202 *Deployment + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden + // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response + ApplicationproblemJSON404 *NotFound + // ApplicationproblemJSON409 the response for an HTTP 409 `application/problem+json` response + ApplicationproblemJSON409 *Conflict +} + +// GetJSON202 returns the response for an HTTP 202 `application/json` response +func (r ResumeDeploymentResponse) GetJSON202() *Deployment { + return r.JSON202 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r ResumeDeploymentResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r ResumeDeploymentResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response +func (r ResumeDeploymentResponse) GetApplicationproblemJSON404() *NotFound { + return r.ApplicationproblemJSON404 +} + +// GetApplicationproblemJSON409 returns the response for an HTTP 409 `application/problem+json` response +func (r ResumeDeploymentResponse) GetApplicationproblemJSON409() *Conflict { + return r.ApplicationproblemJSON409 +} + +// GetBody returns the raw response body bytes +func (r ResumeDeploymentResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r ResumeDeploymentResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ResumeDeploymentResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r ResumeDeploymentResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type ListDeploymentSecretsResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON200 the response for an HTTP 200 `application/json` response + JSON200 *struct { + Data *[]Secret `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` + } + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden + // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response + ApplicationproblemJSON404 *NotFound +} + +// GetJSON200 returns the response for an HTTP 200 `application/json` response +func (r ListDeploymentSecretsResponse) GetJSON200() *struct { + Data *[]Secret `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` +} { + return r.JSON200 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r ListDeploymentSecretsResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r ListDeploymentSecretsResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response +func (r ListDeploymentSecretsResponse) GetApplicationproblemJSON404() *NotFound { + return r.ApplicationproblemJSON404 +} + +// GetBody returns the raw response body bytes +func (r ListDeploymentSecretsResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r ListDeploymentSecretsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ListDeploymentSecretsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r ListDeploymentSecretsResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type AttachDeploymentSecretResponse struct { + Body []byte + HTTPResponse *http.Response + // ApplicationproblemJSON400 the response for an HTTP 400 `application/problem+json` response + ApplicationproblemJSON400 *BadRequest + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden + // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response + ApplicationproblemJSON404 *NotFound + // ApplicationproblemJSON409 the response for an HTTP 409 `application/problem+json` response + ApplicationproblemJSON409 *Conflict + // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response + ApplicationproblemJSON422 *ValidationError +} + +// GetApplicationproblemJSON400 returns the response for an HTTP 400 `application/problem+json` response +func (r AttachDeploymentSecretResponse) GetApplicationproblemJSON400() *BadRequest { + return r.ApplicationproblemJSON400 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r AttachDeploymentSecretResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r AttachDeploymentSecretResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response +func (r AttachDeploymentSecretResponse) GetApplicationproblemJSON404() *NotFound { + return r.ApplicationproblemJSON404 +} + +// GetApplicationproblemJSON409 returns the response for an HTTP 409 `application/problem+json` response +func (r AttachDeploymentSecretResponse) GetApplicationproblemJSON409() *Conflict { + return r.ApplicationproblemJSON409 +} + +// GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response +func (r AttachDeploymentSecretResponse) GetApplicationproblemJSON422() *ValidationError { + return r.ApplicationproblemJSON422 +} + +// GetBody returns the raw response body bytes +func (r AttachDeploymentSecretResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r AttachDeploymentSecretResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r AttachDeploymentSecretResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r AttachDeploymentSecretResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type DetachDeploymentSecretResponse struct { + Body []byte + HTTPResponse *http.Response + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden + // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response + ApplicationproblemJSON404 *NotFound +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r DetachDeploymentSecretResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r DetachDeploymentSecretResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response +func (r DetachDeploymentSecretResponse) GetApplicationproblemJSON404() *NotFound { + return r.ApplicationproblemJSON404 +} + +// GetBody returns the raw response body bytes +func (r DetachDeploymentSecretResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r DetachDeploymentSecretResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r DetachDeploymentSecretResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r DetachDeploymentSecretResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type StopDeploymentResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON202 the response for an HTTP 202 `application/json` response + JSON202 *Deployment + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden + // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response + ApplicationproblemJSON404 *NotFound + // ApplicationproblemJSON409 the response for an HTTP 409 `application/problem+json` response + ApplicationproblemJSON409 *Conflict +} + +// GetJSON202 returns the response for an HTTP 202 `application/json` response +func (r StopDeploymentResponse) GetJSON202() *Deployment { + return r.JSON202 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r StopDeploymentResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r StopDeploymentResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response +func (r StopDeploymentResponse) GetApplicationproblemJSON404() *NotFound { + return r.ApplicationproblemJSON404 +} + +// GetApplicationproblemJSON409 returns the response for an HTTP 409 `application/problem+json` response +func (r StopDeploymentResponse) GetApplicationproblemJSON409() *Conflict { + return r.ApplicationproblemJSON409 +} + +// GetBody returns the raw response body bytes +func (r StopDeploymentResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r StopDeploymentResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r StopDeploymentResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r StopDeploymentResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type ListTasksResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON200 the response for an HTTP 200 `application/json` response + JSON200 *struct { + Data *[]Task `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` + } + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden + // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response + ApplicationproblemJSON404 *NotFound +} + +// GetJSON200 returns the response for an HTTP 200 `application/json` response +func (r ListTasksResponse) GetJSON200() *struct { + Data *[]Task `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` +} { + return r.JSON200 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r ListTasksResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r ListTasksResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response +func (r ListTasksResponse) GetApplicationproblemJSON404() *NotFound { + return r.ApplicationproblemJSON404 +} + +// GetBody returns the raw response body bytes +func (r ListTasksResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r ListTasksResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ListTasksResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r ListTasksResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type GetTaskResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON200 the response for an HTTP 200 `application/json` response + JSON200 *Task + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden + // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response + ApplicationproblemJSON404 *NotFound +} + +// GetJSON200 returns the response for an HTTP 200 `application/json` response +func (r GetTaskResponse) GetJSON200() *Task { + return r.JSON200 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r GetTaskResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r GetTaskResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response +func (r GetTaskResponse) GetApplicationproblemJSON404() *NotFound { + return r.ApplicationproblemJSON404 +} + +// GetBody returns the raw response body bytes +func (r GetTaskResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r GetTaskResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetTaskResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r GetTaskResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type ListVersionsResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON200 the response for an HTTP 200 `application/json` response + JSON200 *struct { + Data *[]Version `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` + } + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden + // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response + ApplicationproblemJSON404 *NotFound +} + +// GetJSON200 returns the response for an HTTP 200 `application/json` response +func (r ListVersionsResponse) GetJSON200() *struct { + Data *[]Version `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` +} { + return r.JSON200 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r ListVersionsResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r ListVersionsResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response +func (r ListVersionsResponse) GetApplicationproblemJSON404() *NotFound { + return r.ApplicationproblemJSON404 +} + +// GetBody returns the raw response body bytes +func (r ListVersionsResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r ListVersionsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ListVersionsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r ListVersionsResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type GetVersionResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON200 the response for an HTTP 200 `application/json` response + JSON200 *Version + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden + // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response + ApplicationproblemJSON404 *NotFound +} + +// GetJSON200 returns the response for an HTTP 200 `application/json` response +func (r GetVersionResponse) GetJSON200() *Version { + return r.JSON200 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r GetVersionResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r GetVersionResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response +func (r GetVersionResponse) GetApplicationproblemJSON404() *NotFound { + return r.ApplicationproblemJSON404 +} + +// GetBody returns the raw response body bytes +func (r GetVersionResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r GetVersionResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetVersionResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r GetVersionResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type ListWorkersResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON200 the response for an HTTP 200 `application/json` response + JSON200 *struct { + Data *[]Worker `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` + } + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden + // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response + ApplicationproblemJSON404 *NotFound +} + +// GetJSON200 returns the response for an HTTP 200 `application/json` response +func (r ListWorkersResponse) GetJSON200() *struct { + Data *[]Worker `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` +} { + return r.JSON200 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r ListWorkersResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r ListWorkersResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response +func (r ListWorkersResponse) GetApplicationproblemJSON404() *NotFound { + return r.ApplicationproblemJSON404 +} + +// GetBody returns the raw response body bytes +func (r ListWorkersResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r ListWorkersResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ListWorkersResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r ListWorkersResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type ListGpuTypesResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON200 the response for an HTTP 200 `application/json` response + JSON200 *GpuTypeList + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden +} + +// GetJSON200 returns the response for an HTTP 200 `application/json` response +func (r ListGpuTypesResponse) GetJSON200() *GpuTypeList { + return r.JSON200 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r ListGpuTypesResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r ListGpuTypesResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetBody returns the raw response body bytes +func (r ListGpuTypesResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r ListGpuTypesResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ListGpuTypesResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r ListGpuTypesResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type ListSecretsResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON200 the response for an HTTP 200 `application/json` response + JSON200 *struct { + Data *[]Secret `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` + } + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden +} + +// GetJSON200 returns the response for an HTTP 200 `application/json` response +func (r ListSecretsResponse) GetJSON200() *struct { + Data *[]Secret `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` +} { + return r.JSON200 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r ListSecretsResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r ListSecretsResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetBody returns the raw response body bytes +func (r ListSecretsResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r ListSecretsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ListSecretsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r ListSecretsResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type CreateSecretResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON201 the response for an HTTP 201 `application/json` response + JSON201 *Secret + // ApplicationproblemJSON400 the response for an HTTP 400 `application/problem+json` response + ApplicationproblemJSON400 *BadRequest + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden + // ApplicationproblemJSON409 the response for an HTTP 409 `application/problem+json` response + ApplicationproblemJSON409 *Conflict + // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response + ApplicationproblemJSON422 *ValidationError +} + +// GetJSON201 returns the response for an HTTP 201 `application/json` response +func (r CreateSecretResponse) GetJSON201() *Secret { + return r.JSON201 +} + +// GetApplicationproblemJSON400 returns the response for an HTTP 400 `application/problem+json` response +func (r CreateSecretResponse) GetApplicationproblemJSON400() *BadRequest { + return r.ApplicationproblemJSON400 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r CreateSecretResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r CreateSecretResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetApplicationproblemJSON409 returns the response for an HTTP 409 `application/problem+json` response +func (r CreateSecretResponse) GetApplicationproblemJSON409() *Conflict { + return r.ApplicationproblemJSON409 +} + +// GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response +func (r CreateSecretResponse) GetApplicationproblemJSON422() *ValidationError { + return r.ApplicationproblemJSON422 +} + +// GetBody returns the raw response body bytes +func (r CreateSecretResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r CreateSecretResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r CreateSecretResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r CreateSecretResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type DeleteSecretResponse struct { + Body []byte + HTTPResponse *http.Response + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden + // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response + ApplicationproblemJSON404 *NotFound +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r DeleteSecretResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r DeleteSecretResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response +func (r DeleteSecretResponse) GetApplicationproblemJSON404() *NotFound { + return r.ApplicationproblemJSON404 +} + +// GetBody returns the raw response body bytes +func (r DeleteSecretResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r DeleteSecretResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r DeleteSecretResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r DeleteSecretResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type UpdateSecretResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON200 the response for an HTTP 200 `application/json` response + JSON200 *Secret + // ApplicationproblemJSON400 the response for an HTTP 400 `application/problem+json` response + ApplicationproblemJSON400 *BadRequest + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden + // ApplicationproblemJSON404 the response for an HTTP 404 `application/problem+json` response + ApplicationproblemJSON404 *NotFound + // ApplicationproblemJSON422 the response for an HTTP 422 `application/problem+json` response + ApplicationproblemJSON422 *ValidationError +} + +// GetJSON200 returns the response for an HTTP 200 `application/json` response +func (r UpdateSecretResponse) GetJSON200() *Secret { + return r.JSON200 +} + +// GetApplicationproblemJSON400 returns the response for an HTTP 400 `application/problem+json` response +func (r UpdateSecretResponse) GetApplicationproblemJSON400() *BadRequest { + return r.ApplicationproblemJSON400 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r UpdateSecretResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r UpdateSecretResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetApplicationproblemJSON404 returns the response for an HTTP 404 `application/problem+json` response +func (r UpdateSecretResponse) GetApplicationproblemJSON404() *NotFound { + return r.ApplicationproblemJSON404 +} + +// GetApplicationproblemJSON422 returns the response for an HTTP 422 `application/problem+json` response +func (r UpdateSecretResponse) GetApplicationproblemJSON422() *ValidationError { + return r.ApplicationproblemJSON422 +} + +// GetBody returns the raw response body bytes +func (r UpdateSecretResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r UpdateSecretResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r UpdateSecretResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r UpdateSecretResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +type ListUsageEventsResponse struct { + Body []byte + HTTPResponse *http.Response + // JSON200 the response for an HTTP 200 `application/json` response + JSON200 *struct { + Data *[]UsageEvent `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` + } + // ApplicationproblemJSON401 the response for an HTTP 401 `application/problem+json` response + ApplicationproblemJSON401 *Unauthorized + // ApplicationproblemJSON403 the response for an HTTP 403 `application/problem+json` response + ApplicationproblemJSON403 *Forbidden +} + +// GetJSON200 returns the response for an HTTP 200 `application/json` response +func (r ListUsageEventsResponse) GetJSON200() *struct { + Data *[]UsageEvent `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` +} { + return r.JSON200 +} + +// GetApplicationproblemJSON401 returns the response for an HTTP 401 `application/problem+json` response +func (r ListUsageEventsResponse) GetApplicationproblemJSON401() *Unauthorized { + return r.ApplicationproblemJSON401 +} + +// GetApplicationproblemJSON403 returns the response for an HTTP 403 `application/problem+json` response +func (r ListUsageEventsResponse) GetApplicationproblemJSON403() *Forbidden { + return r.ApplicationproblemJSON403 +} + +// GetBody returns the raw response body bytes +func (r ListUsageEventsResponse) GetBody() []byte { + return r.Body +} + +// Status returns HTTPResponse.Status +func (r ListUsageEventsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ListUsageEventsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers +func (r ListUsageEventsResponse) ContentType() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Header.Get("Content-Type") + } + return "" +} + +// GetDeploymentSummaryWithResponse Deployment summary metrics for the authenticated organisation +// +// Aggregate dashboard metrics across all deployments owned by the authenticated organisation. Metrics whose backing system is not yet available are omitted from the response rather than reported as zero. +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with GET /v1/deployment-summary (the `GetDeploymentSummary` operationId). +func (c *ClientWithResponses) GetDeploymentSummaryWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetDeploymentSummaryResponse, error) { + rsp, err := c.GetDeploymentSummary(ctx, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetDeploymentSummaryResponse(rsp) +} + +// ListDeploymentsWithResponse List deployments +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with GET /v1/deployments (the `ListDeployments` operationId). +func (c *ClientWithResponses) ListDeploymentsWithResponse(ctx context.Context, params *ListDeploymentsParams, reqEditors ...RequestEditorFn) (*ListDeploymentsResponse, error) { + rsp, err := c.ListDeployments(ctx, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseListDeploymentsResponse(rsp) +} + +// CreateDeploymentWithBodyWithResponse Create a deployment +// +// Creates a deployment together with its worker configuration and endpoints, as declared in the submitted IaC config. The deployment starts in `initializing` and an initial rollout begins immediately based on the deployment source type: +// +// - `code` source: the codebase is submitted to the build pipeline; once the image is built +// and workers become healthy the deployment transitions to `active`. +// +// - `container` source: the pre-built image is deployed directly with no build step; once +// workers become healthy the deployment transitions to `active`. +// +// If the build, validation, or rollout fails the deployment is marked `failed`. +// +// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). +// +// Corresponds with POST /v1/deployments (the `CreateDeployment` operationId). +func (c *ClientWithResponses) CreateDeploymentWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDeploymentResponse, error) { + rsp, err := c.CreateDeploymentWithBody(ctx, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseCreateDeploymentResponse(rsp) +} + +// CreateDeploymentWithResponse Create a deployment +// +// Creates a deployment together with its worker configuration and endpoints, as declared in the submitted IaC config. The deployment starts in `initializing` and an initial rollout begins immediately based on the deployment source type: +// +// - `code` source: the codebase is submitted to the build pipeline; once the image is built +// and workers become healthy the deployment transitions to `active`. +// +// - `container` source: the pre-built image is deployed directly with no build step; once +// workers become healthy the deployment transitions to `active`. +// +// If the build, validation, or rollout fails the deployment is marked `failed`. +// +// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). +// +// Corresponds with POST /v1/deployments (the `CreateDeployment` operationId). +func (c *ClientWithResponses) CreateDeploymentWithResponse(ctx context.Context, body CreateDeploymentJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDeploymentResponse, error) { + rsp, err := c.CreateDeployment(ctx, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseCreateDeploymentResponse(rsp) +} + +// DeleteDeploymentWithResponse Delete a deployment +// +// Soft delete. Sets `status = deleting` and returns `202` once that intent is persisted. Router removal, cancelling in-progress builds, and worker drain (`draining → stopping → stopped`) are performed asynchronously by the deployer/Scaler; `status` becomes `deleted` once all workers stop. All rows are retained for billing finalisation, audit, and usage history. Idempotent if the deployment is already `deleting`. +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with DELETE /v1/deployments/{deploymentId} (the `DeleteDeployment` operationId). +func (c *ClientWithResponses) DeleteDeploymentWithResponse(ctx context.Context, deploymentId DeploymentId, reqEditors ...RequestEditorFn) (*DeleteDeploymentResponse, error) { + rsp, err := c.DeleteDeployment(ctx, deploymentId, reqEditors...) + if err != nil { + return nil, err + } + return ParseDeleteDeploymentResponse(rsp) +} + +// GetDeploymentWithResponse Get a deployment +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with GET /v1/deployments/{deploymentId} (the `GetDeployment` operationId). +func (c *ClientWithResponses) GetDeploymentWithResponse(ctx context.Context, deploymentId DeploymentId, reqEditors ...RequestEditorFn) (*GetDeploymentResponse, error) { + rsp, err := c.GetDeployment(ctx, deploymentId, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetDeploymentResponse(rsp) +} + +// UpdateDeploymentWithBodyWithResponse Update a deployment +// +// Patches one or more aspects of a deployment in place. All fields are optional; omitted fields are left unchanged. Valid in any non-`deleted` status, including `stopped` (changes apply on `resume`). Lifecycle transitions use the dedicated `deploy`, `stop`, `resume`, and `delete` operations. +// **Currently persisted:** `deploymentName` and `configuration` only. Supplying `deploymentSource`, `secrets`, `environmentVariables`, or `endpoints` returns `422` until those stores land. +// Target behaviour (once fully wired): +// +// - `configuration`: applied on the next Scaler cycle; triggers a rollout so workers +// restart with the new configuration. If the rollout fails, the deployment remains on +// the previous configuration. +// +// - `deploymentSource`: triggers a build (for `code` sources) or image validation (for `container` +// sources); on success the new version is deployed automatically. If the build or +// validation fails, the deployment remains on the previous version. +// +// - `secrets` / `environmentVariables` / `endpoints`: the supplied array **replaces** the +// current set — any item absent from the request is deleted. Endpoints take effect +// immediately. Changes to secrets or environment variables trigger a rollout so workers +// restart and pick up the new values. +// +// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). +// +// Corresponds with PATCH /v1/deployments/{deploymentId} (the `UpdateDeployment` operationId). +func (c *ClientWithResponses) UpdateDeploymentWithBodyWithResponse(ctx context.Context, deploymentId DeploymentId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateDeploymentResponse, error) { + rsp, err := c.UpdateDeploymentWithBody(ctx, deploymentId, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseUpdateDeploymentResponse(rsp) +} + +// UpdateDeploymentWithResponse Update a deployment +// +// Patches one or more aspects of a deployment in place. All fields are optional; omitted fields are left unchanged. Valid in any non-`deleted` status, including `stopped` (changes apply on `resume`). Lifecycle transitions use the dedicated `deploy`, `stop`, `resume`, and `delete` operations. +// **Currently persisted:** `deploymentName` and `configuration` only. Supplying `deploymentSource`, `secrets`, `environmentVariables`, or `endpoints` returns `422` until those stores land. +// Target behaviour (once fully wired): +// +// - `configuration`: applied on the next Scaler cycle; triggers a rollout so workers +// restart with the new configuration. If the rollout fails, the deployment remains on +// the previous configuration. +// +// - `deploymentSource`: triggers a build (for `code` sources) or image validation (for `container` +// sources); on success the new version is deployed automatically. If the build or +// validation fails, the deployment remains on the previous version. +// +// - `secrets` / `environmentVariables` / `endpoints`: the supplied array **replaces** the +// current set — any item absent from the request is deleted. Endpoints take effect +// immediately. Changes to secrets or environment variables trigger a rollout so workers +// restart and pick up the new values. +// +// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). +// +// Corresponds with PATCH /v1/deployments/{deploymentId} (the `UpdateDeployment` operationId). +func (c *ClientWithResponses) UpdateDeploymentWithResponse(ctx context.Context, deploymentId DeploymentId, body UpdateDeploymentJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateDeploymentResponse, error) { + rsp, err := c.UpdateDeployment(ctx, deploymentId, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseUpdateDeploymentResponse(rsp) +} + +// ListBuildsWithResponse List builds +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with GET /v1/deployments/{deploymentId}/builds (the `ListBuilds` operationId). +func (c *ClientWithResponses) ListBuildsWithResponse(ctx context.Context, deploymentId DeploymentId, params *ListBuildsParams, reqEditors ...RequestEditorFn) (*ListBuildsResponse, error) { + rsp, err := c.ListBuilds(ctx, deploymentId, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseListBuildsResponse(rsp) +} + +// GetBuildWithResponse Get a build +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with GET /v1/deployments/{deploymentId}/builds/{buildId} (the `GetBuild` operationId). +func (c *ClientWithResponses) GetBuildWithResponse(ctx context.Context, deploymentId DeploymentId, buildId openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetBuildResponse, error) { + rsp, err := c.GetBuild(ctx, deploymentId, buildId, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetBuildResponse(rsp) +} + +// DeployVersionWithBodyWithResponse Deploy a version +// +// Activates a `ready` version by number, setting `activeVersionId` and returning `202` once that intent is persisted. Worker rollout, routing switch, and cancelling in-progress builds (`failed` with `error: "superseded"`) are performed asynchronously by the deployer/Scaler. Permitted in any addressable status, including `initializing` and `failed`. +// To roll back, supply an older `versionNumber` — the operation is identical to a forward deploy. +// **Rollout** (deployer/Scaler): the platform starts workers on the target version, waits for at least one to become healthy, switches task routing to the new version, then drains old-version workers gracefully. Old workers are given `gracefulStopTtlSecs` to finish in-flight tasks before being force-terminated. If new workers fail to become healthy, old workers are not drained and the deployment continues on the previous version. +// Errors: - Deploy to a `deleting` deployment returns `409 Conflict` - `versionNumber` not found or not `ready` returns `409 Conflict` - Deploy to a non-existent or `deleted` deployment returns `404 Not Found` +// +// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). +// +// Corresponds with POST /v1/deployments/{deploymentId}/deploy (the `DeployVersion` operationId). +func (c *ClientWithResponses) DeployVersionWithBodyWithResponse(ctx context.Context, deploymentId DeploymentId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*DeployVersionResponse, error) { + rsp, err := c.DeployVersionWithBody(ctx, deploymentId, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseDeployVersionResponse(rsp) +} + +// DeployVersionWithResponse Deploy a version +// +// Activates a `ready` version by number, setting `activeVersionId` and returning `202` once that intent is persisted. Worker rollout, routing switch, and cancelling in-progress builds (`failed` with `error: "superseded"`) are performed asynchronously by the deployer/Scaler. Permitted in any addressable status, including `initializing` and `failed`. +// To roll back, supply an older `versionNumber` — the operation is identical to a forward deploy. +// **Rollout** (deployer/Scaler): the platform starts workers on the target version, waits for at least one to become healthy, switches task routing to the new version, then drains old-version workers gracefully. Old workers are given `gracefulStopTtlSecs` to finish in-flight tasks before being force-terminated. If new workers fail to become healthy, old workers are not drained and the deployment continues on the previous version. +// Errors: - Deploy to a `deleting` deployment returns `409 Conflict` - `versionNumber` not found or not `ready` returns `409 Conflict` - Deploy to a non-existent or `deleted` deployment returns `404 Not Found` +// +// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). +// +// Corresponds with POST /v1/deployments/{deploymentId}/deploy (the `DeployVersion` operationId). +func (c *ClientWithResponses) DeployVersionWithResponse(ctx context.Context, deploymentId DeploymentId, body DeployVersionJSONRequestBody, reqEditors ...RequestEditorFn) (*DeployVersionResponse, error) { + rsp, err := c.DeployVersion(ctx, deploymentId, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseDeployVersionResponse(rsp) +} + +// ListEndpointsWithResponse List endpoints +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with GET /v1/deployments/{deploymentId}/endpoints (the `ListEndpoints` operationId). +func (c *ClientWithResponses) ListEndpointsWithResponse(ctx context.Context, deploymentId DeploymentId, params *ListEndpointsParams, reqEditors ...RequestEditorFn) (*ListEndpointsResponse, error) { + rsp, err := c.ListEndpoints(ctx, deploymentId, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseListEndpointsResponse(rsp) +} + +// ListDeploymentEnvironmentVariablesWithResponse List deployment environment variables +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with GET /v1/deployments/{deploymentId}/environment-variables (the `ListDeploymentEnvironmentVariables` operationId). +func (c *ClientWithResponses) ListDeploymentEnvironmentVariablesWithResponse(ctx context.Context, deploymentId DeploymentId, params *ListDeploymentEnvironmentVariablesParams, reqEditors ...RequestEditorFn) (*ListDeploymentEnvironmentVariablesResponse, error) { + rsp, err := c.ListDeploymentEnvironmentVariables(ctx, deploymentId, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseListDeploymentEnvironmentVariablesResponse(rsp) +} + +// DeleteDeploymentEnvironmentVariableWithResponse Delete a deployment environment variable +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with DELETE /v1/deployments/{deploymentId}/environment-variables/{variableName} (the `DeleteDeploymentEnvironmentVariable` operationId). +func (c *ClientWithResponses) DeleteDeploymentEnvironmentVariableWithResponse(ctx context.Context, deploymentId DeploymentId, variableName string, reqEditors ...RequestEditorFn) (*DeleteDeploymentEnvironmentVariableResponse, error) { + rsp, err := c.DeleteDeploymentEnvironmentVariable(ctx, deploymentId, variableName, reqEditors...) + if err != nil { + return nil, err + } + return ParseDeleteDeploymentEnvironmentVariableResponse(rsp) +} + +// UpsertDeploymentEnvironmentVariableWithBodyWithResponse Upsert a deployment environment variable +// +// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). +// +// Corresponds with PUT /v1/deployments/{deploymentId}/environment-variables/{variableName} (the `UpsertDeploymentEnvironmentVariable` operationId). +func (c *ClientWithResponses) UpsertDeploymentEnvironmentVariableWithBodyWithResponse(ctx context.Context, deploymentId DeploymentId, variableName string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpsertDeploymentEnvironmentVariableResponse, error) { + rsp, err := c.UpsertDeploymentEnvironmentVariableWithBody(ctx, deploymentId, variableName, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseUpsertDeploymentEnvironmentVariableResponse(rsp) +} + +// UpsertDeploymentEnvironmentVariableWithResponse Upsert a deployment environment variable +// +// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). +// +// Corresponds with PUT /v1/deployments/{deploymentId}/environment-variables/{variableName} (the `UpsertDeploymentEnvironmentVariable` operationId). +func (c *ClientWithResponses) UpsertDeploymentEnvironmentVariableWithResponse(ctx context.Context, deploymentId DeploymentId, variableName string, body UpsertDeploymentEnvironmentVariableJSONRequestBody, reqEditors ...RequestEditorFn) (*UpsertDeploymentEnvironmentVariableResponse, error) { + rsp, err := c.UpsertDeploymentEnvironmentVariable(ctx, deploymentId, variableName, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseUpsertDeploymentEnvironmentVariableResponse(rsp) +} + +// ListDeploymentEventsWithResponse List deployment events +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with GET /v1/deployments/{deploymentId}/events (the `ListDeploymentEvents` operationId). +func (c *ClientWithResponses) ListDeploymentEventsWithResponse(ctx context.Context, deploymentId DeploymentId, params *ListDeploymentEventsParams, reqEditors ...RequestEditorFn) (*ListDeploymentEventsResponse, error) { + rsp, err := c.ListDeploymentEvents(ctx, deploymentId, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseListDeploymentEventsResponse(rsp) +} + +// StartAsyncTaskWithBodyWithResponse Start a new async task +// +// Starts a new async task on `deploymentId`, routing the request body payload to an available worker. The task runs asynchronously and the response is `202`; poll `GET /v1/deployments/{deploymentId}/tasks/{taskId}` for completion. +// +// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). +// +// Corresponds with POST /v1/deployments/{deploymentId}/invoke-async/{endpointPath} (the `StartAsyncTask` operationId). +func (c *ClientWithResponses) StartAsyncTaskWithBodyWithResponse(ctx context.Context, deploymentId DeploymentId, endpointPath EndpointPath, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*StartAsyncTaskResponse, error) { + rsp, err := c.StartAsyncTaskWithBody(ctx, deploymentId, endpointPath, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseStartAsyncTaskResponse(rsp) +} + +// StartAsyncTaskWithResponse Start a new async task +// +// Starts a new async task on `deploymentId`, routing the request body payload to an available worker. The task runs asynchronously and the response is `202`; poll `GET /v1/deployments/{deploymentId}/tasks/{taskId}` for completion. +// +// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). +// +// Corresponds with POST /v1/deployments/{deploymentId}/invoke-async/{endpointPath} (the `StartAsyncTask` operationId). +func (c *ClientWithResponses) StartAsyncTaskWithResponse(ctx context.Context, deploymentId DeploymentId, endpointPath EndpointPath, body StartAsyncTaskJSONRequestBody, reqEditors ...RequestEditorFn) (*StartAsyncTaskResponse, error) { + rsp, err := c.StartAsyncTask(ctx, deploymentId, endpointPath, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseStartAsyncTaskResponse(rsp) +} + +// StartSyncTaskWithBodyWithResponse Start a new sync task +// +// Starts a new sync task on `deploymentId`, routing the request body payload to an available worker. The request blocks until the task is terminal and returns the result inline (`200`), or `504` if it does not complete within the wait window. +// +// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). +// +// Corresponds with POST /v1/deployments/{deploymentId}/invoke-sync/{endpointPath} (the `StartSyncTask` operationId). +func (c *ClientWithResponses) StartSyncTaskWithBodyWithResponse(ctx context.Context, deploymentId DeploymentId, endpointPath EndpointPath, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*StartSyncTaskResponse, error) { + rsp, err := c.StartSyncTaskWithBody(ctx, deploymentId, endpointPath, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseStartSyncTaskResponse(rsp) +} + +// StartSyncTaskWithResponse Start a new sync task +// +// Starts a new sync task on `deploymentId`, routing the request body payload to an available worker. The request blocks until the task is terminal and returns the result inline (`200`), or `504` if it does not complete within the wait window. +// +// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). +// +// Corresponds with POST /v1/deployments/{deploymentId}/invoke-sync/{endpointPath} (the `StartSyncTask` operationId). +func (c *ClientWithResponses) StartSyncTaskWithResponse(ctx context.Context, deploymentId DeploymentId, endpointPath EndpointPath, body StartSyncTaskJSONRequestBody, reqEditors ...RequestEditorFn) (*StartSyncTaskResponse, error) { + rsp, err := c.StartSyncTask(ctx, deploymentId, endpointPath, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseStartSyncTaskResponse(rsp) +} + +// ResumeDeploymentWithResponse Resume a deployment +// +// Moves the deployment to `initializing` and returns `202` once that intent is persisted. The Scaler then starts workers and sets the deployment to `active`; tasks queued during the stopped period are consumed as workers come online. Precondition: `status = stopped`. +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with POST /v1/deployments/{deploymentId}/resume (the `ResumeDeployment` operationId). +func (c *ClientWithResponses) ResumeDeploymentWithResponse(ctx context.Context, deploymentId DeploymentId, reqEditors ...RequestEditorFn) (*ResumeDeploymentResponse, error) { + rsp, err := c.ResumeDeployment(ctx, deploymentId, reqEditors...) + if err != nil { + return nil, err + } + return ParseResumeDeploymentResponse(rsp) +} + +// ListDeploymentSecretsWithResponse List secrets attached to a deployment +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with GET /v1/deployments/{deploymentId}/secrets (the `ListDeploymentSecrets` operationId). +func (c *ClientWithResponses) ListDeploymentSecretsWithResponse(ctx context.Context, deploymentId DeploymentId, params *ListDeploymentSecretsParams, reqEditors ...RequestEditorFn) (*ListDeploymentSecretsResponse, error) { + rsp, err := c.ListDeploymentSecrets(ctx, deploymentId, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseListDeploymentSecretsResponse(rsp) +} + +// AttachDeploymentSecretWithBodyWithResponse Attach a secret to a deployment +// +// Returns 409 if the secret is already attached to this deployment. +// +// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). +// +// Corresponds with POST /v1/deployments/{deploymentId}/secrets (the `AttachDeploymentSecret` operationId). +func (c *ClientWithResponses) AttachDeploymentSecretWithBodyWithResponse(ctx context.Context, deploymentId DeploymentId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AttachDeploymentSecretResponse, error) { + rsp, err := c.AttachDeploymentSecretWithBody(ctx, deploymentId, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseAttachDeploymentSecretResponse(rsp) +} + +// AttachDeploymentSecretWithResponse Attach a secret to a deployment +// +// Returns 409 if the secret is already attached to this deployment. +// +// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). +// +// Corresponds with POST /v1/deployments/{deploymentId}/secrets (the `AttachDeploymentSecret` operationId). +func (c *ClientWithResponses) AttachDeploymentSecretWithResponse(ctx context.Context, deploymentId DeploymentId, body AttachDeploymentSecretJSONRequestBody, reqEditors ...RequestEditorFn) (*AttachDeploymentSecretResponse, error) { + rsp, err := c.AttachDeploymentSecret(ctx, deploymentId, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseAttachDeploymentSecretResponse(rsp) +} + +// DetachDeploymentSecretWithResponse Detach a secret from a deployment +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with DELETE /v1/deployments/{deploymentId}/secrets/{secretName} (the `DetachDeploymentSecret` operationId). +func (c *ClientWithResponses) DetachDeploymentSecretWithResponse(ctx context.Context, deploymentId DeploymentId, secretName SecretName, reqEditors ...RequestEditorFn) (*DetachDeploymentSecretResponse, error) { + rsp, err := c.DetachDeploymentSecret(ctx, deploymentId, secretName, reqEditors...) + if err != nil { + return nil, err + } + return ParseDetachDeploymentSecretResponse(rsp) +} + +// StopDeploymentWithResponse Stop a deployment +// +// Moves the deployment to `stopping` and returns `202` once that intent is persisted. Scale-to-zero and worker drain are performed asynchronously by the Scaler; `status` becomes `stopped` once all workers drain. In-flight tasks have a grace period (`gracefulStopTtlSecs`) to complete; workers that exceed it are force-terminated and their tasks return to the queue per delivery guarantees. New task submissions are still accepted and queued while stopped, but not consumed. Precondition: `status = active`. +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with POST /v1/deployments/{deploymentId}/stop (the `StopDeployment` operationId). +func (c *ClientWithResponses) StopDeploymentWithResponse(ctx context.Context, deploymentId DeploymentId, reqEditors ...RequestEditorFn) (*StopDeploymentResponse, error) { + rsp, err := c.StopDeployment(ctx, deploymentId, reqEditors...) + if err != nil { + return nil, err + } + return ParseStopDeploymentResponse(rsp) +} + +// ListTasksWithResponse List tasks for a deployment +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with GET /v1/deployments/{deploymentId}/tasks (the `ListTasks` operationId). +func (c *ClientWithResponses) ListTasksWithResponse(ctx context.Context, deploymentId DeploymentId, params *ListTasksParams, reqEditors ...RequestEditorFn) (*ListTasksResponse, error) { + rsp, err := c.ListTasks(ctx, deploymentId, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseListTasksResponse(rsp) +} + +// GetTaskWithResponse Get a task +// +// Returns the task's current status, read through the inference transport layer from the shared result store. When `completed`, includes the result `output` and `completedAt`; when `failed`, includes `error`; when `pending`, neither is set. +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with GET /v1/deployments/{deploymentId}/tasks/{taskId} (the `GetTask` operationId). +func (c *ClientWithResponses) GetTaskWithResponse(ctx context.Context, deploymentId DeploymentId, taskId string, reqEditors ...RequestEditorFn) (*GetTaskResponse, error) { + rsp, err := c.GetTask(ctx, deploymentId, taskId, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetTaskResponse(rsp) +} + +// ListVersionsWithResponse List versions +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with GET /v1/deployments/{deploymentId}/versions (the `ListVersions` operationId). +func (c *ClientWithResponses) ListVersionsWithResponse(ctx context.Context, deploymentId DeploymentId, params *ListVersionsParams, reqEditors ...RequestEditorFn) (*ListVersionsResponse, error) { + rsp, err := c.ListVersions(ctx, deploymentId, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseListVersionsResponse(rsp) +} + +// GetVersionWithResponse Get a version +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with GET /v1/deployments/{deploymentId}/versions/{versionNumber} (the `GetVersion` operationId). +func (c *ClientWithResponses) GetVersionWithResponse(ctx context.Context, deploymentId DeploymentId, versionNumber int32, reqEditors ...RequestEditorFn) (*GetVersionResponse, error) { + rsp, err := c.GetVersion(ctx, deploymentId, versionNumber, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetVersionResponse(rsp) +} + +// ListWorkersWithResponse List workers +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with GET /v1/deployments/{deploymentId}/workers (the `ListWorkers` operationId). +func (c *ClientWithResponses) ListWorkersWithResponse(ctx context.Context, deploymentId DeploymentId, params *ListWorkersParams, reqEditors ...RequestEditorFn) (*ListWorkersResponse, error) { + rsp, err := c.ListWorkers(ctx, deploymentId, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseListWorkersResponse(rsp) +} + +// ListGpuTypesWithResponse List supported GPU types and their pricing +// +// Returns the global GPU type catalogue and pricing. The result is not organisation-specific, but the request still requires authentication. +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with GET /v1/gpu-types (the `ListGpuTypes` operationId). +func (c *ClientWithResponses) ListGpuTypesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListGpuTypesResponse, error) { + rsp, err := c.ListGpuTypes(ctx, reqEditors...) + if err != nil { + return nil, err + } + return ParseListGpuTypesResponse(rsp) +} + +// ListSecretsWithResponse List secrets +// +// Returns secret metadata only; encrypted values are never returned. +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with GET /v1/secrets (the `ListSecrets` operationId). +func (c *ClientWithResponses) ListSecretsWithResponse(ctx context.Context, params *ListSecretsParams, reqEditors ...RequestEditorFn) (*ListSecretsResponse, error) { + rsp, err := c.ListSecrets(ctx, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseListSecretsResponse(rsp) +} + +// CreateSecretWithBodyWithResponse Create a secret +// +// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). +// +// Corresponds with POST /v1/secrets (the `CreateSecret` operationId). +func (c *ClientWithResponses) CreateSecretWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateSecretResponse, error) { + rsp, err := c.CreateSecretWithBody(ctx, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseCreateSecretResponse(rsp) +} + +// CreateSecretWithResponse Create a secret +// +// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). +// +// Corresponds with POST /v1/secrets (the `CreateSecret` operationId). +func (c *ClientWithResponses) CreateSecretWithResponse(ctx context.Context, body CreateSecretJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateSecretResponse, error) { + rsp, err := c.CreateSecret(ctx, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseCreateSecretResponse(rsp) +} + +// DeleteSecretWithResponse Delete a secret +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with DELETE /v1/secrets/{secretName} (the `DeleteSecret` operationId). +func (c *ClientWithResponses) DeleteSecretWithResponse(ctx context.Context, secretName SecretName, reqEditors ...RequestEditorFn) (*DeleteSecretResponse, error) { + rsp, err := c.DeleteSecret(ctx, secretName, reqEditors...) + if err != nil { + return nil, err + } + return ParseDeleteSecretResponse(rsp) +} + +// UpdateSecretWithBodyWithResponse Update a secret +// +// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s). +// +// Corresponds with PUT /v1/secrets/{secretName} (the `UpdateSecret` operationId). +func (c *ClientWithResponses) UpdateSecretWithBodyWithResponse(ctx context.Context, secretName SecretName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateSecretResponse, error) { + rsp, err := c.UpdateSecretWithBody(ctx, secretName, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseUpdateSecretResponse(rsp) +} + +// UpdateSecretWithResponse Update a secret +// +// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s). +// +// Corresponds with PUT /v1/secrets/{secretName} (the `UpdateSecret` operationId). +func (c *ClientWithResponses) UpdateSecretWithResponse(ctx context.Context, secretName SecretName, body UpdateSecretJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateSecretResponse, error) { + rsp, err := c.UpdateSecret(ctx, secretName, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseUpdateSecretResponse(rsp) +} + +// ListUsageEventsWithResponse List usage events +// +// Append-only billing telemetry; one row per worker state transition. +// +// Returns a wrapper object for the known response body format(s). +// +// Corresponds with GET /v1/usage (the `ListUsageEvents` operationId). +func (c *ClientWithResponses) ListUsageEventsWithResponse(ctx context.Context, params *ListUsageEventsParams, reqEditors ...RequestEditorFn) (*ListUsageEventsResponse, error) { + rsp, err := c.ListUsageEvents(ctx, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseListUsageEventsResponse(rsp) +} + +// ParseGetDeploymentSummaryResponse parses an HTTP response from a GetDeploymentSummaryWithResponse call +func ParseGetDeploymentSummaryResponse(rsp *http.Response) (*GetDeploymentSummaryResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetDeploymentSummaryResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest DeploymentSummary + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + } + + return response, nil +} + +// ParseListDeploymentsResponse parses an HTTP response from a ListDeploymentsWithResponse call +func ParseListDeploymentsResponse(rsp *http.Response) (*ListDeploymentsResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &ListDeploymentsResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest struct { + Data *[]Deployment `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` + } + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + } + + return response, nil +} + +// ParseCreateDeploymentResponse parses an HTTP response from a CreateDeploymentWithResponse call +func ParseCreateDeploymentResponse(rsp *http.Response) (*CreateDeploymentResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &CreateDeploymentResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: + var dest Deployment + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON201 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest BadRequest + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: + var dest Conflict + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON409 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: + var dest ValidationError + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON422 = &dest + + } + + return response, nil +} + +// ParseDeleteDeploymentResponse parses an HTTP response from a DeleteDeploymentWithResponse call +func ParseDeleteDeploymentResponse(rsp *http.Response) (*DeleteDeploymentResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &DeleteDeploymentResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 202: + var dest Deployment + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON202 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON404 = &dest + + } + + return response, nil +} + +// ParseGetDeploymentResponse parses an HTTP response from a GetDeploymentWithResponse call +func ParseGetDeploymentResponse(rsp *http.Response) (*GetDeploymentResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetDeploymentResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest Deployment + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON404 = &dest + + } + + return response, nil +} + +// ParseUpdateDeploymentResponse parses an HTTP response from a UpdateDeploymentWithResponse call +func ParseUpdateDeploymentResponse(rsp *http.Response) (*UpdateDeploymentResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &UpdateDeploymentResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest Deployment + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest BadRequest + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: + var dest Conflict + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON409 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: + var dest ValidationError + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON422 = &dest + + } + + return response, nil +} + +// ParseListBuildsResponse parses an HTTP response from a ListBuildsWithResponse call +func ParseListBuildsResponse(rsp *http.Response) (*ListBuildsResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &ListBuildsResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest struct { + Data *[]Build `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` + } + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON404 = &dest + + } + + return response, nil +} + +// ParseGetBuildResponse parses an HTTP response from a GetBuildWithResponse call +func ParseGetBuildResponse(rsp *http.Response) (*GetBuildResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetBuildResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest Build + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON404 = &dest + + } + + return response, nil +} + +// ParseDeployVersionResponse parses an HTTP response from a DeployVersionWithResponse call +func ParseDeployVersionResponse(rsp *http.Response) (*DeployVersionResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &DeployVersionResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 202: + var dest Deployment + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON202 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest BadRequest + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: + var dest Conflict + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON409 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: + var dest ValidationError + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON422 = &dest + + } + + return response, nil +} + +// ParseListEndpointsResponse parses an HTTP response from a ListEndpointsWithResponse call +func ParseListEndpointsResponse(rsp *http.Response) (*ListEndpointsResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &ListEndpointsResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest struct { + Data *[]Endpoint `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` + } + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON404 = &dest + + } + + return response, nil +} + +// ParseListDeploymentEnvironmentVariablesResponse parses an HTTP response from a ListDeploymentEnvironmentVariablesWithResponse call +func ParseListDeploymentEnvironmentVariablesResponse(rsp *http.Response) (*ListDeploymentEnvironmentVariablesResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &ListDeploymentEnvironmentVariablesResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest struct { + Data *[]EnvironmentVariable `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` + } + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON404 = &dest + + } + + return response, nil +} + +// ParseDeleteDeploymentEnvironmentVariableResponse parses an HTTP response from a DeleteDeploymentEnvironmentVariableWithResponse call +func ParseDeleteDeploymentEnvironmentVariableResponse(rsp *http.Response) (*DeleteDeploymentEnvironmentVariableResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &DeleteDeploymentEnvironmentVariableResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case rsp.StatusCode == 204: + break // No content-type + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON404 = &dest + + } + + return response, nil +} + +// ParseUpsertDeploymentEnvironmentVariableResponse parses an HTTP response from a UpsertDeploymentEnvironmentVariableWithResponse call +func ParseUpsertDeploymentEnvironmentVariableResponse(rsp *http.Response) (*UpsertDeploymentEnvironmentVariableResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &UpsertDeploymentEnvironmentVariableResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest EnvironmentVariable + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest BadRequest + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: + var dest ValidationError + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON422 = &dest + + } + + return response, nil +} + +// ParseListDeploymentEventsResponse parses an HTTP response from a ListDeploymentEventsWithResponse call +func ParseListDeploymentEventsResponse(rsp *http.Response) (*ListDeploymentEventsResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &ListDeploymentEventsResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest struct { + Data *[]DeploymentEvent `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` + } + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON404 = &dest + + } + + return response, nil +} + +// ParseStartAsyncTaskResponse parses an HTTP response from a StartAsyncTaskWithResponse call +func ParseStartAsyncTaskResponse(rsp *http.Response) (*StartAsyncTaskResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &StartAsyncTaskResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 202: + var dest TaskAccepted + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON202 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest BadRequest + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: + var dest ValidationError + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON422 = &dest + + } + + return response, nil +} + +// ParseStartSyncTaskResponse parses an HTTP response from a StartSyncTaskWithResponse call +func ParseStartSyncTaskResponse(rsp *http.Response) (*StartSyncTaskResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &StartSyncTaskResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest Task + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest BadRequest + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: + var dest ValidationError + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON422 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 504: + var dest Timeout + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON504 = &dest + + } + + return response, nil +} + +// ParseResumeDeploymentResponse parses an HTTP response from a ResumeDeploymentWithResponse call +func ParseResumeDeploymentResponse(rsp *http.Response) (*ResumeDeploymentResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &ResumeDeploymentResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 202: + var dest Deployment + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON202 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: + var dest Conflict + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON409 = &dest + + } + + return response, nil +} + +// ParseListDeploymentSecretsResponse parses an HTTP response from a ListDeploymentSecretsWithResponse call +func ParseListDeploymentSecretsResponse(rsp *http.Response) (*ListDeploymentSecretsResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &ListDeploymentSecretsResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest struct { + Data *[]Secret `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` + } + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON404 = &dest + + } + + return response, nil +} + +// ParseAttachDeploymentSecretResponse parses an HTTP response from a AttachDeploymentSecretWithResponse call +func ParseAttachDeploymentSecretResponse(rsp *http.Response) (*AttachDeploymentSecretResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &AttachDeploymentSecretResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case rsp.StatusCode == 204: + break // No content-type + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest BadRequest + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: + var dest Conflict + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON409 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: + var dest ValidationError + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON422 = &dest + + } + + return response, nil +} + +// ParseDetachDeploymentSecretResponse parses an HTTP response from a DetachDeploymentSecretWithResponse call +func ParseDetachDeploymentSecretResponse(rsp *http.Response) (*DetachDeploymentSecretResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &DetachDeploymentSecretResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case rsp.StatusCode == 204: + break // No content-type + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON404 = &dest + + } + + return response, nil +} + +// ParseStopDeploymentResponse parses an HTTP response from a StopDeploymentWithResponse call +func ParseStopDeploymentResponse(rsp *http.Response) (*StopDeploymentResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &StopDeploymentResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 202: + var dest Deployment + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON202 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: + var dest Conflict + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON409 = &dest + + } + + return response, nil +} + +// ParseListTasksResponse parses an HTTP response from a ListTasksWithResponse call +func ParseListTasksResponse(rsp *http.Response) (*ListTasksResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &ListTasksResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest struct { + Data *[]Task `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` + } + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON404 = &dest + + } + + return response, nil +} + +// ParseGetTaskResponse parses an HTTP response from a GetTaskWithResponse call +func ParseGetTaskResponse(rsp *http.Response) (*GetTaskResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetTaskResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest Task + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON404 = &dest + + } + + return response, nil +} + +// ParseListVersionsResponse parses an HTTP response from a ListVersionsWithResponse call +func ParseListVersionsResponse(rsp *http.Response) (*ListVersionsResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &ListVersionsResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest struct { + Data *[]Version `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` + } + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON404 = &dest + + } + + return response, nil +} + +// ParseGetVersionResponse parses an HTTP response from a GetVersionWithResponse call +func ParseGetVersionResponse(rsp *http.Response) (*GetVersionResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetVersionResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest Version + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON404 = &dest + + } + + return response, nil +} + +// ParseListWorkersResponse parses an HTTP response from a ListWorkersWithResponse call +func ParseListWorkersResponse(rsp *http.Response) (*ListWorkersResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &ListWorkersResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest struct { + Data *[]Worker `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` + } + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON404 = &dest + + } + + return response, nil +} + +// ParseListGpuTypesResponse parses an HTTP response from a ListGpuTypesWithResponse call +func ParseListGpuTypesResponse(rsp *http.Response) (*ListGpuTypesResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &ListGpuTypesResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest GpuTypeList + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + } + + return response, nil +} + +// ParseListSecretsResponse parses an HTTP response from a ListSecretsWithResponse call +func ParseListSecretsResponse(rsp *http.Response) (*ListSecretsResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &ListSecretsResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest struct { + Data *[]Secret `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` + } + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + } + + return response, nil +} + +// ParseCreateSecretResponse parses an HTTP response from a CreateSecretWithResponse call +func ParseCreateSecretResponse(rsp *http.Response) (*CreateSecretResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &CreateSecretResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: + var dest Secret + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON201 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest BadRequest + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 409: + var dest Conflict + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON409 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: + var dest ValidationError + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON422 = &dest + + } + + return response, nil +} + +// ParseDeleteSecretResponse parses an HTTP response from a DeleteSecretWithResponse call +func ParseDeleteSecretResponse(rsp *http.Response) (*DeleteSecretResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &DeleteSecretResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case rsp.StatusCode == 204: + break // No content-type + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON404 = &dest + + } + + return response, nil +} + +// ParseUpdateSecretResponse parses an HTTP response from a UpdateSecretWithResponse call +func ParseUpdateSecretResponse(rsp *http.Response) (*UpdateSecretResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &UpdateSecretResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest Secret + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest BadRequest + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: + var dest ValidationError + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON422 = &dest + + } + + return response, nil +} + +// ParseListUsageEventsResponse parses an HTTP response from a ListUsageEventsWithResponse call +func ParseListUsageEventsResponse(rsp *http.Response) (*ListUsageEventsResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &ListUsageEventsResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest struct { + Data *[]UsageEvent `json:"data,omitempty"` + + // NextCursor Cursor for the next page; null when there are no more items. + NextCursor *string `json:"nextCursor,omitempty"` + } + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest Unauthorized + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.ApplicationproblemJSON403 = &dest + + } + + return response, nil +} diff --git a/internal/api/serverless/gen/doc.go b/internal/api/serverless/gen/doc.go new file mode 100644 index 0000000..4ec5d21 --- /dev/null +++ b/internal/api/serverless/gen/doc.go @@ -0,0 +1,5 @@ +// Package gen contains the OpenAPI-generated Serverless API client. +// +// Code is produced by oapi-codegen from api/serverless/openapi.yaml. Do not +// edit by hand — regenerate with `make generate-serverless`. +package gen diff --git a/internal/api/serverless/gpu.go b/internal/api/serverless/gpu.go deleted file mode 100644 index c3c7539..0000000 --- a/internal/api/serverless/gpu.go +++ /dev/null @@ -1,18 +0,0 @@ -package serverless - -import "context" - -// gpuTypesResponse is the envelope returned by GET /v1/gpu-types. -type gpuTypesResponse struct { - Data []GpuType `json:"data"` -} - -// ListGpuTypes returns the catalogue of supported GPU types and their pricing. -// This endpoint is not workspace-scoped. -func (c *Client) ListGpuTypes(ctx context.Context) ([]GpuType, error) { - var resp gpuTypesResponse - if err := c.get(ctx, "/v1/gpu-types", &resp); err != nil { - return nil, err - } - return resp.Data, nil -} diff --git a/internal/api/serverless/types.go b/internal/api/serverless/types.go deleted file mode 100644 index bacc06c..0000000 --- a/internal/api/serverless/types.go +++ /dev/null @@ -1,25 +0,0 @@ -package serverless - -// GpuAvailability is the scheduler provisioning availability for a GPU type. -type GpuAvailability string - -const ( - GpuAvailabilityAvailable GpuAvailability = "available" - GpuAvailabilityReserved GpuAvailability = "reserved" - GpuAvailabilityCustom GpuAvailability = "custom" -) - -// GpuPricing is the price for a GPU type. -type GpuPricing struct { - Currency string `json:"currency"` - PerSecond string `json:"perSecond"` -} - -// GpuType is a supported GPU hardware type and its pricing. -type GpuType struct { - ID string `json:"id"` - Name string `json:"name"` - Memory *string `json:"memory,omitempty"` - Availability GpuAvailability `json:"availability"` - Pricing GpuPricing `json:"pricing"` -} diff --git a/internal/cmd/serverless/apps.go b/internal/cmd/serverless/apps.go deleted file mode 100644 index abf89ba..0000000 --- a/internal/cmd/serverless/apps.go +++ /dev/null @@ -1,15 +0,0 @@ -package serverless - -import ( - "github.com/spf13/cobra" -) - -// newAppsCmd returns the "serverless apps" command group. -func newAppsCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "apps", - Short: "Manage deployed serverless applications", - } - cmd.AddCommand(newSecretCmd()) - return cmd -} diff --git a/internal/cmd/serverless/deploy.go b/internal/cmd/serverless/deploy.go index adaf653..bca84ad 100644 --- a/internal/cmd/serverless/deploy.go +++ b/internal/cmd/serverless/deploy.go @@ -12,8 +12,8 @@ func newDeployCmd() *cobra.Command { Short: "Deploy a new serverless application", Long: `Deploy a new serverless application from a Python file. -The application settings come from the project -configuration created by 'runware serverless init' or the dashboard.`, +The application settings come from the project configuration (via the +dashboard, or 'runware serverless init' when available).`, Example: ` # deploy the application in the current project runware serverless deploy @@ -21,7 +21,8 @@ configuration created by 'runware serverless init' or the dashboard.`, runware serverless deploy ./app.py`, Args: cobra.MaximumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { - return fmt.Errorf("not implemented yet") + _ = cmd.Help() + return fmt.Errorf("serverless deploy is not implemented yet") }, } } diff --git a/internal/cmd/serverless/gpus.go b/internal/cmd/serverless/gpus.go index 62bdbc6..8a979f2 100644 --- a/internal/cmd/serverless/gpus.go +++ b/internal/cmd/serverless/gpus.go @@ -23,14 +23,10 @@ func (r gpuTypesResult) Rows() [][]any { rows := make([][]any, len(r)) for i := range r { g := &r[i] - memory := "-" - if g.Memory != nil && *g.Memory != "" { - memory = *g.Memory - } rows[i] = []any{ - g.ID, + g.Id, g.Name, - memory, + g.Memory, string(g.Availability), g.Pricing.PerSecond, } @@ -48,15 +44,14 @@ func newGPUsCmd(logger *log.Logger) *cobra.Command { RunE: func(cmd *cobra.Command, args []string) error { spin := cmdutil.NewSpinner("Fetching GPU types...") spin.Start() + defer spin.Stop() client := serverlessapi.NewClient(config.GetAPIKey(), config.GetServerlessBaseURL(), slog.New(logger)) gpus, err := client.ListGpuTypes(cmd.Context()) if err != nil { - spin.Stop() return err } - spin.Stop() return output.Print(cmdutil.FormatFor(cmd), gpuTypesResult(gpus)) }, } diff --git a/internal/cmd/serverless/open.go b/internal/cmd/serverless/open.go index 8998770..9110fab 100644 --- a/internal/cmd/serverless/open.go +++ b/internal/cmd/serverless/open.go @@ -2,9 +2,11 @@ package serverless import ( "fmt" + "net/url" "os" "strings" + "github.com/pkg/browser" "github.com/runware/runware-cli/internal/cmdutil" "github.com/runware/runware-cli/internal/config" "github.com/runware/runware-cli/internal/output" @@ -37,15 +39,15 @@ func newOpenCmd() *cobra.Command { Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { id := args[0] - url := strings.TrimSuffix(config.GetDashboardURL(), "/") + "/serverless/" + id + dashboardURL := strings.TrimSuffix(config.GetDashboardURL(), "/") + "/serverless/" + url.PathEscape(id) - if err := cmdutil.OpenBrowser(cmd.Context(), url); err != nil { + if err := browser.OpenURL(dashboardURL); err != nil { fmt.Fprintf(os.Stderr, "Could not open browser automatically: %v\n", err) } return output.Print(cmdutil.FormatFor(cmd), openResult{ DeploymentID: id, - URL: url, + URL: dashboardURL, }) }, } diff --git a/internal/cmd/serverless/registry.go b/internal/cmd/serverless/registry.go deleted file mode 100644 index 21e840c..0000000 --- a/internal/cmd/serverless/registry.go +++ /dev/null @@ -1,13 +0,0 @@ -package serverless - -import ( - "github.com/spf13/cobra" -) - -// newRegistryCmd returns the "serverless registry" command group. -func newRegistryCmd() *cobra.Command { - return &cobra.Command{ - Use: "registry", - Short: "Manage container registries for serverless deployments", - } -} diff --git a/internal/cmd/serverless/secret.go b/internal/cmd/serverless/secret.go deleted file mode 100644 index 5f3ecf7..0000000 --- a/internal/cmd/serverless/secret.go +++ /dev/null @@ -1,13 +0,0 @@ -package serverless - -import ( - "github.com/spf13/cobra" -) - -// newSecretCmd returns the "serverless apps secret" command group. -func newSecretCmd() *cobra.Command { - return &cobra.Command{ - Use: "secret", - Short: "Manage secrets for a serverless application", - } -} diff --git a/internal/cmd/serverless/serverless.go b/internal/cmd/serverless/serverless.go index 7bd70c3..d1ffca6 100644 --- a/internal/cmd/serverless/serverless.go +++ b/internal/cmd/serverless/serverless.go @@ -18,8 +18,6 @@ func NewCmd(logger *log.Logger) *cobra.Command { newDeployCmd(), newGPUsCmd(logger), newOpenCmd(), - newRegistryCmd(), - newAppsCmd(), ) return cmd } diff --git a/internal/cmdutil/browser.go b/internal/cmdutil/browser.go deleted file mode 100644 index d873d27..0000000 --- a/internal/cmdutil/browser.go +++ /dev/null @@ -1,32 +0,0 @@ -package cmdutil - -import ( - "context" - "fmt" - "os/exec" - "runtime" -) - -// OpenBrowser opens url in the user's default web browser. It returns an error -// if the platform launcher cannot be started (e.g. in a headless environment). -func OpenBrowser(ctx context.Context, url string) error { - var name string - var args []string - switch runtime.GOOS { - case "darwin": - name = "open" - args = []string{url} - case "windows": - name = "rundll32" - args = []string{"url.dll,FileProtocolHandler", url} - default: - name = "xdg-open" - args = []string{url} - } - // The launcher name is a fixed per-OS constant and the URL is passed as a - // separate argv element (not shell-interpreted), so there is no injection. - if err := exec.CommandContext(ctx, name, args...).Start(); err != nil { //nolint:gosec - return fmt.Errorf("failed to open browser: %w", err) - } - return nil -} From 27d7688deeee9fa0c1f48e7e43b5f0a27d7d680b Mon Sep 17 00:00:00 2001 From: ryank90 Date: Wed, 29 Jul 2026 20:51:19 +0100 Subject: [PATCH 07/10] fix: update short desc based on nomeclature --- internal/cmd/serverless/serverless.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/cmd/serverless/serverless.go b/internal/cmd/serverless/serverless.go index d1ffca6..318f9e0 100644 --- a/internal/cmd/serverless/serverless.go +++ b/internal/cmd/serverless/serverless.go @@ -11,7 +11,7 @@ import ( func NewCmd(logger *log.Logger) *cobra.Command { cmd := &cobra.Command{ Use: "serverless", - Short: "Manage Runware serverless deployments", + Short: "Manage Runware serverless applications", Long: "Deploy, monitor, and manage Runware serverless applications on the platform", } cmd.AddCommand( From d10e897a03391a2ffefefd24d3b6391df7e384fd Mon Sep 17 00:00:00 2001 From: ryank90 Date: Wed, 29 Jul 2026 21:27:57 +0100 Subject: [PATCH 08/10] fix(open): uri structure --- internal/cmd/serverless/open.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/cmd/serverless/open.go b/internal/cmd/serverless/open.go index 9110fab..de2399f 100644 --- a/internal/cmd/serverless/open.go +++ b/internal/cmd/serverless/open.go @@ -33,13 +33,13 @@ func (r openResult) Rows() [][]any { func newOpenCmd() *cobra.Command { return &cobra.Command{ Use: "open ", - Short: "Open a deployment in the Runware dashboard", - Example: ` # open a deployment's dashboard page in your browser + Short: "Open an application in the Runware dashboard", + Example: ` # open a application's dashboard page in your browser runware serverless open my-model-abc`, Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { id := args[0] - dashboardURL := strings.TrimSuffix(config.GetDashboardURL(), "/") + "/serverless/" + url.PathEscape(id) + dashboardURL := strings.TrimSuffix(config.GetDashboardURL(), "/") + "/serverless/apps/" + url.PathEscape(id) if err := browser.OpenURL(dashboardURL); err != nil { fmt.Fprintf(os.Stderr, "Could not open browser automatically: %v\n", err) From 6bc8afa8a95e31853ae636e35e5c4cefbc48d7f3 Mon Sep 17 00:00:00 2001 From: ryank90 Date: Wed, 29 Jul 2026 21:31:14 +0100 Subject: [PATCH 09/10] fix(docs): regen docs based on changes --- docs/runware.md | 2 +- docs/runware_serverless.md | 4 ++-- docs/runware_serverless_deploy.md | 2 +- docs/runware_serverless_gpus.md | 2 +- docs/runware_serverless_open.md | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/runware.md b/docs/runware.md index 26dd7d2..de30215 100644 --- a/docs/runware.md +++ b/docs/runware.md @@ -31,6 +31,6 @@ Use of Runware services is subject to our Terms of Service (https://runware.ai/t * [runware preset](runware_preset.md) - Manage named presets * [runware result](runware_result.md) - Wait for and display the result of a task by taskUUID * [runware run](runware_run.md) - Run an inference request against any Runware model -* [runware serverless](runware_serverless.md) - Manage Runware serverless deployments +* [runware serverless](runware_serverless.md) - Manage Runware serverless applications * [runware version](runware_version.md) - Print version information diff --git a/docs/runware_serverless.md b/docs/runware_serverless.md index 23fe1a8..1d08e71 100644 --- a/docs/runware_serverless.md +++ b/docs/runware_serverless.md @@ -1,6 +1,6 @@ ## runware serverless -Manage Runware serverless deployments +Manage Runware serverless applications ### Synopsis @@ -26,5 +26,5 @@ Deploy, monitor, and manage Runware serverless applications on the platform * [runware](runware.md) - CLI tool for the Runware API * [runware serverless deploy](runware_serverless_deploy.md) - Deploy a new serverless application * [runware serverless gpus](runware_serverless_gpus.md) - List available GPU types and pricing -* [runware serverless open](runware_serverless_open.md) - Open a deployment in the Runware dashboard +* [runware serverless open](runware_serverless_open.md) - Open an application in the Runware dashboard diff --git a/docs/runware_serverless_deploy.md b/docs/runware_serverless_deploy.md index fe1aa93..4fe8604 100644 --- a/docs/runware_serverless_deploy.md +++ b/docs/runware_serverless_deploy.md @@ -40,5 +40,5 @@ runware serverless deploy [file] [flags] ### SEE ALSO -* [runware serverless](runware_serverless.md) - Manage Runware serverless deployments +* [runware serverless](runware_serverless.md) - Manage Runware serverless applications diff --git a/docs/runware_serverless_gpus.md b/docs/runware_serverless_gpus.md index 5880d13..d872dd5 100644 --- a/docs/runware_serverless_gpus.md +++ b/docs/runware_serverless_gpus.md @@ -30,5 +30,5 @@ runware serverless gpus [flags] ### SEE ALSO -* [runware serverless](runware_serverless.md) - Manage Runware serverless deployments +* [runware serverless](runware_serverless.md) - Manage Runware serverless applications diff --git a/docs/runware_serverless_open.md b/docs/runware_serverless_open.md index ea2434f..eefd11e 100644 --- a/docs/runware_serverless_open.md +++ b/docs/runware_serverless_open.md @@ -1,6 +1,6 @@ ## runware serverless open -Open a deployment in the Runware dashboard +Open an application in the Runware dashboard ``` runware serverless open [flags] @@ -9,7 +9,7 @@ runware serverless open [flags] ### Examples ``` - # open a deployment's dashboard page in your browser + # open a application's dashboard page in your browser runware serverless open my-model-abc ``` @@ -30,5 +30,5 @@ runware serverless open [flags] ### SEE ALSO -* [runware serverless](runware_serverless.md) - Manage Runware serverless deployments +* [runware serverless](runware_serverless.md) - Manage Runware serverless applications From a8f379ef672cb87a1b029bc7eed0ffe7b2a88813 Mon Sep 17 00:00:00 2001 From: ryank90 Date: Wed, 29 Jul 2026 23:39:58 +0100 Subject: [PATCH 10/10] fix: review feedback --- docs/runware_serverless_deploy.md | 5 +++-- internal/api/serverless/client_test.go | 22 ++++++++++++++++++++++ internal/api/serverless/errors.go | 4 +++- internal/cmd/serverless/deploy.go | 5 +++-- internal/config/config.go | 8 +++++--- 5 files changed, 36 insertions(+), 8 deletions(-) diff --git a/docs/runware_serverless_deploy.md b/docs/runware_serverless_deploy.md index 4fe8604..0686fb7 100644 --- a/docs/runware_serverless_deploy.md +++ b/docs/runware_serverless_deploy.md @@ -6,8 +6,9 @@ Deploy a new serverless application Deploy a new serverless application from a Python file. -The application settings come from the project configuration (via the -dashboard, or 'runware serverless init' when available). +Application settings come from project configuration managed in the +Runware dashboard. Local project scaffolding via 'runware serverless init' +is planned and not available yet. ``` runware serverless deploy [file] [flags] diff --git a/internal/api/serverless/client_test.go b/internal/api/serverless/client_test.go index 873a3cf..af58f44 100644 --- a/internal/api/serverless/client_test.go +++ b/internal/api/serverless/client_test.go @@ -68,3 +68,25 @@ func TestListGpuTypes_AuthError(t *testing.T) { t.Errorf("unexpected message: %q", re.Message) } } + +func TestListGpuTypes_ServerError(t *testing.T) { + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusInternalServerError) + _, _ = w.Write([]byte("upstream boom")) + })) + defer srv.Close() + + c := newClient("test-key", srv.URL, slog.Default(), srv.Client()) + _, err := c.ListGpuTypes(context.Background()) + var re *transport.RunwareError + if !errors.As(err, &re) { + t.Fatalf("expected *transport.RunwareError, got %T: %v", err, err) + } + if re.Code != transport.CodeServerError { + t.Errorf("expected CodeServerError, got %v", re.Code) + } + if re.StatusCode != http.StatusInternalServerError { + t.Errorf("expected status 500, got %d", re.StatusCode) + } +} diff --git a/internal/api/serverless/errors.go b/internal/api/serverless/errors.go index 2199f75..7edf6c7 100644 --- a/internal/api/serverless/errors.go +++ b/internal/api/serverless/errors.go @@ -44,6 +44,8 @@ func rawCodeForStatus(statusCode int) string { case http.StatusConflict: return "conflict" default: - return "serverError" + // Must be a key in transport.serverErrorCodes so DeriveCode returns + // CodeServerError rather than CodeUnknown. + return "internalServerError" } } diff --git a/internal/cmd/serverless/deploy.go b/internal/cmd/serverless/deploy.go index bca84ad..3a5d657 100644 --- a/internal/cmd/serverless/deploy.go +++ b/internal/cmd/serverless/deploy.go @@ -12,8 +12,9 @@ func newDeployCmd() *cobra.Command { Short: "Deploy a new serverless application", Long: `Deploy a new serverless application from a Python file. -The application settings come from the project configuration (via the -dashboard, or 'runware serverless init' when available).`, +Application settings come from project configuration managed in the +Runware dashboard. Local project scaffolding via 'runware serverless init' +is planned and not available yet.`, Example: ` # deploy the application in the current project runware serverless deploy diff --git a/internal/config/config.go b/internal/config/config.go index fcd8887..753c45f 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -155,8 +155,9 @@ func GetWSBaseURL() string { } // GetServerlessBaseURL returns the Serverless API base URL. -// RUNWARE_SERVERLESS_BASE_URL overrides the default; this is not exposed in the -// user-facing config file and is intended for internal testing only. +// Override with RUNWARE_SERVERLESS_BASE_URL for internal testing only +// (e.g. pointing at a local or staging control plane). This is not a +// user-facing config key and must not be documented in `runware config`. func GetServerlessBaseURL() string { if v := os.Getenv("RUNWARE_SERVERLESS_BASE_URL"); v != "" { return v @@ -165,7 +166,8 @@ func GetServerlessBaseURL() string { } // GetDashboardURL returns the base URL of the Runware web dashboard. -// RUNWARE_DASHBOARD_URL overrides the default. +// Users may override with RUNWARE_DASHBOARD_URL (e.g. a regional console). +// Unlike the serverless API base URL, this is a supported end-user override. func GetDashboardURL() string { if v := os.Getenv("RUNWARE_DASHBOARD_URL"); v != "" { return v