diff --git a/Makefile b/Makefile index 6b057d93..ddb903ba 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: build build-server build-panda build-proxy install install-server install-panda install-proxy test lint clean docker docker-push docker-sandbox test-sandbox run studio help setup-hooks govulncheck generate +.PHONY: build build-server build-panda build-proxy install install-server install-panda install-proxy test lint clean docker docker-push docker-sandbox test-sandbox run studio help setup-hooks govulncheck # Build variables VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev") @@ -61,9 +61,6 @@ govulncheck: ## Scan for reachable vulnerabilities (allowlist in scripts/govulnc tidy: ## Run go mod tidy go mod tidy -generate: ## Run code generation (oapi-codegen for the compute API client) - go generate ./pkg/compute/... - clean: ## Clean build artifacts rm -f panda-server .panda-server-bin panda panda-proxy panda-server-linux-amd64 rm -f coverage.out coverage.html diff --git a/go.mod b/go.mod index 05c08d2a..b53d0789 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,6 @@ require ( github.com/minio/minio-go/v7 v7.2.1 github.com/moby/moby/api v1.54.2 github.com/moby/moby/client v0.4.1 - github.com/oapi-codegen/runtime v1.3.1 github.com/prometheus/client_golang v1.23.2 github.com/prometheus/client_model v0.6.2 github.com/redis/go-redis/v9 v9.20.0 @@ -32,7 +31,6 @@ require ( github.com/stretchr/testify v1.11.1 github.com/testcontainers/testcontainers-go v0.42.0 github.com/yuin/goldmark v1.8.2 - go.yaml.in/yaml/v3 v3.0.4 golang.org/x/sys v0.45.0 golang.org/x/time v0.15.0 google.golang.org/protobuf v1.36.11 @@ -57,7 +55,6 @@ require ( github.com/distribution/reference v0.6.0 // indirect github.com/dlclark/regexp2 v1.12.0 // indirect github.com/docker/go-connections v0.7.0 // indirect - github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/ebitengine/purego v0.10.0 // indirect github.com/fatih/color v1.19.0 // indirect @@ -102,7 +99,7 @@ require ( github.com/moby/term v0.5.2 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/oapi-codegen/oapi-codegen/v2 v2.7.1 // indirect + github.com/oapi-codegen/runtime v1.3.1 // indirect github.com/oasdiff/yaml v0.0.9 // indirect github.com/oasdiff/yaml3 v0.0.9 // indirect github.com/ogen-go/ogen v1.20.3 // indirect @@ -120,8 +117,6 @@ require ( github.com/segmentio/asm v1.2.1 // indirect github.com/shirou/gopsutil/v4 v4.26.3 // indirect github.com/shopspring/decimal v1.4.0 // indirect - github.com/speakeasy-api/jsonpath v0.6.3 // indirect - github.com/speakeasy-api/openapi v1.19.2 // indirect github.com/spf13/cast v1.10.0 // indirect github.com/spf13/pflag v1.0.10 // indirect github.com/tinylib/msgp v1.6.4 // indirect @@ -129,7 +124,6 @@ require ( github.com/tklauser/numcpus v0.11.0 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasthttp v1.71.0 // indirect - github.com/vmware-labs/yaml-jsonpath v0.3.2 // indirect github.com/woodsbury/decimal128 v1.4.0 // indirect github.com/yosida95/uritemplate/v3 v3.0.2 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect @@ -145,6 +139,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.1 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect + go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/crypto v0.52.0 // indirect golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 // indirect golang.org/x/mod v0.35.0 // indirect @@ -163,7 +158,4 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect ) -tool ( - github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen - golang.org/x/vuln/cmd/govulncheck -) +tool golang.org/x/vuln/cmd/govulncheck diff --git a/go.sum b/go.sum index 17c8da04..32183176 100644 --- a/go.sum +++ b/go.sum @@ -24,9 +24,6 @@ github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK3 github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -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/containerd/errdefs v1.0.0 h1:tg5yIfIlQIrxYtu9ajqY42W3lpS19XqdxRQeEwYG8PI= github.com/containerd/errdefs v1.0.0/go.mod h1:+YBYIdtsnF4Iw6nWZhJcqGSg/dwvV7tyJ/kCkyJ2k+M= github.com/containerd/errdefs/pkg v0.3.0 h1:9IKJ06FvyNlexW690DXuQNx2KA2cUJXx151Xdx3ZPPE= @@ -54,9 +51,6 @@ github.com/docker/go-connections v0.7.0 h1:6SsRfJddP22WMrCkj19x9WKjEDTB+ahsdiGYf github.com/docker/go-connections v0.7.0/go.mod h1:no1qkHdjq7kLMGUXYAduOhYPSJxxvgWBh7ogVvptn3Q= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -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/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU= @@ -75,10 +69,6 @@ github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2 github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= -github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= github.com/fxamacker/cbor/v2 v2.9.2 h1:X4Ksno9+x3cz0TZv69ec1hxP/+tymuR8PXQJyDwfh78= github.com/fxamacker/cbor/v2 v2.9.2/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= github.com/gdamore/encoding v1.0.1 h1:YzKZckdBL6jVt2Gc+5p82qhrGiqMdG/eNs6Wy0u3Uhw= @@ -113,7 +103,6 @@ github.com/go-openapi/swag/jsonname v0.25.5 h1:8p150i44rv/Drip4vWI3kGi9+4W9TdI3U github.com/go-openapi/swag/jsonname v0.25.5/go.mod h1:jNqqikyiAK56uS7n8sLkdaNY/uq6+D2m2LANat09pKU= github.com/go-openapi/testify/v2 v2.4.0 h1:8nsPrHVCWkQ4p8h1EsRVymA2XABB4OT40gcvAu+voFM= github.com/go-openapi/testify/v2 v2.4.0/go.mod h1:HCPmvFFnheKK2BuwSA0TbbdxJ3I16pjwMkYkP4Ywn54= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-test/deep v1.1.0 h1:WOcxcdHcvdgThNXjw0t76K42FXTU7HpNQWHpA2HHNlg= github.com/go-test/deep v1.1.0/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/gofiber/fiber/v3 v3.3.0 h1:QBd3sYCqdy6Qs5gJYzSw4I4SbqL204jPqpdub/ueiw8= @@ -124,28 +113,14 @@ github.com/gofiber/utils/v2 v2.0.6 h1:7fXYy7nSsyqbH0GQUMtK4Kwjy4J7R5742VM7JsZxzO github.com/gofiber/utils/v2 v2.0.6/go.mod h1:p7mAHAk3+oUK10ZX2xTw9fZQixb4hCg8SKd4IH2xroU= github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= -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/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmdtest v0.4.1-0.20220921163831-55ab3332a786 h1:rcv+Ippz6RAtvaGgKxc+8FQIpxHgsF+HBzPyYL2cyVU= github.com/google/go-cmdtest v0.4.1-0.20220921163831-55ab3332a786/go.mod h1:apVn/GCasLZUVpAJ6oWAuyP7Ne7CEsQbTnc0plM3m+o= -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/jsonschema-go v0.4.2 h1:tmrUohrwoLZZS/P3x7ex0WAVknEkBZM46iALbcqoRA8= github.com/google/jsonschema-go v0.4.2/go.mod h1:r5quNTdLOYEz95Ru18zA0ydNbBuYoo9tgaYcxEYhJVE= -github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0 h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= @@ -154,8 +129,6 @@ github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8= github.com/gorilla/css v1.0.1/go.mod h1:BvnYkspnSzMmwRK+b8/xgNPLiIuNZr6vbZBTPQ2A3b0= github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.5 h1:jP1RStw811EvUDzsUQ9oESqw2e4RqCjSAD9qIL8eMns= github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.5/go.mod h1:WXNBZ64q3+ZUemCMXD9kYnr56H7CgZxDBHCVwstfl3s= -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/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= @@ -168,11 +141,8 @@ github.com/klauspost/cpuid/v2 v2.2.11 h1:0OwqZRYI2rFrjS4kvkDnqJkKHdHaRnCm68/DY4O github.com/klauspost/cpuid/v2 v2.2.11/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= github.com/klauspost/crc32 v1.3.0 h1:sSmTt3gUt81RP655XGZPElI0PelVTZ6YwCRnPSupoFM= github.com/klauspost/crc32 v1.3.0/go.mod h1:D7kQaZhnkX/Y0tstFGf8VUzv2UofNGqCjnC3zdHB0Hw= -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/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= @@ -221,11 +191,6 @@ github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9 github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -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/oapi-codegen/v2 v2.7.1 h1:a7Ab7YlpqkVG5HKrTaeFstm32Z5QOnyjnbsCO0jiMYM= -github.com/oapi-codegen/oapi-codegen/v2 v2.7.1/go.mod h1:qzFy6iuobJw/hD1aRILee4G87/ShmhR0xYCwcUtZMCw= github.com/oapi-codegen/runtime v1.3.1 h1:RgDY6J4OGQLbRXhG/Xpt3vSVqYpHQS7hN4m85+5xB9g= github.com/oapi-codegen/runtime v1.3.1/go.mod h1:kOdeacKy7t40Rclb1je37ZLFboFxh+YLy0zaPCMibPY= github.com/oasdiff/yaml v0.0.9 h1:zQOvd2UKoozsSsAknnWoDJlSK4lC0mpmjfDsfqNwX48= @@ -234,18 +199,6 @@ github.com/oasdiff/yaml3 v0.0.9 h1:rWPrKccrdUm8J0F3sGuU+fuh9+1K/RdJlWF7O/9yw2g= github.com/oasdiff/yaml3 v0.0.9/go.mod h1:y5+oSEHCPT/DGrS++Wc/479ERge0zTFxaF8PbGKcg2o= github.com/ogen-go/ogen v1.20.3 h1:1tvJuJE0BnQ7Nukd6ykiTOP0ucfL0yrAjHUg3S1DCQk= github.com/ogen-go/ogen v1.20.3/go.mod h1:sJ1pJVp4S1RcSZlYIiMLo0QSMSt2pls4zfrc+hNKnzk= -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/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040= @@ -282,8 +235,6 @@ github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 h1:KRzFb2m7YtdldCEkzs6KqmJw4nqEV github.com/santhosh-tekuri/jsonschema/v6 v6.0.2/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU= github.com/segmentio/asm v1.2.1 h1:DTNbBqs57ioxAD4PrArqftgypG4/qNpXoJx8TVXxPR0= github.com/segmentio/asm v1.2.1/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= -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/shamaton/msgpack/v3 v3.1.2 h1:d5gWAIyMU4M0WgDjz6IFSCuXJUA2dFwRHBpDclE8CLw= github.com/shamaton/msgpack/v3 v3.1.2/go.mod h1:DcQG8jrdrQCIxr3HlMYkiXdMhK+KfN2CitkyzsQV4uc= github.com/shirou/gopsutil/v4 v4.26.3 h1:2ESdQt90yU3oXF/CdOlRCJxrP+Am1aBYubTMTfxJ1qc= @@ -292,10 +243,6 @@ github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w= github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g= -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.19.2 h1:md90tE71/M8jS3cuRlsuWP5Aed4xoG5PSRvXeZgCv/M= -github.com/speakeasy-api/openapi v1.19.2/go.mod h1:UfKa7FqE4jgexJZuj51MmdHAFGmDv0Zaw3+yOd81YKU= github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I= github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg= github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY= @@ -313,8 +260,6 @@ github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/ github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4= github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0= 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.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= @@ -334,8 +279,6 @@ github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6Kllzaw github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.71.0 h1:tepR7H+Guh9VUqxxcPggYi8R3lGUu2Rsdh+z7/FCY3k= github.com/valyala/fasthttp v1.71.0/go.mod h1:z1sDUvOShhXq/C9mwH/fSm1Vb71tUJwmQdgkBrBNwnA= -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/woodsbury/decimal128 v1.4.0 h1:xJATj7lLu4f2oObouMt2tgGiElE5gO6mSWUjQsBgUlc= github.com/woodsbury/decimal128 v1.4.0/go.mod h1:BP46FUrVjVhdTbKT+XuQh2xfQaGki9LMIRJSFuh6THU= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= @@ -344,7 +287,6 @@ github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZ github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E= github.com/yosida95/uritemplate/v3 v3.0.2 h1:Ed3Oyj9yrmi9087+NczuL5BwkIc4wvTb5zIM+UJPGz4= github.com/yosida95/uritemplate/v3 v3.0.2/go.mod h1:ILOh0sOhIJR3+L/8afwt/kE++YT040gmv5BQTMR2HP4= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yuin/goldmark v1.8.2 h1:kEGpgqJXdgbkhcOgBxkC0X0PmoPG1ZyoZ117rDVp4zE= github.com/yuin/goldmark v1.8.2/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg= @@ -381,56 +323,34 @@ go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= 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/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/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.52.0 h1:RMs7fP2rXdep0CftQlK8Uf+kibLm7qkCcradZWYz988= golang.org/x/crypto v0.52.0/go.mod h1:1QgfPxDqh0T2M/elOJtp9RvuR95kVjir0e6/BvEmGbc= golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 h1:y5zboxd6LQAqYIhHnB48p0ByQ/GnQx2BE33L8BOHQkI= golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6/go.mod h1:U6Lno4MTRCDY+Ba7aCcauB9T60gsv5s4ralQzP72ZoQ= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.35.0 h1:Ww1D637e6Pg+Zb2KrWfHQUnH2dQRLBQyAtpr/haaJeM= golang.org/x/mod v0.35.0/go.mod h1:+GwiRhIInF8wPm+4AoT6L0FA1QWAad3OMdTRx4tFYlU= -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-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -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.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.55.0 h1:bcvxaJn3e1U6InsFWt1JUq1aSjnRxLzT2rtD2KfkDF8= golang.org/x/net v0.55.0/go.mod h1:L5U2KuzuOe1lY7Z+aWVIKK6qEeJXnXV9yzGA+WCHJww= golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= -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.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= golang.org/x/sync v0.20.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-20190916202348-b4ddaad3f8a3/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-20201204225414-ed752295db88/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-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -446,7 +366,6 @@ golang.org/x/term v0.43.0 h1:S4RLU2sB31O/NCl+zFN9Aru9A/Cq2aqKpTZJ6B+DwT4= golang.org/x/term v0.43.0/go.mod h1:lrhlHNdQJHO+1qVYiHfFKVuVioJIheAc3fBSMFYEIsk= 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.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= @@ -456,7 +375,6 @@ golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= 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.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.44.0 h1:UP4ajHPIcuMjT1GqzDWRlalUEoY+uzoZKnhOjbIPD2c= @@ -468,9 +386,6 @@ golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated/go.mod h1:RVAQXBGN golang.org/x/vuln v1.3.0 h1:hZYzR8uRhYhDSX88d+40TWbKAVw7BIvRWm26rtEn8jw= golang.org/x/vuln v1.3.0/go.mod h1:MIY2PaR1y52stzZM3uHBboUAdVJvSVMl5nP3OQrwQaE= 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= gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= google.golang.org/genproto/googleapis/api v0.0.0-20260120221211-b8f7ae30c516 h1:vmC/ws+pLzWjj/gzApyoZuSVrDtF1aod4u/+bbj8hgM= @@ -479,32 +394,15 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20260120221211-b8f7ae30c516 h1: google.golang.org/genproto/googleapis/rpc v0.0.0-20260120221211-b8f7ae30c516/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ= google.golang.org/grpc v1.79.3 h1:sybAEdRIEtvcD68Gx7dmnwjZKlyfuc61Dyo9pGXXkKE= google.golang.org/grpc v1.79.3/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ= -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= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -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/ini.v1 v1.67.2 h1:JtOSMb9OuaCZKr7h5D/h6iii14sK0hLbplTc6frx4Ss= gopkg.in/ini.v1 v1.67.2/go.mod h1:x/cyOwCgZqOkJoDIJ3c1KNHMo10+nLGAhh+kn3Zizss= -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/modules/compute/module.go b/modules/compute/module.go index 95af3f31..bc313d8a 100644 --- a/modules/compute/module.go +++ b/modules/compute/module.go @@ -196,6 +196,8 @@ func (m *Module) PythonAPIDocs() map[string]types.ModuleDoc { "get_node": {Signature: "get_node(node_id, datasource=None) -> dict", Description: "Get one compute node by id"}, "list_audit": {Signature: "list_audit(datasource=None) -> dict", Description: "List audit-log entries"}, "meta": {Signature: "meta(datasource=None) -> dict", Description: "Get service metadata (version, limits, capabilities)"}, + "list_api_operations": {Signature: "list_api_operations(datasource=None) -> dict", Description: "List the operations the compute service currently advertises, with their path/query/body arguments"}, + "call": {Signature: "call(operation, datasource=None, **kwargs) -> dict", Description: "Call any compute API operation by name; the interface is discovered from the running service, so operations added upstream work without a panda upgrade"}, }, }, } diff --git a/modules/compute/python/compute.py b/modules/compute/python/compute.py index 7baacb4a..b84db673 100644 --- a/modules/compute/python/compute.py +++ b/modules/compute/python/compute.py @@ -671,3 +671,25 @@ def delete_ssh_key(key_id: str, datasource: str | None = None) -> Any: """Delete one of the caller's SSH public keys.""" _require_compute_available() return _runtime.invoke_json("compute.delete_ssh_key", _args(datasource, id=key_id)) + + +def list_api_operations(datasource: str | None = None) -> Any: + """List the operations the compute service currently advertises. + + Each entry has the operation name plus its path/query arguments and + whether it takes a request body with any required fields. + """ + _require_compute_available() + return _runtime.invoke_json("compute.list_api_operations", _args(datasource)) + + +def call(operation: str, datasource: str | None = None, **kwargs: Any) -> Any: + """Call any compute API operation by name. + + The interface is discovered from the running service, so operations added + upstream work without a panda upgrade; see :func:`list_api_operations` + for the catalog. Path and query arguments are taken by name and everything + else becomes a request-body field. Mutations need an ``idempotency_key``. + """ + _require_compute_available() + return _runtime.invoke_json("compute." + operation, _args(datasource, **kwargs)) diff --git a/pkg/cli/compute.go b/pkg/cli/compute.go index 3482b7f2..addcd63e 100644 --- a/pkg/cli/compute.go +++ b/pkg/cli/compute.go @@ -57,6 +57,8 @@ var ( computeForkPaused bool computePortProtocol string computePortService string + computeCallArgs []string + computeCallJSON string ) var computeCmd = &cobra.Command{ @@ -223,11 +225,19 @@ func init() { computeUsersCmd.AddCommand(computeUsersListCmd, computeUsersGetCmd) computeNodesCmd.AddCommand(computeNodesListCmd, computeNodesGetCmd) + computeCallCmd.Flags().StringArrayVar(&computeCallArgs, "arg", nil, + "Operation argument as key=value; values parse as JSON when possible; repeatable") + computeCallCmd.Flags().StringVar(&computeCallJSON, "json", "", + "Operation arguments as one JSON object") + computeCallCmd.Flags().StringVar(&computeIdempotency, "idempotency-key", "", + "Idempotency key to make a mutation safely retryable (generated per invocation otherwise)") + computeCmd.AddCommand( computeDatasourcesCmd, computeMetaCmd, computeAuditCmd, computeSessionCmd, + computeCallCmd, computeSandboxesCmd, computeImagesCmd, computeForksCmd, @@ -366,6 +376,76 @@ var computeAuditCmd = &cobra.Command{ }, } +var computeCallCmd = &cobra.Command{ + Use: "call [operation]", + Short: "Call any compute API operation by name", + Long: `Call any operation the compute service advertises, including ones this CLI +has no dedicated command for. The interface is discovered from the running +service, so new operations work without upgrading panda. + +Run without arguments to list the available operations with their arguments. +Pass arguments with --arg key=value; values parse as JSON when possible +(numbers, booleans, arrays, objects) and as plain strings otherwise, and +--json supplies a full argument object in one flag. Path and query arguments +are taken by name; everything else becomes a request-body field. + +Mutations require an idempotency key; one is generated per invocation unless +--idempotency-key is set. + +Examples: + panda compute call + panda compute call list_sandboxes --arg limit=5 + panda compute call get_sandbox --arg id=sb-123 + panda compute call snapshot_sandbox --arg id=sb-123 --arg note='before upgrade' + panda compute call expose_port --json '{"id":"sb-123","port":8080}'`, + Args: cobra.MaximumNArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + if len(args) == 0 { + return runComputeRaw(cmd, "compute.list_api_operations", computeArgs()) + } + + opArgs := computeArgs() + + if computeCallJSON != "" { + var decoded map[string]any + if err := json.Unmarshal([]byte(computeCallJSON), &decoded); err != nil { + return fmt.Errorf("--json: %w", err) + } + + for key, value := range decoded { + opArgs[key] = value + } + } + + for _, entry := range computeCallArgs { + key, raw, found := strings.Cut(entry, "=") + if !found || key == "" { + return fmt.Errorf("--arg %q is not key=value", entry) + } + + opArgs[key] = parseComputeCallValue(raw) + } + + if _, ok := opArgs["idempotency_key"]; !ok { + opArgs["idempotency_key"] = computeIdemOrGenerated() + } + + return runComputeRaw(cmd, "compute."+args[0], opArgs) + }, +} + +// parseComputeCallValue decodes an --arg value as JSON when possible so +// numbers, booleans, arrays, and objects keep their types, falling back to +// the raw string. +func parseComputeCallValue(raw string) any { + var value any + if err := json.Unmarshal([]byte(raw), &value); err != nil { + return raw + } + + return value +} + var computeSessionCmd = &cobra.Command{ Use: "session", Short: "Show the authenticated session and identity", diff --git a/pkg/compute/codegen.yaml b/pkg/compute/codegen.yaml deleted file mode 100644 index 9cbe95b5..00000000 --- a/pkg/compute/codegen.yaml +++ /dev/null @@ -1,5 +0,0 @@ -package: compute -generate: - models: true - client: true -output: compute.gen.go diff --git a/pkg/compute/compute.gen.go b/pkg/compute/compute.gen.go deleted file mode 100644 index e442eb4a..00000000 --- a/pkg/compute/compute.gen.go +++ /dev/null @@ -1,11155 +0,0 @@ -// Package compute provides primitives to interact with the openapi HTTP API. -// -// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.1 DO NOT EDIT. -package compute - -import ( - "bytes" - "context" - "encoding/json" - "fmt" - "io" - "net/http" - "net/url" - "strings" - "time" - - "go.yaml.in/yaml/v3" - - "github.com/oapi-codegen/runtime" -) - -const ( - BearerAuthScopes bearerAuthContextKey = "bearerAuth.Scopes" -) - -// Defines values for BakeStatusLastResult. -const ( - BakeStatusLastResultFailed BakeStatusLastResult = "failed" - BakeStatusLastResultSucceeded BakeStatusLastResult = "succeeded" -) - -// Valid indicates whether the value is a known member of the BakeStatusLastResult enum. -func (e BakeStatusLastResult) Valid() bool { - switch e { - case BakeStatusLastResultFailed: - return true - case BakeStatusLastResultSucceeded: - return true - default: - return false - } -} - -// Defines values for CreateSandboxRequestOnDelete. -const ( - CreateSandboxRequestOnDeleteArchive CreateSandboxRequestOnDelete = "archive" - CreateSandboxRequestOnDeleteDelete CreateSandboxRequestOnDelete = "delete" - CreateSandboxRequestOnDeleteHot CreateSandboxRequestOnDelete = "hot" -) - -// Valid indicates whether the value is a known member of the CreateSandboxRequestOnDelete enum. -func (e CreateSandboxRequestOnDelete) Valid() bool { - switch e { - case CreateSandboxRequestOnDeleteArchive: - return true - case CreateSandboxRequestOnDeleteDelete: - return true - case CreateSandboxRequestOnDeleteHot: - return true - default: - return false - } -} - -// Defines values for ErrorBodyCode. -const ( - ErrorBodyCodeAmbiguousPagination ErrorBodyCode = "ambiguous_pagination" - ErrorBodyCodeAmbiguousTemplate ErrorBodyCode = "ambiguous_template" - ErrorBodyCodeConflict ErrorBodyCode = "conflict" - ErrorBodyCodeExecUnavailable ErrorBodyCode = "exec_unavailable" - ErrorBodyCodeForbidden ErrorBodyCode = "forbidden" - ErrorBodyCodeHookTemplateNotFound ErrorBodyCode = "hook_template_not_found" - ErrorBodyCodeInternalError ErrorBodyCode = "internal_error" - ErrorBodyCodeInvalidCursor ErrorBodyCode = "invalid_cursor" - ErrorBodyCodeInvalidExecRequest ErrorBodyCode = "invalid_exec_request" - ErrorBodyCodeInvalidFilter ErrorBodyCode = "invalid_filter" - ErrorBodyCodeInvalidHook ErrorBodyCode = "invalid_hook" - ErrorBodyCodeInvalidJson ErrorBodyCode = "invalid_json" - ErrorBodyCodeInvalidLimit ErrorBodyCode = "invalid_limit" - ErrorBodyCodeInvalidOffset ErrorBodyCode = "invalid_offset" - ErrorBodyCodeInvalidOnDelete ErrorBodyCode = "invalid_on_delete" - ErrorBodyCodeInvalidOverride ErrorBodyCode = "invalid_override" - ErrorBodyCodeInvalidPort ErrorBodyCode = "invalid_port" - ErrorBodyCodeInvalidRequest ErrorBodyCode = "invalid_request" - ErrorBodyCodeInvalidSource ErrorBodyCode = "invalid_source" - ErrorBodyCodeInvalidSshAuthorization ErrorBodyCode = "invalid_ssh_authorization" - ErrorBodyCodeInvalidSshKey ErrorBodyCode = "invalid_ssh_key" - ErrorBodyCodeInvalidSshPublicKey ErrorBodyCode = "invalid_ssh_public_key" - ErrorBodyCodeInvalidTemplate ErrorBodyCode = "invalid_template" - ErrorBodyCodeInvalidTtl ErrorBodyCode = "invalid_ttl" - ErrorBodyCodeMissingIdempotencyKey ErrorBodyCode = "missing_idempotency_key" - ErrorBodyCodeMissingTemplate ErrorBodyCode = "missing_template" - ErrorBodyCodeNotFound ErrorBodyCode = "not_found" - ErrorBodyCodeNotReady ErrorBodyCode = "not_ready" - ErrorBodyCodeOverrideNotAllowed ErrorBodyCode = "override_not_allowed" - ErrorBodyCodeRequestTooLarge ErrorBodyCode = "request_too_large" - ErrorBodyCodeStreamingUnavailable ErrorBodyCode = "streaming_unavailable" - ErrorBodyCodeTemplateNotFound ErrorBodyCode = "template_not_found" - ErrorBodyCodeUnauthorized ErrorBodyCode = "unauthorized" -) - -// Valid indicates whether the value is a known member of the ErrorBodyCode enum. -func (e ErrorBodyCode) Valid() bool { - switch e { - case ErrorBodyCodeAmbiguousPagination: - return true - case ErrorBodyCodeAmbiguousTemplate: - return true - case ErrorBodyCodeConflict: - return true - case ErrorBodyCodeExecUnavailable: - return true - case ErrorBodyCodeForbidden: - return true - case ErrorBodyCodeHookTemplateNotFound: - return true - case ErrorBodyCodeInternalError: - return true - case ErrorBodyCodeInvalidCursor: - return true - case ErrorBodyCodeInvalidExecRequest: - return true - case ErrorBodyCodeInvalidFilter: - return true - case ErrorBodyCodeInvalidHook: - return true - case ErrorBodyCodeInvalidJson: - return true - case ErrorBodyCodeInvalidLimit: - return true - case ErrorBodyCodeInvalidOffset: - return true - case ErrorBodyCodeInvalidOnDelete: - return true - case ErrorBodyCodeInvalidOverride: - return true - case ErrorBodyCodeInvalidPort: - return true - case ErrorBodyCodeInvalidRequest: - return true - case ErrorBodyCodeInvalidSource: - return true - case ErrorBodyCodeInvalidSshAuthorization: - return true - case ErrorBodyCodeInvalidSshKey: - return true - case ErrorBodyCodeInvalidSshPublicKey: - return true - case ErrorBodyCodeInvalidTemplate: - return true - case ErrorBodyCodeInvalidTtl: - return true - case ErrorBodyCodeMissingIdempotencyKey: - return true - case ErrorBodyCodeMissingTemplate: - return true - case ErrorBodyCodeNotFound: - return true - case ErrorBodyCodeNotReady: - return true - case ErrorBodyCodeOverrideNotAllowed: - return true - case ErrorBodyCodeRequestTooLarge: - return true - case ErrorBodyCodeStreamingUnavailable: - return true - case ErrorBodyCodeTemplateNotFound: - return true - case ErrorBodyCodeUnauthorized: - return true - default: - return false - } -} - -// Defines values for ForkIdentityClock. -const ( - ForkIdentityClockCorrect ForkIdentityClock = "correct" - ForkIdentityClockInherit ForkIdentityClock = "inherit" -) - -// Valid indicates whether the value is a known member of the ForkIdentityClock enum. -func (e ForkIdentityClock) Valid() bool { - switch e { - case ForkIdentityClockCorrect: - return true - case ForkIdentityClockInherit: - return true - default: - return false - } -} - -// Defines values for ForkIdentityRng. -const ( - ForkIdentityRngInherit ForkIdentityRng = "inherit" - ForkIdentityRngReseed ForkIdentityRng = "reseed" -) - -// Valid indicates whether the value is a known member of the ForkIdentityRng enum. -func (e ForkIdentityRng) Valid() bool { - switch e { - case ForkIdentityRngInherit: - return true - case ForkIdentityRngReseed: - return true - default: - return false - } -} - -// Defines values for ForkRequestFlavor. -const ( - ForkRequestFlavorCold ForkRequestFlavor = "cold" - ForkRequestFlavorWarm ForkRequestFlavor = "warm" -) - -// Valid indicates whether the value is a known member of the ForkRequestFlavor enum. -func (e ForkRequestFlavor) Valid() bool { - switch e { - case ForkRequestFlavorCold: - return true - case ForkRequestFlavorWarm: - return true - default: - return false - } -} - -// Defines values for ForkSourceKind. -const ( - ForkSourceKindSandbox ForkSourceKind = "sandbox" - ForkSourceKindSnapshot ForkSourceKind = "snapshot" -) - -// Valid indicates whether the value is a known member of the ForkSourceKind enum. -func (e ForkSourceKind) Valid() bool { - switch e { - case ForkSourceKindSandbox: - return true - case ForkSourceKindSnapshot: - return true - default: - return false - } -} - -// Defines values for HookDeclarationEvent. -const ( - AfterCreate HookDeclarationEvent = "after_create" - AfterRestore HookDeclarationEvent = "after_restore" - AfterResume HookDeclarationEvent = "after_resume" - BeforeDelete HookDeclarationEvent = "before_delete" - BeforePause HookDeclarationEvent = "before_pause" - BeforeSnapshot HookDeclarationEvent = "before_snapshot" - BeforeStop HookDeclarationEvent = "before_stop" -) - -// Valid indicates whether the value is a known member of the HookDeclarationEvent enum. -func (e HookDeclarationEvent) Valid() bool { - switch e { - case AfterCreate: - return true - case AfterRestore: - return true - case AfterResume: - return true - case BeforeDelete: - return true - case BeforePause: - return true - case BeforeSnapshot: - return true - case BeforeStop: - return true - default: - return false - } -} - -// Defines values for HookDeclarationOnFailure. -const ( - HookDeclarationOnFailureAbort HookDeclarationOnFailure = "abort" - HookDeclarationOnFailureContinue HookDeclarationOnFailure = "continue" -) - -// Valid indicates whether the value is a known member of the HookDeclarationOnFailure enum. -func (e HookDeclarationOnFailure) Valid() bool { - switch e { - case HookDeclarationOnFailureAbort: - return true - case HookDeclarationOnFailureContinue: - return true - default: - return false - } -} - -// Defines values for HookRunStatus. -const ( - HookRunStatusFailed HookRunStatus = "failed" - HookRunStatusRunning HookRunStatus = "running" - HookRunStatusSkipped HookRunStatus = "skipped" - HookRunStatusSucceeded HookRunStatus = "succeeded" - HookRunStatusTimedOut HookRunStatus = "timed_out" -) - -// Valid indicates whether the value is a known member of the HookRunStatus enum. -func (e HookRunStatus) Valid() bool { - switch e { - case HookRunStatusFailed: - return true - case HookRunStatusRunning: - return true - case HookRunStatusSkipped: - return true - case HookRunStatusSucceeded: - return true - case HookRunStatusTimedOut: - return true - default: - return false - } -} - -// Defines values for HookSummaryOnFailure. -const ( - HookSummaryOnFailureAbort HookSummaryOnFailure = "abort" - HookSummaryOnFailureContinue HookSummaryOnFailure = "continue" -) - -// Valid indicates whether the value is a known member of the HookSummaryOnFailure enum. -func (e HookSummaryOnFailure) Valid() bool { - switch e { - case HookSummaryOnFailureAbort: - return true - case HookSummaryOnFailureContinue: - return true - default: - return false - } -} - -// Defines values for ImageFlavor. -const ( - ImageFlavorCold ImageFlavor = "cold" - ImageFlavorWarm ImageFlavor = "warm" -) - -// Valid indicates whether the value is a known member of the ImageFlavor enum. -func (e ImageFlavor) Valid() bool { - switch e { - case ImageFlavorCold: - return true - case ImageFlavorWarm: - return true - default: - return false - } -} - -// Defines values for ImageKind. -const ( - Named ImageKind = "named" - Raw ImageKind = "raw" -) - -// Valid indicates whether the value is a known member of the ImageKind enum. -func (e ImageKind) Valid() bool { - switch e { - case Named: - return true - case Raw: - return true - default: - return false - } -} - -// Defines values for LineageNodeEdge. -const ( - CreatedFrom LineageNodeEdge = "created-from" - SnapshottedTo LineageNodeEdge = "snapshotted-to" -) - -// Valid indicates whether the value is a known member of the LineageNodeEdge enum. -func (e LineageNodeEdge) Valid() bool { - switch e { - case CreatedFrom: - return true - case SnapshottedTo: - return true - default: - return false - } -} - -// Defines values for LineageNodeKind. -const ( - Empty LineageNodeKind = "—" - SANDBOX LineageNodeKind = "SANDBOX" - SNAPSHOT LineageNodeKind = "SNAPSHOT" -) - -// Valid indicates whether the value is a known member of the LineageNodeKind enum. -func (e LineageNodeKind) Valid() bool { - switch e { - case Empty: - return true - case SANDBOX: - return true - case SNAPSHOT: - return true - default: - return false - } -} - -// Defines values for LineageNodeVariant. -const ( - LineageNodeVariantCurrent LineageNodeVariant = "current" - LineageNodeVariantHistorical LineageNodeVariant = "historical" - LineageNodeVariantNone LineageNodeVariant = "none" - LineageNodeVariantRestoredLive LineageNodeVariant = "restored-live" - LineageNodeVariantSnapshot LineageNodeVariant = "snapshot" -) - -// Valid indicates whether the value is a known member of the LineageNodeVariant enum. -func (e LineageNodeVariant) Valid() bool { - switch e { - case LineageNodeVariantCurrent: - return true - case LineageNodeVariantHistorical: - return true - case LineageNodeVariantNone: - return true - case LineageNodeVariantRestoredLive: - return true - case LineageNodeVariantSnapshot: - return true - default: - return false - } -} - -// Defines values for LogLineSource. -const ( - LogLineSourceConsole LogLineSource = "console" - LogLineSourceFirecracker LogLineSource = "firecracker" -) - -// Valid indicates whether the value is a known member of the LogLineSource enum. -func (e LogLineSource) Valid() bool { - switch e { - case LogLineSourceConsole: - return true - case LogLineSourceFirecracker: - return true - default: - return false - } -} - -// Defines values for OperationState. -const ( - OperationStateFailed OperationState = "failed" - OperationStateQueued OperationState = "queued" - OperationStateRunning OperationState = "running" - OperationStateSucceeded OperationState = "succeeded" -) - -// Valid indicates whether the value is a known member of the OperationState enum. -func (e OperationState) Valid() bool { - switch e { - case OperationStateFailed: - return true - case OperationStateQueued: - return true - case OperationStateRunning: - return true - case OperationStateSucceeded: - return true - default: - return false - } -} - -// Defines values for SandboxOnDelete. -const ( - SandboxOnDeleteArchive SandboxOnDelete = "archive" - SandboxOnDeleteDelete SandboxOnDelete = "delete" - SandboxOnDeleteHot SandboxOnDelete = "hot" -) - -// Valid indicates whether the value is a known member of the SandboxOnDelete enum. -func (e SandboxOnDelete) Valid() bool { - switch e { - case SandboxOnDeleteArchive: - return true - case SandboxOnDeleteDelete: - return true - case SandboxOnDeleteHot: - return true - default: - return false - } -} - -// Defines values for SandboxState. -const ( - SandboxStateDegraded SandboxState = "degraded" - SandboxStateFailed SandboxState = "failed" - SandboxStateGone SandboxState = "gone" - SandboxStatePaused SandboxState = "paused" - SandboxStatePending SandboxState = "pending" - SandboxStateRestoring SandboxState = "restoring" - SandboxStateRunning SandboxState = "running" - SandboxStateSnapshotting SandboxState = "snapshotting" - SandboxStateStopped SandboxState = "stopped" -) - -// Valid indicates whether the value is a known member of the SandboxState enum. -func (e SandboxState) Valid() bool { - switch e { - case SandboxStateDegraded: - return true - case SandboxStateFailed: - return true - case SandboxStateGone: - return true - case SandboxStatePaused: - return true - case SandboxStatePending: - return true - case SandboxStateRestoring: - return true - case SandboxStateRunning: - return true - case SandboxStateSnapshotting: - return true - case SandboxStateStopped: - return true - default: - return false - } -} - -// Defines values for ScheduledResponseStatus. -const ( - Scheduled ScheduledResponseStatus = "scheduled" -) - -// Valid indicates whether the value is a known member of the ScheduledResponseStatus enum. -func (e ScheduledResponseStatus) Valid() bool { - switch e { - case Scheduled: - return true - default: - return false - } -} - -// Defines values for SnapshotState. -const ( - Available SnapshotState = "available" - Creating SnapshotState = "creating" - Deleted SnapshotState = "deleted" - Failed SnapshotState = "failed" - Unavailable SnapshotState = "unavailable" -) - -// Valid indicates whether the value is a known member of the SnapshotState enum. -func (e SnapshotState) Valid() bool { - switch e { - case Available: - return true - case Creating: - return true - case Deleted: - return true - case Failed: - return true - case Unavailable: - return true - default: - return false - } -} - -// Defines values for SnapshotBootSourceFlavor. -const ( - SnapshotBootSourceFlavorCold SnapshotBootSourceFlavor = "cold" - SnapshotBootSourceFlavorWarm SnapshotBootSourceFlavor = "warm" -) - -// Valid indicates whether the value is a known member of the SnapshotBootSourceFlavor enum. -func (e SnapshotBootSourceFlavor) Valid() bool { - switch e { - case SnapshotBootSourceFlavorCold: - return true - case SnapshotBootSourceFlavorWarm: - return true - default: - return false - } -} - -// Defines values for SnapshotBootSourceKind. -const ( - SnapshotBootSourceKindSnapshot SnapshotBootSourceKind = "snapshot" -) - -// Valid indicates whether the value is a known member of the SnapshotBootSourceKind enum. -func (e SnapshotBootSourceKind) Valid() bool { - switch e { - case SnapshotBootSourceKindSnapshot: - return true - default: - return false - } -} - -// Defines values for TemplateClockPolicy. -const ( - Frozen TemplateClockPolicy = "frozen" - Realtime TemplateClockPolicy = "realtime" -) - -// Valid indicates whether the value is a known member of the TemplateClockPolicy enum. -func (e TemplateClockPolicy) Valid() bool { - switch e { - case Frozen: - return true - case Realtime: - return true - default: - return false - } -} - -// Defines values for TemplateFlavor. -const ( - TemplateFlavorCold TemplateFlavor = "cold" - TemplateFlavorWarm TemplateFlavor = "warm" -) - -// Valid indicates whether the value is a known member of the TemplateFlavor enum. -func (e TemplateFlavor) Valid() bool { - switch e { - case TemplateFlavorCold: - return true - case TemplateFlavorWarm: - return true - default: - return false - } -} - -// Defines values for TemplateBootSourceKind. -const ( - TemplateBootSourceKindTemplate TemplateBootSourceKind = "template" -) - -// Valid indicates whether the value is a known member of the TemplateBootSourceKind enum. -func (e TemplateBootSourceKind) Valid() bool { - switch e { - case TemplateBootSourceKindTemplate: - return true - default: - return false - } -} - -// Defines values for WatchdogDeclarationAction. -const ( - WatchdogDeclarationActionNone WatchdogDeclarationAction = "none" - WatchdogDeclarationActionSnapshot WatchdogDeclarationAction = "snapshot" - WatchdogDeclarationActionStop WatchdogDeclarationAction = "stop" -) - -// Valid indicates whether the value is a known member of the WatchdogDeclarationAction enum. -func (e WatchdogDeclarationAction) Valid() bool { - switch e { - case WatchdogDeclarationActionNone: - return true - case WatchdogDeclarationActionSnapshot: - return true - case WatchdogDeclarationActionStop: - return true - default: - return false - } -} - -// Defines values for WatchdogSummaryAction. -const ( - WatchdogSummaryActionNone WatchdogSummaryAction = "none" - WatchdogSummaryActionSnapshot WatchdogSummaryAction = "snapshot" - WatchdogSummaryActionStop WatchdogSummaryAction = "stop" -) - -// Valid indicates whether the value is a known member of the WatchdogSummaryAction enum. -func (e WatchdogSummaryAction) Valid() bool { - switch e { - case WatchdogSummaryActionNone: - return true - case WatchdogSummaryActionSnapshot: - return true - case WatchdogSummaryActionStop: - return true - default: - return false - } -} - -// Defines values for GetSandboxLogsParamsSource. -const ( - GetSandboxLogsParamsSourceConsole GetSandboxLogsParamsSource = "console" - GetSandboxLogsParamsSourceFirecracker GetSandboxLogsParamsSource = "firecracker" -) - -// Valid indicates whether the value is a known member of the GetSandboxLogsParamsSource enum. -func (e GetSandboxLogsParamsSource) Valid() bool { - switch e { - case GetSandboxLogsParamsSourceConsole: - return true - case GetSandboxLogsParamsSourceFirecracker: - return true - default: - return false - } -} - -// AcceptedResponse defines model for AcceptedResponse. -type AcceptedResponse struct { - Hooks *[]HookSummary `json:"hooks,omitempty"` - - // Id Resource ID for create-style operations. - Id *string `json:"id,omitempty"` - OpId string `json:"op_id"` - SandboxId *string `json:"sandbox_id,omitempty"` - SnapshotId *string `json:"snapshot_id,omitempty"` - Watchdog *WatchdogSummary `json:"watchdog,omitempty"` -} - -// AddSSHPublicKeyRequest defines model for AddSSHPublicKeyRequest. -type AddSSHPublicKeyRequest struct { - // Label Optional display label. Defaults to the key comment or fingerprint. - Label *string `json:"label,omitempty"` - - // Name Optional display name. Defaults to the key comment or fingerprint. - Name *string `json:"name,omitempty"` - - // PublicKey One OpenSSH public key line. - PublicKey string `json:"public_key"` -} - -// AuthCLIConfig defines model for AuthCLIConfig. -type AuthCLIConfig struct { - ClientId *string `json:"client_id,omitempty"` - Issuer *string `json:"issuer,omitempty"` - OidcEnabled bool `json:"oidc_enabled"` - Scopes []string `json:"scopes"` -} - -// AuthSession defines model for AuthSession. -type AuthSession struct { - Authenticated bool `json:"authenticated"` - Enabled bool `json:"enabled"` - User *WebSessionIdentity `json:"user,omitempty"` -} - -// BakeStatus defines model for BakeStatus. -type BakeStatus struct { - ActiveCreatedAt *time.Time `json:"active_created_at,omitempty"` - ActiveVersion *string `json:"active_version,omitempty"` - Description *string `json:"description,omitempty"` - Enabled bool `json:"enabled"` - Interval string `json:"interval"` - LastAttemptAt *time.Time `json:"last_attempt_at,omitempty"` - LastError *string `json:"last_error,omitempty"` - LastResult *BakeStatusLastResult `json:"last_result,omitempty"` - LastVersion *string `json:"last_version,omitempty"` - Name string `json:"name"` - NextDueAt *time.Time `json:"next_due_at,omitempty"` - Running bool `json:"running"` - Seed string `json:"seed"` -} - -// BakeStatusLastResult defines model for BakeStatus.LastResult. -type BakeStatusLastResult string - -// BakeStatusList defines model for BakeStatusList. -type BakeStatusList struct { - Items []BakeStatus `json:"items"` - NextCursor *string `json:"next_cursor,omitempty"` - Total int `json:"total"` -} - -// CreateSandboxRequest defines model for CreateSandboxRequest. -type CreateSandboxRequest struct { - // DiskGb Optional disk override in GiB. Cold creates require disk_gb to be greater than or equal to the cold template disk size. Warm restores require disk_gb to be at least the recorded warm snapshot disk size. This resizes the backing zvol only; extra space becomes available to the guest only after the guest resizes its filesystem. - DiskGb *int `json:"disk_gb,omitempty"` - - // Env Optional write-only guest environment delivered to shells and execs. - Env *map[string]string `json:"env,omitempty"` - - // ExposedPorts Optional explicit port exposure list. Absent inherits template or snapshot defaults; present empty exposes nothing. - ExposedPorts *[]PortExposureRequest `json:"exposed_ports,omitempty"` - Hooks *[]HookDeclaration `json:"hooks,omitempty"` - - // Labels Optional service metadata labels for the sandbox. - Labels *map[string]string `json:"labels,omitempty"` - - // MemoryMb Optional memory override in MiB, bounded by operator override_limits. Warm restores pin memory to the recorded snapshot value because Firecracker restore loads the saved memory image; requests with a different memory value are rejected with override_not_allowed. Snapshot sources currently resolve through warm restore, so the same rule applies. - MemoryMb *int `json:"memory_mb,omitempty"` - - // Name Optional display name stored as sandbox web metadata. - Name *string `json:"name,omitempty"` - - // OnDelete Disposition to apply when the sandbox is deleted. - OnDelete *CreateSandboxRequestOnDelete `json:"on_delete,omitempty"` - - // Paused When true the restored sandbox is left paused (its fully-booted memory image loaded but not resumed) instead of running. Valid only for a warm-flavor snapshot source; a template source or the cold flavor is rejected because there is no frozen image to hold. - Paused *bool `json:"paused,omitempty"` - Source *CreateSandboxSource `json:"source,omitempty"` - - // Template Legacy template name. Mutually exclusive with source. - Template *string `json:"template,omitempty"` - - // Ttl Optional positive Go-style duration string. - Ttl *string `json:"ttl,omitempty"` - - // Vcpu Optional vCPU override, bounded by operator override_limits. Cold creates may override freely within limits. Warm restores require vCPU to be at least the recorded warm snapshot value because supervisor pod sizing is derived from this metadata. - Vcpu *int `json:"vcpu,omitempty"` - Watchdog *WatchdogDeclaration `json:"watchdog,omitempty"` -} - -// CreateSandboxRequestOnDelete Disposition to apply when the sandbox is deleted. -type CreateSandboxRequestOnDelete string - -// CreateSandboxSource defines model for CreateSandboxSource. -type CreateSandboxSource struct { - union json.RawMessage -} - -// ErrorBody defines model for ErrorBody. -type ErrorBody struct { - Code ErrorBodyCode `json:"code"` - Details *map[string]string `json:"details,omitempty"` - Message string `json:"message"` -} - -// ErrorBodyCode defines model for ErrorBody.Code. -type ErrorBodyCode string - -// ErrorEnvelope defines model for ErrorEnvelope. -type ErrorEnvelope struct { - Error ErrorBody `json:"error"` -} - -// ExecSandboxRequest defines model for ExecSandboxRequest. -type ExecSandboxRequest struct { - // Command Argument vector executed directly in the guest (no shell). Wrap in ["/bin/sh", "-c", ...] for shell semantics. - Command []string `json:"command"` - - // Timeout Positive Go-style duration bounding the command's runtime. Defaults to 30s; maximum 5m. - Timeout *string `json:"timeout,omitempty"` -} - -// ExecSandboxResult defines model for ExecSandboxResult. -type ExecSandboxResult struct { - // ExitCode Command exit code. -1 when the process was killed (including on timeout). - ExitCode int `json:"exit_code"` - Stderr string `json:"stderr"` - StderrTruncated *bool `json:"stderr_truncated,omitempty"` - Stdout string `json:"stdout"` - StdoutTruncated *bool `json:"stdout_truncated,omitempty"` - - // TimedOut True when the command hit the timeout and was killed. - TimedOut *bool `json:"timed_out,omitempty"` -} - -// ExposePortRequest defines model for ExposePortRequest. -type ExposePortRequest struct { - Managed *bool `json:"managed,omitempty"` - Name *string `json:"name,omitempty"` - Port int `json:"port"` - Protocol *string `json:"protocol,omitempty"` - Service *string `json:"service,omitempty"` -} - -// ExposedPort defines model for ExposedPort. -type ExposedPort struct { - // Managed Owned by an automated reconciler (portsync) rather than a user. - Managed *bool `json:"managed,omitempty"` - Name *string `json:"name,omitempty"` - Port int `json:"port"` - - // Protocol Endpoint label within the service (e.g. rpc, ws, metrics). - Protocol *string `json:"protocol,omitempty"` - - // Service Workload the exposure belongs to (e.g. Kurtosis service name); grouping key. - Service *string `json:"service,omitempty"` - Url string `json:"url"` -} - -// Fork defines model for Fork. -type Fork struct { - Cancelled int `json:"cancelled"` - Children *[]ForkChild `json:"children,omitempty"` - CreatedAt string `json:"created_at"` - DeadlineAt *string `json:"deadline_at,omitempty"` - Failed int `json:"failed"` - FailureMessage *string `json:"failure_message,omitempty"` - FailureReason *string `json:"failure_reason,omitempty"` - Id string `json:"id"` - MinReady *int `json:"min_ready,omitempty"` - Queued int `json:"queued"` - Requested int `json:"requested"` - Running int `json:"running"` - Source ForkSource `json:"source"` - State string `json:"state"` - UpdatedAt string `json:"updated_at"` -} - -// ForkAccepted defines model for ForkAccepted. -type ForkAccepted struct { - ForkId string `json:"fork_id"` - OpId string `json:"op_id"` -} - -// ForkChild defines model for ForkChild. -type ForkChild struct { - Ordinal int `json:"ordinal"` - SandboxId string `json:"sandbox_id"` - State string `json:"state"` -} - -// ForkIdentity defines model for ForkIdentity. -type ForkIdentity struct { - // Clock correct applies realtime clock correction while the child is paused during snapshot load, regardless of the snapshot manifest; inherit leaves the manifest or template clock policy in control. - Clock ForkIdentityClock `json:"clock"` - - // Rng Child RNG policy. reseed relies on the VM Generation ID clone event. inherit is reserved for a future Firecracker flag and is rejected by the current server because regeneration is currently unconditional on snapshot restore. - Rng ForkIdentityRng `json:"rng"` -} - -// ForkIdentityClock correct applies realtime clock correction while the child is paused during snapshot load, regardless of the snapshot manifest; inherit leaves the manifest or template clock policy in control. -type ForkIdentityClock string - -// ForkIdentityRng Child RNG policy. reseed relies on the VM Generation ID clone event. inherit is reserved for a future Firecracker flag and is rejected by the current server because regeneration is currently unconditional on snapshot restore. -type ForkIdentityRng string - -// ForkRequest defines model for ForkRequest. -type ForkRequest struct { - // Count Number of sandboxes to create. The only multiplier in the API. - Count int `json:"count"` - - // Deadline Go-style duration string bounding how long queued children may wait for capacity before the sweeper cancels the still-queued ones. - Deadline *string `json:"deadline,omitempty"` - - // Flavor How each child boots from the source snapshot. "warm" (default) resumes the captured memory image; "cold" boots a fresh kernel on the snapshot's disk. - Flavor *ForkRequestFlavor `json:"flavor,omitempty"` - Identity ForkIdentity `json:"identity"` - - // MinReady Floor of ready children below which the fork reports failure (min_ready_not_met). Running children are never destroyed to meet it. Must not exceed count. - MinReady *int `json:"min_ready,omitempty"` - - // Paused Whether children land paused instead of running. Omit to inherit the default: sandbox-source children inherit the source's state at fork time (a paused source yields paused children), snapshot-source children run. Set true/false to override. paused true with the cold flavor is rejected because cold children fresh-boot. - Paused *bool `json:"paused,omitempty"` - - // Ttl Go-style duration string applied to every child. Fork children always carry a TTL: omit to fall back to the configured lifecycle.default_ttl (a required server default). If neither is present the request is rejected. - Ttl *string `json:"ttl,omitempty"` -} - -// ForkRequestFlavor How each child boots from the source snapshot. "warm" (default) resumes the captured memory image; "cold" boots a fresh kernel on the snapshot's disk. -type ForkRequestFlavor string - -// ForkSource defines model for ForkSource. -type ForkSource struct { - Id string `json:"id"` - Kind ForkSourceKind `json:"kind"` -} - -// ForkSourceKind defines model for ForkSource.Kind. -type ForkSourceKind string - -// GuestNetwork defines model for GuestNetwork. -type GuestNetwork struct { - Dns string `json:"dns"` - EgressAllow []string `json:"egressAllow"` - EgressDeny []string `json:"egressDeny"` - GuestIp *string `json:"guestIp"` - Jailer bool `json:"jailer"` - Nftables bool `json:"nftables"` - Node *string `json:"node"` - TapDevice string `json:"tapDevice"` - UplinkCidr string `json:"uplinkCidr"` -} - -// HookDeclaration defines model for HookDeclaration. -type HookDeclaration struct { - Env *map[string]string `json:"env,omitempty"` - Event HookDeclarationEvent `json:"event"` - OnFailure *HookDeclarationOnFailure `json:"on_failure,omitempty"` - RunOrder *int `json:"run_order,omitempty"` - - // Script Inline shell script. Mutually exclusive with template. - Script *string `json:"script,omitempty"` - - // Template Hook template name. Mutually exclusive with script. - Template *string `json:"template,omitempty"` - TimeoutSeconds *int `json:"timeout_seconds,omitempty"` -} - -// HookDeclarationEvent defines model for HookDeclaration.Event. -type HookDeclarationEvent string - -// HookDeclarationOnFailure defines model for HookDeclaration.OnFailure. -type HookDeclarationOnFailure string - -// HookRun defines model for HookRun. -type HookRun struct { - Error *string `json:"error,omitempty"` - Event string `json:"event"` - ExitCode *int `json:"exit_code,omitempty"` - FinishedAt *time.Time `json:"finished_at,omitempty"` - HookId *string `json:"hook_id,omitempty"` - Id string `json:"id"` - OperationId *string `json:"operation_id,omitempty"` - SandboxId string `json:"sandbox_id"` - StartedAt time.Time `json:"started_at"` - Status HookRunStatus `json:"status"` - StderrTail *string `json:"stderr_tail,omitempty"` - StdoutTail *string `json:"stdout_tail,omitempty"` -} - -// HookRunStatus defines model for HookRun.Status. -type HookRunStatus string - -// HookRunList defines model for HookRunList. -type HookRunList struct { - Items []HookRun `json:"items"` - NextCursor *string `json:"next_cursor,omitempty"` - Total int `json:"total"` -} - -// HookSummary defines model for HookSummary. -type HookSummary struct { - Event string `json:"event"` - OnFailure HookSummaryOnFailure `json:"on_failure"` - RunOrder int `json:"run_order"` - SourceTemplateName *string `json:"source_template_name,omitempty"` - TimeoutSeconds int `json:"timeout_seconds"` -} - -// HookSummaryOnFailure defines model for HookSummary.OnFailure. -type HookSummaryOnFailure string - -// HookSummaryList defines model for HookSummaryList. -type HookSummaryList struct { - Items []HookSummary `json:"items"` - NextCursor *string `json:"next_cursor,omitempty"` - Total int `json:"total"` -} - -// HookTemplate defines model for HookTemplate. -type HookTemplate struct { - CreatedAt time.Time `json:"created_at"` - CreatedBy *string `json:"created_by,omitempty"` - Description *string `json:"description,omitempty"` - Env *map[string]string `json:"env,omitempty"` - Id string `json:"id"` - Name string `json:"name"` - Script string `json:"script"` - TimeoutSeconds int `json:"timeout_seconds"` - UpdatedAt time.Time `json:"updated_at"` -} - -// HookTemplateList defines model for HookTemplateList. -type HookTemplateList struct { - Items []HookTemplate `json:"items"` - NextCursor *string `json:"next_cursor,omitempty"` - Total int `json:"total"` -} - -// HookTemplateRequest defines model for HookTemplateRequest. -type HookTemplateRequest struct { - Description *string `json:"description,omitempty"` - Env *map[string]string `json:"env,omitempty"` - Name *string `json:"name,omitempty"` - Script string `json:"script"` - TimeoutSeconds *int `json:"timeout_seconds,omitempty"` -} - -// Image defines model for Image. -type Image struct { - CreatedAt *string `json:"createdAt,omitempty"` - Flavor ImageFlavor `json:"flavor"` - - // Id Snapshot ID for raw images, "name@version" for named ones. - Id string `json:"id"` - Kind ImageKind `json:"kind"` - Name *string `json:"name,omitempty"` - - // Promoted Raw image backs an active named image. - Promoted *bool `json:"promoted,omitempty"` - Snapshot *Snapshot `json:"snapshot,omitempty"` - SnapshotId *string `json:"snapshotId,omitempty"` - Template *Template `json:"template,omitempty"` - Version *string `json:"version,omitempty"` -} - -// ImageFlavor defines model for Image.Flavor. -type ImageFlavor string - -// ImageKind defines model for Image.Kind. -type ImageKind string - -// ImageList defines model for ImageList. -type ImageList struct { - Items []Image `json:"items"` - NextCursor *string `json:"next_cursor,omitempty"` - Total int `json:"total"` -} - -// IngressAuthorizeRequest defines model for IngressAuthorizeRequest. -type IngressAuthorizeRequest struct { - // GatewayPublicKey One OpenSSH public key generated by the gateway for this session. - GatewayPublicKey string `json:"gateway_public_key"` - - // PortLabel Numeric port string or configured port name. - PortLabel string `json:"port_label"` - SandboxId string `json:"sandbox_id"` -} - -// IngressAuthorizeResponse defines model for IngressAuthorizeResponse. -type IngressAuthorizeResponse struct { - Capability string `json:"capability"` - ExpiresAt time.Time `json:"expires_at"` - GuestCertificate string `json:"guest_certificate"` - IncarnationId string `json:"incarnation_id"` - Port int `json:"port"` - SandboxId string `json:"sandbox_id"` - SupervisorEndpoint string `json:"supervisor_endpoint"` - SupervisorPort int `json:"supervisor_port"` -} - -// LeaseResponse defines model for LeaseResponse. -type LeaseResponse struct { - // ExpiresAt New expiry after the lease extension. - ExpiresAt *time.Time `json:"expires_at,omitempty"` - Id string `json:"id"` -} - -// LeaseSandboxRequest defines model for LeaseSandboxRequest. -type LeaseSandboxRequest struct { - // Extend Positive Go-style duration to extend the lease by, clamped to max_lease_extension and max TTL. - Extend string `json:"extend"` -} - -// LineageNode defines model for LineageNode. -type LineageNode struct { - CreatedAt *time.Time `json:"createdAt,omitempty"` - Depth int `json:"depth"` - Edge *LineageNodeEdge `json:"edge,omitempty"` - EntityId *string `json:"entityId,omitempty"` - Href *string `json:"href,omitempty"` - IsLast bool `json:"isLast"` - Key string `json:"key"` - Kind LineageNodeKind `json:"kind"` - Label string `json:"label"` - ParentKey *string `json:"parentKey,omitempty"` - State *string `json:"state,omitempty"` - Sub string `json:"sub"` - Variant LineageNodeVariant `json:"variant"` -} - -// LineageNodeEdge defines model for LineageNode.Edge. -type LineageNodeEdge string - -// LineageNodeKind defines model for LineageNode.Kind. -type LineageNodeKind string - -// LineageNodeVariant defines model for LineageNode.Variant. -type LineageNodeVariant string - -// LineageResponse defines model for LineageResponse. -type LineageResponse struct { - Nodes []LineageNode `json:"nodes"` -} - -// ListEnvelope defines model for ListEnvelope. -type ListEnvelope struct { - Items []interface{} `json:"items"` - NextCursor *string `json:"next_cursor,omitempty"` - Total int `json:"total"` -} - -// LiveMetrics defines model for LiveMetrics. -type LiveMetrics struct { - CpuPct float32 `json:"cpuPct"` - DiskTotalGiB float32 `json:"diskTotalGiB"` - DiskUsedGiB float32 `json:"diskUsedGiB"` - MemTotalGiB float32 `json:"memTotalGiB"` - MemUsedGiB float32 `json:"memUsedGiB"` -} - -// LogLine defines model for LogLine. -type LogLine struct { - Level string `json:"level"` - Msg string `json:"msg"` - - // Source Log stream source when provided by the real sandbox log backend. - Source *LogLineSource `json:"source,omitempty"` - - // Src Backward-compatible source/process field. - Src string `json:"src"` - Ts string `json:"ts"` -} - -// LogLineSource Log stream source when provided by the real sandbox log backend. -type LogLineSource string - -// LogsResponse defines model for LogsResponse. -type LogsResponse struct { - Items []LogLine `json:"items"` - - // Truncated True when at least one source was tailed from a larger log. - Truncated *bool `json:"truncated,omitempty"` -} - -// Operation defines model for Operation. -type Operation struct { - Actor string `json:"actor"` - DurationMs *int64 `json:"durationMs,omitempty"` - Err string `json:"err"` - Id string `json:"id"` - IdempotencyKey string `json:"idempotencyKey"` - Progress *OperationProgress `json:"progress,omitempty"` - StartedAt time.Time `json:"startedAt"` - State OperationState `json:"state"` - Target string `json:"target"` - TargetId *string `json:"targetId,omitempty"` - Type string `json:"type"` - Warnings []string `json:"warnings"` -} - -// OperationState defines model for Operation.State. -type OperationState string - -// OperationList defines model for OperationList. -type OperationList struct { - Items []Operation `json:"items"` - NextCursor *string `json:"next_cursor,omitempty"` - Total int `json:"total"` -} - -// OperationPhaseTiming defines model for OperationPhaseTiming. -type OperationPhaseTiming struct { - DurationMs *int64 `json:"durationMs,omitempty"` - FinishedAt *time.Time `json:"finishedAt,omitempty"` - Name string `json:"name"` - StartedAt time.Time `json:"startedAt"` -} - -// OperationProgress defines model for OperationProgress. -type OperationProgress struct { - // Percent 0-100 completion estimate; absent when indeterminate. - Percent *float64 `json:"percent,omitempty"` - - // Phase Name of the step currently executing; empty once terminal. - Phase *string `json:"phase,omitempty"` - Phases []OperationPhaseTiming `json:"phases"` - - // Planned Ordered steps the operation expects to run. - Planned *[]string `json:"planned,omitempty"` - - // Unit What unitsDone/unitsTotal count, e.g. bytes. - Unit *string `json:"unit,omitempty"` - UnitsDone *int64 `json:"unitsDone,omitempty"` - UnitsTotal *int64 `json:"unitsTotal,omitempty"` - UpdatedAt time.Time `json:"updatedAt"` -} - -// PortExposureRequest defines model for PortExposureRequest. -type PortExposureRequest struct { - Managed *bool `json:"managed,omitempty"` - Name *string `json:"name,omitempty"` - Port int `json:"port"` - Protocol *string `json:"protocol,omitempty"` - Service *string `json:"service,omitempty"` -} - -// PrepareSandboxSSHRequest defines model for PrepareSandboxSSHRequest. -type PrepareSandboxSSHRequest struct { - // PublicKey One registered OpenSSH public key to certify for gateway authentication. - PublicKey string `json:"public_key"` -} - -// PrepareSandboxSSHResult defines model for PrepareSandboxSSHResult. -type PrepareSandboxSSHResult struct { - ClientCertificate string `json:"client_certificate"` - ExpiresAt time.Time `json:"expires_at"` - Host string `json:"host"` - KeyFingerprint string `json:"key_fingerprint"` - Port int `json:"port"` - Username string `json:"username"` -} - -// PromoteSnapshotRequest defines model for PromoteSnapshotRequest. -type PromoteSnapshotRequest struct { - Description *string `json:"description,omitempty"` - Name string `json:"name"` - Replace *bool `json:"replace,omitempty"` - Tags *[]string `json:"tags,omitempty"` - Version *string `json:"version,omitempty"` -} - -// SSHAuthorizeRequest defines model for SSHAuthorizeRequest. -type SSHAuthorizeRequest struct { - // ClientCertificate Service-issued gateway-auth SSH certificate presented by the client. - ClientCertificate *string `json:"client_certificate,omitempty"` - - // GatewayPublicKey One OpenSSH public key generated by the gateway for this session. - GatewayPublicKey string `json:"gateway_public_key"` - - // PublicKeyFingerprint SHA256 fingerprint of a live registered public key already proven by the gateway. - PublicKeyFingerprint *string `json:"public_key_fingerprint,omitempty"` - - // RoutingUsername SSH username carrying the target sandbox name. - RoutingUsername string `json:"routing_username"` -} - -// SSHAuthorizeResponse defines model for SSHAuthorizeResponse. -type SSHAuthorizeResponse struct { - Capability string `json:"capability"` - ExpiresAt time.Time `json:"expires_at"` - GuestCertificate string `json:"guest_certificate"` - IncarnationId string `json:"incarnation_id"` - SandboxId string `json:"sandbox_id"` - SupervisorEndpoint string `json:"supervisor_endpoint"` - SupervisorPort int `json:"supervisor_port"` -} - -// SSHPublicKey defines model for SSHPublicKey. -type SSHPublicKey struct { - CreatedAt time.Time `json:"created_at"` - Fingerprint string `json:"fingerprint"` - Id string `json:"id"` - Name string `json:"name"` - PublicKey string `json:"public_key"` - UpdatedAt time.Time `json:"updated_at"` -} - -// SSHPublicKeyList defines model for SSHPublicKeyList. -type SSHPublicKeyList struct { - Items []SSHPublicKey `json:"items"` - NextCursor *string `json:"next_cursor,omitempty"` - Total int `json:"total"` -} - -// Sandbox defines model for Sandbox. -type Sandbox struct { - Clock *string `json:"clock,omitempty"` - ClockPolicy string `json:"clockPolicy"` - CreatedAt time.Time `json:"createdAt"` - Err string `json:"err"` - ExpiresAt *time.Time `json:"expiresAt,omitempty"` - ExposedPorts *[]ExposedPort `json:"exposedPorts,omitempty"` - Frozen bool `json:"frozen"` - Hooks *[]HookSummary `json:"hooks,omitempty"` - Id string `json:"id"` - IdempotencyKey string `json:"idempotencyKey"` - Ip *string `json:"ip,omitempty"` - Labels map[string]string `json:"labels"` - LeaseRenews *string `json:"leaseRenews,omitempty"` - LeasedBy *string `json:"leasedBy,omitempty"` - MaxExpiresAt *time.Time `json:"maxExpiresAt,omitempty"` - Mem int `json:"mem"` - Metrics LiveMetrics `json:"metrics"` - Name string `json:"name"` - Network GuestNetwork `json:"network"` - Node *string `json:"node,omitempty"` - OnDelete SandboxOnDelete `json:"onDelete"` - Procs []string `json:"procs"` - Restored bool `json:"restored"` - Snap int `json:"snap"` - SourceSnapshot *string `json:"sourceSnapshot,omitempty"` - State SandboxState `json:"state"` - Tags []string `json:"tags"` - Template string `json:"template"` - Vcpu int `json:"vcpu"` - Ver string `json:"ver"` - Watchdog *WatchdogSummary `json:"watchdog,omitempty"` - Workload string `json:"workload"` -} - -// SandboxOnDelete defines model for Sandbox.OnDelete. -type SandboxOnDelete string - -// SandboxState defines model for Sandbox.State. -type SandboxState string - -// SandboxList defines model for SandboxList. -type SandboxList struct { - Items []Sandbox `json:"items"` - NextCursor *string `json:"next_cursor,omitempty"` - Total int `json:"total"` -} - -// SandboxMetricSample defines model for SandboxMetricSample. -type SandboxMetricSample struct { - // CpuSecondsTotal Cumulative counter of Firecracker process user+system CPU seconds. - CpuSecondsTotal float32 `json:"cpu_seconds_total"` - - // DiskUsedBytes Point-in-time sandbox disk usage gauge; null when per-sandbox usage is unavailable. - DiskUsedBytes *int64 `json:"disk_used_bytes,omitempty"` - - // MemoryBytes Point-in-time RSS memory gauge for the Firecracker process. - MemoryBytes int64 `json:"memory_bytes"` - - // NetRxBytes Cumulative receive byte counter from the sandbox TAP device. - NetRxBytes int64 `json:"net_rx_bytes"` - - // NetTxBytes Cumulative transmit byte counter from the sandbox TAP device. - NetTxBytes int64 `json:"net_tx_bytes"` - - // SampledAt Wall-clock sample timestamp produced by the supervisor/control-plane sampler. - SampledAt time.Time `json:"sampled_at"` -} - -// SandboxMetricsResponse defines model for SandboxMetricsResponse. -type SandboxMetricsResponse struct { - Items []SandboxMetricSample `json:"items"` -} - -// ScheduledResponse defines model for ScheduledResponse. -type ScheduledResponse struct { - Status ScheduledResponseStatus `json:"status"` -} - -// ScheduledResponseStatus defines model for ScheduledResponse.Status. -type ScheduledResponseStatus string - -// Snapshot defines model for Snapshot. -type Snapshot struct { - Clock *string `json:"clock,omitempty"` - CreatedAt time.Time `json:"createdAt"` - Description string `json:"description"` - Digest string `json:"digest"` - - // ExpiresAt When the snapshot is reaped. Snapshots always carry a TTL (request ttl or the configured lifecycle.default_snapshot_ttl), so this is populated for every live snapshot. - ExpiresAt *time.Time `json:"expiresAt,omitempty"` - Frozen bool `json:"frozen"` - FrozenAt string `json:"frozenAt"` - Id string `json:"id"` - Node *string `json:"node,omitempty"` - Note string `json:"note"` - Owner string `json:"owner"` - Parent *string `json:"parent,omitempty"` - Restores int `json:"restores"` - Sandbox string `json:"sandbox"` - SandboxId string `json:"sandboxId"` - Size string `json:"size"` - SizeGiB float32 `json:"sizeGiB"` - State SnapshotState `json:"state"` - Tags []string `json:"tags"` - Template string `json:"template"` - Ver string `json:"ver"` -} - -// SnapshotState defines model for Snapshot.State. -type SnapshotState string - -// SnapshotBootSource defines model for SnapshotBootSource. -type SnapshotBootSource struct { - // Flavor How the snapshot boots. "warm" (default) resumes the captured memory image and pins memory to the snapshot's size. "cold" boots a fresh kernel on the snapshot's disk state with freely chosen vcpu and memory. - Flavor *SnapshotBootSourceFlavor `json:"flavor,omitempty"` - Kind SnapshotBootSourceKind `json:"kind"` - SnapshotId string `json:"snapshot_id"` -} - -// SnapshotBootSourceFlavor How the snapshot boots. "warm" (default) resumes the captured memory image and pins memory to the snapshot's size. "cold" boots a fresh kernel on the snapshot's disk state with freely chosen vcpu and memory. -type SnapshotBootSourceFlavor string - -// SnapshotBootSourceKind defines model for SnapshotBootSource.Kind. -type SnapshotBootSourceKind string - -// SnapshotSandboxRequest defines model for SnapshotSandboxRequest. -type SnapshotSandboxRequest struct { - Note *string `json:"note,omitempty"` - - // Ttl Go-style duration string. Snapshots always carry a TTL: omit to fall back to the configured lifecycle.default_snapshot_ttl (a required server default). If neither is present the request is rejected. - Ttl *string `json:"ttl,omitempty"` -} - -// Template defines model for Template. -type Template struct { - Artifact string `json:"artifact"` - Build TemplateBuild `json:"build"` - Clock string `json:"clock"` - ClockPolicy TemplateClockPolicy `json:"clockPolicy"` - Description *string `json:"description,omitempty"` - DiskGb int `json:"diskGb"` - Flavor TemplateFlavor `json:"flavor"` - Kernel string `json:"kernel"` - MemoryMb int `json:"memoryMb"` - Name string `json:"name"` - Pinned string `json:"pinned"` - Rootfs string `json:"rootfs"` - Sizing string `json:"sizing"` - SourceSnapshotId *string `json:"sourceSnapshotId,omitempty"` - Tags []string `json:"tags"` - Vcpu int `json:"vcpu"` - VcpuOptions []int `json:"vcpuOptions"` - Ver string `json:"ver"` -} - -// TemplateClockPolicy defines model for Template.ClockPolicy. -type TemplateClockPolicy string - -// TemplateFlavor defines model for Template.Flavor. -type TemplateFlavor string - -// TemplateBootSource defines model for TemplateBootSource. -type TemplateBootSource struct { - Kind TemplateBootSourceKind `json:"kind"` - Name string `json:"name"` - Version *string `json:"version,omitempty"` -} - -// TemplateBootSourceKind defines model for TemplateBootSource.Kind. -type TemplateBootSourceKind string - -// TemplateBuild defines model for TemplateBuild. -type TemplateBuild struct { - // Source Freeform provenance for the template build recipe or warm snapshot lineage. - Source string `json:"source"` -} - -// WatchdogDeclaration defines model for WatchdogDeclaration. -type WatchdogDeclaration struct { - Action WatchdogDeclarationAction `json:"action"` - Env *map[string]string `json:"env,omitempty"` - FailureThreshold *int `json:"failure_threshold,omitempty"` - IntervalSeconds int `json:"interval_seconds"` - - // Script Inline shell script. Mutually exclusive with template. - Script *string `json:"script,omitempty"` - - // Template Hook template name. Mutually exclusive with script. - Template *string `json:"template,omitempty"` - TimeoutSeconds *int `json:"timeout_seconds,omitempty"` -} - -// WatchdogDeclarationAction defines model for WatchdogDeclaration.Action. -type WatchdogDeclarationAction string - -// WatchdogSummary defines model for WatchdogSummary. -type WatchdogSummary struct { - Action WatchdogSummaryAction `json:"action"` - FailureThreshold int `json:"failure_threshold"` - IntervalSeconds int `json:"interval_seconds"` - SourceTemplateName *string `json:"source_template_name,omitempty"` - TimeoutSeconds int `json:"timeout_seconds"` -} - -// WatchdogSummaryAction defines model for WatchdogSummary.Action. -type WatchdogSummaryAction string - -// WebSessionIdentity defines model for WebSessionIdentity. -type WebSessionIdentity struct { - AvatarUrl string `json:"avatarUrl"` - Email string `json:"email"` - ExpiresAt *time.Time `json:"expiresAt,omitempty"` - Handle string `json:"handle"` - Name string `json:"name"` - Subject string `json:"subject"` -} - -// Cursor defines model for Cursor. -type Cursor = string - -// Filter defines model for Filter. -type Filter = []string - -// ForkID defines model for ForkID. -type ForkID = string - -// IdempotencyKey defines model for IdempotencyKey. -type IdempotencyKey = string - -// ImageID defines model for ImageID. -type ImageID = string - -// Limit defines model for Limit. -type Limit = int - -// Offset defines model for Offset. -type Offset = int - -// OperationID defines model for OperationID. -type OperationID = string - -// Port defines model for Port. -type Port = int - -// SSHPublicKeyID defines model for SSHPublicKeyID. -type SSHPublicKeyID = string - -// SandboxID defines model for SandboxID. -type SandboxID = string - -// BadRequest defines model for BadRequest. -type BadRequest = ErrorEnvelope - -// Conflict defines model for Conflict. -type Conflict = ErrorEnvelope - -// Error defines model for Error. -type Error = ErrorEnvelope - -// Forbidden defines model for Forbidden. -type Forbidden = ErrorEnvelope - -// InternalError defines model for InternalError. -type InternalError = ErrorEnvelope - -// NotFound defines model for NotFound. -type NotFound = ErrorEnvelope - -// NotReady defines model for NotReady. -type NotReady = ErrorEnvelope - -// UnprocessableEntity defines model for UnprocessableEntity. -type UnprocessableEntity = ErrorEnvelope - -// bearerAuthContextKey is the context key for bearerAuth security scheme -type bearerAuthContextKey string - -// ListBakesParams defines parameters for ListBakes. -type ListBakesParams struct { - Limit *Limit `form:"limit,omitempty" json:"limit,omitempty"` - - // Cursor Integer offset cursor returned as next_cursor. - Cursor *Cursor `form:"cursor,omitempty" json:"cursor,omitempty"` - - // Offset Integer offset alternative to cursor. - Offset *Offset `form:"offset,omitempty" json:"offset,omitempty"` - - // Filter Filter results by field, formatted as keyvalue where op is one of =, !=, ~= (contains), >, <, >=, <=. Keys are response field names and may be dotted to reach nested fields (e.g. error.reason). Comparison is numeric when both sides are numbers and case-insensitive otherwise. Repeatable; all filters must match. Applied before pagination. - Filter *Filter `form:"filter,omitempty" json:"filter,omitempty"` -} - -// ListHookTemplatesParams defines parameters for ListHookTemplates. -type ListHookTemplatesParams struct { - Limit *Limit `form:"limit,omitempty" json:"limit,omitempty"` - - // Cursor Integer offset cursor returned as next_cursor. - Cursor *Cursor `form:"cursor,omitempty" json:"cursor,omitempty"` - - // Offset Integer offset alternative to cursor. - Offset *Offset `form:"offset,omitempty" json:"offset,omitempty"` - - // Filter Filter results by field, formatted as keyvalue where op is one of =, !=, ~= (contains), >, <, >=, <=. Keys are response field names and may be dotted to reach nested fields (e.g. error.reason). Comparison is numeric when both sides are numbers and case-insensitive otherwise. Repeatable; all filters must match. Applied before pagination. - Filter *Filter `form:"filter,omitempty" json:"filter,omitempty"` -} - -// ListImagesParams defines parameters for ListImages. -type ListImagesParams struct { - Limit *Limit `form:"limit,omitempty" json:"limit,omitempty"` - - // Cursor Integer offset cursor returned as next_cursor. - Cursor *Cursor `form:"cursor,omitempty" json:"cursor,omitempty"` - - // Offset Integer offset alternative to cursor. - Offset *Offset `form:"offset,omitempty" json:"offset,omitempty"` - - // Filter Filter results by field, formatted as keyvalue where op is one of =, !=, ~= (contains), >, <, >=, <=. Keys are response field names and may be dotted to reach nested fields (e.g. error.reason). Comparison is numeric when both sides are numbers and case-insensitive otherwise. Repeatable; all filters must match. Applied before pagination. - Filter *Filter `form:"filter,omitempty" json:"filter,omitempty"` -} - -// DeleteImageParams defines parameters for DeleteImage. -type DeleteImageParams struct { - // IdempotencyKey Required for mutating requests. Reusing a key with the same request returns the same accepted operation; reusing it with a different request returns 409. - IdempotencyKey IdempotencyKey `json:"Idempotency-Key"` -} - -// ForkImageParams defines parameters for ForkImage. -type ForkImageParams struct { - // IdempotencyKey Required for mutating requests. Reusing a key with the same request returns the same accepted operation; reusing it with a different request returns 409. - IdempotencyKey IdempotencyKey `json:"Idempotency-Key"` -} - -// ListSSHPublicKeysParams defines parameters for ListSSHPublicKeys. -type ListSSHPublicKeysParams struct { - Limit *Limit `form:"limit,omitempty" json:"limit,omitempty"` - - // Cursor Integer offset cursor returned as next_cursor. - Cursor *Cursor `form:"cursor,omitempty" json:"cursor,omitempty"` - - // Offset Integer offset alternative to cursor. - Offset *Offset `form:"offset,omitempty" json:"offset,omitempty"` - - // Filter Filter results by field, formatted as keyvalue where op is one of =, !=, ~= (contains), >, <, >=, <=. Keys are response field names and may be dotted to reach nested fields (e.g. error.reason). Comparison is numeric when both sides are numbers and case-insensitive otherwise. Repeatable; all filters must match. Applied before pagination. - Filter *Filter `form:"filter,omitempty" json:"filter,omitempty"` -} - -// ListOperationsParams defines parameters for ListOperations. -type ListOperationsParams struct { - Limit *Limit `form:"limit,omitempty" json:"limit,omitempty"` - - // Cursor Integer offset cursor returned as next_cursor. - Cursor *Cursor `form:"cursor,omitempty" json:"cursor,omitempty"` - - // Offset Integer offset alternative to cursor. - Offset *Offset `form:"offset,omitempty" json:"offset,omitempty"` - - // Filter Filter results by field, formatted as keyvalue where op is one of =, !=, ~= (contains), >, <, >=, <=. Keys are response field names and may be dotted to reach nested fields (e.g. error.reason). Comparison is numeric when both sides are numbers and case-insensitive otherwise. Repeatable; all filters must match. Applied before pagination. - Filter *Filter `form:"filter,omitempty" json:"filter,omitempty"` -} - -// ListSandboxesParams defines parameters for ListSandboxes. -type ListSandboxesParams struct { - Limit *Limit `form:"limit,omitempty" json:"limit,omitempty"` - - // Cursor Integer offset cursor returned as next_cursor. - Cursor *Cursor `form:"cursor,omitempty" json:"cursor,omitempty"` - - // Offset Integer offset alternative to cursor. - Offset *Offset `form:"offset,omitempty" json:"offset,omitempty"` - - // Filter Filter results by field, formatted as keyvalue where op is one of =, !=, ~= (contains), >, <, >=, <=. Keys are response field names and may be dotted to reach nested fields (e.g. error.reason). Comparison is numeric when both sides are numbers and case-insensitive otherwise. Repeatable; all filters must match. Applied before pagination. - Filter *Filter `form:"filter,omitempty" json:"filter,omitempty"` -} - -// CreateSandboxParams defines parameters for CreateSandbox. -type CreateSandboxParams struct { - // IdempotencyKey Required for mutating requests. Reusing a key with the same request returns the same accepted operation; reusing it with a different request returns 409. - IdempotencyKey IdempotencyKey `json:"Idempotency-Key"` -} - -// DeleteSandboxParams defines parameters for DeleteSandbox. -type DeleteSandboxParams struct { - // Retain Set to false to discard retained state and delete without honoring the sandbox on_delete disposition. Omit or set true to use the stored disposition. - Retain *bool `form:"retain,omitempty" json:"retain,omitempty"` - - // IdempotencyKey Required for mutating requests. Reusing a key with the same request returns the same accepted operation; reusing it with a different request returns 409. - IdempotencyKey IdempotencyKey `json:"Idempotency-Key"` -} - -// StreamExecSandboxParams defines parameters for StreamExecSandbox. -type StreamExecSandboxParams struct { - // Cmd Repeated argv item, in order. The server shell-quotes and joins these items for SSH exec. - Cmd []string `form:"cmd" json:"cmd"` - Pty *bool `form:"pty,omitempty" json:"pty,omitempty"` - Rows *int `form:"rows,omitempty" json:"rows,omitempty"` - Cols *int `form:"cols,omitempty" json:"cols,omitempty"` -} - -// ForkSandboxParams defines parameters for ForkSandbox. -type ForkSandboxParams struct { - // IdempotencyKey Required for mutating requests. Reusing a key with the same request returns the same accepted operation; reusing it with a different request returns 409. - IdempotencyKey IdempotencyKey `json:"Idempotency-Key"` -} - -// GetSandboxHookRunsParams defines parameters for GetSandboxHookRuns. -type GetSandboxHookRunsParams struct { - Limit *Limit `form:"limit,omitempty" json:"limit,omitempty"` - - // Cursor Integer offset cursor returned as next_cursor. - Cursor *Cursor `form:"cursor,omitempty" json:"cursor,omitempty"` - - // Offset Integer offset alternative to cursor. - Offset *Offset `form:"offset,omitempty" json:"offset,omitempty"` - - // Filter Filter results by field, formatted as keyvalue where op is one of =, !=, ~= (contains), >, <, >=, <=. Keys are response field names and may be dotted to reach nested fields (e.g. error.reason). Comparison is numeric when both sides are numbers and case-insensitive otherwise. Repeatable; all filters must match. Applied before pagination. - Filter *Filter `form:"filter,omitempty" json:"filter,omitempty"` -} - -// GetSandboxHooksParams defines parameters for GetSandboxHooks. -type GetSandboxHooksParams struct { - Limit *Limit `form:"limit,omitempty" json:"limit,omitempty"` - - // Cursor Integer offset cursor returned as next_cursor. - Cursor *Cursor `form:"cursor,omitempty" json:"cursor,omitempty"` - - // Offset Integer offset alternative to cursor. - Offset *Offset `form:"offset,omitempty" json:"offset,omitempty"` - - // Filter Filter results by field, formatted as keyvalue where op is one of =, !=, ~= (contains), >, <, >=, <=. Keys are response field names and may be dotted to reach nested fields (e.g. error.reason). Comparison is numeric when both sides are numbers and case-insensitive otherwise. Repeatable; all filters must match. Applied before pagination. - Filter *Filter `form:"filter,omitempty" json:"filter,omitempty"` -} - -// GetSandboxLogsParams defines parameters for GetSandboxLogs. -type GetSandboxLogsParams struct { - // TailBytes Per-source byte tail to return. Defaults to 256 KiB and is capped by the server. - TailBytes *int64 `form:"tail_bytes,omitempty" json:"tail_bytes,omitempty"` - - // Source Restrict logs to one source. - Source *GetSandboxLogsParamsSource `form:"source,omitempty" json:"source,omitempty"` -} - -// GetSandboxLogsParamsSource defines parameters for GetSandboxLogs. -type GetSandboxLogsParamsSource string - -// GetSandboxMetricsParams defines parameters for GetSandboxMetrics. -type GetSandboxMetricsParams struct { - Since *time.Time `form:"since,omitempty" json:"since,omitempty"` - Until *time.Time `form:"until,omitempty" json:"until,omitempty"` - - // Step Positive duration hint accepted for client compatibility; raw samples are still returned. - Step *string `form:"step,omitempty" json:"step,omitempty"` -} - -// PauseSandboxParams defines parameters for PauseSandbox. -type PauseSandboxParams struct { - // IdempotencyKey Required for mutating requests. Reusing a key with the same request returns the same accepted operation; reusing it with a different request returns 409. - IdempotencyKey IdempotencyKey `json:"Idempotency-Key"` -} - -// ResumeSandboxParams defines parameters for ResumeSandbox. -type ResumeSandboxParams struct { - // IdempotencyKey Required for mutating requests. Reusing a key with the same request returns the same accepted operation; reusing it with a different request returns 409. - IdempotencyKey IdempotencyKey `json:"Idempotency-Key"` -} - -// SnapshotSandboxParams defines parameters for SnapshotSandbox. -type SnapshotSandboxParams struct { - // IdempotencyKey Required for mutating requests. Reusing a key with the same request returns the same accepted operation; reusing it with a different request returns 409. - IdempotencyKey IdempotencyKey `json:"Idempotency-Key"` -} - -// StartSandboxParams defines parameters for StartSandbox. -type StartSandboxParams struct { - // IdempotencyKey Required for mutating requests. Reusing a key with the same request returns the same accepted operation; reusing it with a different request returns 409. - IdempotencyKey IdempotencyKey `json:"Idempotency-Key"` -} - -// StopSandboxParams defines parameters for StopSandbox. -type StopSandboxParams struct { - // IdempotencyKey Required for mutating requests. Reusing a key with the same request returns the same accepted operation; reusing it with a different request returns 409. - IdempotencyKey IdempotencyKey `json:"Idempotency-Key"` -} - -// CreateHookTemplateJSONRequestBody defines body for CreateHookTemplate for application/json ContentType. -type CreateHookTemplateJSONRequestBody = HookTemplateRequest - -// UpdateHookTemplateJSONRequestBody defines body for UpdateHookTemplate for application/json ContentType. -type UpdateHookTemplateJSONRequestBody = HookTemplateRequest - -// ForkImageJSONRequestBody defines body for ForkImage for application/json ContentType. -type ForkImageJSONRequestBody = ForkRequest - -// PromoteImageJSONRequestBody defines body for PromoteImage for application/json ContentType. -type PromoteImageJSONRequestBody = PromoteSnapshotRequest - -// AuthorizeIngressJSONRequestBody defines body for AuthorizeIngress for application/json ContentType. -type AuthorizeIngressJSONRequestBody = IngressAuthorizeRequest - -// AddSSHPublicKeyJSONRequestBody defines body for AddSSHPublicKey for application/json ContentType. -type AddSSHPublicKeyJSONRequestBody = AddSSHPublicKeyRequest - -// CreateSandboxJSONRequestBody defines body for CreateSandbox for application/json ContentType. -type CreateSandboxJSONRequestBody = CreateSandboxRequest - -// ExecSandboxJSONRequestBody defines body for ExecSandbox for application/json ContentType. -type ExecSandboxJSONRequestBody = ExecSandboxRequest - -// ForkSandboxJSONRequestBody defines body for ForkSandbox for application/json ContentType. -type ForkSandboxJSONRequestBody = ForkRequest - -// LeaseSandboxJSONRequestBody defines body for LeaseSandbox for application/json ContentType. -type LeaseSandboxJSONRequestBody = LeaseSandboxRequest - -// ExposePortJSONRequestBody defines body for ExposePort for application/json ContentType. -type ExposePortJSONRequestBody = ExposePortRequest - -// SnapshotSandboxJSONRequestBody defines body for SnapshotSandbox for application/json ContentType. -type SnapshotSandboxJSONRequestBody = SnapshotSandboxRequest - -// PrepareSandboxSSHJSONRequestBody defines body for PrepareSandboxSSH for application/json ContentType. -type PrepareSandboxSSHJSONRequestBody = PrepareSandboxSSHRequest - -// AuthorizeSSHJSONRequestBody defines body for AuthorizeSSH for application/json ContentType. -type AuthorizeSSHJSONRequestBody = SSHAuthorizeRequest - -// AddUserSSHPublicKeyJSONRequestBody defines body for AddUserSSHPublicKey for application/json ContentType. -type AddUserSSHPublicKeyJSONRequestBody = AddSSHPublicKeyRequest - -// AsTemplateBootSource returns the union data inside the CreateSandboxSource as a TemplateBootSource -func (t CreateSandboxSource) AsTemplateBootSource() (TemplateBootSource, error) { - var body TemplateBootSource - err := json.Unmarshal(t.union, &body) - return body, err -} - -// FromTemplateBootSource overwrites any union data inside the CreateSandboxSource as the provided TemplateBootSource -func (t *CreateSandboxSource) FromTemplateBootSource(v TemplateBootSource) error { - b, err := json.Marshal(v) - t.union = b - return err -} - -// MergeTemplateBootSource performs a merge with any union data inside the CreateSandboxSource, using the provided TemplateBootSource -func (t *CreateSandboxSource) MergeTemplateBootSource(v TemplateBootSource) error { - b, err := json.Marshal(v) - if err != nil { - return err - } - - merged, err := runtime.JSONMerge(t.union, b) - t.union = merged - return err -} - -// AsSnapshotBootSource returns the union data inside the CreateSandboxSource as a SnapshotBootSource -func (t CreateSandboxSource) AsSnapshotBootSource() (SnapshotBootSource, error) { - var body SnapshotBootSource - err := json.Unmarshal(t.union, &body) - return body, err -} - -// FromSnapshotBootSource overwrites any union data inside the CreateSandboxSource as the provided SnapshotBootSource -func (t *CreateSandboxSource) FromSnapshotBootSource(v SnapshotBootSource) error { - b, err := json.Marshal(v) - t.union = b - return err -} - -// MergeSnapshotBootSource performs a merge with any union data inside the CreateSandboxSource, using the provided SnapshotBootSource -func (t *CreateSandboxSource) MergeSnapshotBootSource(v SnapshotBootSource) 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 CreateSandboxSource) MarshalJSON() ([]byte, error) { - b, err := t.union.MarshalJSON() - return b, err -} - -func (t *CreateSandboxSource) 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 { - // ListAudit request - ListAudit(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // AuthCLIConfig request - AuthCLIConfig(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // AuthSession request - AuthSession(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListBakes request - ListBakes(ctx context.Context, params *ListBakesParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // RunBake request - RunBake(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListForks request - ListForks(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetFork request - GetFork(ctx context.Context, id ForkID, reqEditors ...RequestEditorFn) (*http.Response, error) - - // Healthz request - Healthz(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListHookTemplates request - ListHookTemplates(ctx context.Context, params *ListHookTemplatesParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateHookTemplateWithBody request with any body - CreateHookTemplateWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateHookTemplate(ctx context.Context, body CreateHookTemplateJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteHookTemplate request - DeleteHookTemplate(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetHookTemplate request - GetHookTemplate(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpdateHookTemplateWithBody request with any body - UpdateHookTemplateWithBody(ctx context.Context, name string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpdateHookTemplate(ctx context.Context, name string, body UpdateHookTemplateJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListImages request - ListImages(ctx context.Context, params *ListImagesParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteImage request - DeleteImage(ctx context.Context, id ImageID, params *DeleteImageParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetImage request - GetImage(ctx context.Context, id ImageID, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeactivateImage request - DeactivateImage(ctx context.Context, id ImageID, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ForkImageWithBody request with any body - ForkImageWithBody(ctx context.Context, id ImageID, params *ForkImageParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - ForkImage(ctx context.Context, id ImageID, params *ForkImageParams, body ForkImageJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetImageLineage request - GetImageLineage(ctx context.Context, id ImageID, reqEditors ...RequestEditorFn) (*http.Response, error) - - // PromoteImageWithBody request with any body - PromoteImageWithBody(ctx context.Context, id ImageID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - PromoteImage(ctx context.Context, id ImageID, body PromoteImageJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetImageRestoredBy request - GetImageRestoredBy(ctx context.Context, id ImageID, reqEditors ...RequestEditorFn) (*http.Response, error) - - // AuthorizeIngressWithBody request with any body - AuthorizeIngressWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - AuthorizeIngress(ctx context.Context, body AuthorizeIngressJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListSSHPublicKeys request - ListSSHPublicKeys(ctx context.Context, params *ListSSHPublicKeysParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // AddSSHPublicKeyWithBody request with any body - AddSSHPublicKeyWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - AddSSHPublicKey(ctx context.Context, body AddSSHPublicKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteSSHPublicKey request - DeleteSSHPublicKey(ctx context.Context, id SSHPublicKeyID, reqEditors ...RequestEditorFn) (*http.Response, error) - - // Meta request - Meta(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // Metrics request - Metrics(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListNodes request - ListNodes(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetNode request - GetNode(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // OpenAPIYAML request - OpenAPIYAML(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListOperations request - ListOperations(ctx context.Context, params *ListOperationsParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetOperation request - GetOperation(ctx context.Context, id OperationID, reqEditors ...RequestEditorFn) (*http.Response, error) - - // Readyz request - Readyz(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListSandboxes request - ListSandboxes(ctx context.Context, params *ListSandboxesParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateSandboxWithBody request with any body - CreateSandboxWithBody(ctx context.Context, params *CreateSandboxParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateSandbox(ctx context.Context, params *CreateSandboxParams, body CreateSandboxJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteSandbox request - DeleteSandbox(ctx context.Context, id SandboxID, params *DeleteSandboxParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetSandbox request - GetSandbox(ctx context.Context, id SandboxID, reqEditors ...RequestEditorFn) (*http.Response, error) - - // StreamExecSandbox request - StreamExecSandbox(ctx context.Context, id SandboxID, params *StreamExecSandboxParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ExecSandboxWithBody request with any body - ExecSandboxWithBody(ctx context.Context, id SandboxID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - ExecSandbox(ctx context.Context, id SandboxID, body ExecSandboxJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ForkSandboxWithBody request with any body - ForkSandboxWithBody(ctx context.Context, id SandboxID, params *ForkSandboxParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - ForkSandbox(ctx context.Context, id SandboxID, params *ForkSandboxParams, body ForkSandboxJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetSandboxHookRuns request - GetSandboxHookRuns(ctx context.Context, id SandboxID, params *GetSandboxHookRunsParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetSandboxHooks request - GetSandboxHooks(ctx context.Context, id SandboxID, params *GetSandboxHooksParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetSandboxImages request - GetSandboxImages(ctx context.Context, id SandboxID, reqEditors ...RequestEditorFn) (*http.Response, error) - - // LeaseSandboxWithBody request with any body - LeaseSandboxWithBody(ctx context.Context, id SandboxID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - LeaseSandbox(ctx context.Context, id SandboxID, body LeaseSandboxJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetSandboxLineage request - GetSandboxLineage(ctx context.Context, id SandboxID, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetSandboxLogs request - GetSandboxLogs(ctx context.Context, id SandboxID, params *GetSandboxLogsParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetSandboxMetrics request - GetSandboxMetrics(ctx context.Context, id SandboxID, params *GetSandboxMetricsParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetSandboxOperations request - GetSandboxOperations(ctx context.Context, id SandboxID, reqEditors ...RequestEditorFn) (*http.Response, error) - - // PauseSandbox request - PauseSandbox(ctx context.Context, id SandboxID, params *PauseSandboxParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ExposePortWithBody request with any body - ExposePortWithBody(ctx context.Context, id SandboxID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - ExposePort(ctx context.Context, id SandboxID, body ExposePortJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UnexposePort request - UnexposePort(ctx context.Context, id SandboxID, port Port, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ResumeSandbox request - ResumeSandbox(ctx context.Context, id SandboxID, params *ResumeSandboxParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // SnapshotSandboxWithBody request with any body - SnapshotSandboxWithBody(ctx context.Context, id SandboxID, params *SnapshotSandboxParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - SnapshotSandbox(ctx context.Context, id SandboxID, params *SnapshotSandboxParams, body SnapshotSandboxJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // PrepareSandboxSSHWithBody request with any body - PrepareSandboxSSHWithBody(ctx context.Context, id SandboxID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - PrepareSandboxSSH(ctx context.Context, id SandboxID, body PrepareSandboxSSHJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // StartSandbox request - StartSandbox(ctx context.Context, id SandboxID, params *StartSandboxParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // StopSandbox request - StopSandbox(ctx context.Context, id SandboxID, params *StopSandboxParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // TunnelSandbox request - TunnelSandbox(ctx context.Context, id SandboxID, port int, reqEditors ...RequestEditorFn) (*http.Response, error) - - // AuthorizeSSHWithBody request with any body - AuthorizeSSHWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - AuthorizeSSH(ctx context.Context, body AuthorizeSSHJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListUsers request - ListUsers(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetUser request - GetUser(ctx context.Context, handle string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // AddUserSSHPublicKeyWithBody request with any body - AddUserSSHPublicKeyWithBody(ctx context.Context, handle string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - AddUserSSHPublicKey(ctx context.Context, handle string, body AddUserSSHPublicKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteUserSSHPublicKey request - DeleteUserSSHPublicKey(ctx context.Context, handle string, id SSHPublicKeyID, reqEditors ...RequestEditorFn) (*http.Response, error) -} - -func (c *Client) ListAudit(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListAuditRequest(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) -} - -func (c *Client) AuthCLIConfig(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewAuthCLIConfigRequest(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) -} - -func (c *Client) AuthSession(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewAuthSessionRequest(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) -} - -func (c *Client) ListBakes(ctx context.Context, params *ListBakesParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListBakesRequest(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) -} - -func (c *Client) RunBake(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewRunBakeRequest(c.Server, name) - 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) -} - -func (c *Client) ListForks(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListForksRequest(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) -} - -func (c *Client) GetFork(ctx context.Context, id ForkID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetForkRequest(c.Server, id) - 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) -} - -func (c *Client) Healthz(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewHealthzRequest(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) -} - -func (c *Client) ListHookTemplates(ctx context.Context, params *ListHookTemplatesParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListHookTemplatesRequest(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) -} - -func (c *Client) CreateHookTemplateWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateHookTemplateRequestWithBody(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) -} - -func (c *Client) CreateHookTemplate(ctx context.Context, body CreateHookTemplateJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateHookTemplateRequest(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) -} - -func (c *Client) DeleteHookTemplate(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteHookTemplateRequest(c.Server, name) - 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) -} - -func (c *Client) GetHookTemplate(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetHookTemplateRequest(c.Server, name) - 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) -} - -func (c *Client) UpdateHookTemplateWithBody(ctx context.Context, name string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateHookTemplateRequestWithBody(c.Server, name, 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) -} - -func (c *Client) UpdateHookTemplate(ctx context.Context, name string, body UpdateHookTemplateJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateHookTemplateRequest(c.Server, name, 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) -} - -func (c *Client) ListImages(ctx context.Context, params *ListImagesParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListImagesRequest(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) -} - -func (c *Client) DeleteImage(ctx context.Context, id ImageID, params *DeleteImageParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteImageRequest(c.Server, id, 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) -} - -func (c *Client) GetImage(ctx context.Context, id ImageID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetImageRequest(c.Server, id) - 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) -} - -func (c *Client) DeactivateImage(ctx context.Context, id ImageID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeactivateImageRequest(c.Server, id) - 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) -} - -func (c *Client) ForkImageWithBody(ctx context.Context, id ImageID, params *ForkImageParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewForkImageRequestWithBody(c.Server, id, params, 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) -} - -func (c *Client) ForkImage(ctx context.Context, id ImageID, params *ForkImageParams, body ForkImageJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewForkImageRequest(c.Server, id, params, 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) -} - -func (c *Client) GetImageLineage(ctx context.Context, id ImageID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetImageLineageRequest(c.Server, id) - 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) -} - -func (c *Client) PromoteImageWithBody(ctx context.Context, id ImageID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPromoteImageRequestWithBody(c.Server, id, 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) -} - -func (c *Client) PromoteImage(ctx context.Context, id ImageID, body PromoteImageJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPromoteImageRequest(c.Server, id, 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) -} - -func (c *Client) GetImageRestoredBy(ctx context.Context, id ImageID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetImageRestoredByRequest(c.Server, id) - 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) -} - -func (c *Client) AuthorizeIngressWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewAuthorizeIngressRequestWithBody(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) -} - -func (c *Client) AuthorizeIngress(ctx context.Context, body AuthorizeIngressJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewAuthorizeIngressRequest(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) -} - -func (c *Client) ListSSHPublicKeys(ctx context.Context, params *ListSSHPublicKeysParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListSSHPublicKeysRequest(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) -} - -func (c *Client) AddSSHPublicKeyWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewAddSSHPublicKeyRequestWithBody(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) -} - -func (c *Client) AddSSHPublicKey(ctx context.Context, body AddSSHPublicKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewAddSSHPublicKeyRequest(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) -} - -func (c *Client) DeleteSSHPublicKey(ctx context.Context, id SSHPublicKeyID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteSSHPublicKeyRequest(c.Server, id) - 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) -} - -func (c *Client) Meta(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewMetaRequest(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) -} - -func (c *Client) Metrics(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewMetricsRequest(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) -} - -func (c *Client) ListNodes(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListNodesRequest(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) -} - -func (c *Client) GetNode(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetNodeRequest(c.Server, id) - 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) -} - -func (c *Client) OpenAPIYAML(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewOpenAPIYAMLRequest(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) -} - -func (c *Client) ListOperations(ctx context.Context, params *ListOperationsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListOperationsRequest(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) -} - -func (c *Client) GetOperation(ctx context.Context, id OperationID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetOperationRequest(c.Server, id) - 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) -} - -func (c *Client) Readyz(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewReadyzRequest(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) -} - -func (c *Client) ListSandboxes(ctx context.Context, params *ListSandboxesParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListSandboxesRequest(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) -} - -func (c *Client) CreateSandboxWithBody(ctx context.Context, params *CreateSandboxParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateSandboxRequestWithBody(c.Server, params, 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) -} - -func (c *Client) CreateSandbox(ctx context.Context, params *CreateSandboxParams, body CreateSandboxJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateSandboxRequest(c.Server, params, 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) -} - -func (c *Client) DeleteSandbox(ctx context.Context, id SandboxID, params *DeleteSandboxParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteSandboxRequest(c.Server, id, 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) -} - -func (c *Client) GetSandbox(ctx context.Context, id SandboxID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetSandboxRequest(c.Server, id) - 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) -} - -func (c *Client) StreamExecSandbox(ctx context.Context, id SandboxID, params *StreamExecSandboxParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewStreamExecSandboxRequest(c.Server, id, 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) -} - -func (c *Client) ExecSandboxWithBody(ctx context.Context, id SandboxID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewExecSandboxRequestWithBody(c.Server, id, 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) -} - -func (c *Client) ExecSandbox(ctx context.Context, id SandboxID, body ExecSandboxJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewExecSandboxRequest(c.Server, id, 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) -} - -func (c *Client) ForkSandboxWithBody(ctx context.Context, id SandboxID, params *ForkSandboxParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewForkSandboxRequestWithBody(c.Server, id, params, 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) -} - -func (c *Client) ForkSandbox(ctx context.Context, id SandboxID, params *ForkSandboxParams, body ForkSandboxJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewForkSandboxRequest(c.Server, id, params, 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) -} - -func (c *Client) GetSandboxHookRuns(ctx context.Context, id SandboxID, params *GetSandboxHookRunsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetSandboxHookRunsRequest(c.Server, id, 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) -} - -func (c *Client) GetSandboxHooks(ctx context.Context, id SandboxID, params *GetSandboxHooksParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetSandboxHooksRequest(c.Server, id, 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) -} - -func (c *Client) GetSandboxImages(ctx context.Context, id SandboxID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetSandboxImagesRequest(c.Server, id) - 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) -} - -func (c *Client) LeaseSandboxWithBody(ctx context.Context, id SandboxID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewLeaseSandboxRequestWithBody(c.Server, id, 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) -} - -func (c *Client) LeaseSandbox(ctx context.Context, id SandboxID, body LeaseSandboxJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewLeaseSandboxRequest(c.Server, id, 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) -} - -func (c *Client) GetSandboxLineage(ctx context.Context, id SandboxID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetSandboxLineageRequest(c.Server, id) - 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) -} - -func (c *Client) GetSandboxLogs(ctx context.Context, id SandboxID, params *GetSandboxLogsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetSandboxLogsRequest(c.Server, id, 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) -} - -func (c *Client) GetSandboxMetrics(ctx context.Context, id SandboxID, params *GetSandboxMetricsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetSandboxMetricsRequest(c.Server, id, 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) -} - -func (c *Client) GetSandboxOperations(ctx context.Context, id SandboxID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetSandboxOperationsRequest(c.Server, id) - 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) -} - -func (c *Client) PauseSandbox(ctx context.Context, id SandboxID, params *PauseSandboxParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPauseSandboxRequest(c.Server, id, 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) -} - -func (c *Client) ExposePortWithBody(ctx context.Context, id SandboxID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewExposePortRequestWithBody(c.Server, id, 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) -} - -func (c *Client) ExposePort(ctx context.Context, id SandboxID, body ExposePortJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewExposePortRequest(c.Server, id, 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) -} - -func (c *Client) UnexposePort(ctx context.Context, id SandboxID, port Port, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUnexposePortRequest(c.Server, id, port) - 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) -} - -func (c *Client) ResumeSandbox(ctx context.Context, id SandboxID, params *ResumeSandboxParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewResumeSandboxRequest(c.Server, id, 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) -} - -func (c *Client) SnapshotSandboxWithBody(ctx context.Context, id SandboxID, params *SnapshotSandboxParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewSnapshotSandboxRequestWithBody(c.Server, id, params, 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) -} - -func (c *Client) SnapshotSandbox(ctx context.Context, id SandboxID, params *SnapshotSandboxParams, body SnapshotSandboxJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewSnapshotSandboxRequest(c.Server, id, params, 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) -} - -func (c *Client) PrepareSandboxSSHWithBody(ctx context.Context, id SandboxID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPrepareSandboxSSHRequestWithBody(c.Server, id, 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) -} - -func (c *Client) PrepareSandboxSSH(ctx context.Context, id SandboxID, body PrepareSandboxSSHJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPrepareSandboxSSHRequest(c.Server, id, 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) -} - -func (c *Client) StartSandbox(ctx context.Context, id SandboxID, params *StartSandboxParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewStartSandboxRequest(c.Server, id, 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) -} - -func (c *Client) StopSandbox(ctx context.Context, id SandboxID, params *StopSandboxParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewStopSandboxRequest(c.Server, id, 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) -} - -func (c *Client) TunnelSandbox(ctx context.Context, id SandboxID, port int, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewTunnelSandboxRequest(c.Server, id, port) - 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) -} - -func (c *Client) AuthorizeSSHWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewAuthorizeSSHRequestWithBody(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) -} - -func (c *Client) AuthorizeSSH(ctx context.Context, body AuthorizeSSHJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewAuthorizeSSHRequest(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) -} - -func (c *Client) ListUsers(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListUsersRequest(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) -} - -func (c *Client) GetUser(ctx context.Context, handle string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetUserRequest(c.Server, handle) - 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) -} - -func (c *Client) AddUserSSHPublicKeyWithBody(ctx context.Context, handle string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewAddUserSSHPublicKeyRequestWithBody(c.Server, handle, 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) -} - -func (c *Client) AddUserSSHPublicKey(ctx context.Context, handle string, body AddUserSSHPublicKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewAddUserSSHPublicKeyRequest(c.Server, handle, 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) -} - -func (c *Client) DeleteUserSSHPublicKey(ctx context.Context, handle string, id SSHPublicKeyID, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteUserSSHPublicKeyRequest(c.Server, handle, id) - 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) -} - -// NewListAuditRequest generates requests for ListAudit -func NewListAuditRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/v1/audit") - 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 -} - -// NewAuthCLIConfigRequest generates requests for AuthCLIConfig -func NewAuthCLIConfigRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/v1/auth/cli-config") - 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 -} - -// NewAuthSessionRequest generates requests for AuthSession -func NewAuthSessionRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/v1/auth/session") - 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 -} - -// NewListBakesRequest generates requests for ListBakes -func NewListBakesRequest(server string, params *ListBakesParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/v1/bakes") - 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: ""}); 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.Offset != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "offset", *params.Offset, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if params.Filter != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "filter", *params.Filter, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "array", 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 -} - -// NewRunBakeRequest generates requests for RunBake -func NewRunBakeRequest(server string, name string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "name", name, 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/bakes/%s/run", 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 -} - -// NewListForksRequest generates requests for ListForks -func NewListForksRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/v1/forks") - 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 -} - -// NewGetForkRequest generates requests for GetFork -func NewGetForkRequest(server string, id ForkID) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/forks/%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 -} - -// NewHealthzRequest generates requests for Healthz -func NewHealthzRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/v1/healthz") - 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 -} - -// NewListHookTemplatesRequest generates requests for ListHookTemplates -func NewListHookTemplatesRequest(server string, params *ListHookTemplatesParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/v1/hook-templates") - 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: ""}); 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.Offset != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "offset", *params.Offset, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if params.Filter != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "filter", *params.Filter, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "array", 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 -} - -// NewCreateHookTemplateRequest calls the generic CreateHookTemplate builder with application/json body -func NewCreateHookTemplateRequest(server string, body CreateHookTemplateJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateHookTemplateRequestWithBody(server, "application/json", bodyReader) -} - -// NewCreateHookTemplateRequestWithBody generates requests for CreateHookTemplate with any type of body -func NewCreateHookTemplateRequestWithBody(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/hook-templates") - 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 -} - -// NewDeleteHookTemplateRequest generates requests for DeleteHookTemplate -func NewDeleteHookTemplateRequest(server string, name string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "name", name, 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/hook-templates/%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 -} - -// NewGetHookTemplateRequest generates requests for GetHookTemplate -func NewGetHookTemplateRequest(server string, name string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "name", name, 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/hook-templates/%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 -} - -// NewUpdateHookTemplateRequest calls the generic UpdateHookTemplate builder with application/json body -func NewUpdateHookTemplateRequest(server string, name string, body UpdateHookTemplateJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdateHookTemplateRequestWithBody(server, name, "application/json", bodyReader) -} - -// NewUpdateHookTemplateRequestWithBody generates requests for UpdateHookTemplate with any type of body -func NewUpdateHookTemplateRequestWithBody(server string, name string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "name", name, 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/hook-templates/%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 -} - -// NewListImagesRequest generates requests for ListImages -func NewListImagesRequest(server string, params *ListImagesParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/v1/images") - 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: ""}); 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.Offset != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "offset", *params.Offset, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if params.Filter != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "filter", *params.Filter, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "array", 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 -} - -// NewDeleteImageRequest generates requests for DeleteImage -func NewDeleteImageRequest(server string, id ImageID, params *DeleteImageParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/images/%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 - } - - if params != nil { - - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithOptions("simple", false, "Idempotency-Key", params.IdempotencyKey, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationHeader, Type: "string", Format: ""}) - if err != nil { - return nil, err - } - - req.Header.Set("Idempotency-Key", headerParam0) - - } - - return req, nil -} - -// NewGetImageRequest generates requests for GetImage -func NewGetImageRequest(server string, id ImageID) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/images/%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 -} - -// NewDeactivateImageRequest generates requests for DeactivateImage -func NewDeactivateImageRequest(server string, id ImageID) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/images/%s/deactivate", 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 -} - -// NewForkImageRequest calls the generic ForkImage builder with application/json body -func NewForkImageRequest(server string, id ImageID, params *ForkImageParams, body ForkImageJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewForkImageRequestWithBody(server, id, params, "application/json", bodyReader) -} - -// NewForkImageRequestWithBody generates requests for ForkImage with any type of body -func NewForkImageRequestWithBody(server string, id ImageID, params *ForkImageParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/images/%s/fork", 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) - - if params != nil { - - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithOptions("simple", false, "Idempotency-Key", params.IdempotencyKey, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationHeader, Type: "string", Format: ""}) - if err != nil { - return nil, err - } - - req.Header.Set("Idempotency-Key", headerParam0) - - } - - return req, nil -} - -// NewGetImageLineageRequest generates requests for GetImageLineage -func NewGetImageLineageRequest(server string, id ImageID) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/images/%s/lineage", 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 -} - -// NewPromoteImageRequest calls the generic PromoteImage builder with application/json body -func NewPromoteImageRequest(server string, id ImageID, body PromoteImageJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPromoteImageRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewPromoteImageRequestWithBody generates requests for PromoteImage with any type of body -func NewPromoteImageRequestWithBody(server string, id ImageID, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/images/%s/promote", 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 -} - -// NewGetImageRestoredByRequest generates requests for GetImageRestoredBy -func NewGetImageRestoredByRequest(server string, id ImageID) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/images/%s/restored-by", 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 -} - -// NewAuthorizeIngressRequest calls the generic AuthorizeIngress builder with application/json body -func NewAuthorizeIngressRequest(server string, body AuthorizeIngressJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewAuthorizeIngressRequestWithBody(server, "application/json", bodyReader) -} - -// NewAuthorizeIngressRequestWithBody generates requests for AuthorizeIngress with any type of body -func NewAuthorizeIngressRequestWithBody(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/ingress/authorize") - 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 -} - -// NewListSSHPublicKeysRequest generates requests for ListSSHPublicKeys -func NewListSSHPublicKeysRequest(server string, params *ListSSHPublicKeysParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/v1/me/ssh-keys") - 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: ""}); 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.Offset != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "offset", *params.Offset, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if params.Filter != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "filter", *params.Filter, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "array", 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 -} - -// NewAddSSHPublicKeyRequest calls the generic AddSSHPublicKey builder with application/json body -func NewAddSSHPublicKeyRequest(server string, body AddSSHPublicKeyJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewAddSSHPublicKeyRequestWithBody(server, "application/json", bodyReader) -} - -// NewAddSSHPublicKeyRequestWithBody generates requests for AddSSHPublicKey with any type of body -func NewAddSSHPublicKeyRequestWithBody(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/me/ssh-keys") - 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 -} - -// NewDeleteSSHPublicKeyRequest generates requests for DeleteSSHPublicKey -func NewDeleteSSHPublicKeyRequest(server string, id SSHPublicKeyID) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/me/ssh-keys/%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 -} - -// NewMetaRequest generates requests for Meta -func NewMetaRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/v1/meta") - 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 -} - -// NewMetricsRequest generates requests for Metrics -func NewMetricsRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/v1/metrics") - 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 -} - -// NewListNodesRequest generates requests for ListNodes -func NewListNodesRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/v1/nodes") - 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 -} - -// NewGetNodeRequest generates requests for GetNode -func NewGetNodeRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/nodes/%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 -} - -// NewOpenAPIYAMLRequest generates requests for OpenAPIYAML -func NewOpenAPIYAMLRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/v1/openapi.yaml") - 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 -} - -// NewListOperationsRequest generates requests for ListOperations -func NewListOperationsRequest(server string, params *ListOperationsParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/v1/operations") - 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: ""}); 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.Offset != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "offset", *params.Offset, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if params.Filter != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "filter", *params.Filter, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "array", 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 -} - -// NewGetOperationRequest generates requests for GetOperation -func NewGetOperationRequest(server string, id OperationID) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/operations/%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 -} - -// NewReadyzRequest generates requests for Readyz -func NewReadyzRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/v1/readyz") - 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 -} - -// NewListSandboxesRequest generates requests for ListSandboxes -func NewListSandboxesRequest(server string, params *ListSandboxesParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/v1/sandboxes") - 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: ""}); 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.Offset != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "offset", *params.Offset, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if params.Filter != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "filter", *params.Filter, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "array", 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 -} - -// NewCreateSandboxRequest calls the generic CreateSandbox builder with application/json body -func NewCreateSandboxRequest(server string, params *CreateSandboxParams, body CreateSandboxJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateSandboxRequestWithBody(server, params, "application/json", bodyReader) -} - -// NewCreateSandboxRequestWithBody generates requests for CreateSandbox with any type of body -func NewCreateSandboxRequestWithBody(server string, params *CreateSandboxParams, 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/sandboxes") - 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) - - if params != nil { - - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithOptions("simple", false, "Idempotency-Key", params.IdempotencyKey, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationHeader, Type: "string", Format: ""}) - if err != nil { - return nil, err - } - - req.Header.Set("Idempotency-Key", headerParam0) - - } - - return req, nil -} - -// NewDeleteSandboxRequest generates requests for DeleteSandbox -func NewDeleteSandboxRequest(server string, id SandboxID, params *DeleteSandboxParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/sandboxes/%s", 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.Retain != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "retain", *params.Retain, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "boolean", 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.MethodDelete, queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params != nil { - - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithOptions("simple", false, "Idempotency-Key", params.IdempotencyKey, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationHeader, Type: "string", Format: ""}) - if err != nil { - return nil, err - } - - req.Header.Set("Idempotency-Key", headerParam0) - - } - - return req, nil -} - -// NewGetSandboxRequest generates requests for GetSandbox -func NewGetSandboxRequest(server string, id SandboxID) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/sandboxes/%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 -} - -// NewStreamExecSandboxRequest generates requests for StreamExecSandbox -func NewStreamExecSandboxRequest(server string, id SandboxID, params *StreamExecSandboxParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/sandboxes/%s/exec", 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.Cmd != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "cmd", params.Cmd, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "array", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if params.Pty != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "pty", *params.Pty, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "boolean", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if params.Rows != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "rows", *params.Rows, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if params.Cols != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "cols", *params.Cols, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", 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 -} - -// NewExecSandboxRequest calls the generic ExecSandbox builder with application/json body -func NewExecSandboxRequest(server string, id SandboxID, body ExecSandboxJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewExecSandboxRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewExecSandboxRequestWithBody generates requests for ExecSandbox with any type of body -func NewExecSandboxRequestWithBody(server string, id SandboxID, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/sandboxes/%s/exec", 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 -} - -// NewForkSandboxRequest calls the generic ForkSandbox builder with application/json body -func NewForkSandboxRequest(server string, id SandboxID, params *ForkSandboxParams, body ForkSandboxJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewForkSandboxRequestWithBody(server, id, params, "application/json", bodyReader) -} - -// NewForkSandboxRequestWithBody generates requests for ForkSandbox with any type of body -func NewForkSandboxRequestWithBody(server string, id SandboxID, params *ForkSandboxParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/sandboxes/%s/fork", 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) - - if params != nil { - - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithOptions("simple", false, "Idempotency-Key", params.IdempotencyKey, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationHeader, Type: "string", Format: ""}) - if err != nil { - return nil, err - } - - req.Header.Set("Idempotency-Key", headerParam0) - - } - - return req, nil -} - -// NewGetSandboxHookRunsRequest generates requests for GetSandboxHookRuns -func NewGetSandboxHookRunsRequest(server string, id SandboxID, params *GetSandboxHookRunsParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/sandboxes/%s/hook-runs", 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: ""}); 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.Offset != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "offset", *params.Offset, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if params.Filter != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "filter", *params.Filter, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "array", 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 -} - -// NewGetSandboxHooksRequest generates requests for GetSandboxHooks -func NewGetSandboxHooksRequest(server string, id SandboxID, params *GetSandboxHooksParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/sandboxes/%s/hooks", 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: ""}); 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.Offset != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "offset", *params.Offset, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: ""}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if params.Filter != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "filter", *params.Filter, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "array", 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 -} - -// NewGetSandboxImagesRequest generates requests for GetSandboxImages -func NewGetSandboxImagesRequest(server string, id SandboxID) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/sandboxes/%s/images", 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 -} - -// NewLeaseSandboxRequest calls the generic LeaseSandbox builder with application/json body -func NewLeaseSandboxRequest(server string, id SandboxID, body LeaseSandboxJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewLeaseSandboxRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewLeaseSandboxRequestWithBody generates requests for LeaseSandbox with any type of body -func NewLeaseSandboxRequestWithBody(server string, id SandboxID, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/sandboxes/%s/lease", 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 -} - -// NewGetSandboxLineageRequest generates requests for GetSandboxLineage -func NewGetSandboxLineageRequest(server string, id SandboxID) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/sandboxes/%s/lineage", 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 -} - -// NewGetSandboxLogsRequest generates requests for GetSandboxLogs -func NewGetSandboxLogsRequest(server string, id SandboxID, params *GetSandboxLogsParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/sandboxes/%s/logs", 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.TailBytes != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "tail_bytes", *params.TailBytes, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationQuery, Type: "integer", Format: "int64"}); err != nil { - return nil, err - } else { - for _, qp := range strings.Split(queryFrag, "&") { - rawQueryFragments = append(rawQueryFragments, qp) - } - } - - } - - if params.Source != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "source", *params.Source, 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 -} - -// NewGetSandboxMetricsRequest generates requests for GetSandboxMetrics -func NewGetSandboxMetricsRequest(server string, id SandboxID, params *GetSandboxMetricsParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/sandboxes/%s/metrics", 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.Since != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "since", *params.Since, 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.Until != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "until", *params.Until, 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.Step != nil { - - if queryFrag, err := runtime.StyleParamWithOptions("form", true, "step", *params.Step, 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 -} - -// NewGetSandboxOperationsRequest generates requests for GetSandboxOperations -func NewGetSandboxOperationsRequest(server string, id SandboxID) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/sandboxes/%s/operations", 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 -} - -// NewPauseSandboxRequest generates requests for PauseSandbox -func NewPauseSandboxRequest(server string, id SandboxID, params *PauseSandboxParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/sandboxes/%s/pause", 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 - } - - if params != nil { - - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithOptions("simple", false, "Idempotency-Key", params.IdempotencyKey, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationHeader, Type: "string", Format: ""}) - if err != nil { - return nil, err - } - - req.Header.Set("Idempotency-Key", headerParam0) - - } - - return req, nil -} - -// NewExposePortRequest calls the generic ExposePort builder with application/json body -func NewExposePortRequest(server string, id SandboxID, body ExposePortJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewExposePortRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewExposePortRequestWithBody generates requests for ExposePort with any type of body -func NewExposePortRequestWithBody(server string, id SandboxID, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/sandboxes/%s/ports", 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 -} - -// NewUnexposePortRequest generates requests for UnexposePort -func NewUnexposePortRequest(server string, id SandboxID, port Port) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithOptions("simple", false, "port", port, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "integer", Format: ""}) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/v1/sandboxes/%s/ports/%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 -} - -// NewResumeSandboxRequest generates requests for ResumeSandbox -func NewResumeSandboxRequest(server string, id SandboxID, params *ResumeSandboxParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/sandboxes/%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 - } - - if params != nil { - - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithOptions("simple", false, "Idempotency-Key", params.IdempotencyKey, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationHeader, Type: "string", Format: ""}) - if err != nil { - return nil, err - } - - req.Header.Set("Idempotency-Key", headerParam0) - - } - - return req, nil -} - -// NewSnapshotSandboxRequest calls the generic SnapshotSandbox builder with application/json body -func NewSnapshotSandboxRequest(server string, id SandboxID, params *SnapshotSandboxParams, body SnapshotSandboxJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewSnapshotSandboxRequestWithBody(server, id, params, "application/json", bodyReader) -} - -// NewSnapshotSandboxRequestWithBody generates requests for SnapshotSandbox with any type of body -func NewSnapshotSandboxRequestWithBody(server string, id SandboxID, params *SnapshotSandboxParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/sandboxes/%s/snapshot", 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) - - if params != nil { - - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithOptions("simple", false, "Idempotency-Key", params.IdempotencyKey, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationHeader, Type: "string", Format: ""}) - if err != nil { - return nil, err - } - - req.Header.Set("Idempotency-Key", headerParam0) - - } - - return req, nil -} - -// NewPrepareSandboxSSHRequest calls the generic PrepareSandboxSSH builder with application/json body -func NewPrepareSandboxSSHRequest(server string, id SandboxID, body PrepareSandboxSSHJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPrepareSandboxSSHRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewPrepareSandboxSSHRequestWithBody generates requests for PrepareSandboxSSH with any type of body -func NewPrepareSandboxSSHRequestWithBody(server string, id SandboxID, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/sandboxes/%s/ssh", 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 -} - -// NewStartSandboxRequest generates requests for StartSandbox -func NewStartSandboxRequest(server string, id SandboxID, params *StartSandboxParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/sandboxes/%s/start", 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 - } - - if params != nil { - - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithOptions("simple", false, "Idempotency-Key", params.IdempotencyKey, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationHeader, Type: "string", Format: ""}) - if err != nil { - return nil, err - } - - req.Header.Set("Idempotency-Key", headerParam0) - - } - - return req, nil -} - -// NewStopSandboxRequest generates requests for StopSandbox -func NewStopSandboxRequest(server string, id SandboxID, params *StopSandboxParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/sandboxes/%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 - } - - if params != nil { - - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithOptions("simple", false, "Idempotency-Key", params.IdempotencyKey, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationHeader, Type: "string", Format: ""}) - if err != nil { - return nil, err - } - - req.Header.Set("Idempotency-Key", headerParam0) - - } - - return req, nil -} - -// NewTunnelSandboxRequest generates requests for TunnelSandbox -func NewTunnelSandboxRequest(server string, id SandboxID, port int) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "id", id, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithOptions("simple", false, "port", port, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "integer", Format: ""}) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/v1/sandboxes/%s/tunnel/%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 -} - -// NewAuthorizeSSHRequest calls the generic AuthorizeSSH builder with application/json body -func NewAuthorizeSSHRequest(server string, body AuthorizeSSHJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewAuthorizeSSHRequestWithBody(server, "application/json", bodyReader) -} - -// NewAuthorizeSSHRequestWithBody generates requests for AuthorizeSSH with any type of body -func NewAuthorizeSSHRequestWithBody(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/ssh/authorize") - 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 -} - -// NewListUsersRequest generates requests for ListUsers -func NewListUsersRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/v1/users") - 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 -} - -// NewGetUserRequest generates requests for GetUser -func NewGetUserRequest(server string, handle string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "handle", handle, 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/users/%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 -} - -// NewAddUserSSHPublicKeyRequest calls the generic AddUserSSHPublicKey builder with application/json body -func NewAddUserSSHPublicKeyRequest(server string, handle string, body AddUserSSHPublicKeyJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewAddUserSSHPublicKeyRequestWithBody(server, handle, "application/json", bodyReader) -} - -// NewAddUserSSHPublicKeyRequestWithBody generates requests for AddUserSSHPublicKey with any type of body -func NewAddUserSSHPublicKeyRequestWithBody(server string, handle string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "handle", handle, 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/users/%s/ssh-keys", 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 -} - -// NewDeleteUserSSHPublicKeyRequest generates requests for DeleteUserSSHPublicKey -func NewDeleteUserSSHPublicKeyRequest(server string, handle string, id SSHPublicKeyID) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithOptions("simple", false, "handle", handle, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""}) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithOptions("simple", false, "id", id, 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/users/%s/ssh-keys/%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 -} - -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 { - // ListAuditWithResponse request - ListAuditWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListAuditResponse, error) - - // AuthCLIConfigWithResponse request - AuthCLIConfigWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*AuthCLIConfigResponse, error) - - // AuthSessionWithResponse request - AuthSessionWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*AuthSessionResponse, error) - - // ListBakesWithResponse request - ListBakesWithResponse(ctx context.Context, params *ListBakesParams, reqEditors ...RequestEditorFn) (*ListBakesResponse, error) - - // RunBakeWithResponse request - RunBakeWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*RunBakeResponse, error) - - // ListForksWithResponse request - ListForksWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListForksResponse, error) - - // GetForkWithResponse request - GetForkWithResponse(ctx context.Context, id ForkID, reqEditors ...RequestEditorFn) (*GetForkResponse, error) - - // HealthzWithResponse request - HealthzWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*HealthzResponse, error) - - // ListHookTemplatesWithResponse request - ListHookTemplatesWithResponse(ctx context.Context, params *ListHookTemplatesParams, reqEditors ...RequestEditorFn) (*ListHookTemplatesResponse, error) - - // CreateHookTemplateWithBodyWithResponse request with any body - CreateHookTemplateWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateHookTemplateResponse, error) - - CreateHookTemplateWithResponse(ctx context.Context, body CreateHookTemplateJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateHookTemplateResponse, error) - - // DeleteHookTemplateWithResponse request - DeleteHookTemplateWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*DeleteHookTemplateResponse, error) - - // GetHookTemplateWithResponse request - GetHookTemplateWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*GetHookTemplateResponse, error) - - // UpdateHookTemplateWithBodyWithResponse request with any body - UpdateHookTemplateWithBodyWithResponse(ctx context.Context, name string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateHookTemplateResponse, error) - - UpdateHookTemplateWithResponse(ctx context.Context, name string, body UpdateHookTemplateJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateHookTemplateResponse, error) - - // ListImagesWithResponse request - ListImagesWithResponse(ctx context.Context, params *ListImagesParams, reqEditors ...RequestEditorFn) (*ListImagesResponse, error) - - // DeleteImageWithResponse request - DeleteImageWithResponse(ctx context.Context, id ImageID, params *DeleteImageParams, reqEditors ...RequestEditorFn) (*DeleteImageResponse, error) - - // GetImageWithResponse request - GetImageWithResponse(ctx context.Context, id ImageID, reqEditors ...RequestEditorFn) (*GetImageResponse, error) - - // DeactivateImageWithResponse request - DeactivateImageWithResponse(ctx context.Context, id ImageID, reqEditors ...RequestEditorFn) (*DeactivateImageResponse, error) - - // ForkImageWithBodyWithResponse request with any body - ForkImageWithBodyWithResponse(ctx context.Context, id ImageID, params *ForkImageParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ForkImageResponse, error) - - ForkImageWithResponse(ctx context.Context, id ImageID, params *ForkImageParams, body ForkImageJSONRequestBody, reqEditors ...RequestEditorFn) (*ForkImageResponse, error) - - // GetImageLineageWithResponse request - GetImageLineageWithResponse(ctx context.Context, id ImageID, reqEditors ...RequestEditorFn) (*GetImageLineageResponse, error) - - // PromoteImageWithBodyWithResponse request with any body - PromoteImageWithBodyWithResponse(ctx context.Context, id ImageID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PromoteImageResponse, error) - - PromoteImageWithResponse(ctx context.Context, id ImageID, body PromoteImageJSONRequestBody, reqEditors ...RequestEditorFn) (*PromoteImageResponse, error) - - // GetImageRestoredByWithResponse request - GetImageRestoredByWithResponse(ctx context.Context, id ImageID, reqEditors ...RequestEditorFn) (*GetImageRestoredByResponse, error) - - // AuthorizeIngressWithBodyWithResponse request with any body - AuthorizeIngressWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AuthorizeIngressResponse, error) - - AuthorizeIngressWithResponse(ctx context.Context, body AuthorizeIngressJSONRequestBody, reqEditors ...RequestEditorFn) (*AuthorizeIngressResponse, error) - - // ListSSHPublicKeysWithResponse request - ListSSHPublicKeysWithResponse(ctx context.Context, params *ListSSHPublicKeysParams, reqEditors ...RequestEditorFn) (*ListSSHPublicKeysResponse, error) - - // AddSSHPublicKeyWithBodyWithResponse request with any body - AddSSHPublicKeyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AddSSHPublicKeyResponse, error) - - AddSSHPublicKeyWithResponse(ctx context.Context, body AddSSHPublicKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*AddSSHPublicKeyResponse, error) - - // DeleteSSHPublicKeyWithResponse request - DeleteSSHPublicKeyWithResponse(ctx context.Context, id SSHPublicKeyID, reqEditors ...RequestEditorFn) (*DeleteSSHPublicKeyResponse, error) - - // MetaWithResponse request - MetaWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*MetaResponse, error) - - // MetricsWithResponse request - MetricsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*MetricsResponse, error) - - // ListNodesWithResponse request - ListNodesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListNodesResponse, error) - - // GetNodeWithResponse request - GetNodeWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetNodeResponse, error) - - // OpenAPIYAMLWithResponse request - OpenAPIYAMLWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*OpenAPIYAMLResponse, error) - - // ListOperationsWithResponse request - ListOperationsWithResponse(ctx context.Context, params *ListOperationsParams, reqEditors ...RequestEditorFn) (*ListOperationsResponse, error) - - // GetOperationWithResponse request - GetOperationWithResponse(ctx context.Context, id OperationID, reqEditors ...RequestEditorFn) (*GetOperationResponse, error) - - // ReadyzWithResponse request - ReadyzWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ReadyzResponse, error) - - // ListSandboxesWithResponse request - ListSandboxesWithResponse(ctx context.Context, params *ListSandboxesParams, reqEditors ...RequestEditorFn) (*ListSandboxesResponse, error) - - // CreateSandboxWithBodyWithResponse request with any body - CreateSandboxWithBodyWithResponse(ctx context.Context, params *CreateSandboxParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateSandboxResponse, error) - - CreateSandboxWithResponse(ctx context.Context, params *CreateSandboxParams, body CreateSandboxJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateSandboxResponse, error) - - // DeleteSandboxWithResponse request - DeleteSandboxWithResponse(ctx context.Context, id SandboxID, params *DeleteSandboxParams, reqEditors ...RequestEditorFn) (*DeleteSandboxResponse, error) - - // GetSandboxWithResponse request - GetSandboxWithResponse(ctx context.Context, id SandboxID, reqEditors ...RequestEditorFn) (*GetSandboxResponse, error) - - // StreamExecSandboxWithResponse request - StreamExecSandboxWithResponse(ctx context.Context, id SandboxID, params *StreamExecSandboxParams, reqEditors ...RequestEditorFn) (*StreamExecSandboxResponse, error) - - // ExecSandboxWithBodyWithResponse request with any body - ExecSandboxWithBodyWithResponse(ctx context.Context, id SandboxID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ExecSandboxResponse, error) - - ExecSandboxWithResponse(ctx context.Context, id SandboxID, body ExecSandboxJSONRequestBody, reqEditors ...RequestEditorFn) (*ExecSandboxResponse, error) - - // ForkSandboxWithBodyWithResponse request with any body - ForkSandboxWithBodyWithResponse(ctx context.Context, id SandboxID, params *ForkSandboxParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ForkSandboxResponse, error) - - ForkSandboxWithResponse(ctx context.Context, id SandboxID, params *ForkSandboxParams, body ForkSandboxJSONRequestBody, reqEditors ...RequestEditorFn) (*ForkSandboxResponse, error) - - // GetSandboxHookRunsWithResponse request - GetSandboxHookRunsWithResponse(ctx context.Context, id SandboxID, params *GetSandboxHookRunsParams, reqEditors ...RequestEditorFn) (*GetSandboxHookRunsResponse, error) - - // GetSandboxHooksWithResponse request - GetSandboxHooksWithResponse(ctx context.Context, id SandboxID, params *GetSandboxHooksParams, reqEditors ...RequestEditorFn) (*GetSandboxHooksResponse, error) - - // GetSandboxImagesWithResponse request - GetSandboxImagesWithResponse(ctx context.Context, id SandboxID, reqEditors ...RequestEditorFn) (*GetSandboxImagesResponse, error) - - // LeaseSandboxWithBodyWithResponse request with any body - LeaseSandboxWithBodyWithResponse(ctx context.Context, id SandboxID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*LeaseSandboxResponse, error) - - LeaseSandboxWithResponse(ctx context.Context, id SandboxID, body LeaseSandboxJSONRequestBody, reqEditors ...RequestEditorFn) (*LeaseSandboxResponse, error) - - // GetSandboxLineageWithResponse request - GetSandboxLineageWithResponse(ctx context.Context, id SandboxID, reqEditors ...RequestEditorFn) (*GetSandboxLineageResponse, error) - - // GetSandboxLogsWithResponse request - GetSandboxLogsWithResponse(ctx context.Context, id SandboxID, params *GetSandboxLogsParams, reqEditors ...RequestEditorFn) (*GetSandboxLogsResponse, error) - - // GetSandboxMetricsWithResponse request - GetSandboxMetricsWithResponse(ctx context.Context, id SandboxID, params *GetSandboxMetricsParams, reqEditors ...RequestEditorFn) (*GetSandboxMetricsResponse, error) - - // GetSandboxOperationsWithResponse request - GetSandboxOperationsWithResponse(ctx context.Context, id SandboxID, reqEditors ...RequestEditorFn) (*GetSandboxOperationsResponse, error) - - // PauseSandboxWithResponse request - PauseSandboxWithResponse(ctx context.Context, id SandboxID, params *PauseSandboxParams, reqEditors ...RequestEditorFn) (*PauseSandboxResponse, error) - - // ExposePortWithBodyWithResponse request with any body - ExposePortWithBodyWithResponse(ctx context.Context, id SandboxID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ExposePortResponse, error) - - ExposePortWithResponse(ctx context.Context, id SandboxID, body ExposePortJSONRequestBody, reqEditors ...RequestEditorFn) (*ExposePortResponse, error) - - // UnexposePortWithResponse request - UnexposePortWithResponse(ctx context.Context, id SandboxID, port Port, reqEditors ...RequestEditorFn) (*UnexposePortResponse, error) - - // ResumeSandboxWithResponse request - ResumeSandboxWithResponse(ctx context.Context, id SandboxID, params *ResumeSandboxParams, reqEditors ...RequestEditorFn) (*ResumeSandboxResponse, error) - - // SnapshotSandboxWithBodyWithResponse request with any body - SnapshotSandboxWithBodyWithResponse(ctx context.Context, id SandboxID, params *SnapshotSandboxParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SnapshotSandboxResponse, error) - - SnapshotSandboxWithResponse(ctx context.Context, id SandboxID, params *SnapshotSandboxParams, body SnapshotSandboxJSONRequestBody, reqEditors ...RequestEditorFn) (*SnapshotSandboxResponse, error) - - // PrepareSandboxSSHWithBodyWithResponse request with any body - PrepareSandboxSSHWithBodyWithResponse(ctx context.Context, id SandboxID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PrepareSandboxSSHResponse, error) - - PrepareSandboxSSHWithResponse(ctx context.Context, id SandboxID, body PrepareSandboxSSHJSONRequestBody, reqEditors ...RequestEditorFn) (*PrepareSandboxSSHResponse, error) - - // StartSandboxWithResponse request - StartSandboxWithResponse(ctx context.Context, id SandboxID, params *StartSandboxParams, reqEditors ...RequestEditorFn) (*StartSandboxResponse, error) - - // StopSandboxWithResponse request - StopSandboxWithResponse(ctx context.Context, id SandboxID, params *StopSandboxParams, reqEditors ...RequestEditorFn) (*StopSandboxResponse, error) - - // TunnelSandboxWithResponse request - TunnelSandboxWithResponse(ctx context.Context, id SandboxID, port int, reqEditors ...RequestEditorFn) (*TunnelSandboxResponse, error) - - // AuthorizeSSHWithBodyWithResponse request with any body - AuthorizeSSHWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AuthorizeSSHResponse, error) - - AuthorizeSSHWithResponse(ctx context.Context, body AuthorizeSSHJSONRequestBody, reqEditors ...RequestEditorFn) (*AuthorizeSSHResponse, error) - - // ListUsersWithResponse request - ListUsersWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListUsersResponse, error) - - // GetUserWithResponse request - GetUserWithResponse(ctx context.Context, handle string, reqEditors ...RequestEditorFn) (*GetUserResponse, error) - - // AddUserSSHPublicKeyWithBodyWithResponse request with any body - AddUserSSHPublicKeyWithBodyWithResponse(ctx context.Context, handle string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AddUserSSHPublicKeyResponse, error) - - AddUserSSHPublicKeyWithResponse(ctx context.Context, handle string, body AddUserSSHPublicKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*AddUserSSHPublicKeyResponse, error) - - // DeleteUserSSHPublicKeyWithResponse request - DeleteUserSSHPublicKeyWithResponse(ctx context.Context, handle string, id SSHPublicKeyID, reqEditors ...RequestEditorFn) (*DeleteUserSSHPublicKeyResponse, error) -} - -type ListAuditResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r ListAuditResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListAuditResponse) 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 ListAuditResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type AuthCLIConfigResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *AuthCLIConfig - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r AuthCLIConfigResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r AuthCLIConfigResponse) 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 AuthCLIConfigResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type AuthSessionResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *AuthSession - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r AuthSessionResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r AuthSessionResponse) 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 AuthSessionResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type ListBakesResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *BakeStatusList - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r ListBakesResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListBakesResponse) 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 ListBakesResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type RunBakeResponse struct { - Body []byte - HTTPResponse *http.Response - JSON202 *ScheduledResponse - JSON404 *NotFound - JSON409 *Conflict - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r RunBakeResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r RunBakeResponse) 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 RunBakeResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type ListForksResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *[]Fork - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r ListForksResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListForksResponse) 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 ListForksResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetForkResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Fork - JSON404 *NotFound - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r GetForkResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetForkResponse) 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 GetForkResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type HealthzResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r HealthzResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r HealthzResponse) 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 HealthzResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type ListHookTemplatesResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *HookTemplateList - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r ListHookTemplatesResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListHookTemplatesResponse) 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 ListHookTemplatesResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type CreateHookTemplateResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *HookTemplate - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r CreateHookTemplateResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateHookTemplateResponse) 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 CreateHookTemplateResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type DeleteHookTemplateResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r DeleteHookTemplateResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteHookTemplateResponse) 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 DeleteHookTemplateResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetHookTemplateResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *HookTemplate - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r GetHookTemplateResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetHookTemplateResponse) 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 GetHookTemplateResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type UpdateHookTemplateResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *HookTemplate - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r UpdateHookTemplateResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpdateHookTemplateResponse) 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 UpdateHookTemplateResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type ListImagesResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *ImageList - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r ListImagesResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListImagesResponse) 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 ListImagesResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type DeleteImageResponse struct { - Body []byte - HTTPResponse *http.Response - JSON202 *AcceptedResponse - JSON409 *Error - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r DeleteImageResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteImageResponse) 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 DeleteImageResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetImageResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Image - JSON404 *NotFound - JSON500 *InternalError -} - -// Status returns HTTPResponse.Status -func (r GetImageResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetImageResponse) 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 GetImageResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type DeactivateImageResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *NotFound - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r DeactivateImageResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeactivateImageResponse) 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 DeactivateImageResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type ForkImageResponse struct { - Body []byte - HTTPResponse *http.Response - JSON202 *ForkAccepted - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r ForkImageResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ForkImageResponse) 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 ForkImageResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetImageLineageResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *LineageResponse - JSON404 *NotFound - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r GetImageLineageResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetImageLineageResponse) 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 GetImageLineageResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type PromoteImageResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *Image - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r PromoteImageResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r PromoteImageResponse) 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 PromoteImageResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetImageRestoredByResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *NotFound - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r GetImageRestoredByResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetImageRestoredByResponse) 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 GetImageRestoredByResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type AuthorizeIngressResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *IngressAuthorizeResponse - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r AuthorizeIngressResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r AuthorizeIngressResponse) 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 AuthorizeIngressResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type ListSSHPublicKeysResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *SSHPublicKeyList - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r ListSSHPublicKeysResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListSSHPublicKeysResponse) 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 ListSSHPublicKeysResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type AddSSHPublicKeyResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *SSHPublicKey - JSON400 *BadRequest - JSON409 *Conflict - JSON500 *InternalError -} - -// Status returns HTTPResponse.Status -func (r AddSSHPublicKeyResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r AddSSHPublicKeyResponse) 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 AddSSHPublicKeyResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type DeleteSSHPublicKeyResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *NotFound - JSON500 *InternalError -} - -// Status returns HTTPResponse.Status -func (r DeleteSSHPublicKeyResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteSSHPublicKeyResponse) 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 DeleteSSHPublicKeyResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type MetaResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r MetaResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r MetaResponse) 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 MetaResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type MetricsResponse struct { - Body []byte - HTTPResponse *http.Response -} - -// Status returns HTTPResponse.Status -func (r MetricsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r MetricsResponse) 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 MetricsResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type ListNodesResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r ListNodesResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListNodesResponse) 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 ListNodesResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetNodeResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *NotFound - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r GetNodeResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetNodeResponse) 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 GetNodeResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type OpenAPIYAMLResponse struct { - Body []byte - HTTPResponse *http.Response - YAML200 *string -} - -// Status returns HTTPResponse.Status -func (r OpenAPIYAMLResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r OpenAPIYAMLResponse) 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 OpenAPIYAMLResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type ListOperationsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *OperationList - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r ListOperationsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListOperationsResponse) 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 ListOperationsResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetOperationResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation - JSON404 *NotFound - JSON500 *InternalError -} - -// Status returns HTTPResponse.Status -func (r GetOperationResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetOperationResponse) 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 GetOperationResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type ReadyzResponse struct { - Body []byte - HTTPResponse *http.Response - JSON503 *NotReady -} - -// Status returns HTTPResponse.Status -func (r ReadyzResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ReadyzResponse) 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 ReadyzResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type ListSandboxesResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *SandboxList - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r ListSandboxesResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListSandboxesResponse) 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 ListSandboxesResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type CreateSandboxResponse struct { - Body []byte - HTTPResponse *http.Response - JSON202 *AcceptedResponse - JSON400 *BadRequest - JSON409 *Conflict - JSON422 *UnprocessableEntity - JSON500 *InternalError -} - -// Status returns HTTPResponse.Status -func (r CreateSandboxResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateSandboxResponse) 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 CreateSandboxResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type DeleteSandboxResponse struct { - Body []byte - HTTPResponse *http.Response - JSON202 *AcceptedResponse - JSON400 *BadRequest - JSON409 *Conflict - JSON500 *InternalError -} - -// Status returns HTTPResponse.Status -func (r DeleteSandboxResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteSandboxResponse) 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 DeleteSandboxResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetSandboxResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Sandbox - JSON404 *NotFound - JSON500 *InternalError -} - -// Status returns HTTPResponse.Status -func (r GetSandboxResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetSandboxResponse) 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 GetSandboxResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type StreamExecSandboxResponse struct { - Body []byte - HTTPResponse *http.Response - JSON400 *BadRequest - JSON409 *Conflict - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r StreamExecSandboxResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r StreamExecSandboxResponse) 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 StreamExecSandboxResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type ExecSandboxResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *ExecSandboxResult - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r ExecSandboxResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ExecSandboxResponse) 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 ExecSandboxResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type ForkSandboxResponse struct { - Body []byte - HTTPResponse *http.Response - JSON202 *ForkAccepted - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r ForkSandboxResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ForkSandboxResponse) 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 ForkSandboxResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetSandboxHookRunsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *HookRunList - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r GetSandboxHookRunsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetSandboxHookRunsResponse) 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 GetSandboxHookRunsResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetSandboxHooksResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *HookSummaryList - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r GetSandboxHooksResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetSandboxHooksResponse) 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 GetSandboxHooksResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetSandboxImagesResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *NotFound - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r GetSandboxImagesResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetSandboxImagesResponse) 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 GetSandboxImagesResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type LeaseSandboxResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *LeaseResponse - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r LeaseSandboxResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r LeaseSandboxResponse) 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 LeaseSandboxResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetSandboxLineageResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *LineageResponse - JSON404 *NotFound - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r GetSandboxLineageResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetSandboxLineageResponse) 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 GetSandboxLineageResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetSandboxLogsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *LogsResponse - JSON404 *NotFound - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r GetSandboxLogsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetSandboxLogsResponse) 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 GetSandboxLogsResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetSandboxMetricsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *SandboxMetricsResponse - JSON400 *BadRequest - JSON404 *NotFound - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r GetSandboxMetricsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetSandboxMetricsResponse) 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 GetSandboxMetricsResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetSandboxOperationsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *NotFound - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r GetSandboxOperationsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetSandboxOperationsResponse) 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 GetSandboxOperationsResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type PauseSandboxResponse struct { - Body []byte - HTTPResponse *http.Response - JSON202 *AcceptedResponse - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r PauseSandboxResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r PauseSandboxResponse) 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 PauseSandboxResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type ExposePortResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *ExposedPort - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r ExposePortResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ExposePortResponse) 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 ExposePortResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type UnexposePortResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r UnexposePortResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UnexposePortResponse) 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 UnexposePortResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type ResumeSandboxResponse struct { - Body []byte - HTTPResponse *http.Response - JSON202 *AcceptedResponse - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r ResumeSandboxResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ResumeSandboxResponse) 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 ResumeSandboxResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type SnapshotSandboxResponse struct { - Body []byte - HTTPResponse *http.Response - JSON202 *AcceptedResponse - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r SnapshotSandboxResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r SnapshotSandboxResponse) 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 SnapshotSandboxResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type PrepareSandboxSSHResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *PrepareSandboxSSHResult - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r PrepareSandboxSSHResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r PrepareSandboxSSHResponse) 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 PrepareSandboxSSHResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type StartSandboxResponse struct { - Body []byte - HTTPResponse *http.Response - JSON202 *AcceptedResponse - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r StartSandboxResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r StartSandboxResponse) 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 StartSandboxResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type StopSandboxResponse struct { - Body []byte - HTTPResponse *http.Response - JSON202 *AcceptedResponse - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r StopSandboxResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r StopSandboxResponse) 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 StopSandboxResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type TunnelSandboxResponse struct { - Body []byte - HTTPResponse *http.Response - JSON400 *BadRequest - JSON409 *Conflict - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r TunnelSandboxResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r TunnelSandboxResponse) 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 TunnelSandboxResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type AuthorizeSSHResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *SSHAuthorizeResponse - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r AuthorizeSSHResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r AuthorizeSSHResponse) 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 AuthorizeSSHResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type ListUsersResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r ListUsersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListUsersResponse) 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 ListUsersResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type GetUserResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *NotFound - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r GetUserResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetUserResponse) 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 GetUserResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type AddUserSSHPublicKeyResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *SSHPublicKey - JSON403 *Forbidden - JSON404 *NotFound - JSON409 *Conflict - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r AddUserSSHPublicKeyResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r AddUserSSHPublicKeyResponse) 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 AddUserSSHPublicKeyResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -type DeleteUserSSHPublicKeyResponse struct { - Body []byte - HTTPResponse *http.Response - JSON403 *Forbidden - JSON404 *NotFound - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r DeleteUserSSHPublicKeyResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteUserSSHPublicKeyResponse) 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 DeleteUserSSHPublicKeyResponse) ContentType() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Header.Get("Content-Type") - } - return "" -} - -// ListAuditWithResponse request returning *ListAuditResponse -func (c *ClientWithResponses) ListAuditWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListAuditResponse, error) { - rsp, err := c.ListAudit(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseListAuditResponse(rsp) -} - -// AuthCLIConfigWithResponse request returning *AuthCLIConfigResponse -func (c *ClientWithResponses) AuthCLIConfigWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*AuthCLIConfigResponse, error) { - rsp, err := c.AuthCLIConfig(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseAuthCLIConfigResponse(rsp) -} - -// AuthSessionWithResponse request returning *AuthSessionResponse -func (c *ClientWithResponses) AuthSessionWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*AuthSessionResponse, error) { - rsp, err := c.AuthSession(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseAuthSessionResponse(rsp) -} - -// ListBakesWithResponse request returning *ListBakesResponse -func (c *ClientWithResponses) ListBakesWithResponse(ctx context.Context, params *ListBakesParams, reqEditors ...RequestEditorFn) (*ListBakesResponse, error) { - rsp, err := c.ListBakes(ctx, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseListBakesResponse(rsp) -} - -// RunBakeWithResponse request returning *RunBakeResponse -func (c *ClientWithResponses) RunBakeWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*RunBakeResponse, error) { - rsp, err := c.RunBake(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseRunBakeResponse(rsp) -} - -// ListForksWithResponse request returning *ListForksResponse -func (c *ClientWithResponses) ListForksWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListForksResponse, error) { - rsp, err := c.ListForks(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseListForksResponse(rsp) -} - -// GetForkWithResponse request returning *GetForkResponse -func (c *ClientWithResponses) GetForkWithResponse(ctx context.Context, id ForkID, reqEditors ...RequestEditorFn) (*GetForkResponse, error) { - rsp, err := c.GetFork(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetForkResponse(rsp) -} - -// HealthzWithResponse request returning *HealthzResponse -func (c *ClientWithResponses) HealthzWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*HealthzResponse, error) { - rsp, err := c.Healthz(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseHealthzResponse(rsp) -} - -// ListHookTemplatesWithResponse request returning *ListHookTemplatesResponse -func (c *ClientWithResponses) ListHookTemplatesWithResponse(ctx context.Context, params *ListHookTemplatesParams, reqEditors ...RequestEditorFn) (*ListHookTemplatesResponse, error) { - rsp, err := c.ListHookTemplates(ctx, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseListHookTemplatesResponse(rsp) -} - -// CreateHookTemplateWithBodyWithResponse request with arbitrary body returning *CreateHookTemplateResponse -func (c *ClientWithResponses) CreateHookTemplateWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateHookTemplateResponse, error) { - rsp, err := c.CreateHookTemplateWithBody(ctx, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateHookTemplateResponse(rsp) -} - -func (c *ClientWithResponses) CreateHookTemplateWithResponse(ctx context.Context, body CreateHookTemplateJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateHookTemplateResponse, error) { - rsp, err := c.CreateHookTemplate(ctx, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateHookTemplateResponse(rsp) -} - -// DeleteHookTemplateWithResponse request returning *DeleteHookTemplateResponse -func (c *ClientWithResponses) DeleteHookTemplateWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*DeleteHookTemplateResponse, error) { - rsp, err := c.DeleteHookTemplate(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteHookTemplateResponse(rsp) -} - -// GetHookTemplateWithResponse request returning *GetHookTemplateResponse -func (c *ClientWithResponses) GetHookTemplateWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*GetHookTemplateResponse, error) { - rsp, err := c.GetHookTemplate(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetHookTemplateResponse(rsp) -} - -// UpdateHookTemplateWithBodyWithResponse request with arbitrary body returning *UpdateHookTemplateResponse -func (c *ClientWithResponses) UpdateHookTemplateWithBodyWithResponse(ctx context.Context, name string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateHookTemplateResponse, error) { - rsp, err := c.UpdateHookTemplateWithBody(ctx, name, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateHookTemplateResponse(rsp) -} - -func (c *ClientWithResponses) UpdateHookTemplateWithResponse(ctx context.Context, name string, body UpdateHookTemplateJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateHookTemplateResponse, error) { - rsp, err := c.UpdateHookTemplate(ctx, name, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateHookTemplateResponse(rsp) -} - -// ListImagesWithResponse request returning *ListImagesResponse -func (c *ClientWithResponses) ListImagesWithResponse(ctx context.Context, params *ListImagesParams, reqEditors ...RequestEditorFn) (*ListImagesResponse, error) { - rsp, err := c.ListImages(ctx, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseListImagesResponse(rsp) -} - -// DeleteImageWithResponse request returning *DeleteImageResponse -func (c *ClientWithResponses) DeleteImageWithResponse(ctx context.Context, id ImageID, params *DeleteImageParams, reqEditors ...RequestEditorFn) (*DeleteImageResponse, error) { - rsp, err := c.DeleteImage(ctx, id, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteImageResponse(rsp) -} - -// GetImageWithResponse request returning *GetImageResponse -func (c *ClientWithResponses) GetImageWithResponse(ctx context.Context, id ImageID, reqEditors ...RequestEditorFn) (*GetImageResponse, error) { - rsp, err := c.GetImage(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetImageResponse(rsp) -} - -// DeactivateImageWithResponse request returning *DeactivateImageResponse -func (c *ClientWithResponses) DeactivateImageWithResponse(ctx context.Context, id ImageID, reqEditors ...RequestEditorFn) (*DeactivateImageResponse, error) { - rsp, err := c.DeactivateImage(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeactivateImageResponse(rsp) -} - -// ForkImageWithBodyWithResponse request with arbitrary body returning *ForkImageResponse -func (c *ClientWithResponses) ForkImageWithBodyWithResponse(ctx context.Context, id ImageID, params *ForkImageParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ForkImageResponse, error) { - rsp, err := c.ForkImageWithBody(ctx, id, params, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseForkImageResponse(rsp) -} - -func (c *ClientWithResponses) ForkImageWithResponse(ctx context.Context, id ImageID, params *ForkImageParams, body ForkImageJSONRequestBody, reqEditors ...RequestEditorFn) (*ForkImageResponse, error) { - rsp, err := c.ForkImage(ctx, id, params, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseForkImageResponse(rsp) -} - -// GetImageLineageWithResponse request returning *GetImageLineageResponse -func (c *ClientWithResponses) GetImageLineageWithResponse(ctx context.Context, id ImageID, reqEditors ...RequestEditorFn) (*GetImageLineageResponse, error) { - rsp, err := c.GetImageLineage(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetImageLineageResponse(rsp) -} - -// PromoteImageWithBodyWithResponse request with arbitrary body returning *PromoteImageResponse -func (c *ClientWithResponses) PromoteImageWithBodyWithResponse(ctx context.Context, id ImageID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PromoteImageResponse, error) { - rsp, err := c.PromoteImageWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParsePromoteImageResponse(rsp) -} - -func (c *ClientWithResponses) PromoteImageWithResponse(ctx context.Context, id ImageID, body PromoteImageJSONRequestBody, reqEditors ...RequestEditorFn) (*PromoteImageResponse, error) { - rsp, err := c.PromoteImage(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParsePromoteImageResponse(rsp) -} - -// GetImageRestoredByWithResponse request returning *GetImageRestoredByResponse -func (c *ClientWithResponses) GetImageRestoredByWithResponse(ctx context.Context, id ImageID, reqEditors ...RequestEditorFn) (*GetImageRestoredByResponse, error) { - rsp, err := c.GetImageRestoredBy(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetImageRestoredByResponse(rsp) -} - -// AuthorizeIngressWithBodyWithResponse request with arbitrary body returning *AuthorizeIngressResponse -func (c *ClientWithResponses) AuthorizeIngressWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AuthorizeIngressResponse, error) { - rsp, err := c.AuthorizeIngressWithBody(ctx, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseAuthorizeIngressResponse(rsp) -} - -func (c *ClientWithResponses) AuthorizeIngressWithResponse(ctx context.Context, body AuthorizeIngressJSONRequestBody, reqEditors ...RequestEditorFn) (*AuthorizeIngressResponse, error) { - rsp, err := c.AuthorizeIngress(ctx, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseAuthorizeIngressResponse(rsp) -} - -// ListSSHPublicKeysWithResponse request returning *ListSSHPublicKeysResponse -func (c *ClientWithResponses) ListSSHPublicKeysWithResponse(ctx context.Context, params *ListSSHPublicKeysParams, reqEditors ...RequestEditorFn) (*ListSSHPublicKeysResponse, error) { - rsp, err := c.ListSSHPublicKeys(ctx, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseListSSHPublicKeysResponse(rsp) -} - -// AddSSHPublicKeyWithBodyWithResponse request with arbitrary body returning *AddSSHPublicKeyResponse -func (c *ClientWithResponses) AddSSHPublicKeyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AddSSHPublicKeyResponse, error) { - rsp, err := c.AddSSHPublicKeyWithBody(ctx, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseAddSSHPublicKeyResponse(rsp) -} - -func (c *ClientWithResponses) AddSSHPublicKeyWithResponse(ctx context.Context, body AddSSHPublicKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*AddSSHPublicKeyResponse, error) { - rsp, err := c.AddSSHPublicKey(ctx, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseAddSSHPublicKeyResponse(rsp) -} - -// DeleteSSHPublicKeyWithResponse request returning *DeleteSSHPublicKeyResponse -func (c *ClientWithResponses) DeleteSSHPublicKeyWithResponse(ctx context.Context, id SSHPublicKeyID, reqEditors ...RequestEditorFn) (*DeleteSSHPublicKeyResponse, error) { - rsp, err := c.DeleteSSHPublicKey(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteSSHPublicKeyResponse(rsp) -} - -// MetaWithResponse request returning *MetaResponse -func (c *ClientWithResponses) MetaWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*MetaResponse, error) { - rsp, err := c.Meta(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseMetaResponse(rsp) -} - -// MetricsWithResponse request returning *MetricsResponse -func (c *ClientWithResponses) MetricsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*MetricsResponse, error) { - rsp, err := c.Metrics(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseMetricsResponse(rsp) -} - -// ListNodesWithResponse request returning *ListNodesResponse -func (c *ClientWithResponses) ListNodesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListNodesResponse, error) { - rsp, err := c.ListNodes(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseListNodesResponse(rsp) -} - -// GetNodeWithResponse request returning *GetNodeResponse -func (c *ClientWithResponses) GetNodeWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetNodeResponse, error) { - rsp, err := c.GetNode(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetNodeResponse(rsp) -} - -// OpenAPIYAMLWithResponse request returning *OpenAPIYAMLResponse -func (c *ClientWithResponses) OpenAPIYAMLWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*OpenAPIYAMLResponse, error) { - rsp, err := c.OpenAPIYAML(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseOpenAPIYAMLResponse(rsp) -} - -// ListOperationsWithResponse request returning *ListOperationsResponse -func (c *ClientWithResponses) ListOperationsWithResponse(ctx context.Context, params *ListOperationsParams, reqEditors ...RequestEditorFn) (*ListOperationsResponse, error) { - rsp, err := c.ListOperations(ctx, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseListOperationsResponse(rsp) -} - -// GetOperationWithResponse request returning *GetOperationResponse -func (c *ClientWithResponses) GetOperationWithResponse(ctx context.Context, id OperationID, reqEditors ...RequestEditorFn) (*GetOperationResponse, error) { - rsp, err := c.GetOperation(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetOperationResponse(rsp) -} - -// ReadyzWithResponse request returning *ReadyzResponse -func (c *ClientWithResponses) ReadyzWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ReadyzResponse, error) { - rsp, err := c.Readyz(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseReadyzResponse(rsp) -} - -// ListSandboxesWithResponse request returning *ListSandboxesResponse -func (c *ClientWithResponses) ListSandboxesWithResponse(ctx context.Context, params *ListSandboxesParams, reqEditors ...RequestEditorFn) (*ListSandboxesResponse, error) { - rsp, err := c.ListSandboxes(ctx, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseListSandboxesResponse(rsp) -} - -// CreateSandboxWithBodyWithResponse request with arbitrary body returning *CreateSandboxResponse -func (c *ClientWithResponses) CreateSandboxWithBodyWithResponse(ctx context.Context, params *CreateSandboxParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateSandboxResponse, error) { - rsp, err := c.CreateSandboxWithBody(ctx, params, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateSandboxResponse(rsp) -} - -func (c *ClientWithResponses) CreateSandboxWithResponse(ctx context.Context, params *CreateSandboxParams, body CreateSandboxJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateSandboxResponse, error) { - rsp, err := c.CreateSandbox(ctx, params, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateSandboxResponse(rsp) -} - -// DeleteSandboxWithResponse request returning *DeleteSandboxResponse -func (c *ClientWithResponses) DeleteSandboxWithResponse(ctx context.Context, id SandboxID, params *DeleteSandboxParams, reqEditors ...RequestEditorFn) (*DeleteSandboxResponse, error) { - rsp, err := c.DeleteSandbox(ctx, id, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteSandboxResponse(rsp) -} - -// GetSandboxWithResponse request returning *GetSandboxResponse -func (c *ClientWithResponses) GetSandboxWithResponse(ctx context.Context, id SandboxID, reqEditors ...RequestEditorFn) (*GetSandboxResponse, error) { - rsp, err := c.GetSandbox(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetSandboxResponse(rsp) -} - -// StreamExecSandboxWithResponse request returning *StreamExecSandboxResponse -func (c *ClientWithResponses) StreamExecSandboxWithResponse(ctx context.Context, id SandboxID, params *StreamExecSandboxParams, reqEditors ...RequestEditorFn) (*StreamExecSandboxResponse, error) { - rsp, err := c.StreamExecSandbox(ctx, id, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseStreamExecSandboxResponse(rsp) -} - -// ExecSandboxWithBodyWithResponse request with arbitrary body returning *ExecSandboxResponse -func (c *ClientWithResponses) ExecSandboxWithBodyWithResponse(ctx context.Context, id SandboxID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ExecSandboxResponse, error) { - rsp, err := c.ExecSandboxWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseExecSandboxResponse(rsp) -} - -func (c *ClientWithResponses) ExecSandboxWithResponse(ctx context.Context, id SandboxID, body ExecSandboxJSONRequestBody, reqEditors ...RequestEditorFn) (*ExecSandboxResponse, error) { - rsp, err := c.ExecSandbox(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseExecSandboxResponse(rsp) -} - -// ForkSandboxWithBodyWithResponse request with arbitrary body returning *ForkSandboxResponse -func (c *ClientWithResponses) ForkSandboxWithBodyWithResponse(ctx context.Context, id SandboxID, params *ForkSandboxParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ForkSandboxResponse, error) { - rsp, err := c.ForkSandboxWithBody(ctx, id, params, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseForkSandboxResponse(rsp) -} - -func (c *ClientWithResponses) ForkSandboxWithResponse(ctx context.Context, id SandboxID, params *ForkSandboxParams, body ForkSandboxJSONRequestBody, reqEditors ...RequestEditorFn) (*ForkSandboxResponse, error) { - rsp, err := c.ForkSandbox(ctx, id, params, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseForkSandboxResponse(rsp) -} - -// GetSandboxHookRunsWithResponse request returning *GetSandboxHookRunsResponse -func (c *ClientWithResponses) GetSandboxHookRunsWithResponse(ctx context.Context, id SandboxID, params *GetSandboxHookRunsParams, reqEditors ...RequestEditorFn) (*GetSandboxHookRunsResponse, error) { - rsp, err := c.GetSandboxHookRuns(ctx, id, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetSandboxHookRunsResponse(rsp) -} - -// GetSandboxHooksWithResponse request returning *GetSandboxHooksResponse -func (c *ClientWithResponses) GetSandboxHooksWithResponse(ctx context.Context, id SandboxID, params *GetSandboxHooksParams, reqEditors ...RequestEditorFn) (*GetSandboxHooksResponse, error) { - rsp, err := c.GetSandboxHooks(ctx, id, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetSandboxHooksResponse(rsp) -} - -// GetSandboxImagesWithResponse request returning *GetSandboxImagesResponse -func (c *ClientWithResponses) GetSandboxImagesWithResponse(ctx context.Context, id SandboxID, reqEditors ...RequestEditorFn) (*GetSandboxImagesResponse, error) { - rsp, err := c.GetSandboxImages(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetSandboxImagesResponse(rsp) -} - -// LeaseSandboxWithBodyWithResponse request with arbitrary body returning *LeaseSandboxResponse -func (c *ClientWithResponses) LeaseSandboxWithBodyWithResponse(ctx context.Context, id SandboxID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*LeaseSandboxResponse, error) { - rsp, err := c.LeaseSandboxWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseLeaseSandboxResponse(rsp) -} - -func (c *ClientWithResponses) LeaseSandboxWithResponse(ctx context.Context, id SandboxID, body LeaseSandboxJSONRequestBody, reqEditors ...RequestEditorFn) (*LeaseSandboxResponse, error) { - rsp, err := c.LeaseSandbox(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseLeaseSandboxResponse(rsp) -} - -// GetSandboxLineageWithResponse request returning *GetSandboxLineageResponse -func (c *ClientWithResponses) GetSandboxLineageWithResponse(ctx context.Context, id SandboxID, reqEditors ...RequestEditorFn) (*GetSandboxLineageResponse, error) { - rsp, err := c.GetSandboxLineage(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetSandboxLineageResponse(rsp) -} - -// GetSandboxLogsWithResponse request returning *GetSandboxLogsResponse -func (c *ClientWithResponses) GetSandboxLogsWithResponse(ctx context.Context, id SandboxID, params *GetSandboxLogsParams, reqEditors ...RequestEditorFn) (*GetSandboxLogsResponse, error) { - rsp, err := c.GetSandboxLogs(ctx, id, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetSandboxLogsResponse(rsp) -} - -// GetSandboxMetricsWithResponse request returning *GetSandboxMetricsResponse -func (c *ClientWithResponses) GetSandboxMetricsWithResponse(ctx context.Context, id SandboxID, params *GetSandboxMetricsParams, reqEditors ...RequestEditorFn) (*GetSandboxMetricsResponse, error) { - rsp, err := c.GetSandboxMetrics(ctx, id, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetSandboxMetricsResponse(rsp) -} - -// GetSandboxOperationsWithResponse request returning *GetSandboxOperationsResponse -func (c *ClientWithResponses) GetSandboxOperationsWithResponse(ctx context.Context, id SandboxID, reqEditors ...RequestEditorFn) (*GetSandboxOperationsResponse, error) { - rsp, err := c.GetSandboxOperations(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetSandboxOperationsResponse(rsp) -} - -// PauseSandboxWithResponse request returning *PauseSandboxResponse -func (c *ClientWithResponses) PauseSandboxWithResponse(ctx context.Context, id SandboxID, params *PauseSandboxParams, reqEditors ...RequestEditorFn) (*PauseSandboxResponse, error) { - rsp, err := c.PauseSandbox(ctx, id, params, reqEditors...) - if err != nil { - return nil, err - } - return ParsePauseSandboxResponse(rsp) -} - -// ExposePortWithBodyWithResponse request with arbitrary body returning *ExposePortResponse -func (c *ClientWithResponses) ExposePortWithBodyWithResponse(ctx context.Context, id SandboxID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ExposePortResponse, error) { - rsp, err := c.ExposePortWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseExposePortResponse(rsp) -} - -func (c *ClientWithResponses) ExposePortWithResponse(ctx context.Context, id SandboxID, body ExposePortJSONRequestBody, reqEditors ...RequestEditorFn) (*ExposePortResponse, error) { - rsp, err := c.ExposePort(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseExposePortResponse(rsp) -} - -// UnexposePortWithResponse request returning *UnexposePortResponse -func (c *ClientWithResponses) UnexposePortWithResponse(ctx context.Context, id SandboxID, port Port, reqEditors ...RequestEditorFn) (*UnexposePortResponse, error) { - rsp, err := c.UnexposePort(ctx, id, port, reqEditors...) - if err != nil { - return nil, err - } - return ParseUnexposePortResponse(rsp) -} - -// ResumeSandboxWithResponse request returning *ResumeSandboxResponse -func (c *ClientWithResponses) ResumeSandboxWithResponse(ctx context.Context, id SandboxID, params *ResumeSandboxParams, reqEditors ...RequestEditorFn) (*ResumeSandboxResponse, error) { - rsp, err := c.ResumeSandbox(ctx, id, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseResumeSandboxResponse(rsp) -} - -// SnapshotSandboxWithBodyWithResponse request with arbitrary body returning *SnapshotSandboxResponse -func (c *ClientWithResponses) SnapshotSandboxWithBodyWithResponse(ctx context.Context, id SandboxID, params *SnapshotSandboxParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SnapshotSandboxResponse, error) { - rsp, err := c.SnapshotSandboxWithBody(ctx, id, params, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseSnapshotSandboxResponse(rsp) -} - -func (c *ClientWithResponses) SnapshotSandboxWithResponse(ctx context.Context, id SandboxID, params *SnapshotSandboxParams, body SnapshotSandboxJSONRequestBody, reqEditors ...RequestEditorFn) (*SnapshotSandboxResponse, error) { - rsp, err := c.SnapshotSandbox(ctx, id, params, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseSnapshotSandboxResponse(rsp) -} - -// PrepareSandboxSSHWithBodyWithResponse request with arbitrary body returning *PrepareSandboxSSHResponse -func (c *ClientWithResponses) PrepareSandboxSSHWithBodyWithResponse(ctx context.Context, id SandboxID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PrepareSandboxSSHResponse, error) { - rsp, err := c.PrepareSandboxSSHWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParsePrepareSandboxSSHResponse(rsp) -} - -func (c *ClientWithResponses) PrepareSandboxSSHWithResponse(ctx context.Context, id SandboxID, body PrepareSandboxSSHJSONRequestBody, reqEditors ...RequestEditorFn) (*PrepareSandboxSSHResponse, error) { - rsp, err := c.PrepareSandboxSSH(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParsePrepareSandboxSSHResponse(rsp) -} - -// StartSandboxWithResponse request returning *StartSandboxResponse -func (c *ClientWithResponses) StartSandboxWithResponse(ctx context.Context, id SandboxID, params *StartSandboxParams, reqEditors ...RequestEditorFn) (*StartSandboxResponse, error) { - rsp, err := c.StartSandbox(ctx, id, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseStartSandboxResponse(rsp) -} - -// StopSandboxWithResponse request returning *StopSandboxResponse -func (c *ClientWithResponses) StopSandboxWithResponse(ctx context.Context, id SandboxID, params *StopSandboxParams, reqEditors ...RequestEditorFn) (*StopSandboxResponse, error) { - rsp, err := c.StopSandbox(ctx, id, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseStopSandboxResponse(rsp) -} - -// TunnelSandboxWithResponse request returning *TunnelSandboxResponse -func (c *ClientWithResponses) TunnelSandboxWithResponse(ctx context.Context, id SandboxID, port int, reqEditors ...RequestEditorFn) (*TunnelSandboxResponse, error) { - rsp, err := c.TunnelSandbox(ctx, id, port, reqEditors...) - if err != nil { - return nil, err - } - return ParseTunnelSandboxResponse(rsp) -} - -// AuthorizeSSHWithBodyWithResponse request with arbitrary body returning *AuthorizeSSHResponse -func (c *ClientWithResponses) AuthorizeSSHWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AuthorizeSSHResponse, error) { - rsp, err := c.AuthorizeSSHWithBody(ctx, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseAuthorizeSSHResponse(rsp) -} - -func (c *ClientWithResponses) AuthorizeSSHWithResponse(ctx context.Context, body AuthorizeSSHJSONRequestBody, reqEditors ...RequestEditorFn) (*AuthorizeSSHResponse, error) { - rsp, err := c.AuthorizeSSH(ctx, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseAuthorizeSSHResponse(rsp) -} - -// ListUsersWithResponse request returning *ListUsersResponse -func (c *ClientWithResponses) ListUsersWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListUsersResponse, error) { - rsp, err := c.ListUsers(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseListUsersResponse(rsp) -} - -// GetUserWithResponse request returning *GetUserResponse -func (c *ClientWithResponses) GetUserWithResponse(ctx context.Context, handle string, reqEditors ...RequestEditorFn) (*GetUserResponse, error) { - rsp, err := c.GetUser(ctx, handle, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetUserResponse(rsp) -} - -// AddUserSSHPublicKeyWithBodyWithResponse request with arbitrary body returning *AddUserSSHPublicKeyResponse -func (c *ClientWithResponses) AddUserSSHPublicKeyWithBodyWithResponse(ctx context.Context, handle string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AddUserSSHPublicKeyResponse, error) { - rsp, err := c.AddUserSSHPublicKeyWithBody(ctx, handle, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseAddUserSSHPublicKeyResponse(rsp) -} - -func (c *ClientWithResponses) AddUserSSHPublicKeyWithResponse(ctx context.Context, handle string, body AddUserSSHPublicKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*AddUserSSHPublicKeyResponse, error) { - rsp, err := c.AddUserSSHPublicKey(ctx, handle, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseAddUserSSHPublicKeyResponse(rsp) -} - -// DeleteUserSSHPublicKeyWithResponse request returning *DeleteUserSSHPublicKeyResponse -func (c *ClientWithResponses) DeleteUserSSHPublicKeyWithResponse(ctx context.Context, handle string, id SSHPublicKeyID, reqEditors ...RequestEditorFn) (*DeleteUserSSHPublicKeyResponse, error) { - rsp, err := c.DeleteUserSSHPublicKey(ctx, handle, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteUserSSHPublicKeyResponse(rsp) -} - -// ParseListAuditResponse parses an HTTP response from a ListAuditWithResponse call -func ParseListAuditResponse(rsp *http.Response) (*ListAuditResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListAuditResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseAuthCLIConfigResponse parses an HTTP response from a AuthCLIConfigWithResponse call -func ParseAuthCLIConfigResponse(rsp *http.Response) (*AuthCLIConfigResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &AuthCLIConfigResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest AuthCLIConfig - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseAuthSessionResponse parses an HTTP response from a AuthSessionWithResponse call -func ParseAuthSessionResponse(rsp *http.Response) (*AuthSessionResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &AuthSessionResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest AuthSession - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseListBakesResponse parses an HTTP response from a ListBakesWithResponse call -func ParseListBakesResponse(rsp *http.Response) (*ListBakesResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListBakesResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest BakeStatusList - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseRunBakeResponse parses an HTTP response from a RunBakeWithResponse call -func ParseRunBakeResponse(rsp *http.Response) (*RunBakeResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &RunBakeResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 202: - var dest ScheduledResponse - 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 == 404: - var dest NotFound - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &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.JSON409 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseListForksResponse parses an HTTP response from a ListForksWithResponse call -func ParseListForksResponse(rsp *http.Response) (*ListForksResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListForksResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest []Fork - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseGetForkResponse parses an HTTP response from a GetForkWithResponse call -func ParseGetForkResponse(rsp *http.Response) (*GetForkResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetForkResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Fork - 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 == 404: - var dest NotFound - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseHealthzResponse parses an HTTP response from a HealthzWithResponse call -func ParseHealthzResponse(rsp *http.Response) (*HealthzResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &HealthzResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseListHookTemplatesResponse parses an HTTP response from a ListHookTemplatesWithResponse call -func ParseListHookTemplatesResponse(rsp *http.Response) (*ListHookTemplatesResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListHookTemplatesResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest HookTemplateList - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseCreateHookTemplateResponse parses an HTTP response from a CreateHookTemplateWithResponse call -func ParseCreateHookTemplateResponse(rsp *http.Response) (*CreateHookTemplateResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateHookTemplateResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest HookTemplate - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseDeleteHookTemplateResponse parses an HTTP response from a DeleteHookTemplateWithResponse call -func ParseDeleteHookTemplateResponse(rsp *http.Response) (*DeleteHookTemplateResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteHookTemplateResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseGetHookTemplateResponse parses an HTTP response from a GetHookTemplateWithResponse call -func ParseGetHookTemplateResponse(rsp *http.Response) (*GetHookTemplateResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetHookTemplateResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest HookTemplate - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseUpdateHookTemplateResponse parses an HTTP response from a UpdateHookTemplateWithResponse call -func ParseUpdateHookTemplateResponse(rsp *http.Response) (*UpdateHookTemplateResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpdateHookTemplateResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest HookTemplate - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseListImagesResponse parses an HTTP response from a ListImagesWithResponse call -func ParseListImagesResponse(rsp *http.Response) (*ListImagesResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListImagesResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest ImageList - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseDeleteImageResponse parses an HTTP response from a DeleteImageWithResponse call -func ParseDeleteImageResponse(rsp *http.Response) (*DeleteImageResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteImageResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 202: - var dest AcceptedResponse - 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 == 409: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON409 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseGetImageResponse parses an HTTP response from a GetImageWithResponse call -func ParseGetImageResponse(rsp *http.Response) (*GetImageResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetImageResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Image - 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 == 404: - var dest NotFound - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: - var dest InternalError - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON500 = &dest - - } - - return response, nil -} - -// ParseDeactivateImageResponse parses an HTTP response from a DeactivateImageWithResponse call -func ParseDeactivateImageResponse(rsp *http.Response) (*DeactivateImageResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeactivateImageResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - 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.JSON404 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseForkImageResponse parses an HTTP response from a ForkImageWithResponse call -func ParseForkImageResponse(rsp *http.Response) (*ForkImageResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ForkImageResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 202: - var dest ForkAccepted - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON202 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseGetImageLineageResponse parses an HTTP response from a GetImageLineageWithResponse call -func ParseGetImageLineageResponse(rsp *http.Response) (*GetImageLineageResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetImageLineageResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest LineageResponse - 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 == 404: - var dest NotFound - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParsePromoteImageResponse parses an HTTP response from a PromoteImageWithResponse call -func ParsePromoteImageResponse(rsp *http.Response) (*PromoteImageResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &PromoteImageResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest Image - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseGetImageRestoredByResponse parses an HTTP response from a GetImageRestoredByWithResponse call -func ParseGetImageRestoredByResponse(rsp *http.Response) (*GetImageRestoredByResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetImageRestoredByResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - 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.JSON404 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseAuthorizeIngressResponse parses an HTTP response from a AuthorizeIngressWithResponse call -func ParseAuthorizeIngressResponse(rsp *http.Response) (*AuthorizeIngressResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &AuthorizeIngressResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest IngressAuthorizeResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseListSSHPublicKeysResponse parses an HTTP response from a ListSSHPublicKeysWithResponse call -func ParseListSSHPublicKeysResponse(rsp *http.Response) (*ListSSHPublicKeysResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListSSHPublicKeysResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest SSHPublicKeyList - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseAddSSHPublicKeyResponse parses an HTTP response from a AddSSHPublicKeyWithResponse call -func ParseAddSSHPublicKeyResponse(rsp *http.Response) (*AddSSHPublicKeyResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &AddSSHPublicKeyResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest SSHPublicKey - 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.JSON400 = &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.JSON409 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: - var dest InternalError - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON500 = &dest - - } - - return response, nil -} - -// ParseDeleteSSHPublicKeyResponse parses an HTTP response from a DeleteSSHPublicKeyWithResponse call -func ParseDeleteSSHPublicKeyResponse(rsp *http.Response) (*DeleteSSHPublicKeyResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteSSHPublicKeyResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - 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.JSON404 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: - var dest InternalError - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON500 = &dest - - } - - return response, nil -} - -// ParseMetaResponse parses an HTTP response from a MetaWithResponse call -func ParseMetaResponse(rsp *http.Response) (*MetaResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &MetaResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseMetricsResponse parses an HTTP response from a MetricsWithResponse call -func ParseMetricsResponse(rsp *http.Response) (*MetricsResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &MetricsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - return response, nil -} - -// ParseListNodesResponse parses an HTTP response from a ListNodesWithResponse call -func ParseListNodesResponse(rsp *http.Response) (*ListNodesResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListNodesResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseGetNodeResponse parses an HTTP response from a GetNodeWithResponse call -func ParseGetNodeResponse(rsp *http.Response) (*GetNodeResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetNodeResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - 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.JSON404 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseOpenAPIYAMLResponse parses an HTTP response from a OpenAPIYAMLWithResponse call -func ParseOpenAPIYAMLResponse(rsp *http.Response) (*OpenAPIYAMLResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &OpenAPIYAMLResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "yaml") && rsp.StatusCode == 200: - var dest string - if err := yaml.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.YAML200 = &dest - - } - - return response, nil -} - -// ParseListOperationsResponse parses an HTTP response from a ListOperationsWithResponse call -func ParseListOperationsResponse(rsp *http.Response) (*ListOperationsResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListOperationsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest OperationList - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseGetOperationResponse parses an HTTP response from a GetOperationWithResponse call -func ParseGetOperationResponse(rsp *http.Response) (*GetOperationResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetOperationResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - 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 == 404: - var dest NotFound - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: - var dest InternalError - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON500 = &dest - - } - - return response, nil -} - -// ParseReadyzResponse parses an HTTP response from a ReadyzWithResponse call -func ParseReadyzResponse(rsp *http.Response) (*ReadyzResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ReadyzResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 503: - var dest NotReady - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON503 = &dest - - } - - return response, nil -} - -// ParseListSandboxesResponse parses an HTTP response from a ListSandboxesWithResponse call -func ParseListSandboxesResponse(rsp *http.Response) (*ListSandboxesResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListSandboxesResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest SandboxList - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseCreateSandboxResponse parses an HTTP response from a CreateSandboxWithResponse call -func ParseCreateSandboxResponse(rsp *http.Response) (*CreateSandboxResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateSandboxResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 202: - var dest AcceptedResponse - 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.JSON400 = &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.JSON409 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: - var dest UnprocessableEntity - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON422 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: - var dest InternalError - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON500 = &dest - - } - - return response, nil -} - -// ParseDeleteSandboxResponse parses an HTTP response from a DeleteSandboxWithResponse call -func ParseDeleteSandboxResponse(rsp *http.Response) (*DeleteSandboxResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteSandboxResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 202: - var dest AcceptedResponse - 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.JSON400 = &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.JSON409 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: - var dest InternalError - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON500 = &dest - - } - - return response, nil -} - -// ParseGetSandboxResponse parses an HTTP response from a GetSandboxWithResponse call -func ParseGetSandboxResponse(rsp *http.Response) (*GetSandboxResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetSandboxResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Sandbox - 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 == 404: - var dest NotFound - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: - var dest InternalError - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON500 = &dest - - } - - return response, nil -} - -// ParseStreamExecSandboxResponse parses an HTTP response from a StreamExecSandboxWithResponse call -func ParseStreamExecSandboxResponse(rsp *http.Response) (*StreamExecSandboxResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &StreamExecSandboxResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - 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.JSON400 = &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.JSON409 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseExecSandboxResponse parses an HTTP response from a ExecSandboxWithResponse call -func ParseExecSandboxResponse(rsp *http.Response) (*ExecSandboxResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ExecSandboxResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest ExecSandboxResult - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseForkSandboxResponse parses an HTTP response from a ForkSandboxWithResponse call -func ParseForkSandboxResponse(rsp *http.Response) (*ForkSandboxResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ForkSandboxResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 202: - var dest ForkAccepted - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON202 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseGetSandboxHookRunsResponse parses an HTTP response from a GetSandboxHookRunsWithResponse call -func ParseGetSandboxHookRunsResponse(rsp *http.Response) (*GetSandboxHookRunsResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetSandboxHookRunsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest HookRunList - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseGetSandboxHooksResponse parses an HTTP response from a GetSandboxHooksWithResponse call -func ParseGetSandboxHooksResponse(rsp *http.Response) (*GetSandboxHooksResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetSandboxHooksResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest HookSummaryList - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseGetSandboxImagesResponse parses an HTTP response from a GetSandboxImagesWithResponse call -func ParseGetSandboxImagesResponse(rsp *http.Response) (*GetSandboxImagesResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetSandboxImagesResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - 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.JSON404 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseLeaseSandboxResponse parses an HTTP response from a LeaseSandboxWithResponse call -func ParseLeaseSandboxResponse(rsp *http.Response) (*LeaseSandboxResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &LeaseSandboxResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest LeaseResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseGetSandboxLineageResponse parses an HTTP response from a GetSandboxLineageWithResponse call -func ParseGetSandboxLineageResponse(rsp *http.Response) (*GetSandboxLineageResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetSandboxLineageResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest LineageResponse - 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 == 404: - var dest NotFound - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseGetSandboxLogsResponse parses an HTTP response from a GetSandboxLogsWithResponse call -func ParseGetSandboxLogsResponse(rsp *http.Response) (*GetSandboxLogsResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetSandboxLogsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest LogsResponse - 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 == 404: - var dest NotFound - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseGetSandboxMetricsResponse parses an HTTP response from a GetSandboxMetricsWithResponse call -func ParseGetSandboxMetricsResponse(rsp *http.Response) (*GetSandboxMetricsResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetSandboxMetricsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest SandboxMetricsResponse - 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.JSON400 = &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.JSON404 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseGetSandboxOperationsResponse parses an HTTP response from a GetSandboxOperationsWithResponse call -func ParseGetSandboxOperationsResponse(rsp *http.Response) (*GetSandboxOperationsResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetSandboxOperationsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - 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.JSON404 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParsePauseSandboxResponse parses an HTTP response from a PauseSandboxWithResponse call -func ParsePauseSandboxResponse(rsp *http.Response) (*PauseSandboxResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &PauseSandboxResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 202: - var dest AcceptedResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON202 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseExposePortResponse parses an HTTP response from a ExposePortWithResponse call -func ParseExposePortResponse(rsp *http.Response) (*ExposePortResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ExposePortResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest ExposedPort - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseUnexposePortResponse parses an HTTP response from a UnexposePortWithResponse call -func ParseUnexposePortResponse(rsp *http.Response) (*UnexposePortResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UnexposePortResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseResumeSandboxResponse parses an HTTP response from a ResumeSandboxWithResponse call -func ParseResumeSandboxResponse(rsp *http.Response) (*ResumeSandboxResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ResumeSandboxResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 202: - var dest AcceptedResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON202 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseSnapshotSandboxResponse parses an HTTP response from a SnapshotSandboxWithResponse call -func ParseSnapshotSandboxResponse(rsp *http.Response) (*SnapshotSandboxResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &SnapshotSandboxResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 202: - var dest AcceptedResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON202 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParsePrepareSandboxSSHResponse parses an HTTP response from a PrepareSandboxSSHWithResponse call -func ParsePrepareSandboxSSHResponse(rsp *http.Response) (*PrepareSandboxSSHResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &PrepareSandboxSSHResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest PrepareSandboxSSHResult - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseStartSandboxResponse parses an HTTP response from a StartSandboxWithResponse call -func ParseStartSandboxResponse(rsp *http.Response) (*StartSandboxResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &StartSandboxResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 202: - var dest AcceptedResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON202 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseStopSandboxResponse parses an HTTP response from a StopSandboxWithResponse call -func ParseStopSandboxResponse(rsp *http.Response) (*StopSandboxResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &StopSandboxResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 202: - var dest AcceptedResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON202 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseTunnelSandboxResponse parses an HTTP response from a TunnelSandboxWithResponse call -func ParseTunnelSandboxResponse(rsp *http.Response) (*TunnelSandboxResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &TunnelSandboxResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - 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.JSON400 = &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.JSON409 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseAuthorizeSSHResponse parses an HTTP response from a AuthorizeSSHWithResponse call -func ParseAuthorizeSSHResponse(rsp *http.Response) (*AuthorizeSSHResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &AuthorizeSSHResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest SSHAuthorizeResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseListUsersResponse parses an HTTP response from a ListUsersWithResponse call -func ParseListUsersResponse(rsp *http.Response) (*ListUsersResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListUsersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseGetUserResponse parses an HTTP response from a GetUserWithResponse call -func ParseGetUserResponse(rsp *http.Response) (*GetUserResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetUserResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - 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.JSON404 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseAddUserSSHPublicKeyResponse parses an HTTP response from a AddUserSSHPublicKeyWithResponse call -func ParseAddUserSSHPublicKeyResponse(rsp *http.Response) (*AddUserSSHPublicKeyResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &AddUserSSHPublicKeyResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest SSHPublicKey - 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 == 403: - var dest Forbidden - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON403 = &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.JSON404 = &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.JSON409 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} - -// ParseDeleteUserSSHPublicKeyResponse parses an HTTP response from a DeleteUserSSHPublicKeyWithResponse call -func ParseDeleteUserSSHPublicKeyResponse(rsp *http.Response) (*DeleteUserSSHPublicKeyResponse, error) { - bodyBytes, err := io.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteUserSSHPublicKeyResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - 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.JSON403 = &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.JSON404 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - } - - return response, nil -} diff --git a/pkg/compute/compute.go b/pkg/compute/compute.go index 205aa07f..b2aa04ee 100644 --- a/pkg/compute/compute.go +++ b/pkg/compute/compute.go @@ -1,12 +1,176 @@ -// Package compute provides a typed Go client and models generated from the -// compute service's OpenAPI 3 specification. +// Package compute provides a runtime-discovered interface to the compute +// service. The service publishes an OpenAPI 3 document at SpecPath; ParseSpec +// distills it into an operation index mapping public operation names to HTTP +// requests, so the full API surface is available without compiled-in bindings +// and new upstream operations need no panda change. package compute -import _ "embed" +import ( + "fmt" + "sort" + "strings" + "unicode" -//go:generate go tool oapi-codegen -config codegen.yaml openapi.yaml + "github.com/getkin/kin-openapi/openapi3" +) -// OpenAPIYAML is the checked-in OpenAPI 3 specification for the compute service. -// -//go:embed openapi.yaml -var OpenAPIYAML []byte +// SpecPath is the well-known route where the compute service serves its +// OpenAPI 3 document. +const SpecPath = "/v1/openapi.yaml" + +// Operation is one indexed API operation. Only structural fields are kept: +// free-text document content (titles, descriptions, summaries) is never +// retained, so nothing service-specific can surface to callers. +type Operation struct { + // Name is the public snake_case operation name derived from the + // document's operationId, e.g. createSandbox -> create_sandbox. + Name string + // ID is the operationId as declared by the service. + ID string + Method string + // Path is the upstream route template with {param} placeholders. + Path string + PathParams []string + QueryParams []string + HasBody bool + // RequiredBody lists top-level body fields the document marks required. + RequiredBody []string +} + +// Index resolves public operation names to operations. +type Index struct { + ops map[string]Operation +} + +// legacyNames maps operation names panda published before they were derived +// from the interface document to their canonical derived names. +var legacyNames = map[string]string{ + "list_ssh_keys": "list_ssh_public_keys", + "add_ssh_key": "add_ssh_public_key", + "delete_ssh_key": "delete_ssh_public_key", +} + +// ParseSpec builds an operation index from an OpenAPI 3 document. +func ParseSpec(data []byte) (*Index, error) { + doc, err := openapi3.NewLoader().LoadFromData(data) + if err != nil { + return nil, fmt.Errorf("parsing compute interface document: %w", err) + } + + if doc.Paths == nil || doc.Paths.Len() == 0 { + return nil, fmt.Errorf("compute interface document declares no paths") + } + + ops := make(map[string]Operation) + + for path, item := range doc.Paths.Map() { + for method, op := range item.Operations() { + if op == nil || op.OperationID == "" { + continue + } + + entry := Operation{ + Name: snakeCase(op.OperationID), + ID: op.OperationID, + Method: method, + Path: path, + } + + params := make(openapi3.Parameters, 0, len(item.Parameters)+len(op.Parameters)) + params = append(params, item.Parameters...) + params = append(params, op.Parameters...) + + for _, ref := range params { + if ref == nil || ref.Value == nil { + continue + } + + switch param := ref.Value; param.In { + case openapi3.ParameterInPath: + entry.PathParams = append(entry.PathParams, param.Name) + case openapi3.ParameterInQuery: + entry.QueryParams = append(entry.QueryParams, param.Name) + } + } + + if body := op.RequestBody; body != nil && body.Value != nil { + entry.HasBody = true + + if media := body.Value.Content.Get("application/json"); media != nil && + media.Schema != nil && media.Schema.Value != nil { + entry.RequiredBody = append(entry.RequiredBody, media.Schema.Value.Required...) + } + } + + ops[entry.Name] = entry + } + } + + return &Index{ops: ops}, nil +} + +// Lookup resolves a public operation name, accepting legacy aliases. +func (i *Index) Lookup(name string) (Operation, bool) { + if canonical, ok := legacyNames[name]; ok { + name = canonical + } + + op, ok := i.ops[name] + + return op, ok +} + +// Operations returns the indexed operations sorted by name. +func (i *Index) Operations() []Operation { + out := make([]Operation, 0, len(i.ops)) + for _, op := range i.ops { + out = append(out, op) + } + + sort.Slice(out, func(a, b int) bool { return out[a].Name < out[b].Name }) + + return out +} + +// Names returns the sorted public operation names. +func (i *Index) Names() []string { + names := make([]string, 0, len(i.ops)) + for name := range i.ops { + names = append(names, name) + } + + sort.Strings(names) + + return names +} + +// snakeCase converts an operationId to its public snake_case name, keeping +// acronym runs intact: listSSHPublicKeys -> list_ssh_public_keys. +func snakeCase(s string) string { + runes := []rune(s) + + var b strings.Builder + + b.Grow(len(runes) + 4) + + for i, r := range runes { + if !unicode.IsUpper(r) { + b.WriteRune(r) + + continue + } + + if i > 0 { + prevLower := unicode.IsLower(runes[i-1]) || unicode.IsDigit(runes[i-1]) + acronymEnd := unicode.IsUpper(runes[i-1]) && i+1 < len(runes) && unicode.IsLower(runes[i+1]) + + if prevLower || acronymEnd { + b.WriteByte('_') + } + } + + b.WriteRune(unicode.ToLower(r)) + } + + return b.String() +} diff --git a/pkg/compute/compute_test.go b/pkg/compute/compute_test.go index b8cb3995..c3fbc456 100644 --- a/pkg/compute/compute_test.go +++ b/pkg/compute/compute_test.go @@ -1,83 +1,282 @@ package compute import ( + "encoding/json" + "errors" "strings" "testing" - "github.com/getkin/kin-openapi/openapi3" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) -// TestOpenAPISpecParses ensures the embedded spec is a valid OpenAPI 3 document -// the generated client was built from. -func TestOpenAPISpecParses(t *testing.T) { - t.Parallel() +// testSpec is a stand-in interface document. Its free-text fields carry the +// brandmark-xyzzy sentinel so tests can prove no document free text is +// retained in the index. +const testSpec = ` +openapi: 3.0.3 +info: + title: Brandmark-Xyzzy Fabric API + description: brandmark-xyzzy internal control plane. + version: v1 +paths: + /v1/widgets: + get: + operationId: listWidgets + description: brandmark-xyzzy widget listing. + parameters: + - $ref: '#/components/parameters/Limit' + - name: filter + in: query + schema: + type: array + items: + type: string + responses: + '200': + description: OK + post: + operationId: createWidget + parameters: + - name: Idempotency-Key + in: header + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateWidgetRequest' + responses: + '202': + description: Accepted + /v1/widgets/{id}: + parameters: + - name: id + in: path + required: true + schema: + type: string + get: + operationId: getWidget + responses: + '200': + description: OK + delete: + operationId: deleteWidget + parameters: + - name: retain + in: query + schema: + type: boolean + responses: + '204': + description: Removed + /v1/me/ssh-keys: + get: + operationId: listSSHPublicKeys + responses: + '200': + description: OK +components: + parameters: + Limit: + name: limit + in: query + schema: + type: integer + schemas: + CreateWidgetRequest: + type: object + required: [name] + properties: + name: + type: string + note: + type: string +` - require.NotEmpty(t, OpenAPIYAML) +func testIndex(t *testing.T) *Index { + t.Helper() - spec, err := openapi3.NewLoader().LoadFromData(OpenAPIYAML) + index, err := ParseSpec([]byte(testSpec)) require.NoError(t, err) - require.NoError(t, spec.Validate(t.Context())) - assert.Equal(t, "v1", spec.Info.Version) + return index } -// TestOpenAPISpecHasNoUpstreamBranding guards against the upstream service name -// leaking back into the public spec when it is re-copied and regenerated. The -// compute spec must stay neutral. -func TestOpenAPISpecHasNoUpstreamBranding(t *testing.T) { +func TestParseSpecIndexesOperations(t *testing.T) { t.Parallel() - assert.NotContains(t, strings.ToLower(string(OpenAPIYAML)), "farplane", - "the compute OpenAPI spec must not reference the upstream service by name") + index := testIndex(t) + + assert.Equal(t, []string{ + "create_widget", "delete_widget", "get_widget", "list_ssh_public_keys", "list_widgets", + }, index.Names()) + + op, ok := index.Lookup("create_widget") + require.True(t, ok) + assert.Equal(t, "createWidget", op.ID) + assert.Equal(t, "POST", op.Method) + assert.Equal(t, "/v1/widgets", op.Path) + assert.True(t, op.HasBody) + assert.Equal(t, []string{"name"}, op.RequiredBody) + + op, ok = index.Lookup("delete_widget") + require.True(t, ok) + assert.Equal(t, []string{"id"}, op.PathParams) + assert.Equal(t, []string{"retain"}, op.QueryParams) + assert.False(t, op.HasBody) } -// TestOpenAPISpecRoutesAreVersioned anchors the /v1 path prefix the server -// operations rely on when forwarding through the proxy. -func TestOpenAPISpecRoutesAreVersioned(t *testing.T) { +func TestParseSpecRejectsUnusableDocuments(t *testing.T) { t.Parallel() - spec, err := openapi3.NewLoader().LoadFromData(OpenAPIYAML) - require.NoError(t, err) + _, err := ParseSpec([]byte("!! not yaml")) + assert.Error(t, err) - for path := range spec.Paths.Map() { - assert.True(t, strings.HasPrefix(path, "/v1/"), - "compute spec path %q is not under /v1", path) - } + _, err = ParseSpec([]byte("openapi: 3.0.3\ninfo:\n title: x\n version: v1\npaths: {}\n")) + assert.ErrorContains(t, err, "no paths") } -// TestOpenAPISpecHasExpectedOperations pins the operationIds the compute server -// operations depend on. If the spec drops one on a re-copy, the generated -// client method disappears and the server stops compiling; this test surfaces -// the cause directly. -func TestOpenAPISpecHasExpectedOperations(t *testing.T) { +// TestIndexRetainsNoFreeText proves the neutrality invariant: nothing from +// the document's free-text fields (titles, descriptions) survives into the +// index, so upstream branding cannot surface to callers. +func TestIndexRetainsNoFreeText(t *testing.T) { t.Parallel() - spec, err := openapi3.NewLoader().LoadFromData(OpenAPIYAML) + index := testIndex(t) + + serialized, err := json.Marshal(index.Operations()) require.NoError(t, err) - want := []string{ - "listSandboxes", "createSandbox", "getSandbox", "deleteSandbox", - "stopSandbox", "startSandbox", "snapshotSandbox", "leaseSandbox", - "listImages", "getImage", "deleteImage", "deactivateImage", - "forkSandbox", "forkImage", "listForks", "getFork", - "promoteImage", "getImageRestoredBy", "getImageLineage", "getSandboxImages", - "listBakes", "runBake", "exposePort", "unexposePort", - "listOperations", "getOperation", - "listSSHPublicKeys", "addSSHPublicKey", "deleteSSHPublicKey", - "authSession", - } + assert.NotContains(t, strings.ToLower(string(serialized)), "xyzzy") +} + +func TestLookupResolvesLegacyAliases(t *testing.T) { + t.Parallel() + + index := testIndex(t) + + op, ok := index.Lookup("list_ssh_keys") + require.True(t, ok) + assert.Equal(t, "listSSHPublicKeys", op.ID) +} - got := make(map[string]bool) +func TestSnakeCase(t *testing.T) { + t.Parallel() - for _, item := range spec.Paths.Map() { - for _, op := range item.Operations() { - got[op.OperationID] = true - } + cases := map[string]string{ + "createSandbox": "create_sandbox", + "listSSHPublicKeys": "list_ssh_public_keys", + "prepareSandboxSSH": "prepare_sandbox_ssh", + "authCLIConfig": "auth_cli_config", + "getImageRestoredBy": "get_image_restored_by", + "meta": "meta", + "healthz": "healthz", } - for _, id := range want { - assert.True(t, got[id], "operationId %q missing from the compute OpenAPI spec", id) + for input, want := range cases { + assert.Equal(t, want, snakeCase(input), "snakeCase(%s)", input) } } + +func TestBuildRequestSplitsArguments(t *testing.T) { + t.Parallel() + + index := testIndex(t) + + op, ok := index.Lookup("create_widget") + require.True(t, ok) + + req, err := op.BuildRequest(map[string]any{ + "datasource": "production", + "idempotency_key": "idem-1", + "name": "w1", + "note": "hello", + "empty": "", + "nothing": nil, + }) + require.NoError(t, err) + + assert.Equal(t, "POST", req.Method) + assert.Equal(t, "/v1/widgets", req.Path) + assert.Equal(t, "idem-1", req.Header.Get("Idempotency-Key")) + assert.JSONEq(t, `{"name":"w1","note":"hello"}`, string(req.Body), + "reserved, nil, and empty-string arguments stay out of the body") +} + +func TestBuildRequestEnforcesRequiredBodyFields(t *testing.T) { + t.Parallel() + + index := testIndex(t) + + op, ok := index.Lookup("create_widget") + require.True(t, ok) + + _, err := op.BuildRequest(map[string]any{"note": "no name"}) + require.Error(t, err) + assert.Contains(t, err.Error(), "name is required") + + var argErr *ArgError + + assert.True(t, errors.As(err, &argErr)) +} + +func TestBuildRequestSubstitutesAndEscapesPathParams(t *testing.T) { + t.Parallel() + + index := testIndex(t) + + op, ok := index.Lookup("get_widget") + require.True(t, ok) + + req, err := op.BuildRequest(map[string]any{"id": "name@v1/beta"}) + require.NoError(t, err) + assert.Equal(t, "/v1/widgets/name@v1%2Fbeta", req.Path) + + _, err = op.BuildRequest(map[string]any{}) + require.Error(t, err) + assert.Contains(t, err.Error(), "id is required") +} + +func TestBuildRequestQuerySemantics(t *testing.T) { + t.Parallel() + + index := testIndex(t) + + op, ok := index.Lookup("list_widgets") + require.True(t, ok) + + // Zero numbers and empty strings are unset; repeated values fan out. + req, err := op.BuildRequest(map[string]any{ + "limit": float64(0), + "filter": []any{"state=running", "vcpu>=4"}, + }) + require.NoError(t, err) + assert.Equal(t, "/v1/widgets?filter=state%3Drunning&filter=vcpu%3E%3D4", req.Path) + + op, ok = index.Lookup("delete_widget") + require.True(t, ok) + + // A false boolean is meaningful and must be sent. + req, err = op.BuildRequest(map[string]any{"id": "w1", "retain": false, "idempotency_key": "k"}) + require.NoError(t, err) + assert.Equal(t, "/v1/widgets/w1?retain=false", req.Path) + assert.Nil(t, req.Body) +} + +func TestBuildRequestRejectsUnknownArgsWithoutBody(t *testing.T) { + t.Parallel() + + index := testIndex(t) + + op, ok := index.Lookup("get_widget") + require.True(t, ok) + + _, err := op.BuildRequest(map[string]any{"id": "w1", "bogus": "x", "extra": float64(1)}) + require.Error(t, err) + assert.Contains(t, err.Error(), "does not accept: bogus, extra") +} diff --git a/pkg/compute/openapi.yaml b/pkg/compute/openapi.yaml deleted file mode 100644 index 5ee87b8f..00000000 --- a/pkg/compute/openapi.yaml +++ /dev/null @@ -1,2722 +0,0 @@ -openapi: 3.0.3 -info: - title: Compute API - version: v1 - description: Internal REST API for sandbox, snapshot, template, and operation management. -servers: - - url: / -tags: - - name: auth - - name: ssh-keys - - name: ssh - - name: sandboxes - - name: snapshots - - name: forks - - name: templates - - name: bakes - - name: hook-templates - - name: operations - - name: system -paths: - /v1/me/ssh-keys: - get: - tags: [ssh-keys] - operationId: listSSHPublicKeys - parameters: - - $ref: '#/components/parameters/Limit' - - $ref: '#/components/parameters/Cursor' - - $ref: '#/components/parameters/Offset' - - $ref: '#/components/parameters/Filter' - responses: - '200': - description: SSH public keys registered by the authenticated subject. - content: - application/json: - schema: - $ref: '#/components/schemas/SSHPublicKeyList' - default: - $ref: '#/components/responses/Error' - post: - tags: [ssh-keys] - operationId: addSSHPublicKey - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/AddSSHPublicKeyRequest' - responses: - '201': - description: SSH public key registered. - content: - application/json: - schema: - $ref: '#/components/schemas/SSHPublicKey' - '400': - $ref: '#/components/responses/BadRequest' - '409': - $ref: '#/components/responses/Conflict' - '500': - $ref: '#/components/responses/InternalError' - /v1/me/ssh-keys/{id}: - parameters: - - $ref: '#/components/parameters/SSHPublicKeyID' - delete: - tags: [ssh-keys] - operationId: deleteSSHPublicKey - responses: - '204': - description: SSH public key removed. - '404': - $ref: '#/components/responses/NotFound' - '500': - $ref: '#/components/responses/InternalError' - /v1/sandboxes: - get: - tags: [sandboxes] - operationId: listSandboxes - parameters: - - $ref: '#/components/parameters/Limit' - - $ref: '#/components/parameters/Cursor' - - $ref: '#/components/parameters/Offset' - - $ref: '#/components/parameters/Filter' - responses: - '200': - description: Sandboxes in stable ID order. - content: - application/json: - schema: - $ref: '#/components/schemas/SandboxList' - default: - $ref: '#/components/responses/Error' - post: - tags: [sandboxes] - operationId: createSandbox - parameters: - - $ref: '#/components/parameters/IdempotencyKey' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/CreateSandboxRequest' - responses: - '202': - description: Sandbox creation accepted. Poll the returned operation ID. - content: - application/json: - schema: - $ref: '#/components/schemas/AcceptedResponse' - '400': - $ref: '#/components/responses/BadRequest' - '409': - $ref: '#/components/responses/Conflict' - '422': - $ref: '#/components/responses/UnprocessableEntity' - '500': - $ref: '#/components/responses/InternalError' - /v1/sandboxes/{id}: - parameters: - - $ref: '#/components/parameters/SandboxID' - get: - tags: [sandboxes] - operationId: getSandbox - responses: - '200': - description: Sandbox. - content: - application/json: - schema: - $ref: '#/components/schemas/Sandbox' - '404': - $ref: '#/components/responses/NotFound' - '500': - $ref: '#/components/responses/InternalError' - delete: - tags: [sandboxes] - operationId: deleteSandbox - parameters: - - $ref: '#/components/parameters/IdempotencyKey' - - name: retain - in: query - required: false - description: Set to false to discard retained state and delete without honoring the sandbox on_delete disposition. Omit or set true to use the stored disposition. - schema: - type: boolean - default: true - responses: - '202': - description: Sandbox deletion accepted. Poll the returned operation ID. - content: - application/json: - schema: - $ref: '#/components/schemas/AcceptedResponse' - '400': - $ref: '#/components/responses/BadRequest' - '409': - $ref: '#/components/responses/Conflict' - '500': - $ref: '#/components/responses/InternalError' - /v1/sandboxes/{id}/stop: - parameters: - - $ref: '#/components/parameters/SandboxID' - post: - tags: [sandboxes] - operationId: stopSandbox - parameters: - - $ref: '#/components/parameters/IdempotencyKey' - responses: - '202': - description: Stop accepted. Poll the returned operation ID. - content: - application/json: - schema: - $ref: '#/components/schemas/AcceptedResponse' - default: - $ref: '#/components/responses/Error' - /v1/sandboxes/{id}/start: - parameters: - - $ref: '#/components/parameters/SandboxID' - post: - tags: [sandboxes] - operationId: startSandbox - parameters: - - $ref: '#/components/parameters/IdempotencyKey' - responses: - '202': - description: Start accepted. Poll the returned operation ID. - content: - application/json: - schema: - $ref: '#/components/schemas/AcceptedResponse' - default: - $ref: '#/components/responses/Error' - /v1/sandboxes/{id}/pause: - parameters: - - $ref: '#/components/parameters/SandboxID' - post: - tags: [sandboxes] - operationId: pauseSandbox - parameters: - - $ref: '#/components/parameters/IdempotencyKey' - responses: - '202': - description: Pause accepted. Poll the returned operation ID. - content: - application/json: - schema: - $ref: '#/components/schemas/AcceptedResponse' - default: - $ref: '#/components/responses/Error' - /v1/sandboxes/{id}/resume: - parameters: - - $ref: '#/components/parameters/SandboxID' - post: - tags: [sandboxes] - operationId: resumeSandbox - parameters: - - $ref: '#/components/parameters/IdempotencyKey' - responses: - '202': - description: Resume accepted. Poll the returned operation ID. - content: - application/json: - schema: - $ref: '#/components/schemas/AcceptedResponse' - default: - $ref: '#/components/responses/Error' - /v1/sandboxes/{id}/snapshot: - parameters: - - $ref: '#/components/parameters/SandboxID' - post: - tags: [sandboxes] - operationId: snapshotSandbox - parameters: - - $ref: '#/components/parameters/IdempotencyKey' - requestBody: - required: false - content: - application/json: - schema: - $ref: '#/components/schemas/SnapshotSandboxRequest' - responses: - '202': - description: Snapshot accepted. Poll the returned operation ID. - content: - application/json: - schema: - $ref: '#/components/schemas/AcceptedResponse' - default: - $ref: '#/components/responses/Error' - /v1/sandboxes/{id}/ports: - parameters: - - $ref: '#/components/parameters/SandboxID' - post: - tags: [sandboxes] - operationId: exposePort - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/ExposePortRequest' - responses: - '200': - description: Exposed port with public URL. - content: - application/json: - schema: - $ref: '#/components/schemas/ExposedPort' - default: - $ref: '#/components/responses/Error' - /v1/sandboxes/{id}/ports/{port}: - parameters: - - $ref: '#/components/parameters/SandboxID' - - $ref: '#/components/parameters/Port' - delete: - tags: [sandboxes] - operationId: unexposePort - responses: - '204': - description: Port removed or was not exposed. - default: - $ref: '#/components/responses/Error' - /v1/sandboxes/{id}/fork: - parameters: - - $ref: '#/components/parameters/SandboxID' - post: - tags: [sandboxes] - operationId: forkSandbox - description: >- - Capture the sandbox as an ephemeral snapshot and fan out `count` - sandboxes from it. The source keeps running. Every child requires a - TTL; children default to the source's TTL duration restarted at their - own boot and parent expiry never cascades. - parameters: - - $ref: '#/components/parameters/IdempotencyKey' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/ForkRequest' - responses: - '202': - description: Fork accepted. Poll the returned operation ID or GET /v1/forks/{id}. - content: - application/json: - schema: - $ref: '#/components/schemas/ForkAccepted' - default: - $ref: '#/components/responses/Error' - /v1/sandboxes/{id}/lease: - parameters: - - $ref: '#/components/parameters/SandboxID' - post: - tags: [sandboxes] - operationId: leaseSandbox - summary: Extend a sandbox's TTL. A heartbeat is a periodic call to this endpoint. - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/LeaseSandboxRequest' - responses: - '200': - description: Lease extended. Returns the new expiry, clamped to max TTL. - content: - application/json: - schema: - $ref: '#/components/schemas/LeaseResponse' - default: - $ref: '#/components/responses/Error' - /v1/sandboxes/{id}/exec: - parameters: - - $ref: '#/components/parameters/SandboxID' - get: - tags: [sandboxes] - operationId: streamExecSandbox - summary: Execute a command in a running sandbox over WebSocket. - description: | - Pre-upgrade validation returns JSON errors. On success this endpoint upgrades to a WebSocket. - Client binary messages are stdin with a 0x00 prefix. Server binary messages use 0x01 for stdout - and 0x02 for stderr; PTY output is sent on stdout. Client text messages may resize the PTY with - {"type":"resize","rows":N,"cols":N}. Server text messages report {"type":"exit","exit_code":N} - or {"type":"error","message":"..."}. - parameters: - - name: cmd - in: query - required: true - description: Repeated argv item, in order. The server shell-quotes and joins these items for SSH exec. - style: form - explode: true - schema: - type: array - minItems: 1 - items: - type: string - - name: pty - in: query - required: false - schema: - type: boolean - default: false - - name: rows - in: query - required: false - schema: - type: integer - minimum: 1 - default: 24 - - name: cols - in: query - required: false - schema: - type: integer - minimum: 1 - default: 80 - responses: - '400': - $ref: '#/components/responses/BadRequest' - '409': - $ref: '#/components/responses/Conflict' - default: - $ref: '#/components/responses/Error' - post: - tags: [sandboxes] - operationId: execSandbox - summary: Run a command in the sandbox and wait for it to complete. - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/ExecSandboxRequest' - responses: - '200': - description: Command completed (any exit code). Output is truncated by the guest at 1 MiB per stream. - content: - application/json: - schema: - $ref: '#/components/schemas/ExecSandboxResult' - default: - $ref: '#/components/responses/Error' - /v1/sandboxes/{id}/hooks: - parameters: - - $ref: '#/components/parameters/SandboxID' - get: - tags: [sandboxes] - operationId: getSandboxHooks - parameters: - - $ref: '#/components/parameters/Limit' - - $ref: '#/components/parameters/Cursor' - - $ref: '#/components/parameters/Offset' - - $ref: '#/components/parameters/Filter' - responses: - '200': - description: Lifecycle hook contract attached to the sandbox. - content: - application/json: - schema: - $ref: '#/components/schemas/HookSummaryList' - default: - $ref: '#/components/responses/Error' - /v1/sandboxes/{id}/hook-runs: - parameters: - - $ref: '#/components/parameters/SandboxID' - get: - tags: [sandboxes] - operationId: getSandboxHookRuns - parameters: - - $ref: '#/components/parameters/Limit' - - $ref: '#/components/parameters/Cursor' - - $ref: '#/components/parameters/Offset' - - $ref: '#/components/parameters/Filter' - responses: - '200': - description: Hook execution history, newest first. - content: - application/json: - schema: - $ref: '#/components/schemas/HookRunList' - default: - $ref: '#/components/responses/Error' - /v1/sandboxes/{id}/ssh: - parameters: - - $ref: '#/components/parameters/SandboxID' - post: - tags: [ssh] - operationId: prepareSandboxSSH - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/PrepareSandboxSSHRequest' - responses: - '200': - description: Stock SSH connection details and a gateway-auth certificate for the supplied key. - content: - application/json: - schema: - $ref: '#/components/schemas/PrepareSandboxSSHResult' - default: - $ref: '#/components/responses/Error' - /v1/sandboxes/{id}/tunnel/{port}: - parameters: - - $ref: '#/components/parameters/SandboxID' - - name: port - in: path - required: true - schema: - type: integer - minimum: 1 - maximum: 65535 - get: - tags: [sandboxes] - operationId: tunnelSandbox - summary: Open a raw TCP tunnel to a port inside a running sandbox over WebSocket. - description: | - Pre-upgrade validation returns JSON errors. On success this endpoint upgrades to a WebSocket. - Binary messages are raw bytes in both directions. A single WebSocket maps to one guest TCP - connection to 127.0.0.1:{port}. Server text messages report {"type":"error","message":"..."} - before close when a runtime tunnel failure occurs. - responses: - '400': - $ref: '#/components/responses/BadRequest' - '409': - $ref: '#/components/responses/Conflict' - default: - $ref: '#/components/responses/Error' - /v1/ssh/authorize: - post: - tags: [ssh] - operationId: authorizeSSH - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/SSHAuthorizeRequest' - responses: - '200': - description: Live SSH access authorization for the gateway. - content: - application/json: - schema: - $ref: '#/components/schemas/SSHAuthorizeResponse' - default: - $ref: '#/components/responses/Error' - /v1/ingress/authorize: - post: - tags: [ingress] - operationId: authorizeIngress - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/IngressAuthorizeRequest' - responses: - '200': - description: Live ingress access authorization for the gateway. - content: - application/json: - schema: - $ref: '#/components/schemas/IngressAuthorizeResponse' - default: - $ref: '#/components/responses/Error' - /v1/images: - get: - tags: [images] - operationId: listImages - description: >- - Unified view over bootable saved state: raw snapshots plus named - templates (warm promoted checkpoints and cold config-declared bases). - parameters: - - $ref: '#/components/parameters/Limit' - - $ref: '#/components/parameters/Cursor' - - $ref: '#/components/parameters/Offset' - - $ref: '#/components/parameters/Filter' - responses: - '200': - description: Named images in ID order, then raw images newest first. - content: - application/json: - schema: - $ref: '#/components/schemas/ImageList' - default: - $ref: '#/components/responses/Error' - /v1/images/{id}: - parameters: - - $ref: '#/components/parameters/ImageID' - get: - tags: [images] - operationId: getImage - responses: - '200': - description: Image. - content: - application/json: - schema: - $ref: '#/components/schemas/Image' - '404': - $ref: '#/components/responses/NotFound' - '500': - $ref: '#/components/responses/InternalError' - delete: - tags: [images] - operationId: deleteImage - description: Delete a raw image. Named images are deactivated instead (409). - parameters: - - $ref: '#/components/parameters/IdempotencyKey' - responses: - '202': - description: Image deletion accepted. Poll the returned operation ID. - content: - application/json: - schema: - $ref: '#/components/schemas/AcceptedResponse' - '409': - $ref: '#/components/responses/Error' - default: - $ref: '#/components/responses/Error' - /v1/images/{id}/promote: - parameters: - - $ref: '#/components/parameters/ImageID' - post: - tags: [images] - operationId: promoteImage - description: Promote a raw image to a named one. Named IDs are rejected (409). - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/PromoteSnapshotRequest' - responses: - '201': - description: The named image created by the promotion. - content: - application/json: - schema: - $ref: '#/components/schemas/Image' - default: - $ref: '#/components/responses/Error' - /v1/images/{id}/fork: - parameters: - - $ref: '#/components/parameters/ImageID' - post: - tags: [images] - operationId: forkImage - description: >- - Fan out `count` sandboxes from an image. Raw images fork directly; - named warm images fork their backing snapshot. Cold images have no - checkpoint to fork (400). Every child requires a TTL. - parameters: - - $ref: '#/components/parameters/IdempotencyKey' - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/ForkRequest' - responses: - '202': - description: Fork accepted. Poll the returned operation ID or GET /v1/forks/{id}. - content: - application/json: - schema: - $ref: '#/components/schemas/ForkAccepted' - default: - $ref: '#/components/responses/Error' - /v1/images/{id}/deactivate: - parameters: - - $ref: '#/components/parameters/ImageID' - post: - tags: [images] - operationId: deactivateImage - description: Retire a named image. Accepts a name or name@version. - responses: - '204': - description: Named image deactivated. - '404': - $ref: '#/components/responses/NotFound' - default: - $ref: '#/components/responses/Error' - /v1/images/{id}/restored-by: - parameters: - - $ref: '#/components/parameters/ImageID' - get: - tags: [images] - operationId: getImageRestoredBy - description: Sandboxes created from the image's snapshot. Empty for cold images. - responses: - '200': - description: Sandboxes restored from the image. - '404': - $ref: '#/components/responses/NotFound' - default: - $ref: '#/components/responses/Error' - /v1/images/{id}/lineage: - parameters: - - $ref: '#/components/parameters/ImageID' - get: - tags: [images] - operationId: getImageLineage - description: Derived provenance graph centered on the image's snapshot. Empty for cold images. - responses: - '200': - description: Derived provenance graph centered on the image. - content: - application/json: - schema: - $ref: '#/components/schemas/LineageResponse' - '404': - $ref: '#/components/responses/NotFound' - default: - $ref: '#/components/responses/Error' - /v1/forks: - get: - tags: [forks] - operationId: listForks - description: List fork operations and their progress counts. - responses: - '200': - description: Fork operations. - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/Fork' - default: - $ref: '#/components/responses/Error' - /v1/forks/{id}: - parameters: - - $ref: '#/components/parameters/ForkID' - get: - tags: [forks] - operationId: getFork - description: Progress of a single fork operation, including per-child state. - responses: - '200': - description: Fork operation. - content: - application/json: - schema: - $ref: '#/components/schemas/Fork' - '404': - $ref: '#/components/responses/NotFound' - default: - $ref: '#/components/responses/Error' - /v1/bakes: - get: - tags: [bakes] - operationId: listBakes - parameters: - - $ref: '#/components/parameters/Limit' - - $ref: '#/components/parameters/Cursor' - - $ref: '#/components/parameters/Offset' - - $ref: '#/components/parameters/Filter' - responses: - '200': - description: Configured bakes and their scheduling state. - content: - application/json: - schema: - $ref: '#/components/schemas/BakeStatusList' - default: - $ref: '#/components/responses/Error' - /v1/bakes/{name}/run: - parameters: - - name: name - in: path - required: true - schema: - type: string - post: - tags: [bakes] - operationId: runBake - responses: - '202': - description: Bake run scheduled. - content: - application/json: - schema: - $ref: '#/components/schemas/ScheduledResponse' - '404': - $ref: '#/components/responses/NotFound' - '409': - $ref: '#/components/responses/Conflict' - default: - $ref: '#/components/responses/Error' - /v1/hook-templates: - get: - tags: [hook-templates] - operationId: listHookTemplates - parameters: - - $ref: '#/components/parameters/Limit' - - $ref: '#/components/parameters/Cursor' - - $ref: '#/components/parameters/Offset' - - $ref: '#/components/parameters/Filter' - responses: - '200': - description: Hook templates in stable name order. - content: - application/json: - schema: - $ref: '#/components/schemas/HookTemplateList' - default: - $ref: '#/components/responses/Error' - post: - tags: [hook-templates] - operationId: createHookTemplate - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/HookTemplateRequest' - responses: - '201': - description: Hook template created. - content: - application/json: - schema: - $ref: '#/components/schemas/HookTemplate' - default: - $ref: '#/components/responses/Error' - /v1/hook-templates/{name}: - parameters: - - name: name - in: path - required: true - schema: - type: string - get: - tags: [hook-templates] - operationId: getHookTemplate - responses: - '200': - description: Hook template. - content: - application/json: - schema: - $ref: '#/components/schemas/HookTemplate' - default: - $ref: '#/components/responses/Error' - put: - tags: [hook-templates] - operationId: updateHookTemplate - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/HookTemplateRequest' - responses: - '200': - description: Hook template updated. - content: - application/json: - schema: - $ref: '#/components/schemas/HookTemplate' - default: - $ref: '#/components/responses/Error' - delete: - tags: [hook-templates] - operationId: deleteHookTemplate - responses: - '204': - description: Hook template deleted. - default: - $ref: '#/components/responses/Error' - /v1/operations: - get: - tags: [operations] - operationId: listOperations - parameters: - - $ref: '#/components/parameters/Limit' - - $ref: '#/components/parameters/Cursor' - - $ref: '#/components/parameters/Offset' - - $ref: '#/components/parameters/Filter' - responses: - '200': - description: Operations in stable created_at/id order. - content: - application/json: - schema: - $ref: '#/components/schemas/OperationList' - default: - $ref: '#/components/responses/Error' - /v1/operations/{id}: - parameters: - - $ref: '#/components/parameters/OperationID' - get: - tags: [operations] - operationId: getOperation - responses: - '200': - description: Operation. Terminal states are succeeded and failed. - content: - application/json: - schema: - $ref: '#/components/schemas/Operation' - '404': - $ref: '#/components/responses/NotFound' - '500': - $ref: '#/components/responses/InternalError' - /v1/healthz: - get: - tags: [system] - operationId: healthz - responses: - '200': - description: Process is alive. - content: - text/plain: - schema: - type: string - /v1/readyz: - get: - tags: [system] - operationId: readyz - responses: - '200': - description: Service dependencies are ready. - content: - text/plain: - schema: - type: string - '503': - $ref: '#/components/responses/NotReady' - /v1/metrics: - get: - tags: [system] - operationId: metrics - responses: - '200': - description: Prometheus metrics. - content: - text/plain: - schema: - type: string - /v1/openapi.yaml: - get: - tags: [system] - operationId: openAPIYAML - responses: - '200': - description: This OpenAPI document. - content: - application/yaml: - schema: - type: string - /v1/auth/session: - get: - tags: [auth] - operationId: authSession - responses: - '200': - description: Browser authentication status and identity when OIDC auth is enabled. - content: - application/json: - schema: - $ref: '#/components/schemas/AuthSession' - default: - $ref: '#/components/responses/Error' - /v1/auth/cli-config: - get: - tags: [auth] - operationId: authCLIConfig - security: [] - responses: - '200': - description: Public OIDC settings used by native CLI login. - content: - application/json: - schema: - $ref: '#/components/schemas/AuthCLIConfig' - default: - $ref: '#/components/responses/Error' - /v1/meta: - get: - tags: [system] - operationId: meta - responses: - '200': - description: Server reference clock. - default: - $ref: '#/components/responses/Error' - /v1/sandboxes/{id}/logs: - parameters: - - $ref: '#/components/parameters/SandboxID' - get: - tags: [sandboxes] - operationId: getSandboxLogs - parameters: - - name: tail_bytes - in: query - required: false - description: Per-source byte tail to return. Defaults to 256 KiB and is capped by the server. - schema: - type: integer - format: int64 - minimum: 1 - - name: source - in: query - required: false - description: Restrict logs to one source. - schema: - type: string - enum: [console, firecracker] - responses: - '200': - description: Guest log lines (empty in deferred mode). - content: - application/json: - schema: - $ref: '#/components/schemas/LogsResponse' - '404': - $ref: '#/components/responses/NotFound' - default: - $ref: '#/components/responses/Error' - /v1/sandboxes/{id}/metrics: - parameters: - - $ref: '#/components/parameters/SandboxID' - get: - tags: [sandboxes] - operationId: getSandboxMetrics - summary: Return raw sampled sandbox resource metrics. - description: | - Returns stored point samples only. The server does not calculate rates or downsample by step. - Clients derive CPU and network rates from consecutive counter samples. At most 5000 samples - are returned per request. - parameters: - - name: since - in: query - required: false - schema: - type: string - format: date-time - - name: until - in: query - required: false - schema: - type: string - format: date-time - - name: step - in: query - required: false - description: Positive duration hint accepted for client compatibility; raw samples are still returned. - schema: - type: string - example: 30s - responses: - '200': - description: Raw metric samples ordered by sampled_at ascending. - content: - application/json: - schema: - $ref: '#/components/schemas/SandboxMetricsResponse' - '400': - $ref: '#/components/responses/BadRequest' - '404': - $ref: '#/components/responses/NotFound' - default: - $ref: '#/components/responses/Error' - /v1/sandboxes/{id}/lineage: - parameters: - - $ref: '#/components/parameters/SandboxID' - get: - tags: [sandboxes] - operationId: getSandboxLineage - responses: - '200': - description: Derived provenance graph for the sandbox. - content: - application/json: - schema: - $ref: '#/components/schemas/LineageResponse' - '404': - $ref: '#/components/responses/NotFound' - default: - $ref: '#/components/responses/Error' - /v1/sandboxes/{id}/operations: - parameters: - - $ref: '#/components/parameters/SandboxID' - get: - tags: [sandboxes] - operationId: getSandboxOperations - responses: - '200': - description: Operations targeting the sandbox. - '404': - $ref: '#/components/responses/NotFound' - default: - $ref: '#/components/responses/Error' - /v1/sandboxes/{id}/images: - parameters: - - $ref: '#/components/parameters/SandboxID' - get: - tags: [sandboxes] - operationId: getSandboxImages - responses: - '200': - description: Raw images captured from the sandbox. - '404': - $ref: '#/components/responses/NotFound' - default: - $ref: '#/components/responses/Error' - /v1/nodes: - get: - tags: [system] - operationId: listNodes - responses: - '200': - description: Node registry entries. - default: - $ref: '#/components/responses/Error' - /v1/nodes/{id}: - parameters: - - name: id - in: path - required: true - schema: - type: string - get: - tags: [system] - operationId: getNode - responses: - '200': - description: A node registry entry. - '404': - $ref: '#/components/responses/NotFound' - default: - $ref: '#/components/responses/Error' - /v1/users: - get: - tags: [system] - operationId: listUsers - responses: - '200': - description: Users. - default: - $ref: '#/components/responses/Error' - /v1/users/{handle}: - parameters: - - name: handle - in: path - required: true - schema: - type: string - get: - tags: [system] - operationId: getUser - responses: - '200': - description: A user. - '404': - $ref: '#/components/responses/NotFound' - default: - $ref: '#/components/responses/Error' - /v1/users/{handle}/ssh-keys: - parameters: - - name: handle - in: path - required: true - schema: - type: string - post: - tags: [ssh-keys] - operationId: addUserSSHPublicKey - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/AddSSHPublicKeyRequest' - responses: - '201': - description: SSH public key registered for the target user. - content: - application/json: - schema: - $ref: '#/components/schemas/SSHPublicKey' - '403': - $ref: '#/components/responses/Forbidden' - '404': - $ref: '#/components/responses/NotFound' - '409': - $ref: '#/components/responses/Conflict' - default: - $ref: '#/components/responses/Error' - /v1/users/{handle}/ssh-keys/{id}: - parameters: - - name: handle - in: path - required: true - schema: - type: string - - $ref: '#/components/parameters/SSHPublicKeyID' - delete: - tags: [ssh-keys] - operationId: deleteUserSSHPublicKey - responses: - '204': - description: SSH public key removed from the target user. - '403': - $ref: '#/components/responses/Forbidden' - '404': - $ref: '#/components/responses/NotFound' - default: - $ref: '#/components/responses/Error' - /v1/audit: - get: - tags: [system] - operationId: listAudit - responses: - '200': - description: Append-only audit log entries. - default: - $ref: '#/components/responses/Error' -security: - - bearerAuth: [] -components: - securitySchemes: - bearerAuth: - type: http - scheme: bearer - bearerFormat: JWT - description: Authentik-issued OIDC access token (JWT). Users reach the API via panda-proxy forwarding their token; machine callers use a client_credentials token. - parameters: - IdempotencyKey: - name: Idempotency-Key - in: header - required: true - description: Required for mutating requests. Reusing a key with the same request returns the same accepted operation; reusing it with a different request returns 409. - schema: - type: string - minLength: 1 - Limit: - name: limit - in: query - required: false - schema: - type: integer - minimum: 1 - maximum: 500 - default: 100 - Cursor: - name: cursor - in: query - required: false - description: Integer offset cursor returned as next_cursor. - schema: - type: string - Filter: - name: filter - in: query - required: false - description: >- - Filter results by field, formatted as keyvalue where op is one of - =, !=, ~= (contains), >, <, >=, <=. Keys are response field names and may - be dotted to reach nested fields (e.g. error.reason). Comparison is - numeric when both sides are numbers and case-insensitive otherwise. - Repeatable; all filters must match. Applied before pagination. - explode: true - schema: - type: array - items: - type: string - examples: - status: - summary: Only running items - value: ["state=running"] - combined: - summary: Multiple filters (AND) - value: ["state=running", "template~=ubuntu"] - Offset: - name: offset - in: query - required: false - description: Integer offset alternative to cursor. - schema: - type: integer - minimum: 0 - SandboxID: - name: id - in: path - required: true - schema: - type: string - Port: - name: port - in: path - required: true - schema: - type: integer - minimum: 1 - maximum: 65535 - SnapshotID: - name: id - in: path - required: true - schema: - type: string - ImageID: - name: id - in: path - required: true - description: Snapshot ID for raw images, or "name@version" for named ones. - schema: - type: string - OperationID: - name: id - in: path - required: true - schema: - type: string - ForkID: - name: id - in: path - required: true - schema: - type: string - SSHPublicKeyID: - name: id - in: path - required: true - schema: - type: string - responses: - Error: - description: API error. - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorEnvelope' - BadRequest: - description: Bad request, including malformed JSON, missing idempotency key, or invalid pagination parameters. - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorEnvelope' - NotFound: - description: Resource not found. - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorEnvelope' - Forbidden: - description: Caller does not have the required role. - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorEnvelope' - Conflict: - description: Conflict, including idempotency-key reuse with a different request. - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorEnvelope' - UnprocessableEntity: - description: Syntactically valid request that failed validation. - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorEnvelope' - InternalError: - description: Internal server error. Message is masked and does not include internal details. - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorEnvelope' - NotReady: - description: Service is not ready. - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorEnvelope' - schemas: - AuthSession: - type: object - required: [enabled, authenticated] - properties: - enabled: - type: boolean - authenticated: - type: boolean - user: - $ref: '#/components/schemas/WebSessionIdentity' - AuthCLIConfig: - type: object - required: [oidc_enabled, scopes] - properties: - oidc_enabled: - type: boolean - issuer: - type: string - format: uri - client_id: - type: string - scopes: - type: array - items: - type: string - WebSessionIdentity: - type: object - required: [subject, handle, email, name, avatarUrl] - properties: - subject: - type: string - handle: - type: string - email: - type: string - name: - type: string - avatarUrl: - type: string - expiresAt: - type: string - format: date-time - CreateSandboxRequest: - type: object - additionalProperties: false - properties: - template: - type: string - description: Legacy template name. Mutually exclusive with source. - source: - $ref: '#/components/schemas/CreateSandboxSource' - ttl: - type: string - description: Optional positive Go-style duration string. - on_delete: - type: string - enum: [delete, hot, archive] - description: Disposition to apply when the sandbox is deleted. - name: - type: string - maxLength: 128 - description: Optional display name stored as sandbox web metadata. - env: - type: object - additionalProperties: - type: string - description: Optional write-only guest environment delivered to shells and execs. - labels: - type: object - additionalProperties: - type: string - description: Optional service metadata labels for the sandbox. - vcpu: - type: integer - minimum: 1 - description: Optional vCPU override, bounded by operator override_limits. Cold creates may override freely within limits. Warm restores require vCPU to be at least the recorded warm snapshot value because supervisor pod sizing is derived from this metadata. - memory_mb: - type: integer - minimum: 1 - description: Optional memory override in MiB, bounded by operator override_limits. Warm restores pin memory to the recorded snapshot value because Firecracker restore loads the saved memory image; requests with a different memory value are rejected with override_not_allowed. Snapshot sources currently resolve through warm restore, so the same rule applies. - disk_gb: - type: integer - minimum: 1 - description: Optional disk override in GiB. Cold creates require disk_gb to be greater than or equal to the cold template disk size. Warm restores require disk_gb to be at least the recorded warm snapshot disk size. This resizes the backing zvol only; extra space becomes available to the guest only after the guest resizes its filesystem. - paused: - type: boolean - description: >- - When true the restored sandbox is left paused (its fully-booted - memory image loaded but not resumed) instead of running. Valid only - for a warm-flavor snapshot source; a template source or the cold - flavor is rejected because there is no frozen image to hold. - hooks: - type: array - maxItems: 16 - items: - $ref: '#/components/schemas/HookDeclaration' - watchdog: - $ref: '#/components/schemas/WatchdogDeclaration' - exposed_ports: - type: array - items: - $ref: '#/components/schemas/PortExposureRequest' - description: Optional explicit port exposure list. Absent inherits template or snapshot defaults; present empty exposes nothing. - CreateSandboxSource: - oneOf: - - $ref: '#/components/schemas/TemplateBootSource' - - $ref: '#/components/schemas/SnapshotBootSource' - TemplateBootSource: - type: object - additionalProperties: false - required: [kind, name] - properties: - kind: - type: string - enum: [template] - name: - type: string - version: - type: string - SnapshotBootSource: - type: object - additionalProperties: false - required: [kind, snapshot_id] - properties: - kind: - type: string - enum: [snapshot] - snapshot_id: - type: string - flavor: - type: string - enum: [warm, cold] - description: >- - How the snapshot boots. "warm" (default) resumes the captured - memory image and pins memory to the snapshot's size. "cold" boots - a fresh kernel on the snapshot's disk state with freely chosen - vcpu and memory. - SnapshotSandboxRequest: - type: object - additionalProperties: false - properties: - note: - type: string - ttl: - type: string - description: >- - Go-style duration string. Snapshots always carry a TTL: omit to - fall back to the configured lifecycle.default_snapshot_ttl (a - required server default). If neither is present the request is - rejected. - ForkRequest: - type: object - additionalProperties: false - required: [count, identity] - properties: - count: - type: integer - minimum: 1 - description: Number of sandboxes to create. The only multiplier in the API. - identity: - $ref: '#/components/schemas/ForkIdentity' - ttl: - type: string - description: >- - Go-style duration string applied to every child. Fork children - always carry a TTL: omit to fall back to the configured - lifecycle.default_ttl (a required server default). If neither is - present the request is rejected. - min_ready: - type: integer - minimum: 0 - description: >- - Floor of ready children below which the fork reports failure - (min_ready_not_met). Running children are never destroyed to meet - it. Must not exceed count. - deadline: - type: string - description: >- - Go-style duration string bounding how long queued children may wait - for capacity before the sweeper cancels the still-queued ones. - flavor: - type: string - enum: [warm, cold] - description: >- - How each child boots from the source snapshot. "warm" (default) - resumes the captured memory image; "cold" boots a fresh kernel on - the snapshot's disk. - paused: - type: boolean - description: >- - Whether children land paused instead of running. Omit to inherit - the default: sandbox-source children inherit the source's state at - fork time (a paused source yields paused children), snapshot-source - children run. Set true/false to override. paused true with the cold - flavor is rejected because cold children fresh-boot. - ForkIdentity: - type: object - additionalProperties: false - required: [rng, clock] - properties: - rng: - type: string - enum: [reseed, inherit] - description: >- - Child RNG policy. reseed relies on the VM Generation ID clone - event. inherit is reserved for a future Firecracker flag and is - rejected by the current server because regeneration is currently - unconditional on snapshot restore. - clock: - type: string - enum: [correct, inherit] - description: >- - correct applies realtime clock correction while the child is - paused during snapshot load, regardless of the snapshot manifest; - inherit leaves the manifest or template clock policy in control. - ForkAccepted: - type: object - additionalProperties: false - required: [fork_id, op_id] - properties: - fork_id: - type: string - op_id: - type: string - ForkSource: - type: object - additionalProperties: false - required: [kind, id] - properties: - kind: - type: string - enum: [sandbox, snapshot] - id: - type: string - ForkChild: - type: object - additionalProperties: false - required: [ordinal, sandbox_id, state] - properties: - ordinal: - type: integer - sandbox_id: - type: string - state: - type: string - Fork: - type: object - additionalProperties: false - required: [id, source, state, requested, queued, running, failed, cancelled, created_at, updated_at] - properties: - id: - type: string - source: - $ref: '#/components/schemas/ForkSource' - state: - type: string - requested: - type: integer - min_ready: - type: integer - queued: - type: integer - running: - type: integer - failed: - type: integer - cancelled: - type: integer - deadline_at: - type: string - failure_reason: - type: string - failure_message: - type: string - children: - type: array - items: - $ref: '#/components/schemas/ForkChild' - created_at: - type: string - updated_at: - type: string - HookDeclaration: - type: object - additionalProperties: false - required: [event] - properties: - event: - type: string - enum: [after_create, after_restore, after_resume, before_pause, before_stop, before_snapshot, before_delete] - template: - type: string - description: Hook template name. Mutually exclusive with script. - script: - type: string - maxLength: 65536 - description: Inline shell script. Mutually exclusive with template. - timeout_seconds: - type: integer - minimum: 1 - maximum: 600 - on_failure: - type: string - enum: [abort, continue] - env: - type: object - additionalProperties: - type: string - run_order: - type: integer - WatchdogDeclaration: - type: object - additionalProperties: false - required: [interval_seconds, action] - properties: - template: - type: string - description: Hook template name. Mutually exclusive with script. - script: - type: string - maxLength: 65536 - description: Inline shell script. Mutually exclusive with template. - interval_seconds: - type: integer - minimum: 30 - action: - type: string - enum: [stop, snapshot, none] - failure_threshold: - type: integer - minimum: 1 - default: 3 - timeout_seconds: - type: integer - minimum: 1 - maximum: 600 - env: - type: object - additionalProperties: - type: string - PromoteSnapshotRequest: - type: object - additionalProperties: false - required: [name] - properties: - name: - type: string - version: - type: string - replace: - type: boolean - default: false - description: - type: string - tags: - type: array - items: - type: string - LeaseSandboxRequest: - type: object - additionalProperties: false - required: [extend] - properties: - extend: - type: string - description: Positive Go-style duration to extend the lease by, clamped to max_lease_extension and max TTL. - LeaseResponse: - type: object - required: [id] - properties: - id: - type: string - expires_at: - type: string - format: date-time - description: New expiry after the lease extension. - ExecSandboxRequest: - type: object - additionalProperties: false - required: [command] - properties: - command: - type: array - minItems: 1 - maxItems: 256 - items: - type: string - description: Argument vector executed directly in the guest (no shell). Wrap in ["/bin/sh", "-c", ...] for shell semantics. - timeout: - type: string - description: Positive Go-style duration bounding the command's runtime. Defaults to 30s; maximum 5m. - ExecSandboxResult: - type: object - required: [exit_code, stdout, stderr] - properties: - exit_code: - type: integer - description: Command exit code. -1 when the process was killed (including on timeout). - stdout: - type: string - stderr: - type: string - stdout_truncated: - type: boolean - stderr_truncated: - type: boolean - timed_out: - type: boolean - description: True when the command hit the timeout and was killed. - LogsResponse: - type: object - required: [items] - properties: - items: - type: array - items: - $ref: '#/components/schemas/LogLine' - truncated: - type: boolean - description: True when at least one source was tailed from a larger log. - LogLine: - type: object - required: [ts, level, src, msg] - properties: - ts: - type: string - level: - type: string - src: - type: string - description: Backward-compatible source/process field. - source: - type: string - enum: [console, firecracker] - description: Log stream source when provided by the real sandbox log backend. - msg: - type: string - LineageResponse: - type: object - required: [nodes] - properties: - nodes: - type: array - items: - $ref: '#/components/schemas/LineageNode' - LineageNode: - type: object - required: [key, kind, variant, label, sub, depth, isLast] - properties: - key: - type: string - kind: - type: string - enum: [SNAPSHOT, SANDBOX, "—"] - variant: - type: string - enum: [snapshot, current, restored-live, historical, none] - label: - type: string - sub: - type: string - depth: - type: integer - isLast: - type: boolean - href: - type: string - nullable: true - parentKey: - type: string - edge: - type: string - enum: [created-from, snapshotted-to] - entityId: - type: string - state: - type: string - createdAt: - type: string - format: date-time - PortExposureRequest: - type: object - required: [port] - additionalProperties: false - properties: - port: - type: integer - minimum: 1 - maximum: 65535 - name: - type: string - pattern: '^[a-z][a-z0-9]{0,19}$' - managed: - type: boolean - service: - type: string - protocol: - type: string - ExposePortRequest: - type: object - required: [port] - additionalProperties: false - properties: - port: - type: integer - minimum: 1 - maximum: 65535 - name: - type: string - pattern: '^[a-z][a-z0-9]{0,19}$' - managed: - type: boolean - service: - type: string - protocol: - type: string - ExposedPort: - type: object - required: [port, url] - properties: - port: - type: integer - name: - type: string - url: - type: string - managed: - type: boolean - description: Owned by an automated reconciler (portsync) rather than a user. - service: - type: string - description: Workload the exposure belongs to (e.g. Kurtosis service name); grouping key. - protocol: - type: string - description: Endpoint label within the service (e.g. rpc, ws, metrics). - IngressAuthorizeRequest: - type: object - required: [sandbox_id, port_label, gateway_public_key] - additionalProperties: false - properties: - sandbox_id: - type: string - port_label: - type: string - description: Numeric port string or configured port name. - gateway_public_key: - type: string - description: One OpenSSH public key generated by the gateway for this session. - IngressAuthorizeResponse: - type: object - required: [sandbox_id, incarnation_id, supervisor_endpoint, supervisor_port, capability, guest_certificate, port, expires_at] - properties: - sandbox_id: - type: string - incarnation_id: - type: string - supervisor_endpoint: - type: string - supervisor_port: - type: integer - capability: - type: string - guest_certificate: - type: string - port: - type: integer - expires_at: - type: string - format: date-time - SSHAuthorizeRequest: - type: object - required: [routing_username, gateway_public_key] - additionalProperties: false - properties: - routing_username: - type: string - description: SSH username carrying the target sandbox name. - public_key_fingerprint: - type: string - description: SHA256 fingerprint of a live registered public key already proven by the gateway. - client_certificate: - type: string - description: Service-issued gateway-auth SSH certificate presented by the client. - gateway_public_key: - type: string - description: One OpenSSH public key generated by the gateway for this session. - SSHAuthorizeResponse: - type: object - required: [sandbox_id, incarnation_id, supervisor_endpoint, supervisor_port, capability, guest_certificate, expires_at] - properties: - sandbox_id: - type: string - incarnation_id: - type: string - supervisor_endpoint: - type: string - supervisor_port: - type: integer - capability: - type: string - guest_certificate: - type: string - expires_at: - type: string - format: date-time - PrepareSandboxSSHRequest: - type: object - required: [public_key] - additionalProperties: false - properties: - public_key: - type: string - description: One registered OpenSSH public key to certify for gateway authentication. - PrepareSandboxSSHResult: - type: object - required: [host, port, username, key_fingerprint, client_certificate, expires_at] - properties: - host: - type: string - port: - type: integer - username: - type: string - key_fingerprint: - type: string - client_certificate: - type: string - expires_at: - type: string - format: date-time - AddSSHPublicKeyRequest: - type: object - required: [public_key] - additionalProperties: false - properties: - name: - type: string - description: Optional display name. Defaults to the key comment or fingerprint. - label: - type: string - description: Optional display label. Defaults to the key comment or fingerprint. - public_key: - type: string - description: One OpenSSH public key line. - SSHPublicKey: - type: object - required: [id, name, public_key, fingerprint, created_at, updated_at] - properties: - id: - type: string - name: - type: string - public_key: - type: string - fingerprint: - type: string - created_at: - type: string - format: date-time - updated_at: - type: string - format: date-time - AcceptedResponse: - type: object - required: [op_id] - properties: - id: - type: string - description: Resource ID for create-style operations. - sandbox_id: - type: string - snapshot_id: - type: string - op_id: - type: string - hooks: - type: array - items: - $ref: '#/components/schemas/HookSummary' - watchdog: - $ref: '#/components/schemas/WatchdogSummary' - HookSummary: - type: object - required: [event, timeout_seconds, on_failure, run_order] - properties: - event: - type: string - source_template_name: - type: string - timeout_seconds: - type: integer - on_failure: - type: string - enum: [abort, continue] - run_order: - type: integer - WatchdogSummary: - type: object - required: [interval_seconds, action, failure_threshold, timeout_seconds] - properties: - source_template_name: - type: string - interval_seconds: - type: integer - action: - type: string - enum: [stop, snapshot, none] - failure_threshold: - type: integer - timeout_seconds: - type: integer - HookTemplateRequest: - type: object - additionalProperties: false - required: [script] - properties: - name: - type: string - description: - type: string - script: - type: string - maxLength: 65536 - timeout_seconds: - type: integer - minimum: 1 - maximum: 600 - env: - type: object - additionalProperties: - type: string - HookTemplate: - type: object - required: [id, name, script, timeout_seconds, created_at, updated_at] - properties: - id: - type: string - name: - type: string - description: - type: string - script: - type: string - timeout_seconds: - type: integer - env: - type: object - additionalProperties: - type: string - created_by: - type: string - created_at: - type: string - format: date-time - updated_at: - type: string - format: date-time - HookRun: - type: object - required: [id, sandbox_id, event, status, started_at] - properties: - id: - type: string - sandbox_id: - type: string - hook_id: - type: string - event: - type: string - operation_id: - type: string - status: - type: string - enum: [running, succeeded, failed, timed_out, skipped] - exit_code: - type: integer - stdout_tail: - type: string - stderr_tail: - type: string - error: - type: string - started_at: - type: string - format: date-time - finished_at: - type: string - format: date-time - LiveMetrics: - type: object - required: [cpuPct, memUsedGiB, memTotalGiB, diskUsedGiB, diskTotalGiB] - properties: - cpuPct: - type: number - memUsedGiB: - type: number - memTotalGiB: - type: number - diskUsedGiB: - type: number - diskTotalGiB: - type: number - SandboxMetricsResponse: - type: object - required: [items] - properties: - items: - type: array - maxItems: 5000 - items: - $ref: '#/components/schemas/SandboxMetricSample' - SandboxMetricSample: - type: object - required: [sampled_at, cpu_seconds_total, memory_bytes, net_rx_bytes, net_tx_bytes] - properties: - sampled_at: - type: string - format: date-time - description: Wall-clock sample timestamp produced by the supervisor/control-plane sampler. - cpu_seconds_total: - type: number - description: Cumulative counter of Firecracker process user+system CPU seconds. - memory_bytes: - type: integer - format: int64 - description: Point-in-time RSS memory gauge for the Firecracker process. - disk_used_bytes: - type: integer - format: int64 - nullable: true - description: Point-in-time sandbox disk usage gauge; null when per-sandbox usage is unavailable. - net_rx_bytes: - type: integer - format: int64 - description: Cumulative receive byte counter from the sandbox TAP device. - net_tx_bytes: - type: integer - format: int64 - description: Cumulative transmit byte counter from the sandbox TAP device. - GuestNetwork: - type: object - required: [guestIp, node, uplinkCidr, tapDevice, dns, nftables, jailer, egressAllow, egressDeny] - properties: - guestIp: - type: string - nullable: true - node: - type: string - nullable: true - uplinkCidr: - type: string - tapDevice: - type: string - dns: - type: string - nftables: - type: boolean - jailer: - type: boolean - egressAllow: - type: array - items: - type: string - egressDeny: - type: array - items: - type: string - Sandbox: - type: object - required: [id, name, state, template, ver, vcpu, mem, createdAt, onDelete, snap, frozen, restored, clockPolicy, workload, tags, labels, procs, idempotencyKey, err, metrics, network] - properties: - id: - type: string - name: - type: string - state: - type: string - enum: [pending, running, paused, snapshotting, stopped, restoring, failed, degraded, gone] - template: - type: string - ver: - type: string - node: - type: string - nullable: true - vcpu: - type: integer - mem: - type: integer - createdAt: - type: string - format: date-time - expiresAt: - type: string - format: date-time - nullable: true - maxExpiresAt: - type: string - format: date-time - nullable: true - onDelete: - type: string - enum: [delete, hot, archive] - snap: - type: integer - frozen: - type: boolean - restored: - type: boolean - leasedBy: - type: string - nullable: true - leaseRenews: - type: string - nullable: true - ip: - type: string - nullable: true - clock: - type: string - nullable: true - clockPolicy: - type: string - workload: - type: string - tags: - type: array - items: - type: string - labels: - type: object - additionalProperties: - type: string - procs: - type: array - items: - type: string - idempotencyKey: - type: string - sourceSnapshot: - type: string - nullable: true - err: - type: string - metrics: - $ref: '#/components/schemas/LiveMetrics' - network: - $ref: '#/components/schemas/GuestNetwork' - hooks: - type: array - items: - $ref: '#/components/schemas/HookSummary' - watchdog: - $ref: '#/components/schemas/WatchdogSummary' - exposedPorts: - type: array - items: - $ref: '#/components/schemas/ExposedPort' - Snapshot: - type: object - required: [id, sandbox, sandboxId, template, ver, size, sizeGiB, restores, createdAt, frozenAt, frozen, owner, tags, note, description, digest, state] - properties: - id: - type: string - sandbox: - type: string - sandboxId: - type: string - template: - type: string - ver: - type: string - size: - type: string - sizeGiB: - type: number - node: - type: string - nullable: true - restores: - type: integer - createdAt: - type: string - format: date-time - expiresAt: - type: string - format: date-time - nullable: true - description: >- - When the snapshot is reaped. Snapshots always carry a TTL (request - ttl or the configured lifecycle.default_snapshot_ttl), so this is - populated for every live snapshot. - frozenAt: - type: string - clock: - type: string - nullable: true - frozen: - type: boolean - owner: - type: string - parent: - type: string - nullable: true - tags: - type: array - items: - type: string - note: - type: string - description: - type: string - digest: - type: string - state: - type: string - enum: [creating, available, failed, deleted, unavailable] - Operation: - type: object - required: [id, type, target, state, startedAt, actor, idempotencyKey, err, warnings] - properties: - id: - type: string - type: - type: string - target: - type: string - targetId: - type: string - nullable: true - state: - type: string - enum: [queued, running, succeeded, failed] - startedAt: - type: string - format: date-time - durationMs: - type: integer - format: int64 - nullable: true - actor: - type: string - idempotencyKey: - type: string - err: - type: string - warnings: - type: array - items: - type: string - progress: - $ref: '#/components/schemas/OperationProgress' - nullable: true - OperationProgress: - type: object - required: [phases, updatedAt] - properties: - phase: - type: string - description: Name of the step currently executing; empty once terminal. - planned: - type: array - items: - type: string - description: Ordered steps the operation expects to run. - percent: - type: number - format: double - nullable: true - description: 0-100 completion estimate; absent when indeterminate. - unitsDone: - type: integer - format: int64 - unitsTotal: - type: integer - format: int64 - unit: - type: string - description: What unitsDone/unitsTotal count, e.g. bytes. - phases: - type: array - items: - $ref: '#/components/schemas/OperationPhaseTiming' - updatedAt: - type: string - format: date-time - OperationPhaseTiming: - type: object - required: [name, startedAt] - properties: - name: - type: string - startedAt: - type: string - format: date-time - finishedAt: - type: string - format: date-time - nullable: true - durationMs: - type: integer - format: int64 - nullable: true - Template: - type: object - required: [name, ver, flavor, clock, clockPolicy, sizing, vcpu, memoryMb, diskGb, vcpuOptions, tags, rootfs, kernel, artifact, pinned, build] - properties: - name: - type: string - ver: - type: string - flavor: - type: string - enum: [cold, warm] - clock: - type: string - clockPolicy: - type: string - enum: [frozen, realtime] - sizing: - type: string - vcpu: - type: integer - memoryMb: - type: integer - diskGb: - type: integer - vcpuOptions: - type: array - items: - type: integer - tags: - type: array - items: - type: string - rootfs: - type: string - kernel: - type: string - artifact: - type: string - pinned: - type: string - description: - type: string - build: - $ref: '#/components/schemas/TemplateBuild' - sourceSnapshotId: - type: string - TemplateBuild: - type: object - required: [source] - properties: - source: - type: string - description: Freeform provenance for the template build recipe or warm snapshot lineage. - BakeStatus: - type: object - required: [name, seed, interval, enabled, running] - properties: - name: - type: string - seed: - type: string - interval: - type: string - enabled: - type: boolean - description: - type: string - active_version: - type: string - active_created_at: - type: string - format: date-time - running: - type: boolean - last_attempt_at: - type: string - format: date-time - last_result: - type: string - enum: [succeeded, failed] - last_error: - type: string - last_version: - type: string - next_due_at: - type: string - format: date-time - ScheduledResponse: - type: object - required: [status] - properties: - status: - type: string - enum: [scheduled] - ErrorEnvelope: - type: object - required: [error] - properties: - error: - $ref: '#/components/schemas/ErrorBody' - ErrorBody: - type: object - required: [code, message] - properties: - code: - type: string - enum: - - missing_idempotency_key - - unauthorized - - forbidden - - invalid_json - - request_too_large - - invalid_request - - invalid_source - - missing_template - - template_not_found - - ambiguous_template - - invalid_limit - - invalid_cursor - - invalid_offset - - invalid_filter - - invalid_hook - - invalid_ttl - - invalid_on_delete - - invalid_override - - ambiguous_pagination - - invalid_port - - invalid_ssh_authorization - - invalid_ssh_public_key - - invalid_template - - not_found - - conflict - - not_ready - - override_not_allowed - - streaming_unavailable - - hook_template_not_found - - internal_error - - invalid_ssh_key - - invalid_exec_request - - exec_unavailable - message: - type: string - details: - type: object - additionalProperties: - type: string - SandboxList: - allOf: - - $ref: '#/components/schemas/ListEnvelope' - - type: object - properties: - items: - type: array - items: - $ref: '#/components/schemas/Sandbox' - SnapshotList: - allOf: - - $ref: '#/components/schemas/ListEnvelope' - - type: object - properties: - items: - type: array - items: - $ref: '#/components/schemas/Snapshot' - Image: - type: object - required: [id, kind, flavor] - properties: - id: - type: string - description: Snapshot ID for raw images, "name@version" for named ones. - kind: - type: string - enum: [named, raw] - flavor: - type: string - enum: [warm, cold] - name: - type: string - version: - type: string - snapshotId: - type: string - promoted: - type: boolean - description: Raw image backs an active named image. - createdAt: - type: string - snapshot: - $ref: '#/components/schemas/Snapshot' - template: - $ref: '#/components/schemas/Template' - ImageList: - allOf: - - $ref: '#/components/schemas/ListEnvelope' - - type: object - properties: - items: - type: array - items: - $ref: '#/components/schemas/Image' - TemplateList: - allOf: - - $ref: '#/components/schemas/ListEnvelope' - - type: object - properties: - items: - type: array - items: - $ref: '#/components/schemas/Template' - BakeStatusList: - allOf: - - $ref: '#/components/schemas/ListEnvelope' - - type: object - properties: - items: - type: array - items: - $ref: '#/components/schemas/BakeStatus' - HookTemplateList: - allOf: - - $ref: '#/components/schemas/ListEnvelope' - - type: object - properties: - items: - type: array - items: - $ref: '#/components/schemas/HookTemplate' - HookSummaryList: - allOf: - - $ref: '#/components/schemas/ListEnvelope' - - type: object - properties: - items: - type: array - items: - $ref: '#/components/schemas/HookSummary' - HookRunList: - allOf: - - $ref: '#/components/schemas/ListEnvelope' - - type: object - properties: - items: - type: array - items: - $ref: '#/components/schemas/HookRun' - OperationList: - allOf: - - $ref: '#/components/schemas/ListEnvelope' - - type: object - properties: - items: - type: array - items: - $ref: '#/components/schemas/Operation' - SSHPublicKeyList: - allOf: - - $ref: '#/components/schemas/ListEnvelope' - - type: object - properties: - items: - type: array - items: - $ref: '#/components/schemas/SSHPublicKey' - ListEnvelope: - type: object - required: [items, total] - properties: - items: - type: array - items: {} - next_cursor: - type: string - total: - type: integer - minimum: 0 diff --git a/pkg/compute/request.go b/pkg/compute/request.go new file mode 100644 index 00000000..44623d20 --- /dev/null +++ b/pkg/compute/request.go @@ -0,0 +1,198 @@ +package compute + +import ( + "encoding/json" + "fmt" + "math" + "net/http" + "net/url" + "sort" + "strconv" + "strings" +) + +// Request is a proxy-ready HTTP request built from an operation and a loose +// argument map. +type Request struct { + Method string + // Path is the upstream path with parameters substituted and the query + // string encoded. + Path string + Header http.Header + // Body is nil when the operation takes no request body. + Body []byte +} + +// ArgError marks an argument-validation failure so callers can report a bad +// request instead of an upstream failure. +type ArgError struct { + Err error +} + +func (e *ArgError) Error() string { return e.Err.Error() } + +func (e *ArgError) Unwrap() error { return e.Err } + +// reservedArgs are consumed by the dispatch layer and never forwarded in a +// path, query, or body position. +var reservedArgs = map[string]bool{ + "datasource": true, + "idempotency_key": true, +} + +// BuildRequest maps args onto the operation: declared path and query +// parameters are taken by name, idempotency_key becomes the Idempotency-Key +// header, and every remaining argument becomes a body field. Empty strings +// and zero numbers are dropped from queries, and nil and empty-string values +// from bodies, matching what a caller leaving the field unset would send. +func (o Operation) BuildRequest(args map[string]any) (*Request, error) { + req := &Request{Method: o.Method, Header: http.Header{}} + + if key, _ := args["idempotency_key"].(string); key != "" { + req.Header.Set("Idempotency-Key", key) + } + + consumed := make(map[string]bool, len(reservedArgs)+len(o.PathParams)+len(o.QueryParams)) + for name := range reservedArgs { + consumed[name] = true + } + + path := o.Path + + for _, name := range o.PathParams { + consumed[name] = true + + value := scalarString(args[name]) + if value == "" { + return nil, &ArgError{Err: fmt.Errorf("%s is required", name)} + } + + path = strings.ReplaceAll(path, "{"+name+"}", url.PathEscape(value)) + } + + query := url.Values{} + + for _, name := range o.QueryParams { + consumed[name] = true + + if raw, ok := args[name]; ok { + appendQueryValue(query, name, raw) + } + } + + if encoded := query.Encode(); encoded != "" { + path += "?" + encoded + } + + req.Path = path + + if !o.HasBody { + return req, checkNoLeftoverArgs(o.Name, args, consumed) + } + + body := make(map[string]any, len(args)) + + for key, value := range args { + if consumed[key] || value == nil { + continue + } + + if s, isString := value.(string); isString && s == "" { + continue + } + + body[key] = value + } + + for _, field := range o.RequiredBody { + if _, ok := body[field]; !ok { + return nil, &ArgError{Err: fmt.Errorf("%s is required", field)} + } + } + + encoded, err := json.Marshal(body) + if err != nil { + return nil, &ArgError{Err: fmt.Errorf("encoding request body: %w", err)} + } + + req.Body = encoded + + return req, nil +} + +// checkNoLeftoverArgs rejects arguments a body-less operation cannot carry, +// surfacing typos that were previously dropped silently. +func checkNoLeftoverArgs(operation string, args map[string]any, consumed map[string]bool) error { + unknown := leftoverArgs(args, consumed) + if len(unknown) == 0 { + return nil + } + + return &ArgError{Err: fmt.Errorf("operation %s does not accept: %s", operation, strings.Join(unknown, ", "))} +} + +func appendQueryValue(query url.Values, name string, raw any) { + switch value := raw.(type) { + case []any: + for _, item := range value { + if s := scalarString(item); s != "" { + query.Add(name, s) + } + } + case []string: + for _, item := range value { + if item != "" { + query.Add(name, item) + } + } + case bool: + query.Add(name, strconv.FormatBool(value)) + default: + // Zero numbers and empty strings are treated as unset, mirroring the + // optional-flag semantics existing callers rely on. + if s := scalarString(value); s != "" && s != "0" { + query.Add(name, s) + } + } +} + +// scalarString formats a scalar argument for a path or query position. It +// returns "" for values that cannot be carried there. +func scalarString(raw any) string { + switch value := raw.(type) { + case string: + return value + case float64: + if value == math.Trunc(value) { + return strconv.FormatInt(int64(value), 10) + } + + return strconv.FormatFloat(value, 'f', -1, 64) + case int: + return strconv.Itoa(value) + case int64: + return strconv.FormatInt(value, 10) + case json.Number: + return value.String() + case bool: + return strconv.FormatBool(value) + default: + return "" + } +} + +func leftoverArgs(args map[string]any, consumed map[string]bool) []string { + var unknown []string + + for key, value := range args { + if consumed[key] || value == nil { + continue + } + + unknown = append(unknown, key) + } + + sort.Strings(unknown) + + return unknown +} diff --git a/pkg/server/operations_compute.go b/pkg/server/operations_compute.go index 9ca88ba2..0a241d82 100644 --- a/pkg/server/operations_compute.go +++ b/pkg/server/operations_compute.go @@ -7,9 +7,11 @@ import ( "errors" "fmt" "io" + "maps" "net/http" "sort" "strings" + "time" "github.com/ethpandaops/panda/pkg/compute" "github.com/ethpandaops/panda/pkg/operations" @@ -17,649 +19,330 @@ import ( "github.com/ethpandaops/panda/pkg/types" ) -// computeBaseURL is a placeholder base URL for the generated compute client. -// The host is never dialed: computeProxyDoer rewrites every request through -// the credential proxy, so only the request path and query are used. -const computeBaseURL = "http://compute.invalid" - -// computeProxyDoer routes generated compute-client requests through the -// credential proxy instead of dialing the backend directly. This reuses the -// proxy's auth, user-subject forwarding, and attribution for every endpoint. -type computeProxyDoer struct { - svc *service - datasource string -} - -// Do forwards the request through the proxy's /compute mount and returns the -// upstream response. The proxy strips the /compute prefix before forwarding to -// the backend, so the backend sees the original /v1/... path. -func (d *computeProxyDoer) Do(req *http.Request) (*http.Response, error) { - var body io.Reader - if req.Body != nil { - defer func() { _ = req.Body.Close() }() +const ( + // computeSpecTTL bounds how long a fetched interface document is reused + // before it is refreshed from the service. + computeSpecTTL = 5 * time.Minute + // computeSpecRetryBackoff floors refetches triggered by unknown-operation + // lookups so bad operation names cannot hammer the upstream. + computeSpecRetryBackoff = 30 * time.Second + // computeSpecFetchTimeout bounds a single interface-document fetch. + computeSpecFetchTimeout = 15 * time.Second +) - body = req.Body - } +// computeSpecEntry is one cached, parsed interface document. +type computeSpecEntry struct { + index *compute.Index + fetchedAt time.Time +} - requestPath := "/compute" + req.URL.Path - if req.URL.RawQuery != "" { - requestPath += "?" + req.URL.RawQuery - } +// computeArgAdapters keeps legacy flat argument shapes working by rewriting +// them into the wire shape before generic dispatch. +var computeArgAdapters = map[string]func(map[string]any) error{ + "create_sandbox": adaptComputeCreateSandbox, + "fork_sandbox": adaptComputeFork, + "fork_image": adaptComputeFork, +} - // Forward every header the generated client set (Content-Type, - // Idempotency-Key, Accept, ...). The proxy strips caller credentials and - // injects the service token downstream, so passing them through is safe and - // avoids dropping headers the backend requires. - headers := req.Header.Clone() - if headers == nil { - headers = http.Header{} +// handleComputeOperation dispatches compute.* operations. Aside from the +// locally served list_datasources and list_api_operations, every operation is +// resolved against the service's own interface document at runtime, so new +// upstream operations work without a panda change. +func (s *service) handleComputeOperation(operationID string, w http.ResponseWriter, r *http.Request) bool { + name, ok := strings.CutPrefix(operationID, "compute.") + if !ok { + return false } - headers.Set(handlers.DatasourceHeader, d.datasource) + if name == "list_datasources" { + s.handleComputeListDatasources(w) - respBody, status, respHeaders, err := d.svc.proxyDatasourceRequest( - req.Context(), - "compute", - d.datasource, - req.Method, - requestPath, - body, - headers, - ) - if err != nil { - return nil, err + return true } - if respHeaders == nil { - respHeaders = http.Header{} - } + s.handleComputeAPIOperation(name, w, r) - return &http.Response{ - StatusCode: status, - Status: http.StatusText(status), - Header: respHeaders, - Body: io.NopCloser(bytes.NewReader(respBody)), - Request: req, - }, nil + return true } -// computeOpFunc performs a single typed compute client call and returns the -// raw HTTP response for passthrough. -type computeOpFunc func(ctx context.Context, c *compute.Client, args map[string]any) (*http.Response, error) +func (s *service) handleComputeAPIOperation(name string, w http.ResponseWriter, r *http.Request) { + req, err := decodeOperationRequest(r) + if err != nil { + writeAPIError(w, http.StatusBadRequest, err.Error()) -// computeOpIDFunc is computeOpFunc with a required path id resolved up-front. -type computeOpIDFunc func(ctx context.Context, c *compute.Client, id string, args map[string]any) (*http.Response, error) + return + } -func (s *service) handleComputeOperation(operationID string, w http.ResponseWriter, r *http.Request) bool { - switch operationID { - case "compute.list_datasources": - s.handleComputeListDatasources(w) + datasource, status, err := s.computeDatasource(req.Args) + if err != nil { + writeAPIError(w, status, err.Error()) - // Sandboxes. - case "compute.list_sandboxes": - s.computeOp(w, r, func(ctx context.Context, c *compute.Client, args map[string]any) (*http.Response, error) { - return c.ListSandboxes(ctx, &compute.ListSandboxesParams{ - Limit: computeLimit(args), - Cursor: computeCursor(args), - Offset: computeOffset(args), - Filter: computeFilter(args), - }) - }) - case "compute.get_sandbox": - s.computeOpWithID(w, r, "id", func(ctx context.Context, c *compute.Client, id string, _ map[string]any) (*http.Response, error) { - return c.GetSandbox(ctx, id) - }) - case "compute.create_sandbox": - s.computeOp(w, r, s.computeCreateSandbox) - case "compute.delete_sandbox": - s.computeOpWithID(w, r, "id", func(ctx context.Context, c *compute.Client, id string, args map[string]any) (*http.Response, error) { - return c.DeleteSandbox(ctx, id, &compute.DeleteSandboxParams{IdempotencyKey: computeIdem(args)}) - }) - case "compute.stop_sandbox": - s.computeOpWithID(w, r, "id", func(ctx context.Context, c *compute.Client, id string, args map[string]any) (*http.Response, error) { - return c.StopSandbox(ctx, id, &compute.StopSandboxParams{IdempotencyKey: computeIdem(args)}) - }) - case "compute.start_sandbox": - s.computeOpWithID(w, r, "id", func(ctx context.Context, c *compute.Client, id string, args map[string]any) (*http.Response, error) { - return c.StartSandbox(ctx, id, &compute.StartSandboxParams{IdempotencyKey: computeIdem(args)}) - }) - case "compute.snapshot_sandbox": - s.computeOpWithID(w, r, "id", func(ctx context.Context, c *compute.Client, id string, args map[string]any) (*http.Response, error) { - return c.SnapshotSandbox(ctx, id, - &compute.SnapshotSandboxParams{IdempotencyKey: computeIdem(args)}, - compute.SnapshotSandboxJSONRequestBody{ - Note: computeOptStr(args, "note"), - Ttl: computeOptStr(args, "ttl"), - }, - ) - }) - case "compute.lease_sandbox": - s.computeOpWithID(w, r, "id", s.computeLeaseSandbox) - case "compute.prepare_sandbox_ssh": - s.computeOpWithID(w, r, "id", s.computePrepareSandboxSSH) - case "compute.get_sandbox_images": - s.computeOpWithID(w, r, "id", func(ctx context.Context, c *compute.Client, id string, _ map[string]any) (*http.Response, error) { - return c.GetSandboxImages(ctx, id) - }) - case "compute.expose_port": - s.computeOpWithID(w, r, "id", s.computeExposePort) - case "compute.unexpose_port": - s.computeOpWithID(w, r, "id", func(ctx context.Context, c *compute.Client, id string, args map[string]any) (*http.Response, error) { - port := optionalIntArg(args, "port", 0) - if port < 1 { - return nil, &computeArgError{err: fmt.Errorf("port is required and must be at least 1")} - } + return + } - return c.UnexposePort(ctx, id, port, computeIdemHeaderEditor(args)) - }) - case "compute.get_sandbox_operations": - s.computeOpWithID(w, r, "id", func(ctx context.Context, c *compute.Client, id string, _ map[string]any) (*http.Response, error) { - return c.GetSandboxOperations(ctx, id) - }) - case "compute.get_sandbox_logs": - s.computeOpWithID(w, r, "id", func(ctx context.Context, c *compute.Client, id string, args map[string]any) (*http.Response, error) { - params := &compute.GetSandboxLogsParams{} - if v := optionalIntArg(args, "tail_bytes", 0); v > 0 { - tail := int64(v) - params.TailBytes = &tail - } - if v := optionalStringArg(args, "source"); v != "" { - source := compute.GetSandboxLogsParamsSource(v) - params.Source = &source - } - return c.GetSandboxLogs(ctx, id, params) - }) - case "compute.get_sandbox_lineage": - s.computeOpWithID(w, r, "id", func(ctx context.Context, c *compute.Client, id string, _ map[string]any) (*http.Response, error) { - return c.GetSandboxLineage(ctx, id) - }) - case "compute.exec_sandbox": - s.computeOpWithID(w, r, "id", s.computeExecSandbox) - case "compute.get_sandbox_metrics": - s.computeOpWithID(w, r, "id", func(ctx context.Context, c *compute.Client, id string, _ map[string]any) (*http.Response, error) { - return c.GetSandboxMetrics(ctx, id, nil) - }) - case "compute.pause_sandbox": - s.computeOpWithID(w, r, "id", func(ctx context.Context, c *compute.Client, id string, args map[string]any) (*http.Response, error) { - return c.PauseSandbox(ctx, id, &compute.PauseSandboxParams{IdempotencyKey: computeIdem(args)}) - }) - case "compute.resume_sandbox": - s.computeOpWithID(w, r, "id", func(ctx context.Context, c *compute.Client, id string, args map[string]any) (*http.Response, error) { - return c.ResumeSandbox(ctx, id, &compute.ResumeSandboxParams{IdempotencyKey: computeIdem(args)}) - }) - case "compute.get_sandbox_hooks": - s.computeOpWithID(w, r, "id", func(ctx context.Context, c *compute.Client, id string, _ map[string]any) (*http.Response, error) { - return c.GetSandboxHooks(ctx, id, nil) - }) - case "compute.get_sandbox_hook_runs": - s.computeOpWithID(w, r, "id", func(ctx context.Context, c *compute.Client, id string, _ map[string]any) (*http.Response, error) { - return c.GetSandboxHookRuns(ctx, id, nil) - }) - case "compute.fork_sandbox": - s.computeOpWithID(w, r, "id", func(ctx context.Context, c *compute.Client, id string, args map[string]any) (*http.Response, error) { - body, err := computeForkRequest(args) - if err != nil { - return nil, err - } + index, err := s.computeIndex(r.Context(), datasource, false) + if err != nil { + writeAPIError(w, http.StatusBadGateway, err.Error()) - return c.ForkSandbox(ctx, id, - &compute.ForkSandboxParams{IdempotencyKey: computeIdem(args)}, *body) - }) + return + } - // Forks. - case "compute.list_forks": - s.computeOp(w, r, func(ctx context.Context, c *compute.Client, _ map[string]any) (*http.Response, error) { - return c.ListForks(ctx) - }) - case "compute.get_fork": - s.computeOpWithID(w, r, "id", func(ctx context.Context, c *compute.Client, id string, _ map[string]any) (*http.Response, error) { - return c.GetFork(ctx, id) - }) + if name == "list_api_operations" { + s.writeComputeAPIOperations(w, index) - // Images (raw snapshots and named images behind one surface). - case "compute.list_images": - s.computeOp(w, r, func(ctx context.Context, c *compute.Client, args map[string]any) (*http.Response, error) { - return c.ListImages(ctx, &compute.ListImagesParams{ - Limit: computeLimit(args), - Cursor: computeCursor(args), - Offset: computeOffset(args), - Filter: computeFilter(args), - }) - }) - case "compute.get_image": - s.computeOpWithID(w, r, "id", func(ctx context.Context, c *compute.Client, id string, _ map[string]any) (*http.Response, error) { - return c.GetImage(ctx, id) - }) - case "compute.delete_image": - s.computeOpWithID(w, r, "id", func(ctx context.Context, c *compute.Client, id string, args map[string]any) (*http.Response, error) { - return c.DeleteImage(ctx, id, &compute.DeleteImageParams{IdempotencyKey: computeIdem(args)}) - }) - case "compute.fork_image": - s.computeOpWithID(w, r, "id", func(ctx context.Context, c *compute.Client, id string, args map[string]any) (*http.Response, error) { - body, err := computeForkRequest(args) - if err != nil { - return nil, err - } + return + } - return c.ForkImage(ctx, id, - &compute.ForkImageParams{IdempotencyKey: computeIdem(args)}, *body) - }) - case "compute.promote_image": - s.computeOpWithID(w, r, "id", s.computePromoteImage) - case "compute.deactivate_image": - s.computeOpWithID(w, r, "id", func(ctx context.Context, c *compute.Client, id string, args map[string]any) (*http.Response, error) { - return c.DeactivateImage(ctx, id, computeIdemHeaderEditor(args)) - }) - case "compute.get_image_restored_by": - s.computeOpWithID(w, r, "id", func(ctx context.Context, c *compute.Client, id string, _ map[string]any) (*http.Response, error) { - return c.GetImageRestoredBy(ctx, id) - }) - case "compute.get_image_lineage": - s.computeOpWithID(w, r, "id", func(ctx context.Context, c *compute.Client, id string, _ map[string]any) (*http.Response, error) { - return c.GetImageLineage(ctx, id) - }) + op, ok := index.Lookup(name) + if !ok { + // The operation may have shipped upstream after the cached fetch. + if refreshed, refreshErr := s.computeIndex(r.Context(), datasource, true); refreshErr == nil { + index = refreshed + op, ok = index.Lookup(name) + } + } - // Bakes. - case "compute.list_bakes": - s.computeOp(w, r, func(ctx context.Context, c *compute.Client, args map[string]any) (*http.Response, error) { - return c.ListBakes(ctx, &compute.ListBakesParams{ - Limit: computeLimit(args), - Cursor: computeCursor(args), - Offset: computeOffset(args), - Filter: computeFilter(args), - }) - }) - case "compute.run_bake": - s.computeOpWithID(w, r, "name", func(ctx context.Context, c *compute.Client, name string, args map[string]any) (*http.Response, error) { - return c.RunBake(ctx, name, computeIdemHeaderEditor(args)) - }) + if !ok { + writeAPIError(w, http.StatusNotFound, fmt.Sprintf( + "unknown compute operation %q. Available: %s", name, strings.Join(index.Names(), ", "))) - // Operations. - case "compute.list_operations": - s.computeOp(w, r, func(ctx context.Context, c *compute.Client, args map[string]any) (*http.Response, error) { - return c.ListOperations(ctx, &compute.ListOperationsParams{ - Limit: computeLimit(args), - Cursor: computeCursor(args), - Offset: computeOffset(args), - Filter: computeFilter(args), - }) - }) - case "compute.get_operation": - s.computeOpWithID(w, r, "id", func(ctx context.Context, c *compute.Client, id string, _ map[string]any) (*http.Response, error) { - return c.GetOperation(ctx, id) - }) + return + } - // SSH keys (caller's own). - case "compute.list_ssh_keys": - s.computeOp(w, r, func(ctx context.Context, c *compute.Client, args map[string]any) (*http.Response, error) { - return c.ListSSHPublicKeys(ctx, &compute.ListSSHPublicKeysParams{ - Limit: computeLimit(args), - Cursor: computeCursor(args), - Offset: computeOffset(args), - Filter: computeFilter(args), - }) - }) - case "compute.add_ssh_key": - s.computeOp(w, r, s.computeAddSSHKey) - case "compute.delete_ssh_key": - s.computeOpWithID(w, r, "id", func(ctx context.Context, c *compute.Client, id string, _ map[string]any) (*http.Response, error) { - return c.DeleteSSHPublicKey(ctx, id) - }) + args := maps.Clone(req.Args) - // Directory and audit (read-only). - case "compute.list_users": - s.computeOp(w, r, func(ctx context.Context, c *compute.Client, _ map[string]any) (*http.Response, error) { - return c.ListUsers(ctx) - }) - case "compute.get_user": - s.computeOpWithID(w, r, "handle", func(ctx context.Context, c *compute.Client, handle string, _ map[string]any) (*http.Response, error) { - return c.GetUser(ctx, handle) - }) - case "compute.list_nodes": - s.computeOp(w, r, func(ctx context.Context, c *compute.Client, _ map[string]any) (*http.Response, error) { - return c.ListNodes(ctx) - }) - case "compute.get_node": - s.computeOpWithID(w, r, "id", func(ctx context.Context, c *compute.Client, id string, _ map[string]any) (*http.Response, error) { - return c.GetNode(ctx, id) - }) - case "compute.list_audit": - s.computeOp(w, r, func(ctx context.Context, c *compute.Client, _ map[string]any) (*http.Response, error) { - return c.ListAudit(ctx) - }) - case "compute.meta": - s.computeOp(w, r, func(ctx context.Context, c *compute.Client, _ map[string]any) (*http.Response, error) { - return c.Meta(ctx) - }) - case "compute.auth_session": - s.computeOp(w, r, func(ctx context.Context, c *compute.Client, _ map[string]any) (*http.Response, error) { - return c.AuthSession(ctx) - }) + if adapter := computeArgAdapters[op.Name]; adapter != nil { + if err := adapter(args); err != nil { + writeAPIError(w, http.StatusBadRequest, err.Error()) - default: - return false + return + } } - return true -} - -func (s *service) handleComputeListDatasources(w http.ResponseWriter) { - infos, err := s.computeDatasources() + proxied, err := op.BuildRequest(args) if err != nil { - writeAPIError(w, http.StatusServiceUnavailable, err.Error()) + writeAPIError(w, http.StatusBadRequest, err.Error()) return } - items := make([]listItem, 0, len(infos)) - for _, info := range infos { - items = append(items, listItem{ - Name: info.Name, - Description: info.Description, - URL: info.Metadata["url"], - Type: "compute", - }) - } + headers := proxied.Header + headers.Set(handlers.DatasourceHeader, datasource) - sort.Slice(items, func(i, j int) bool { - return items[i].Name < items[j].Name - }) + var body io.Reader - writeOperationResponse(s.log, w, http.StatusOK, operations.Response{ - Kind: operations.ResultKindObject, - Data: map[string]any{"datasources": items}, - }) -} + if proxied.Body != nil { + headers.Set("Content-Type", "application/json") -// computeOp resolves the datasource, builds a proxy-backed client, runs fn, and -// forwards the upstream response. -func (s *service) computeOp(w http.ResponseWriter, r *http.Request, fn computeOpFunc) { - client, args, ok := s.computeClientFor(w, r) - if !ok { - return + body = bytes.NewReader(proxied.Body) } - resp, err := fn(r.Context(), client, args) - s.writeComputeResult(w, resp, err) + // The proxy strips the /compute mount before forwarding, so the backend + // sees the original /v1/... path. + respBody, respStatus, respHeaders, err := s.proxyDatasourceRequest( + r.Context(), "compute", datasource, proxied.Method, "/compute"+proxied.Path, body, headers) + + s.writeComputeResult(w, respBody, respStatus, respHeaders, err) } -// computeOpWithID is computeOp with a required string argument (a path id) -// extracted before the call. -func (s *service) computeOpWithID(w http.ResponseWriter, r *http.Request, idArg string, fn computeOpIDFunc) { - client, args, ok := s.computeClientFor(w, r) - if !ok { - return - } +// computeIndex returns the cached operation index for a datasource, fetching +// the interface document through the proxy when the cache is cold or stale. +// A failed refresh serves the stale index rather than failing the operation. +// With forceRefresh, the TTL is bypassed but refetches are still rate-limited +// by computeSpecRetryBackoff. +func (s *service) computeIndex(ctx context.Context, datasource string, forceRefresh bool) (*compute.Index, error) { + // The lock is held across the fetch so concurrent cold starts fetch once. + s.computeSpecMu.Lock() + defer s.computeSpecMu.Unlock() - id, err := requiredStringArg(args, idArg) - if err != nil { - writeAPIError(w, http.StatusBadRequest, err.Error()) + entry, cached := s.computeSpecs[datasource] - return + maxAge := computeSpecTTL + if forceRefresh { + maxAge = computeSpecRetryBackoff } - resp, err := fn(r.Context(), client, id, args) - s.writeComputeResult(w, resp, err) -} - -func (s *service) computeCreateSandbox(ctx context.Context, c *compute.Client, args map[string]any) (*http.Response, error) { - template := optionalStringArg(args, "template") - snapshotID := optionalStringArg(args, "snapshot_id") - if (template == "") == (snapshotID == "") { - return nil, &computeArgError{err: fmt.Errorf("exactly one of template or snapshot_id is required")} + if cached && time.Since(entry.fetchedAt) < maxAge { + return entry.index, nil } - body := compute.CreateSandboxJSONRequestBody{ - Ttl: computeOptStr(args, "ttl"), - Name: computeOptStr(args, "name"), - Vcpu: computeOptInt(args, "vcpu"), - MemoryMb: computeOptInt(args, "memory_mb"), - DiskGb: computeOptInt(args, "disk_gb"), - } - if template != "" { - body.Template = &template - } else { - source := compute.SnapshotBootSource{ - Kind: compute.SnapshotBootSourceKind("snapshot"), - SnapshotId: snapshotID, - } - if v := optionalStringArg(args, "flavor"); v != "" { - flavor := compute.SnapshotBootSourceFlavor(v) - source.Flavor = &flavor - } - var union compute.CreateSandboxSource - if err := union.FromSnapshotBootSource(source); err != nil { - return nil, &computeArgError{err: err} - } - body.Source = &union - } - - env, err := computeOptStringMap(args, "env") + index, err := s.fetchComputeIndex(ctx, datasource) if err != nil { - return nil, &computeArgError{err: err} - } - body.Env = env - labels, err := computeOptStringMap(args, "labels") - if err != nil { - return nil, &computeArgError{err: err} - } - body.Labels = labels + if cached { + s.log.WithError(err).WithField("datasource", datasource). + Warn("Compute interface refresh failed; serving cached interface") - if raw, ok := args["hooks"]; ok { - var hooks []compute.HookDeclaration - if err := reencodeJSONArg(raw, &hooks); err != nil { - return nil, &computeArgError{err: fmt.Errorf("hooks: %w", err)} - } - body.Hooks = &hooks - } - if raw, ok := args["watchdog"]; ok { - var watchdog compute.WatchdogDeclaration - if err := reencodeJSONArg(raw, &watchdog); err != nil { - return nil, &computeArgError{err: fmt.Errorf("watchdog: %w", err)} - } - body.Watchdog = &watchdog - } - if raw, ok := args["exposed_ports"]; ok { - var ports []compute.PortExposureRequest - if err := reencodeJSONArg(raw, &ports); err != nil { - return nil, &computeArgError{err: fmt.Errorf("exposed_ports: %w", err)} + return entry.index, nil } - body.ExposedPorts = &ports - } - if onDelete := optionalStringArg(args, "on_delete"); onDelete != "" { - disposition := compute.CreateSandboxRequestOnDelete(onDelete) - body.OnDelete = &disposition + return nil, err } - paused, err := optionalBoolArg(args, "paused") - if err != nil { - return nil, &computeArgError{err: err} + if s.computeSpecs == nil { + s.computeSpecs = make(map[string]computeSpecEntry) } - body.Paused = paused - return c.CreateSandbox(ctx, &compute.CreateSandboxParams{IdempotencyKey: computeIdem(args)}, body) -} + s.computeSpecs[datasource] = computeSpecEntry{index: index, fetchedAt: time.Now()} -// computeForkRequest builds the fork body shared by the sandbox- and -// snapshot-sourced fork operations. -func computeForkRequest(args map[string]any) (*compute.ForkRequest, error) { - count := optionalIntArg(args, "count", 0) - if count < 1 { - return nil, &computeArgError{err: fmt.Errorf("count is required and must be at least 1")} - } + return index, nil +} - rng := compute.ForkIdentityRng(optionalStringArg(args, "identity_rng")) - clock := compute.ForkIdentityClock(optionalStringArg(args, "identity_clock")) - if !rng.Valid() || !clock.Valid() { - return nil, &computeArgError{err: fmt.Errorf("identity_rng (reseed) and identity_clock (correct|inherit) are required")} - } +func (s *service) fetchComputeIndex(ctx context.Context, datasource string) (*compute.Index, error) { + ctx, cancel := context.WithTimeout(ctx, computeSpecFetchTimeout) + defer cancel() - body := &compute.ForkRequest{ - Count: count, - Identity: compute.ForkIdentity{Rng: rng, Clock: clock}, - Ttl: computeOptStr(args, "ttl"), - Deadline: computeOptStr(args, "deadline"), - MinReady: computeOptInt(args, "min_ready"), + body, status, _, err := s.proxyDatasourceRequest( + ctx, "compute", datasource, http.MethodGet, "/compute"+compute.SpecPath, nil, + http.Header{handlers.DatasourceHeader: []string{datasource}}, + ) + if err != nil { + return nil, fmt.Errorf("fetching compute interface: %w", err) } - if v := optionalStringArg(args, "flavor"); v != "" { - flavor := compute.ForkRequestFlavor(v) - body.Flavor = &flavor + if status < 200 || status >= 300 { + return nil, fmt.Errorf("fetching compute interface: upstream returned status %d", status) } - paused, err := optionalBoolArg(args, "paused") + index, err := compute.ParseSpec(body) if err != nil { - return nil, &computeArgError{err: err} + return nil, err } - body.Paused = paused - return body, nil + return index, nil } -func (s *service) computeExecSandbox(ctx context.Context, c *compute.Client, id string, args map[string]any) (*http.Response, error) { - rawCommand, ok := args["command"].([]any) - if !ok || len(rawCommand) == 0 { - return nil, &computeArgError{err: fmt.Errorf("command is required and must be a non-empty argument vector")} - } - command := make([]string, 0, len(rawCommand)) - for _, item := range rawCommand { - arg, ok := item.(string) - if !ok { - return nil, &computeArgError{err: fmt.Errorf("command entries must be strings")} +// writeComputeAPIOperations serves the discovered operation catalog. Only +// structural fields are exposed; the interface document's free text never +// reaches callers. +func (s *service) writeComputeAPIOperations(w http.ResponseWriter, index *compute.Index) { + ops := index.Operations() + + items := make([]map[string]any, 0, len(ops)) + + for _, op := range ops { + item := map[string]any{ + "operation": op.Name, + "method": op.Method, + "path": op.Path, } - command = append(command, arg) - } - return c.ExecSandbox(ctx, id, compute.ExecSandboxJSONRequestBody{ - Command: command, - Timeout: computeOptStr(args, "timeout"), - }) -} + if len(op.PathParams) > 0 { + item["path_args"] = op.PathParams + } -func (s *service) computeLeaseSandbox(ctx context.Context, c *compute.Client, id string, args map[string]any) (*http.Response, error) { - extend, err := requiredStringArg(args, "extend") - if err != nil { - return nil, &computeArgError{err: err} - } + if len(op.QueryParams) > 0 { + item["query_args"] = op.QueryParams + } - return c.LeaseSandbox(ctx, id, compute.LeaseSandboxJSONRequestBody{Extend: extend}) -} + if op.HasBody { + item["body"] = true -func (s *service) computePrepareSandboxSSH(ctx context.Context, c *compute.Client, id string, args map[string]any) (*http.Response, error) { - publicKey, err := requiredStringArg(args, "public_key") - if err != nil { - return nil, &computeArgError{err: err} - } + if len(op.RequiredBody) > 0 { + item["required"] = op.RequiredBody + } + } - return c.PrepareSandboxSSH(ctx, id, compute.PrepareSandboxSSHJSONRequestBody{PublicKey: publicKey}) -} + items = append(items, item) + } -func (s *service) computePromoteImage(ctx context.Context, c *compute.Client, id string, args map[string]any) (*http.Response, error) { - name, err := requiredStringArg(args, "name") + payload, err := json.Marshal(map[string]any{"items": items}) if err != nil { - return nil, &computeArgError{err: err} + writeAPIError(w, http.StatusInternalServerError, fmt.Sprintf("encoding operations: %v", err)) + + return } - replace, err := optionalBoolArg(args, "replace") - if err != nil { - return nil, &computeArgError{err: err} - } - - return c.PromoteImage(ctx, id, - compute.PromoteImageJSONRequestBody{ - Name: name, - Version: computeOptStr(args, "version"), - Replace: replace, - Description: computeOptStr(args, "description"), - Tags: computeOptStringSlice(args, "tags"), - }, - computeIdemHeaderEditor(args), - ) + writePassthroughResponse(w, http.StatusOK, "application/json", payload) } -func (s *service) computeExposePort(ctx context.Context, c *compute.Client, id string, args map[string]any) (*http.Response, error) { - port := optionalIntArg(args, "port", 0) - if port < 1 { - return nil, &computeArgError{err: fmt.Errorf("port is required and must be at least 1")} +// adaptComputeCreateSandbox keeps the legacy flat create arguments working: +// snapshot_id and flavor become the snapshot boot source the API expects. +func adaptComputeCreateSandbox(args map[string]any) error { + if _, ok := args["source"]; ok { + return nil } - managed, err := optionalBoolArg(args, "managed") - if err != nil { - return nil, &computeArgError{err: err} - } - - return c.ExposePort(ctx, id, - compute.ExposePortJSONRequestBody{ - Port: port, - Name: computeOptStr(args, "name"), - Protocol: computeOptStr(args, "protocol"), - Service: computeOptStr(args, "service"), - Managed: managed, - }, - computeIdemHeaderEditor(args), - ) -} + template := optionalStringArg(args, "template") + snapshotID := optionalStringArg(args, "snapshot_id") -// computeIdemHeaderEditor forwards the caller's idempotency key on operations -// whose generated client no longer models the header as a parameter. -func computeIdemHeaderEditor(args map[string]any) compute.RequestEditorFn { - return func(_ context.Context, req *http.Request) error { - if key := optionalStringArg(args, "idempotency_key"); key != "" { - req.Header.Set("Idempotency-Key", key) - } + if (template == "") == (snapshotID == "") { + return fmt.Errorf("exactly one of template or snapshot_id is required") + } + + if template != "" { + delete(args, "flavor") return nil } -} -func (s *service) computeAddSSHKey(ctx context.Context, c *compute.Client, args map[string]any) (*http.Response, error) { - publicKey, err := requiredStringArg(args, "public_key") - if err != nil { - return nil, &computeArgError{err: err} + source := map[string]any{"kind": "snapshot", "snapshot_id": snapshotID} + if flavor := optionalStringArg(args, "flavor"); flavor != "" { + source["flavor"] = flavor } - return c.AddSSHPublicKey(ctx, compute.AddSSHPublicKeyJSONRequestBody{ - PublicKey: publicKey, - Name: computeOptStr(args, "name"), - }) -} + delete(args, "snapshot_id") + delete(args, "flavor") + args["source"] = source -// computeClientFor decodes the operation request, resolves the compute -// datasource, and builds a proxy-backed typed client. It writes the -// appropriate error and returns ok=false on failure. -func (s *service) computeClientFor(w http.ResponseWriter, r *http.Request) (*compute.Client, map[string]any, bool) { - req, err := decodeOperationRequest(r) - if err != nil { - writeAPIError(w, http.StatusBadRequest, err.Error()) + return nil +} - return nil, nil, false +// adaptComputeFork nests the legacy flat identity arguments into the identity +// object the API expects. +func adaptComputeFork(args map[string]any) error { + if _, ok := args["identity"]; ok { + return nil } - datasource, status, err := s.computeDatasource(req.Args) - if err != nil { - writeAPIError(w, status, err.Error()) + rng := optionalStringArg(args, "identity_rng") + clock := optionalStringArg(args, "identity_clock") - return nil, nil, false + if rng == "" || clock == "" { + return fmt.Errorf("identity_rng and identity_clock are required") } - client, err := compute.NewClient(computeBaseURL, compute.WithHTTPClient(&computeProxyDoer{svc: s, datasource: datasource})) + delete(args, "identity_rng") + delete(args, "identity_clock") + args["identity"] = map[string]any{"rng": rng, "clock": clock} + + return nil +} + +func (s *service) handleComputeListDatasources(w http.ResponseWriter) { + infos, err := s.computeDatasources() if err != nil { - writeAPIError(w, http.StatusInternalServerError, fmt.Sprintf("building compute client: %v", err)) + writeAPIError(w, http.StatusServiceUnavailable, err.Error()) - return nil, nil, false + return } - return client, req.Args, true + items := make([]listItem, 0, len(infos)) + for _, info := range infos { + items = append(items, listItem{ + Name: info.Name, + Description: info.Description, + URL: info.Metadata["url"], + Type: "compute", + }) + } + + sort.Slice(items, func(i, j int) bool { + return items[i].Name < items[j].Name + }) + + writeOperationResponse(s.log, w, http.StatusOK, operations.Response{ + Kind: operations.ResultKindObject, + Data: map[string]any{"datasources": items}, + }) } // writeComputeResult forwards an upstream compute response to the caller, -// translating transport, argument, and non-2xx errors into API errors. -func (s *service) writeComputeResult(w http.ResponseWriter, resp *http.Response, err error) { +// translating transport errors and non-2xx statuses into API errors. +func (s *service) writeComputeResult(w http.ResponseWriter, body []byte, status int, headers http.Header, err error) { if err != nil { - var argErr *computeArgError + var argErr *compute.ArgError if errors.As(err, &argErr) { - writeAPIError(w, http.StatusBadRequest, argErr.err.Error()) + writeAPIError(w, http.StatusBadRequest, argErr.Error()) return } @@ -669,35 +352,24 @@ func (s *service) writeComputeResult(w http.ResponseWriter, resp *http.Response, return } - if resp == nil { - writeAPIError(w, http.StatusBadGateway, "compute returned no response") + if status < 200 || status >= 300 { + writeAPIError(w, status, strings.TrimSpace(string(body))) return } - defer func() { _ = resp.Body.Close() }() - - body, err := io.ReadAll(resp.Body) - if err != nil { - writeAPIError(w, http.StatusBadGateway, fmt.Sprintf("reading compute response: %v", err)) - - return - } - - if resp.StatusCode < 200 || resp.StatusCode >= 300 { - writeAPIError(w, resp.StatusCode, strings.TrimSpace(string(body))) - - return + contentType := "" + if headers != nil { + contentType = headers.Get("Content-Type") } - contentType := resp.Header.Get("Content-Type") if contentType == "" { contentType = "application/json" } // Preserve the upstream 2xx status so callers can tell apart created (201), // accepted (202), and no-content (204) results. - writePassthroughResponse(w, resp.StatusCode, contentType, body) + writePassthroughResponse(w, status, contentType, body) } func (s *service) computeDatasources() ([]types.DatasourceInfo, error) { @@ -742,139 +414,3 @@ func (s *service) computeDatasource(args map[string]any) (string, int, error) { return "", http.StatusBadRequest, fmt.Errorf("datasource is required when multiple compute datasources exist. Available: %v", names) } } - -// computeArgError marks an argument-validation failure so the operation layer -// can return 400 rather than 502. -type computeArgError struct { - err error -} - -func (e *computeArgError) Error() string { return e.err.Error() } - -func computeLimit(args map[string]any) *compute.Limit { - if v := optionalIntArg(args, "limit", 0); v > 0 { - return &v - } - - return nil -} - -func computeOffset(args map[string]any) *compute.Offset { - if v := optionalIntArg(args, "offset", 0); v > 0 { - return &v - } - - return nil -} - -func computeCursor(args map[string]any) *compute.Cursor { - if v := optionalStringArg(args, "cursor"); v != "" { - return &v - } - - return nil -} - -// computeFilter coerces the repeated filter argument into the generated client's -// query parameter. The compute backend applies the filters before pagination. -func computeFilter(args map[string]any) *compute.Filter { - raw := optionalSliceArg(args, "filter") - if len(raw) == 0 { - return nil - } - - filters := make(compute.Filter, 0, len(raw)) - - for _, item := range raw { - if value, ok := item.(string); ok && value != "" { - filters = append(filters, value) - } - } - - if len(filters) == 0 { - return nil - } - - return &filters -} - -func computeIdem(args map[string]any) compute.IdempotencyKey { - return optionalStringArg(args, "idempotency_key") -} - -func computeOptStr(args map[string]any, key string) *string { - if v := optionalStringArg(args, key); v != "" { - return &v - } - - return nil -} - -func computeOptStringSlice(args map[string]any, key string) *[]string { - var raw []any - - switch values := args[key].(type) { - case []any: - raw = values - case []string: - raw = make([]any, 0, len(values)) - for _, value := range values { - raw = append(raw, value) - } - default: - return nil - } - - items := make([]string, 0, len(raw)) - for _, item := range raw { - if value, ok := item.(string); ok && value != "" { - items = append(items, value) - } - } - - if len(items) == 0 { - return nil - } - - return &items -} - -func computeOptInt(args map[string]any, key string) *int { - if v := optionalIntArg(args, key, 0); v > 0 { - return &v - } - - return nil -} - -func computeOptStringMap(args map[string]any, key string) (*map[string]string, error) { - raw, ok := args[key] - if !ok || raw == nil { - return nil, nil - } - entries, ok := raw.(map[string]any) - if !ok { - return nil, fmt.Errorf("%s must be an object of string values", key) - } - out := make(map[string]string, len(entries)) - for k, v := range entries { - value, ok := v.(string) - if !ok { - return nil, fmt.Errorf("%s.%s must be a string", key, k) - } - out[k] = value - } - - return &out, nil -} - -// reencodeJSONArg round-trips a decoded JSON arg into a typed struct so op -// payloads reuse the generated API models without bespoke field mapping. -func reencodeJSONArg(raw any, target any) error { - encoded, err := json.Marshal(raw) - if err != nil { - return err - } - - return json.Unmarshal(encoded, target) -} diff --git a/pkg/server/operations_compute_test.go b/pkg/server/operations_compute_test.go index d4f30e19..c97ac12f 100644 --- a/pkg/server/operations_compute_test.go +++ b/pkg/server/operations_compute_test.go @@ -3,8 +3,10 @@ package server import ( "bytes" "encoding/json" + "io" "net/http" "net/http/httptest" + "strings" "testing" "github.com/stretchr/testify/assert" @@ -15,9 +17,233 @@ import ( "github.com/ethpandaops/panda/pkg/types" ) +// testComputeSpec is a stand-in interface document as published by a compute +// upstream. Its free-text fields carry the brandmark-xyzzy sentinel so tests +// can prove upstream branding never reaches callers. +const testComputeSpec = ` +openapi: 3.0.3 +info: + title: Brandmark-Xyzzy Fabric API + description: brandmark-xyzzy internal control plane. + version: v1 +paths: + /v1/sandboxes: + get: + operationId: listSandboxes + description: brandmark-xyzzy sandbox listing. + parameters: + - $ref: '#/components/parameters/Limit' + - $ref: '#/components/parameters/Cursor' + - $ref: '#/components/parameters/Offset' + - $ref: '#/components/parameters/Filter' + responses: + '200': + description: OK + post: + operationId: createSandbox + parameters: + - $ref: '#/components/parameters/IdempotencyKey' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateSandboxRequest' + responses: + '202': + description: Accepted + /v1/sandboxes/{id}: + parameters: + - $ref: '#/components/parameters/SandboxID' + delete: + operationId: deleteSandbox + parameters: + - $ref: '#/components/parameters/IdempotencyKey' + - name: retain + in: query + required: false + schema: + type: boolean + responses: + '202': + description: Accepted + /v1/sandboxes/{id}/restart: + parameters: + - $ref: '#/components/parameters/SandboxID' + post: + operationId: restartSandbox + parameters: + - $ref: '#/components/parameters/IdempotencyKey' + responses: + '202': + description: Accepted + /v1/sandboxes/{id}/fork: + parameters: + - $ref: '#/components/parameters/SandboxID' + post: + operationId: forkSandbox + parameters: + - $ref: '#/components/parameters/IdempotencyKey' + requestBody: + required: true + content: + application/json: + schema: + type: object + required: [count, identity] + properties: + count: + type: integer + identity: + type: object + responses: + '202': + description: Accepted + /v1/sandboxes/{id}/ports: + parameters: + - $ref: '#/components/parameters/SandboxID' + post: + operationId: exposePort + requestBody: + required: true + content: + application/json: + schema: + type: object + required: [port] + properties: + port: + type: integer + name: + type: string + responses: + '200': + description: OK + /v1/sandboxes/{id}/ports/{port}: + parameters: + - $ref: '#/components/parameters/SandboxID' + - name: port + in: path + required: true + schema: + type: integer + delete: + operationId: unexposePort + responses: + '204': + description: Removed + /v1/images/{id}/promote: + parameters: + - name: id + in: path + required: true + schema: + type: string + post: + operationId: promoteImage + requestBody: + required: true + content: + application/json: + schema: + type: object + required: [name] + properties: + name: + type: string + responses: + '201': + description: Created + /v1/me/ssh-keys: + get: + operationId: listSSHPublicKeys + responses: + '200': + description: OK +components: + parameters: + SandboxID: + name: id + in: path + required: true + schema: + type: string + IdempotencyKey: + name: Idempotency-Key + in: header + required: true + schema: + type: string + Limit: + name: limit + in: query + schema: + type: integer + Cursor: + name: cursor + in: query + schema: + type: string + Offset: + name: offset + in: query + schema: + type: integer + Filter: + name: filter + in: query + schema: + type: array + items: + type: string + schemas: + CreateSandboxRequest: + type: object + properties: + template: + type: string + ttl: + type: string + source: + type: object +` + +// specServingTransport answers interface-document fetches itself and hands +// every other request to the recording transport, mirroring an upstream that +// publishes its own OpenAPI document. +type specServingTransport struct { + inner *recordingTransport + spec string + + specFetches int +} + +func (t *specServingTransport) RoundTrip(req *http.Request) (*http.Response, error) { + if req.Method == http.MethodGet && strings.HasSuffix(req.URL.Path, "/compute/v1/openapi.yaml") { + t.specFetches++ + + resp := &http.Response{ + StatusCode: http.StatusOK, + Header: make(http.Header), + Body: io.NopCloser(strings.NewReader(t.spec)), + } + resp.Header.Set("Content-Type", "application/yaml") + + return resp, nil + } + + return t.inner.RoundTrip(req) +} + func newComputeService(t *testing.T, transport *recordingTransport, infos ...types.DatasourceInfo) *service { t.Helper() + return newComputeServiceWithTransport(t, &specServingTransport{inner: transport, spec: testComputeSpec}, infos...) +} + +func newComputeServiceWithTransport(t *testing.T, transport http.RoundTripper, infos ...types.DatasourceInfo) *service { + t.Helper() + return testRoutingService(t, transport, []proxy.ClientRoute{{ Name: "hosted", Client: &routingProxyClient{ @@ -44,10 +270,9 @@ func callComputeOp(t *testing.T, svc *service, operationID string, args map[stri return rec } -// TestComputeForwardsIdempotencyKey is a regression test: the generated client -// sets the idempotency key as a request header, and the proxy doer must forward -// it. Dropping it makes every mutating compute op fail upstream with -// missing_idempotency_key. +// TestComputeForwardsIdempotencyKey is a regression test: the idempotency key +// travels as a request header, and dispatch must forward it. Dropping it makes +// every mutating compute op fail upstream with missing_idempotency_key. func TestComputeForwardsIdempotencyKey(t *testing.T) { t.Parallel() @@ -63,14 +288,64 @@ func TestComputeForwardsIdempotencyKey(t *testing.T) { require.Equal(t, http.StatusAccepted, rec.Code, rec.Body.String()) require.NotNil(t, transport.last) - // The doer targets the /compute mount; the proxy strips it before the backend. + // Dispatch targets the /compute mount; the proxy strips it before the backend. assert.Equal(t, "/compute/v1/sandboxes", transport.last.URL.Path) assert.Equal(t, "production", transport.last.Header.Get(handlers.DatasourceHeader)) assert.Equal(t, "idem-123", transport.last.Header.Get("Idempotency-Key"), - "the idempotency key set by the generated client must be forwarded upstream") + "the idempotency key must be forwarded upstream as a header") assert.JSONEq(t, `{"template":"ubuntu/24.04","ttl":"1h"}`, string(transport.lastBody)) } +// TestComputeCreateSandboxFromSnapshot verifies the legacy flat snapshot +// arguments are adapted into the boot-source object the API expects. +func TestComputeCreateSandboxFromSnapshot(t *testing.T) { + t.Parallel() + + transport := &recordingTransport{status: http.StatusAccepted, body: `{"operation_id":"op-2"}`, contentType: "application/json"} + svc := newComputeService(t, transport, types.DatasourceInfo{Name: "production"}) + + rec := callComputeOp(t, svc, "compute.create_sandbox", map[string]any{ + "snapshot_id": "snap-7", + "flavor": "warm", + "ttl": "2h", + "idempotency_key": "idem-snap", + }) + + require.Equal(t, http.StatusAccepted, rec.Code, rec.Body.String()) + require.NotNil(t, transport.last) + + assert.JSONEq(t, `{ + "source": {"kind": "snapshot", "snapshot_id": "snap-7", "flavor": "warm"}, + "ttl": "2h" + }`, string(transport.lastBody)) +} + +// TestComputeForkNestsIdentity verifies the legacy flat identity arguments +// are adapted into the nested identity object. +func TestComputeForkNestsIdentity(t *testing.T) { + t.Parallel() + + transport := &recordingTransport{status: http.StatusAccepted, body: `{"operation_id":"op-3"}`, contentType: "application/json"} + svc := newComputeService(t, transport, types.DatasourceInfo{Name: "production"}) + + rec := callComputeOp(t, svc, "compute.fork_sandbox", map[string]any{ + "id": "sb-1", + "count": 3, + "identity_rng": "reseed", + "identity_clock": "correct", + "idempotency_key": "idem-fork", + }) + + require.Equal(t, http.StatusAccepted, rec.Code, rec.Body.String()) + require.NotNil(t, transport.last) + + assert.Equal(t, "/compute/v1/sandboxes/sb-1/fork", transport.last.URL.Path) + assert.JSONEq(t, `{ + "count": 3, + "identity": {"rng": "reseed", "clock": "correct"} + }`, string(transport.lastBody)) +} + func TestComputePromoteImageBuildsRequest(t *testing.T) { t.Parallel() @@ -181,6 +456,7 @@ func TestComputeListBuildsQuery(t *testing.T) { rec := callComputeOp(t, svc, "compute.list_sandboxes", map[string]any{ "limit": 25, "cursor": "abc", + "offset": 0, }) require.Equal(t, http.StatusOK, rec.Code, rec.Body.String()) @@ -192,6 +468,7 @@ func TestComputeListBuildsQuery(t *testing.T) { query := transport.last.URL.Query() assert.Equal(t, "25", query.Get("limit")) assert.Equal(t, "abc", query.Get("cursor")) + assert.False(t, query.Has("offset"), "zero-valued pagination args are treated as unset") } // TestComputeListForwardsFilters confirms repeated --filter values reach the @@ -228,3 +505,120 @@ func TestComputeRequiresDatasourceWhenAmbiguous(t *testing.T) { assert.Equal(t, http.StatusBadRequest, rec.Code) assert.Nil(t, transport.last, "no upstream request should be made when the datasource is ambiguous") } + +// TestComputeDynamicOperationFromSpec is the core property of runtime +// discovery: an operation that exists only in the upstream interface document +// is callable with no panda code that names it. +func TestComputeDynamicOperationFromSpec(t *testing.T) { + t.Parallel() + + transport := &recordingTransport{status: http.StatusAccepted, body: `{"operation_id":"op-9"}`, contentType: "application/json"} + svc := newComputeService(t, transport, types.DatasourceInfo{Name: "production"}) + + rec := callComputeOp(t, svc, "compute.restart_sandbox", map[string]any{ + "id": "sb-9", + "idempotency_key": "idem-restart", + }) + + require.Equal(t, http.StatusAccepted, rec.Code, rec.Body.String()) + require.NotNil(t, transport.last) + + assert.Equal(t, http.MethodPost, transport.last.Method) + assert.Equal(t, "/compute/v1/sandboxes/sb-9/restart", transport.last.URL.Path) + assert.Equal(t, "idem-restart", transport.last.Header.Get("Idempotency-Key")) +} + +// TestComputeLegacySSHKeyAlias keeps the operation names panda published +// before they were derived from the interface document working. +func TestComputeLegacySSHKeyAlias(t *testing.T) { + t.Parallel() + + transport := &recordingTransport{status: http.StatusOK, body: `{"items":[]}`, contentType: "application/json"} + svc := newComputeService(t, transport, types.DatasourceInfo{Name: "production"}) + + rec := callComputeOp(t, svc, "compute.list_ssh_keys", map[string]any{}) + + require.Equal(t, http.StatusOK, rec.Code, rec.Body.String()) + require.NotNil(t, transport.last) + + assert.Equal(t, http.MethodGet, transport.last.Method) + assert.Equal(t, "/compute/v1/me/ssh-keys", transport.last.URL.Path) +} + +func TestComputeUnknownOperationListsAvailable(t *testing.T) { + t.Parallel() + + transport := &recordingTransport{status: http.StatusOK, body: `{}`, contentType: "application/json"} + svc := newComputeService(t, transport, types.DatasourceInfo{Name: "production"}) + + rec := callComputeOp(t, svc, "compute.explode_sandbox", map[string]any{}) + + assert.Equal(t, http.StatusNotFound, rec.Code) + assert.Contains(t, rec.Body.String(), "unknown compute operation") + assert.Contains(t, rec.Body.String(), "restart_sandbox") +} + +func TestComputeRejectsUnknownArgsOnBodylessOperation(t *testing.T) { + t.Parallel() + + transport := &recordingTransport{status: http.StatusNoContent, contentType: "application/json"} + svc := newComputeService(t, transport, types.DatasourceInfo{Name: "production"}) + + rec := callComputeOp(t, svc, "compute.delete_sandbox", map[string]any{ + "id": "sb-1", + "bogus": "value", + }) + + assert.Equal(t, http.StatusBadRequest, rec.Code) + assert.Contains(t, rec.Body.String(), "does not accept") + assert.Nil(t, transport.last, "no upstream request should be made with unknown arguments") +} + +// TestComputeSpecFetchedOncePerDatasource verifies the interface document is +// cached rather than refetched per operation. +func TestComputeSpecFetchedOncePerDatasource(t *testing.T) { + t.Parallel() + + inner := &recordingTransport{status: http.StatusOK, body: `{"items":[]}`, contentType: "application/json"} + transport := &specServingTransport{inner: inner, spec: testComputeSpec} + svc := newComputeServiceWithTransport(t, transport, types.DatasourceInfo{Name: "production"}) + + for range 3 { + rec := callComputeOp(t, svc, "compute.list_sandboxes", map[string]any{}) + require.Equal(t, http.StatusOK, rec.Code, rec.Body.String()) + } + + assert.Equal(t, 1, transport.specFetches) +} + +// TestComputeCatalogHasNoUpstreamBranding verifies the discovered operation +// catalog carries structural data only: the upstream document's free text +// (title, descriptions) must never surface to callers. +func TestComputeCatalogHasNoUpstreamBranding(t *testing.T) { + t.Parallel() + + transport := &recordingTransport{status: http.StatusOK, body: `{}`, contentType: "application/json"} + svc := newComputeService(t, transport, types.DatasourceInfo{Name: "production"}) + + rec := callComputeOp(t, svc, "compute.list_api_operations", map[string]any{}) + + require.Equal(t, http.StatusOK, rec.Code, rec.Body.String()) + assert.Contains(t, rec.Body.String(), "restart_sandbox") + assert.NotContains(t, strings.ToLower(rec.Body.String()), "xyzzy", + "free text from the upstream interface document must not surface") +} + +// TestComputeSpecFetchFailure verifies an unusable interface document fails +// the operation with an upstream error rather than a panic or a silent retry. +func TestComputeSpecFetchFailure(t *testing.T) { + t.Parallel() + + inner := &recordingTransport{status: http.StatusOK, body: `{}`, contentType: "application/json"} + transport := &specServingTransport{inner: inner, spec: "!! not a yaml document"} + svc := newComputeServiceWithTransport(t, transport, types.DatasourceInfo{Name: "production"}) + + rec := callComputeOp(t, svc, "compute.list_sandboxes", map[string]any{}) + + assert.Equal(t, http.StatusBadGateway, rec.Code) + assert.Contains(t, rec.Body.String(), "compute interface") +} diff --git a/pkg/server/server.go b/pkg/server/server.go index 213e21d0..ea013006 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -74,6 +74,9 @@ type service struct { blockArchiveCacheOnce sync.Once blockArchiveNetworksCacheInst *blockArchiveNetworksCache + + computeSpecMu sync.Mutex + computeSpecs map[string]computeSpecEntry } // NewService creates a new MCP server service.